Show TOC

Example documentationDOMAINS Locate this document in the navigation structure

 

Use of the system table DOMAIN.DOMAINS

Prerequisites

You can use the demo data for the SQL tutorial. Start the Database Studio as database administrator MONA with the password RED and log on to demo database DEMODB: Logging On to a Database.

Create domains. Proceed as described in SQL Tutorial, Domains.

Activities

You can use Database Studio to enter and execute SQL statements. More information: Working with SQL Statements: Overview

Note the General Instructions for formulating SQL statements.

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

  • All domains for which the data type DATE was defined

    SELECT owner, domainname

    FROM DOMAIN.DOMAINS

    WHERE datatype = 'DATE'

  • All of your domains in which a default value was agreed

    SELECT domainname, datatype, len, dec, "DEFAULT"

    FROM DOMAIN.DOMAINS

    WHERE owner = 'MONA'

    AND "DEFAULT" IS NOT NULL

    Note that the column DEFAULT has to be defined as a special identifier (Identifier in double quotes), since DEFAULT is a reserved keyword.

More Information

Constraint of a domain: see DOMAINCONSTRAINTS

Domain for column definition: see COLUMNS