SHOW CREATE TABLE <数据表名>;
mysql> CREATE TABLE tb_emp8 -> ( -> id INT(11) PRIMARY KEY, -> name VARCHAR(22) UNIQUE, -> deptId INT(11) NOT NULL, -> salary FLOAT DEFAULT 0, -> CHECK(salary>0), -> FOREIGN KEY(deptId) REFERENCES tb_dept1(id) -> ); Query OK, 0 rows affected (0.37 sec) mysql> SHOW CREATE TABLE tb_emp8 \G *************************** 1. row *************************** Table: tb_emp8 Create Table: CREATE TABLE `tb_emp8` ( `id` int(11) NOT NULL, `name` varchar(22) DEFAULT NULL, `deptId` int(11) NOT NULL, `salary` float DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`), KEY `deptId` (`deptId`), CONSTRAINT `tb_emp8_ibfk_1` FOREIGN KEY (`deptId`) REFERENCES `tb_dept1` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=gb2312 1 row in set (0.19 sec)
本文链接:http://task.lmcjl.com/news/15336.html