Entering content frame

This graphic is explained in the accompanying text CONSTRAINTS Locate the document in the library structure

Prerequisites

You have generated the Structure linkdemo data for the SQL Tutorial.

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

Define and use constraints. Proceed as described in SQL Tutorial, Structure linkConstraints.

Examples

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

     All conditions on the columns of the tables of the HOTEL schema that represent explicit value checks

SELECT tablename, constraintname, definition
  FROM DOMAIN.CONSTRAINTS
    WHERE schemaname = 'HOTEL'

     All conditions on the columns of the table CUTSOMER that represent explicit value checks

SELECT tablename, constraintname
  FROM DOMAIN.CONSTRAINTS
    WHERE tablename = 'CUSTOMER'

Constraints (integrity conditions) that relate to NOT NULL definitions, primary keys, UNIQUE definitions or referential constrains are not found with this SELECT statement.

Note

NOT-NULL columns: see COLUMNS

Primary keys: see COLUMNS

UNIQUE columns: see INDEXES

Referential constraint: see FOREIGNKEYS

Columns in a referential constraint: see FOREIGNKEYCOLUMNS

Constraint of a domain: see DOMAINCONSTRAINTS

 

Leaving content frame