Documentation Home
MySQL 9.3 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 40.8Mb
PDF (A4) - 40.9Mb
Man Pages (TGZ) - 261.1Kb
Man Pages (Zip) - 368.3Kb
Info (Gzip) - 4.1Mb
Info (Zip) - 4.1Mb


MySQL 9.3 Reference Manual  / ...  / INFORMATION_SCHEMA Tables  / INFORMATION_SCHEMA InnoDB Tables  /  The INFORMATION_SCHEMA INNODB_FOREIGN Table

28.4.12 The INFORMATION_SCHEMA INNODB_FOREIGN Table

TheINNODB_FOREIGN table provides metadata aboutInnoDBforeign keys.

For related usage information and examples, seeSection 17.15.3, “InnoDB INFORMATION_SCHEMA Schema Object Tables”.

TheINNODB_FOREIGN table has these columns:

  • ID

    The name (not a numeric value) of the foreign key index, preceded by the schema (database) name (for example,test/products_fk).

  • FOR_NAME

    The name of thechild table in this foreign key relationship.

  • REF_NAME

    The name of theparent table in this foreign key relationship.

  • N_COLS

    The number of columns in the foreign key index.

  • TYPE

    A collection of bit flags with information about the foreign key column, ORed together. 0 =ON DELETE/UPDATE RESTRICT, 1 =ON DELETE CASCADE, 2 =ON DELETE SET NULL, 4 =ON UPDATE CASCADE, 8 =ON UPDATE SET NULL, 16 =ON DELETE NO ACTION, 32 =ON UPDATE NO ACTION.

Example

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_FOREIGN\G*************************** 1. row ***************************      ID: test/fk1FOR_NAME: test/childREF_NAME: test/parent  N_COLS: 1    TYPE: 1

Notes

  • You must have thePROCESS privilege to query this table.

  • Use theINFORMATION_SCHEMACOLUMNS table or theSHOW COLUMNS statement to view additional information about the columns of this table, including data types and default values.