MySQLでカスケードを表示するにはどうすればよいですか?
カスケードを表示するには、MySQLでSHOWCREATETABLEを使用します。まずテーブルを作成しましょう-
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)
-
MySQLで空のVIEWを作成するにはどうすればよいですか?
MySQLで空のビューを作成するには、次の構文を使用します- create or replace view yourViewName as select yourValue AS yourColumnName, yourValue AS yourColumnName2, . . N from dual where false; MySQLで空のビューを作成するために、上記の構文を実装しましょう- mysql> create or replace view empty_view as select "John Smith" AS Client
-
MySQLビューを作成する方法は?
MySQLビューを作成するには、次の構文のようにCREATEVIEWを使用します- create view yourViewName as select * from yourTableName;として作成します。 まずテーブルを作成しましょう- mysql> create table DemoTable1802 ( StudentId int, StudentName varchar(20) ); Query OK, 0 ro