RSS

Add New column in existing MySQL table Specific Row

19 Nov

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: ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: