create TABLE zhao(\x0d\x0a id number primary key,\x0d\x0a mingcheng nvarchar2(50),\x0d\x0a neirong nvarchar2(50),\x0d\x0a jiezhiriqi date,\x0d\x0a zhuangtai nvarchar2(50)\x0d\x0a)\x0d\x0acreate TABLE tou(\x0d\x0a id number primary key,\x0d\x0a zhao_id number,\x0d\x0a toubiaoqiye nvarchar2(50),\x0d\x0a biaoshuneirong nvarchar2(50),\x0d\x0a toubiaoriqi date,\x0d\x0a baojia number,\x0d\x0a zhuangtai nvarchar2(50),\x0d\x0a foreign KEY(zhao_id) REFERENCES zhao(id)\x0d\x0a)\x0d\x0aforeign key (zhao_id) references to zhao(id)\x0d\x0a多了个tocreate table T (
A NUMBER(14)not null,
B VARCHAR2(11) not null,
C VARCHAR2(20) not null,
D VARCHAR2(60),
E VARCHAR2(20) not null,
F VARCHAR2(50) not null,
constraint pk$T primary key (A), -- 主键
constraint uk$T unique (B) -- 唯一键
)
create table U (
UA NUMBER(14)not null,
UB VARCHAR2(11) not null,
UC VARCHAR2(20) not null,
UD VARCHAR2(60),
UE VARCHAR2(20) not null,
UF VARCHAR2(50) not null,
constraint fk$U_UA foreign key (UA) references T(A)-- 外键 fk$U_UA 是外键名
)
评论列表(0条)