Computer >> 컴퓨터 >  >> 프로그램 작성 >> MySQL

모든 MySQL 테이블을 한 줄에 표시하는 방법은 무엇입니까?

<시간/>

information_schema.tables를 사용하여 모든 테이블을 표시하십시오. 이를 통해 특정 데이터베이스의 테이블만 표시할 수 있도록 데이터베이스 이름도 설정합니다.

이제 "web" 데이터베이스의 모든 테이블을 표시해 보겠습니다. −

mysql> select group_concat(table_name) from information_schema.tables where table_schema='web';

이것은 다음과 같은 출력을 생성합니다 -

+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| group_concat(table_name) |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| demo_table725,demotabe619,demotabe620,demotable211,demotable212,demotable213,demotable214,demotable215,demotable216,demotable217,demotable218,demotable219,demotable220,demotable221,demotable222,demotable223,demotable224,demotable225,demotable226,demotable227,demotable228,demotable229,demotable230,demotable231,demotable232,demotable233,demotable234,demotable235,demotable236,demotable237,demotable238,demotable239,demotable240,demotable241,demotable244,demotable245,demotable246,demotable247,demotable248,demotable249,demotable250,demotable251,demotable252,demotable
253,demotable254,demotable255,demotable256,demotable257,demotable258,demotable259,demotable260,demotable261,demotable262,demotable263,demotable264,demotable265,demotable266,demotable267,demotable268,demotable269,demotable270,demotable271,demotable272,demotable273,demotable274,demotable275,demotable276,demotable277,demotable278,demotable279,demotable280,demotable281,demotable282,demotable283,demotable284,demotable285,demotable286,demotable287,demotable28 |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set, 1 warning (0.01 sec)