SQL문 정리

HWANGKYOJIN·2022년 12월 15일

SQL

목록 보기
1/2

table 전체 데이터삭제

delete from table명

table 특정 데이터삭제

delete from table명 where name = '겨울';

table 특정 데이터삭제 NULL인 값을 지우고 싶을 때

delete from table 명 where name 'is NULL';

'is NULL' 을 사용한다.

table 완전 삭제

drop table 테이블 명

imcrement 초기화하기

ALTER TABLE [TABLE명] AUTO_INCREMENT = [시작할 값];

join table 무시하고 database 삭제하기

SET foreign_key_checks = 0; // 체크 해제

DELETE TABLE [테이블명] or TRUNCATE [테이블명]

SET foreign_key_checks = 1; // 다시 체크 설정

0개의 댓글