mysql> desc eatery;+-------+---------------+------+-----+---------+-------+| Field | Type | Null | Key | Default | Extra |+-------+---------------+------+-----+---------+-------+| id | int(20) | NO | PRI | NULL | || money | decimal(10,4) | YES | | NULL | || stuId | int(4) | YES | MUL | NULL | |+-------+---------------+------+-----+---------+-------+3 rows in set (0.00 sec)
mysql> show columns from eatery;+-------+---------------+------+-----+---------+-------+| Field | Type | Null | Key | Default | Extra |+-------+---------------+------+-----+---------+-------+| id | int(20) | NO | PRI | NULL | || money | decimal(10,4) | YES | | NULL | || stuId | int(4) | YES | MUL | NULL | |+-------+---------------+------+-----+---------+-------+3 rows in set (0.00 sec)
mysql> show create table eatery;+--------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+| Table | Create Table
|+--------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+| eatery | CREATE TABLE `eatery` ( `id` int(20) NOT NULL, `money` decimal(10,4) DEFAULT NULL, `stuId` int(4) DEFAULT NULL, PRIMARY KEY (`id`), KEY `stuId` (`stuId`), CONSTRAINT `eatery_ibfk_1` FOREIGN KEY (`stuId`) REFERENCES `stu` (`stuId`) ON DELETE SET NULL ON UPDATE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=gbk |+--------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+1 row in set (0.00 sec)
评论