T-SQL
create table yourtable(column1 int primary key,....)
--增加列
alter table [TableName] add [P_ID] bigint not null default 0
--删除列
alter table [TableName] drop column [P_ID]
--设置主键
alter table [TableName] add constraint PK_TableName primary key (P_ID)
--删除主键
alter table [TableName] drop constraint PK_TableName
--创建聚集索引(一个表中允许一个聚集索引)
CREATE CLUSTERED INDEX [tTopIndex] ON [TableName] ([P_ID]) ON [PRIMARY]
--创建非聚集索引
CREATE INDEX [tTopIndex] ON TableName ([P_ID]) ON [PRIMARY]
--删除索引
drop index [TableName].[tTopIndex]
--删除重复的数据根据某个字段分组
-- delete from [Owners] where id in ( SELECT Id from [Owners] where [Email] in (SELECT [Email] from [Owners] GROUP BY [Email] HAVING COUNT([Email])>1)
--and id NOT in (SELECT min(id) from [Owners] GROUP BY [Email] HAVING count([Email])>1))