CREATE TABLE Statement •Locking •Foreign Key Definitions and Metadata •Foreign Key Errors •Foreign Key Checks Identifiers •The  CONSTRAINT symbol  value is used, if defined. •If the  CONSTRAINT symbol  clause is not defined, or a symbol is not included following the  CONSTRAINT keyword, a constraint name name is generated automatically. Foreign key constraint naming is governed by the following rules: Prior to MySQL 8.0.16, if the  CONSTRAINT symbol  clause was not defined, or a symbol was not included following the  CONSTRAINT  keyword, both  InnoDB  and  NDB  storage engines would use the FOREIGN_KEY  index_name  if defined. In MySQL 8.0.16 and higher, the  FOREIGN_KEY  index_name is ignored. Table and column identifiers in a  FOREIGN KEY ... REFERENCES  clause can be quoted within backticks ( ‘ ). Alternatively, double quotation marks ( " ) can be used if the  ANSI_QUOTES  SQL mode is enabled. The lower_case_table_names  system variable setting is also taken into account. Foreign key constraints are subject to the following conditions and restrictions: Conditions and Restrictions 2575 •MySQL supports foreign key references between one column and another within a table. (A column cannot have a foreign key reference to itself.) In these cases, a “child table record”  refers to a dependent record within the same table. •MySQL requires indexes on foreign keys and referenced keys so that foreign key checks can be fast and not require a table scan. In the referencing table, there must be an index where the foreign key •Corresponding columns in the foreign key and the referenced key must have similar data types.  The size and sign of fixed precision types such as  INTEGER  and  DECIMAL  must be the same . The length of string types need not be the same. For nonbinary (character) string columns, the character set and collation must be the same. •Creating a foreign key constraint requires the  REFERENCES  privilege on the parent table. •Parent and child tables must use the same storage engine, and they cannot be defined as temporary tables. •NDB Cluster stores foreign names using the same lettercase with which they are created. Prior to version 8.0.20, when processing  SELECT  and other SQL statements,  NDB  compared the names of foreign keys in such statements with the names as stored in a case-sensitive fashion when lower_case_table_names  was equal to 0. In NDB 8.0.20 and later, this value no longer has any effect on how such comparisons are made, and they are always done without regard to lettercase. (Bug #30512043) •The  CONSTRAINT  symbol  value, if defined, must be unique in the database. A duplicate symbol  results in an error similar to:  ERROR 1005 (HY000): Can’t create table ’test.fk1’ (errno: 121) .