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:

Get our latest blog posts delivered to your inbox

Subscribe and get popular blog posts about software testing industry.

Rajkumar

Leave a Comment

Share via
Copy link
Powered by Social Snap