Chat (Lingr.com)
Informaiton
Daily
Column
- MySQL日本語の旅(5/1)
- アクセス向上秘伝(5/9)
- 一風変ったHaskellλ門(6/13)
- SICP Answer Book (5/31) 問題3.26追加
Zope Solution
Extra
アーカイブ
OSS案内所
Site Info
関連リンク
テーブルのリストは、 SHOW TABLES というのがあった。 だから、ビューに対しては、SHOW VIEWS があるに違いない。
mysql> SHOW VIEWS; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VIEWS' at line 1 mysql>
勝手な想像をしてしまったようだ。
SHOW TABLES で、ビューもリストアップできるようだ。
mysql> SHOW TABLES; +----------------+ | Tables_in_test | +----------------+ | ビュー | | 漢字 | +----------------+ 2 rows in set (0.00 sec) mysql>
しかし、これでは、テーブルなのかビューなのかさっぱり分からなくなるではないか。 人間がいずれでであるかを憶えなければならないのは馬鹿馬鹿しい。 それに、私にはそんな記憶力もない!
ということで、また
13.5.4.19. SHOW TABLES Syntax でちゃんと確認しよう。 残念ながら、日本語マニュアルはない。
SHOW [FULL] TABLES [FROM db_name] [LIKE 'pattern'] SHOW TABLES lists the non-TEMPORARY tables in a given database. You can also get this list using the mysqlshow db_name command. Before MySQL 5.0.1, the output from SHOW TABLES contains a single column of table names. Beginning with MySQL 5.0.1, this command also lists any views in the database. As of MySQL 5.0.2, the FULL modifier is supported such that SHOW FULL TABLES displays a second output column. Values for the second column are BASE TABLE for a table and VIEW for a view.
要するに、
- SHOW TABLES で ビュー も見える。
- SHOW FULL TABLES だと、テーブルとビューを識別できるカラムがつく。
では、さっそく試してみよう。
mysql> SHOW FULL TABLES; +----------------+------------+ | Tables_in_test | Table_type | +----------------+------------+ | ビュー | VIEW | | 漢字 | BASE TABLE | +----------------+------------+ 2 rows in set (0.00 sec) mysql>
戻る:ビューの作成
フィードバック:
There is no comment.