1: Add a field to the table
Alter table [table name] add [column name] Type
2: Delete Field
Alter table [table name] Drop column [column name]
3: Modify the field type in the table (you can modify the type of the column, whether it is empty)
ALTER TABLE [table name] ALTER COLUMN [column name] Type
4: Add primary key
Alter table [table name] add constraint [constraint name] primary KEY ([column name])
5: Add UNIQUE Constraint
Alter table [table name] add constraint [constraint name] Unique ([column name])
6: Add default value for a column in a table
Alter table [table name] add constraint [constraint name] Default (defaults) for [column name]
7: Add constraint
Alter table [table name] add constraint [constraint name] Check (content)
8: Add a FOREIGN KEY constraint
Alter table [table name] add constraint [constraint name] FOREIGN key (column name) Referencese another table name (column name)
9: Delete Constraint
Alter table [table name] drop constraint [constraint name]
10: Renaming a table
exec sp_rename ' [Original table name] ', ' [New table name] '
11: Rename the column name
exec sp_rename ' [table name]. [Column name] ', ' [table name]. [New column Name] '
SQL Server ALTER statement