Getting Table Information : DESCRIBE « Command MySQL « SQL / MySQL






Getting Table Information

        
mysql>
mysql> CREATE TABLE t (id INT AUTO_INCREMENT, PRIMARY KEY (id));
Query OK, 0 rows affected (0.01 sec)

mysql>
mysql>
mysql> DESCRIBE t;
+-------+---------+------+-----+---------+----------------+
| Field | Type    | Null | Key | Default | Extra          |
+-------+---------+------+-----+---------+----------------+
| id    | int(11) | NO   | PRI | NULL    | auto_increment |
+-------+---------+------+-----+---------+----------------+
1 row in set (0.00 sec)

mysql>
mysql> SHOW COLUMNS FROM t;
+-------+---------+------+-----+---------+----------------+
| Field | Type    | Null | Key | Default | Extra          |
+-------+---------+------+-----+---------+----------------+
| id    | int(11) | NO   | PRI | NULL    | auto_increment |
+-------+---------+------+-----+---------+----------------+
1 row in set (0.00 sec)

mysql>
mysql> SHOW FIELDS FROM t;
+-------+---------+------+-----+---------+----------------+
| Field | Type    | Null | Key | Default | Extra          |
+-------+---------+------+-----+---------+----------------+
| id    | int(11) | NO   | PRI | NULL    | auto_increment |
+-------+---------+------+-----+---------+----------------+
1 row in set (0.00 sec)

mysql>
mysql> drop table t;
Query OK, 0 rows affected (0.00 sec)

   
    
    
    
    
    
    
    
  








Related examples in the same category

1.Using DESCRIBE Statements
2.Examining the Table Structure with DESCRIBE