Entering content frame

 FOREIGNKEYCOLUMNS 

Using the system table FOREIGNKEYCOLUMNS, you can determine the following database information, among other things:

·        All referential constraints in which the column CNO of table CUSTOMER is the referenced column
SELECT owner, tablename, columnname, fkeyname, rule
  FROM DOMAIN.FOREIGNKEYCOLUMNS
    WHERE reftablename = 'CUSTOMER'
      AND refcolumnname = 'CNO'

·        All referential constraints in which the column HNO of table RESERVATION is the referencing column
SELECT fkeyname, rule
  FROM DOMAIN.FOREIGNKEYCOLUMNS
    WHERE tablename = 'RESERVATION'
      AND columnname = 'HNO'

·        All referential constraints in which the referencing columns come from table RESERVATION
SELECT DISTINCT fkeyname, rule, refowner, reftablename
  FROM DOMAIN.FOREIGNKEYCOLUMNS
    WHERE tablename = 'RESERVATION'

All referential constraints: see FOREIGNKEYS

 

Leaving content frame