可以使用哪些 MySQL 查詢來檢視 MySQL 資料庫的列表?


使用以下 MySQL 查詢,我們可以看到 MySQL 資料庫的列表 -

mysql> SELECT schema_name FROM information_schema.schemata;
+--------------------+
| schema_name        |
+--------------------+
| information_schema |
| gaurav             |
| mysql              |
| performance_schema |
| query              |
| query1             |
| sys                |
| tutorials          |
+--------------------+
8 rows in set (0.00 sec)

我們還可以在此查詢中使用 WHERE 子句,如下所示 -

mysql> SELECT schema_name FROM information_schema.schemata WHERE schema_name LIKE '%schema' OR schema_name LIKE '%s';
+--------------------+
| schema_name        |
+--------------------+
| information_schema |
| performance_schema |
| sys                |
| tutorials          |
+--------------------+
4 rows in set (0.00 sec)

更新於: 2020 年 6 月 20 日

71 次瀏覽

開啟您的 事業

完成課程獲得認證

開始
廣告
© . All rights reserved.