SQL Alter – SQL TUTORIAL | Software Testing Material

SQL ALTER Query:

SQL ALTER TABLE statement is used to add, delete, or modify columns in an existing table.

T0 Add A Column In A Table – Syntax:

Example:

SQL Alert

In the above image, you could find total number of columns are 5 (such as Playername, Runs, Balls, Sixers, and fours) related to first SELECT query where as the total number of columns are 6 (such as Playername, Runs, Balls, Sixers, fours, and DotBalls) related to second SELECT query. We have executed ALTER statement to add a new column (DotBalls) in the table ‘SCOREBOARD’.

To Delete A Column In A Table – Syntax:

Note: Some database systems don’t allow deleting a column.

Example:

SQL Alert Drop

 

To Change The Data Type Of A Column In A Table – Syntax:


In the next tutorial, we will see How To Use DROP Query in SQL

Check out the complete SQL Tutorial by clicking on below link:

Rajkumar SM is a founder of SoftwareTestingMaterial. He is a certified Software Test Engineer by profession and blogger & youtuber by choice. He has an extensive experience in the field of Software Testing. He writes here about Software Testing which includes both Manual and Automation Testing. He loves to be with his wife and cute little kid 'Freedom'.

Leave a Comment

Share via
Copy link
Powered by Social Snap