# Information Schema INNODB\_SYS\_FOREIGN\_COLS Table

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

The `PROCESS` [privilege](https://mariadb.com/docs/server/reference/sql-statements/account-management-sql-statements/grant) 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="information-schema-innodb_sys_foreign-table">INNODB\_SYS\_FOREIGN.ID</a> field.</p><p>Prior to <a href="https://app.gitbook.com/s/aEnK0ZXmUbJzqQrTjFyb/community-server/old-releases/12.1/changes-and-improvements-in-mariadb-12.1">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" %}
