MySQL ADD COLUMN examples
First, we create a table named vendors for the demonstration purpose using the following statement:
CREATE TABLE IF NOT EXISTS vendors (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255)
);
Code language: SQL (Structured Query Language) (sql)
Second, we add a new column named phone to the vendors table. Because we specify the position of the phone column explicitly after the name column, MySQL will obey this.
ALTER TABLE vendors
ADD COLUMN phone VARCHAR(15) AFTER name;
MySQL ADD COLUMN examples First, we create a table named vendors for the demonstration purpose using the following statement:
Code language: SQL (Structured Query Language) (sql) Second, we add a new column named phone to the vendors table. Because we specify the position of the phone column explicitly after the name column, MySQL will obey this.
Reference: https://www.mysqltutorial.org/mysql-add-column/