oracle建表、建主键、外键基本语法
-创建表格语法:
create table 表名(
字段名1 字段类型(长度) 是否为空,
字段名2 字段类型 是否为空
);
-增加主键 alter table 表名 add constraint 主键名 primary key (字段名1);
-增加外键: alter table 表名
add constraint 外键名 foreign key (字段名1)
references 关联表 (字段名2);
在建立表格时就指定主键和外键
create table T_STU (
STU_ID char(5) not null,
ST......
阅读全文