LIKE performs the same checks as CREATE TABLE. The same version of the table storage format as found in the original table is used for the new table.ĬREATE TABLE. Attempting to use it on a view will result in an error: CREATE VIEW v ( mycol ) AS SELECT 'abc' CREATE TABLE v2 LIKE v ERROR 1347 ( HY000 ): 'test.v' is not of type 'BASE TABLE' LIKE does not work with views, only base tables. To make the new table TEMPORARY as well, use CREATE TEMPORARY TABLE. LIKE does not preserve the TEMPORARY status of the original table. Foreign key definitions, as well as any DATA DIRECTORY or INDEX DIRECTORY table options specified on the original table, will not be created. Use the LIKE clause instead of a full table definition to create an empty table with the same definition as another table, including columns, indexes, and table options. Explicitly creating a temporary table with ENGINE=ROCKSDB has never been permitted. Before MariaDB 10.7, they could be specified, but would silently fail, and a MyISAM table would be created instead. ROCKSDB temporary tables cannot be created by setting the default_tmp_storage_engine system variable, or using CREATE TEMPORARY TABLE LIKE. If no storage engine is specified, the default_tmp_storage_engine setting will determine the engine. You must have the CREATE TEMPORARY TABLES privilege on the database to create temporary tables. In that case, their name will reference the temporary table when used in SQL statements. A temporary table can have the same name as a non-temporary table which is located in the same database. They will shadow names of non-temporary tables or views, if they are identical. They will not conflict with other temporary tables from other sessions even if they share the same name. Temporary table names are specific to the session. Temporary tables are dropped when the session ends. Use the TEMPORARY keyword to create a temporary table that is only available to the current session. If the table already exists, then a warning will be triggered by default. If the IF NOT EXISTS clause is used, then the table will only be created if a table with the same name does not already exist. This can be changed by setting the variable slave-ddl-exec-mode to STRICT.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |