Alter
Alter
The ALTER TABLE statement is also used to add and drop various constraints on
an existing table.
The following SQL deletes the "Email" column from the "Customers" table:
Example
ALTER TABLE Customers
DROP COLUMN Email;
SQL Server:
Notice that the new column, "DateOfBirth", is of type date and is going to hold a
date. The data type specifies what type of data the column can hold. For a
complete reference of all the data types available in MS Access, MySQL, and
SQL Server, go to our complete Data Types reference.
ID
1 LastName
Hansen Ola FirstName Timoteivn 10Address Sandnes City
12 Hansen
Svendson Tove Ola Borgvn 23 Timoteivn 10
Sandnes Sandnes
23 Svendson
Pettersen Kari Tove Storgt 20 Borgvn 23 Stavanger Sandnes
Notice that the "DateOfBirth" column is now of type year and is going to hold a
year in a two- or four-digit format.