如何在 MySQL 中查看级联指令?
要在 MySQL 中查看级联指令,请使用 SHOW CREATE TABLE。我们首先创建一个表 −
mysql> create table DemoTable1378 -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> EmployeeId varchar(20), -> EmployeeFirstName varchar(20), -> EmployeeLastName varchar(20), -> EmployeeCountryName varchar(40), -> EmployeeAge int, -> EmployeeSalary int, -> UNIQUE(EmployeeFirstName,EmployeeSalary), -> INDEX First_Last_NameIndex(EmployeeFirstName,EmployeeLastName) -> ); Query OK, 0 rows affected (0.93 sec)
现在让我们在 MySQL 中查看级联指令 −
mysql> show create table DemoTable1378;
这将产生以下输出 −
+---------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Table | Create Table | +---------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | DemoTable1378 | CREATE TABLE `demotable1378` ( `Id` int(11) NOT NULL AUTO_INCREMENT, `EmployeeId` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, `EmployeeFirstName` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, `EmployeeLastName` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, `EmployeeCountryName` varchar(40) COLLATE utf8_unicode_ci DEFAULT NULL, `EmployeeAge` int(11) DEFAULT NULL, `EmployeeSalary` int(11) DEFAULT NULL, PRIMARY KEY (`Id`), UNIQUE KEY `EmployeeFirstName` (`EmployeeFirstName`,`EmployeeSalary`), KEY `First_Last_NameIndex` (`EmployeeFirstName`,`EmployeeLastName`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci | +---------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ 1 row in set (0.02 sec)
广告