[DB] 테이블 문제
- DB
- 2017. 11. 20. 13:09
위의 사진만 보고 테이블 만들어보기
↓ANSWER
CREATE table POST(
post1 char(3) ,
post2 char(3) ,
addr varchar2(60) not null,
CONSTRAINT pk_post PRIMARY KEY(post1,post2)
);
CREATE table MEMBER(
id number(4) constraint pk_member_id primary key,
name varchar(10) not null,
sex char(1) constraint ck_member_sex check(sex in('1','2')),
jumin1 char(6),
jumin2 char(7),
CONSTRAINT uk_member_jumin UNIQUE(jumin1,jumin2),
tel varchar(15),
post1 char(3),
post2 char(3),
CONSTRAINT fk_memeber_post FOREIGN KEY(post1,post2)REFERENCES POST(post1,post2),
addr varchar(60)
);
'DB' 카테고리의 다른 글
[DB] SQL 사용법 (0) | 2017.11.20 |
---|---|
[DB] VIEW (0) | 2017.11.20 |
[DB] Data Integrity(데이터 무결성) (0) | 2017.11.17 |
[DB] Transaction (0) | 2017.11.17 |
[DB] JOIN (0) | 2017.11.16 |