[ 서버 & DB 관련 ]/MySQL
테이블 존재 여부 확인
BIZLAB
2019. 9. 4. 12:28
SELECT 1 FROM Information_schema.tables
WHERE table_schema = 'DB명'
AND table_name = '테이블명'
SELECT COUNT(*) FROM Information_schema.tables
WHERE table_schema = 'DB명'
AND table_name = '테이블명'
테이블 생성시에 확인
create table if not exists "table name" values;