您的位置:首页 > 数据库 > Oracle

ORACLE之表

2016-03-25 11:53 477 查看
本文章中的表在以后的例子中会用到。

首先有t_fn_person和t_fn_dept表。

create table t_fn_person(map_id NUMBER(10) primary key not null,
person_code VARCHAR2(20) not null,
person_name VARCHAR2(20) not null,
sex VARCHAR2(10),
insert_time date,
update_time date,
position VARCHAR2(20),
Salary NUMBER(12, 2),
Dept number);
create table t_fn_dept(DEPT_ID NUMBER PRIMARY KEY NOT NULL,
DEPT_NO VARCHAR2(15) NOT NULL,
DLOCATION VARCHAR2(15));


建立t_fn_person和t_fn_dept的外键

alter table t_fn_person add constraint fk_fn_dept foreign key(dept) references t_fn_dept(dept_id);--建立外键
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: