
create table
(
id int identity(1, 1) not null primary key,
other_column varchar(50)
)
-- 对表设置主键的同时,数据库会自动的创建一个以主键作为名称的唯一索引的。
create table 表名(
Id int identity(1,1) primary key ,--主键。自动增长
Name nvarchar(50) not null
)
create table 表名(
Id int identity(1,1) primary key ,--主键。自动增长
Name nvarchar(50) not null
)
create table tab
(
id int identity(1, 1) not null primary key,
other_column varchar(50)
)
或者
create table tab(
id int identity(1, 1) ,
other_column varchar(50)
);
alter table tab
add constraint aaa primary key (ID);
不晓得