이를 위해 COLUMN_NAME을 사용하고 특정 열 이름으로 LIKE를 설정합니다. 데이터베이스의 알 수 없는 테이블에서 특정 열을 찾자 −
mysql> SELECT TABLE_NAME, COLUMN_NAME, DATA_TYPE, IS_NULLABLE, COLUMN_DEFAULT -> FROM INFORMATION_SCHEMA.COLUMNS -> WHERE column_name LIKE '%StudentName%' -> AND table_schema = 'web';
출력
이것은 다음과 같은 출력을 생성합니다 -
+-------------------+-------------+-----------+-------------+----------------+ | TABLE_NAME | COLUMN_NAME | DATA_TYPE | IS_NULLABLE |COLUMN_DEFAULT | +-------------------+-------------+-----------+-------------+----------------+ | demotable215 | StudentName | varchar | YES | NULL | | demotable221 | StudentName | varchar | YES | NULL | | demotable224 | StudentName | varchar | YES | NULL | | demotable234 | StudentName | varchar | YES | NULL | | demotable269 | StudentName | varchar | YES | NULL | | DemoTable | StudentName | varchar | YES | NULL | | DemoTable | StudentName | varchar | YES | NULL | | DemoTable | StudentName | varchar | YES | NULL | | DemoTable | StudentName | varchar | NO | NULL | | DemoTable | StudentName | varchar | YES | NULL | | DemoTable | StudentName | json | YES | NULL | | DemoTable | StudentName | varchar | YES | NULL | | DemoTable | StudentName | varchar | YES | NULL | | DemoTable | StudentName | varchar | YES | NULL | | DemoTable | StudentName | varchar | NO | NULL | | DemoTable | StudentName | varchar | YES | NULL | | DemoTable | StudentName | varchar | YES | NULL | | DemoTable | StudentName | varchar | YES | NULL | | view_DemoTable | StudentName | varchar | YES | NULL | +-------------------+-------------+-----------+-------------+----------------+ 19 rows in set (0.07 sec)
위에 특정 열이 "StudentName"인 모든 테이블이 표시됩니다.