RSS

Tag Archives: Add a column to an existing MySQL table

Add New column in existing MySQL table Specific Row


To add a column LastName to the Student table with a datatype of VARCHAR(60), use the following SQL statement:

ALTER TABLE Student ADD LastName VARCHAR(60);

This first statement will add the LastName column to the end of the table.If you insert the new column after a specific column, such as FirstName, then use this statement:

ALTER TABLE Student ADD LastName VARCHAR(60) AFTER FirstName;

If you want to Add new column to first Column, Then use this statement:

 

ALTER TABLE Student ADD LastName VARCHAR(60) FIRST;

If you want to Add new column with Default Value, Then use this statement:

ALTER TABLE Student ADD LastName VARCHAR(60) Default 0;

Advertisements
 
Leave a comment

Posted by on November 19, 2015 in My SQL

 

Tags: ,