[MariaDB] 외래키 붙은 컬럼 속성 변경

해질녘·2022년 8월 8일
0

SQL

목록 보기
5/9

코드

alter table student drop foreign key student_ibfk_1;

외래키 제거

alter table school modify sch_id varchar(7);
alter table student modify sch_id varchar(7);

바꾸려던 칼럼과 이를 참조하는 칼럼의 속성 양쪽 변경

alter table student add constraint student_ibfk_1 foreign key(sch_id) references school(sch_id) on update cascade;

외래키 생성

0개의 댓글