> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/server/reference/system-tables/information-schema/information-schema-tables/information-schema-innodb-tables/information-schema-innodb_sys_foreign_cols-table.md).

# Information Schema INNODB\_SYS\_FOREIGN\_COLS Table

The INNODB\_SYS\_FOREIGN\_COLS table maps columns to their respective foreign key constraints within the InnoDB storage engine.

The [Information Schema](/docs/server/reference/system-tables/information-schema.md) `INNODB_SYS_FOREIGN_COLS` table contains information about InnoDB [foreign key](/docs/server/ha-and-performance/optimization-and-tuning/optimization-and-indexes/foreign-keys.md) columns.

The `PROCESS` [privilege](/docs/server/reference/sql-statements/account-management-sql-statements/grant.md) is required to view the table.

It has the following columns:

| Column         | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ID             | <p>Foreign key index associated with this column, matching the <a href="/docs/server/reference/system-tables/information-schema/information-schema-tables/information-schema-innodb-tables/information-schema-innodb_sys_foreign-table.md">INNODB\_SYS\_FOREIGN.ID</a> field.</p><p>Prior to <a href="/docs/release-notes/community-server/old-releases/12.1/changes-and-improvements-in-mariadb-12.1.md">MariaDB 12.1</a>, this is preceded by the database name. From MariaDB 12.1, foreign key names are only required to be unique per table, not per database, so the redundant database name is not shown.</p> |
| FOR\_COL\_NAME | Child column name.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| REF\_COL\_NAME | Parent column name.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| POS            | Ordinal position of the column in the table, starting from 0.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |

## Examples

Prior to MariaDB 12.1:

```sql
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS\G
*************************** 1. row ***************************
          ID: test/fk_book_author
FOR_COL_NAME: author_id
REF_COL_NAME: id
         POS: 0
```

From MariaDB 12.1:

```sql
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS\G
*************************** 1. row ***************************
          ID: fk_book_author
FOR_COL_NAME: author_id
REF_COL_NAME: id
         POS: 0
```

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>

{% @marketo/form formId="4316" %}
