Mega Code Archive

 
Categories / MySQL / Command Mysql
 

Getting Table Structure Information

mysql> mysql> CREATE TABLE item     -> (     ->     id INT UNSIGNED NOT NULL AUTO_INCREMENT,     ->     name CHAR(20),     ->     colors SET('chartreuse','mauve','lime green','puce') DEFAULT 'puce',     ->     PRIMARY KEY (id)     -> ); Query OK, 0 rows affected (0.01 sec) mysql> mysql> SHOW COLUMNS FROM item\G *************************** 1. row ***************************   Field: id    Type: int(10) unsigned    Null: NO     Key: PRI Default: NULL   Extra: auto_increment *************************** 2. row ***************************   Field: name    Type: char(20)    Null: YES     Key: Default: NULL   Extra: *************************** 3. row ***************************   Field: colors    Type: set('chartreuse','mauve','lime green','puce')    Null: YES     Key: Default: puce   Extra: 3 rows in set (0.00 sec) mysql> mysql> mysql> drop table item; Query OK, 0 rows affected (0.00 sec)