20.13. The INFORMATION_SCHEMA KEY_COLUMN_USAGE Table

MySQL 5.0

20.13. The INFORMATION_SCHEMA KEY_COLUMN_USAGE Table

The table describes which key columns have constraints.

Name Name Remarks
 
   
   
   
   
   
   
   
   
   
   
   

Notes:

  • If the constraint is a foreign key, then this is the column of the foreign key, not the column that the foreign key references.

  • The value of is the column's position within the constraint, not the column's position within the table. Column positions are numbered beginning with 1.

  • The value of is for unique and primary-key constraints. For foreign-key constraints, it is the ordinal position in key of the table that is being referenced.

    For example, suppose that there are two tables name and that have the following definitions:

    CREATE TABLE t1
    (
        s1 INT,
        s2 INT,
        s3 INT,
        PRIMARY KEY(s3)
    ) ENGINE=InnoDB;
    
    CREATE TABLE t3
    (
        s1 INT,
        s2 INT,
        s3 INT,
        KEY(s1),
        CONSTRAINT CO FOREIGN KEY (s2) REFERENCES t1(s3)
    ) ENGINE=InnoDB;
    

    For those two tables, the table has two rows:

    • One row with = , = , = , = , = .

    • One row with = , = , = , = , = .

  • , , and were added in MySQL 5.0.6.