
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
How to add columns to an existing MySQL table?
By using ALTER command we can add columns to an existing table.
Syntax
Alter table table-name ADD (column-name datatype);
Example
In the example below, with the help of ALTER Command, column ‘GRADE’ is added to the table ‘Student’.
mysql> Alter table Student ADD (Grade Varchar(10)); Query OK, 5 rows affected (1.05 sec) Records: 5 Duplicates: 0 Warnings: 0
- Related Articles
- How can we add columns with default values to an existing MySQL table?
- How can we add multiple columns, with single command, to an existing MySQL table?
- How to add current date to an existing MySQL table?
- How to add columns at specific position in existing table in MySQL?
- How to add column to an existing table in PostgreSQL?
- How can we get a list of columns in an existing MySQL table?
- How to write PHP script to update an existing MySQL table?
- How can we add a FOREIGN KEY constraint to the field of an existing MySQL table?
- How to rename a column in an existing MySQL table?
- How to add a new column to an existing table using JDBC API?
- How can we set PRIMARY KEY on multiple columns of an existing MySQL table?
- How to add +1 to existing MySQL values?
- How can we alter table to add MySQL virtual GENERATED COLUMNS?
- How can we alter table to add MySQL stored GENERATED COLUMNS?
- Create MySQL query to create a table from an existing table?

Advertisements