검색결과 리스트
글
공부/오라클
2019. 5. 29. 20:55
테이블 만들기 예제 (2)
반응형
학생(student)테이블 구조
학번 | 성명 | 학과코드 | 학년 | 주소 | 이메일 | 핸드폰 | 생일 | 지도교수 코드 |
s_number | s_name | dept_code | grade | address | phone | birth | prof_code | |
number(7) | varchar2(10) | char(2) | number | varchar2(50) | varchar2(20) | char(13) | char(8) | char(2) |
not null | 1 or 2 or 3 | 유일성 제약 | null 허용 | |||||
PK | FK | FK |
학생 테이블 생성
create table student
( s_number number(7) primary key,
s_name varchar2(10) not null,
dept_code char(2),
grade number check(grade in(1,2,3),
address varchar2(50),
email varchar2(20) unique,
phone char(13) null,
birth char(8),
prof_code char(2),
constraint s_dept_code_fk foreign key (dept_code) references department (dept_code) on delete cascade,
constraint s_prof_code_fk foreign key (prof_code) references professor (prof_code) on delete cascade);
'공부 > 오라클' 카테고리의 다른 글
테이블 만들기 예제(1) (0) | 2019.05.29 |
---|
RECENT COMMENT