테이블 제약사항 조회
select * from information_schema.table_constraints
where TABLE_NAME = 'table_name';
테이블 생성 쿼리 확인후, 제약사항 확인
show create table `table`;
외래키 조건 삭제
alter table `table` drop foreign key `foreign_key_constraint_name`;
외래키 조건 추가
alter table `table` add foreign key(`foreign_key_col`) references `ref_table`(id);
외래키 제약 조건 무시
SET FOREIGN_KEY_CHECKS=0;
#query
SET FOREIGN_KEY_CHECKS=1;
'MySql' 카테고리의 다른 글
[MariaDB] Distance 쿼리 Spatial Index 적용해서 성능 늘리기 (0) | 2022.03.17 |
---|---|
[Mariadb] ST_DISTANCE_SPHERE 생성하기 (0) | 2022.03.17 |
[Mysql] U_ST_DISTANCE_SPHERE 직접 구현하기 (0) | 2022.03.17 |
[Mysql] 컬럼 추가, 삭제, 이름변경, 타입 수정 (0) | 2021.09.08 |