## CONSTRAINTS

### Prerequisites

You have generated the demo 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, Constraints.

### 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.

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