CREATE TABLE Statement You can also explicitly specify the data type for a column in the created table: For  CREATE TABLE ... SELECT , if  IF NOT EXISTS  is given and the target table exists, nothing is inserted into the destination table, and the statement is not logged. To ensure that the binary log can be used to re-create the original tables, MySQL does not permit concurrent inserts during  CREATE TABLE ... SELECT . However, prior to MySQL 8.0.21, when a CREATE TABLE ... SELECT  operation is applied from the binary log when row-based replication is in use, concurrent inserts are permitted on the replicated table while copying data. That limitation is removed in MySQL 8.0.21 on storage engines that support atomic DDL. For more information, see Section 13.1.1, “Atomic Data Definition Statement Support” . You cannot use  FOR UPDATE  as part of the  SELECT  in a statement such as  CREATE TABLE  new_table SELECT ... FROM  old_table  ... . If you attempt to do so, the statement fails. CREATE TABLE ... SELECT  operations apply  ENGINE_ATTRIBUTE  and SECONDARY_ENGINE_ATTRIBUTE  values to columns only. Table and index  ENGINE_ATTRIBUTE  and SECONDARY_ENGINE_ATTRIBUTE  values are not applied to the new table unless specified explicitly. MySQL supports foreign keys, which permit cross-referencing related data across tables, and foreign key constraints, which help keep the related data consistent. A foreign key relationship involves a parent table that holds the initial column values, and a child table with column values that reference the parent column values. A foreign key constraint is defined on the child table. The essential syntax for a defining a foreign key constraint in a  CREATE TABLE  or  ALTER TABLE statement includes the following: Foreign key constraint usage is described under the following topics in this section: •Identifiers •Conditions and Restrictions •Referential Actions •Foreign Key Constraint Examples •Adding Foreign Key Constraints •Dropping Foreign Key Constraints SELECT artist.name, COUNT(work.artist_id) AS number_of_works FROM artist LEFT JOIN work ON artist.id = work.artist_id GROUP BY artist.id; CREATE TABLE foo (a TINYINT NOT NULL) SELECT b+1 AS a FROM bar; [CONSTRAINT [ symbol ]] FOREIGN KEY [ index_name ] ( col_name , ...) REFERENCES  tbl_name  ( col_name ,...) [ON DELETE  reference_option ] [ON UPDATE  reference_option ] reference_option : RESTRICT | CASCADE | SET NULL | NO ACTION | SET DEFAULT 2574 13.1.20.5 FOREIGN KEY Constraints