mysql查表語句 [sql] describe table_name; 這個命令用來顯示一個表格的結構 +----------+-----------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+-----------+------+-----+---------+-------+ | ID | int(11) | NO | PRI | NULL | | | userName | char(20) | NO | | NULL | | | password | char(20) | NO | | NULL | | | niName | char(20) | NO | | NULL | | | sex | char(10) | NO | | NULL | | | phone | char(20) | YES | | NULL | | | address | char(100) | YES | | NULL | | +----------+-----------+------+-----+---------+-------+ 和這個命令可以實現同樣效果的是: show columns from table_name; show create table table_name;//顯示某個表格被創建時所用的SQL語句 create table user | CREATE TABLE `user` ( `ID` int(11) NOT NULL, `userName` char(20) NOT NULL, `password` char(20) NOT NULL, `niName` char(20) NOT NULL, `sex` char(10) NOT NULL, `phone` char(20) DEFAULT NULL, `address` char(100) DEFAULT NULL, PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1