2010/12/25

mysqlのテーブル内容確認方法

mysqlでテーブルに設定された内容の確認方法

> desc member;
> show create table member;
> show columns from member;
mysql> desc member;
+---------+---------+------+-----+---------+----------------+
| Field   | Type    | Null | Key | Default | Extra          |
+---------+---------+------+-----+---------+----------------+
| id      | int(11) | NO   | PRI | NULL    | auto_increment |
| name    | text    | YES  |     | NULL    |                |
| age     | int(11) | YES  |     | NULL    |                |
| address | text    | YES  |     | NULL    |                |
+---------+---------+------+-----+---------+----------------+
4 rows in set (0.01 sec)
mysql> show columns from member;
+---------+---------+------+-----+---------+----------------+
| Field   | Type    | Null | Key | Default | Extra          |
+---------+---------+------+-----+---------+----------------+
| id      | int(11) | NO   | PRI | NULL    | auto_increment |
| name    | text    | YES  |     | NULL    |                |
| age     | int(11) | YES  |     | NULL    |                |
| address | text    | YES  |     | NULL    |                |
+---------+---------+------+-----+---------+----------------+
4 rows in set (0.01 sec)
mysql> show create table member;
+--------+----------------------------------------------------------------------
-------------------------------------------------------+
| Table  | Create Table

                                                       |
+--------+----------------------------------------------------------------------
-------------------------------------------------------+
| member | CREATE TABLE `member` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` text,
  `age` int(11) DEFAULT NULL,
  `address` text,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 |
+--------+----------------------------------------------------------------------
-------------------------------------------------------+
1 row in set (0.00 sec)

0 件のコメント:

コメントを投稿