
create table study
-> (
-> study_id int Not NULL,
-> study_date date,
-> study_time time,
-> patient_id int
-> )
-> ;
alter table study
-> add primary key (study_id);
alter table study
-> add constraint FK_study foreign key (patient_id) references person (pid);
desc study;

show create table study;

alter table study
-> drop primary key;
desc study;

3. 생성한 테이블의 foreign key 삭제
alter table study
-> drop foreign key FK_study;
desc study;

show craete table study;

alter table study
-> add foreign key (patient_id) references person (pid);
show create table study;

5. study 테이블의 study_id 를 primary key 로 등록
alter table study
-> add primary key (study_id);
desc study;
