Learn How to Modify or Update Database Table using SQL

Опубликовано: 13 Февраль 2026
на канале: PnTutorials by Pradnyankur Nikam
19,935
105

Learn how to modify or update the database table details using SQL statement. The ALTER TABLE statement is used to rename, add or drop table columns in the existing database table.

To rename the table we use, "ALTER TABLE oldtablename RENAME newtablename;"
To add a new column in the existing table we can use, "ALTER TABLE tablename ADD columnname datatype"
To modify the column data type in the existing table we can use, "ALTER TABLE tablename MODIFY COLUMN columnname datatype"
And to drop a column from the existing table we use, "ALTER TABLE tablename DROP COLUMN columnname"

Select 'school' database, "USE school;" and display all the tables in 'school' database using SQL statement, "SHOW TABLES;"
Rename previously created table 'students3' to 'students4', The SQL statement will be, "ALTER TABLE students3 RENAME students4;"
Lets add one more column to store students last name. The SQL statement will be, "ALTER TABLE students4 ADD lastname VARCHAR(10);"
Modify the column data type by using ALTER TABLE statement like, "ALTER TABLE students4 MODIFY COLUMN lastname VARCHAR(20);"
Drop the column, by using ALTER TABLE statement like, "ALTER TABLE students4 DROP COLUMN lastname;"

Check out the whole playlist of SQL Tutorials or Individual video from the following links,

SQL Tutorial for Beginners. Introduction to SQL Basics
   • SQL Tutorial for Beginners. Introduction t...  

1.Learn What is SQL? Introduction to SQL
   • Learn What is SQL? Introduction to SQL  

2.Learn How to Install MySQL Database Server on Windows Operating System
   • Learn How to Install MySQL Database Server...  

3.Learn What is Database? How to Create and Show Databases using SQL
   • Learn What is Database? How to Create and ...  

4.Learn How to Select and Use Existing Database using SQL
   • Learn How to Select and Use Existing Datab...  

5.Learn How to Delete or Remove Database using SQL
   • Learn How to Delete or Remove Database usi...  

6.Learn What is Database Table? How to Create a Database Table using SQL?
   • Learn What is Database Table? How to Creat...  

7.Learn How to Modify or Update Database Table using SQL
   • Learn How to Modify or Update Database Tab...  

8.Learn How to Delete or Remove Database Table using SQL
   • Learn How to Delete or Remove Database Tab...  

9.Learn How to Add Data Rows in a Table using SQL
   • Learn How to Add Data Rows in a Table usin...  

10.Learn How to Use INSERT INTO SELECT Statement in SQL
   • Learn How to Use INSERT INTO SELECT Statem...  

11.Learn How to Update Data Rows using Update Statement in SQL
   • Learn How to Update Data Rows using Update...  

12.Learn How to Delete Data Rows using Delete Statement in SQL
   • Learn How to Delete Data Rows using Delete...  

Subscribe to my channel:    / @pntutorialsbypradnyankurnikam