AltertableStudentADD(GradeVarchar(10));QueryOK,5rowsaffected(1.05sec)Records:5Duplicates:0Warnings:0"/> AltertableStudentADD(GradeVarchar(10));QueryOK,5rowsaffected(1.05sec)Records:5Duplicates:0Warnings:0">
By using the ALTER command we can add columns to an existing table.
Alter table table-name ADD (column-name datatype);
In the following example, the "GRADE" column is added to the "Student" table with the help of the ALTER command.
mysql> Alter table Student ADD (Grade Varchar(10)); Query OK, 5 rows affected (1.05 sec) Records: 5 Duplicates: 0 Warnings: 0
The above is the detailed content of How to add columns to existing MySQL table?. For more information, please follow other related articles on the PHP Chinese website!