본문 바로가기
MySql

MySQL List of non-empty tables in MySQL database

by 베이스 공부 2020. 10. 21.
반응형

MySQL이 데이터베이스의 비어 있지 않은 모든 테이블을 반환하도록 할 수 있습니까? "SHOW TABLES"와 비슷하지만 비어 있지 않은 것들만.

 

해결 방법

 

'information_schema'는 관련 세부 정보를 보유해야합니다. 당신은 시도 할 수 있습니다

SELECT table_type,
       table_name
FROM information_schema.tables
WHERE table_rows >= 1;

선택 데이터베이스에서 선택합니다. TABLE_SCHEMA 로 필터링 할 수도 있습니다.

SELECT table_schema,
       table_type,
       table_name 
FROM information_schema.tables
WHERE table_rows >= 1
  AND TABLE_SCHEMA=?

 

참조 페이지 https://stackoverflow.com/questions/4746201

 

 

반응형

댓글