Để xem các tầng, hãy sử dụng SHOW CREATE TABLE trong MySQL. Đầu tiên chúng ta hãy tạo một bảng -
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)
Bây giờ chúng ta hãy xem các tầng trong MySQL -
mysql> show create table DemoTable1378;
Điều này sẽ tạo ra kết quả sau -
+---------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | 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)