The ALTER TABLE statement is used to add, delete, or modify columns in an existing table,
SQL ALTER TABLE Syntax - ADD Column
ALTER TABLE [table_name]
ADD [column_name] [datatype] NULL
SQL ALTER TABLE Syntax - DROP Column
ALTER TABLE [table_name]
DROP COLUMN [column_name]
To change the data type of a column in a table:
ALTER TABLE [table_name]
ALTER COLUMN [column_name] [datatype]
SQL ALTER TABLE Syntax - ADD Column
ALTER TABLE [table_name]
ADD [column_name] [datatype] NULL
SQL ALTER TABLE Syntax - DROP Column
ALTER TABLE [table_name]
DROP COLUMN [column_name]
To change the data type of a column in a table:
ALTER TABLE [table_name]
ALTER COLUMN [column_name] [datatype]
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.