MySQL Tutorial/Table/Describe Table Structure — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 09:49, 26 мая 2010
Check the created table by issuing a "describe" command
DESCRIBE tableName;
To verify the table structure, use a DESCRIBE statement
mysql>
mysql>
mysql> CREATE TABLE myTable (
-> id int,
-> first_name VARCHAR(20),
-> last_name VARCHAR(20),
-> sex CHAR(1),
-> start_date DATE,
-> end_date DATE);
Query OK, 0 rows affected (0.05 sec)
mysql>
mysql> show tables;
+----------------+
| Tables_in_test |
+----------------+
| mytable |
+----------------+
1 row in set (0.00 sec)
mysql>
mysql> describe myTable;
+------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+-------------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| first_name | varchar(20) | YES | | NULL | |
| last_name | varchar(20) | YES | | NULL | |
| sex | char(1) | YES | | NULL | |
| start_date | date | YES | | NULL | |
| end_date | date | YES | | NULL | |
+------------+-------------+------+-----+---------+-------+
6 rows in set (0.00 sec)
mysql>
mysql> drop table myTable;
Query OK, 0 rows affected (0.00 sec)
mysql>