Home > Database > Mysql Tutorial > body text

How to add columns to existing MySQL table?

王林
Release: 2023-08-28 17:01:04
forward
582 people have browsed it

如何向现有 MySQL 表添加列?

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

Syntax

Alter table table-name ADD (column-name datatype);
Copy after login

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
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!