Data Science/DB+SQL
[MYSQL] 테이블의 인덱스 정보 조회 SQL
-- How to see indexes for a database or table in MySQL SELECT INDEX_NAME AS `Index Name` , GROUP_CONCAT(COLUMN_NAME ORDER BY SEQ_IN_INDEX SEPARATOR ', ') AS `Columns` , IF(MAX(NON_UNIQUE)=1, 'No', 'Yes') AS `Unique` FROM information_schema.`STATISTICS` AS C WHERE C.table_schema = DATABASE() AND C.TABLE_NAME = '#TableName#' -- 테이블 네임을 지정한다. GROUP BY INDEX_NAME ORDER BY IF(INDEX_NAME='PRIMARY', '1..
2021. 11. 3. 16:33
최근댓글