Start of Content Area

This graphic is explained in the accompanying text FOREIGNKEYS  Locate the document in its SAP Library structure

Prerequisites

You have generated the demo data for the SQL Tutorial.

Log on to the demo database instance DEMODB as user MONA.

Create referential constraints. Proceed as described in SQL Tutorial, Foreign Key Dependencies Between Tables.

Examples

You can use the system table FOREIGNKEYS to determine the following database information, among other things:

     All referential constraints in which the RESERVATION table is the referencing table

SELECT fkeyname, tablename
  FROM DOMAIN.FOREIGNKEYS
    WHERE tablename = 'RESERVATION'

     All referential constraints generated with the DELETE CASCADE rule

SELECT schemaname, fkeyname
  FROM DOMAIN.FOREIGNKEYS
    WHERE rule = 'DELETE CASCADE'

Note

Columns in referential constraints: see FOREIGNKEYCOLUMNS

 

End of Content Area