AltertableStudentADD(GradeVarchar(10));QueryOK,5rowsaffected(1.05sec)Records:5Duplicates:0Warnings:0"/> AltertableStudentADD(GradeVarchar(10));QueryOK,5rowsaffected(1.05sec)Records:5Duplicates:0Warnings:0">

Home >Database >Mysql Tutorial >How to add columns to existing MySQL table?

How to add columns to existing MySQL table?

王林
王林forward
2023-08-28 17:01:04647browse

如何向现有 MySQL 表添加列?

By using the ALTER command we can add columns to an existing table.

Syntax

Alter table table-name ADD (column-name datatype);

Example

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!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete