728x90
SELECT 	index_name 											AS 'index'
	,	GROUP_CONCAT(column_name ORDER BY seq_in_index) 	AS 'index_columns'
	,	IF( MAX(NON_UNIQUE)=0, 'Yes', '')					AS 'IsUnique'
FROM 	information_schema.statistics
WHERE 	table_schema = 'my_dbname'
AND		TABLE_NAME = 'my_tablename'
GROUP BY TABLE_NAME, index_name;

/*
SQL Results
----------------------------------------------------
index		index_columns	IsUnique
----------------------------------------------------
PRIMARY		Host,Db,User	Yes
User		User
*/
728x90
  • 네이버 블러그 공유하기
  • 네이버 밴드에 공유하기
  • 페이스북 공유하기
  • 카카오스토리 공유하기
반응형