Example: Sales

Suppose you want to define tables to keep your company's sales in different countries.

You create the tables as follows:

     CREATE TABLE US_SALES 
       (PRODUCT_ITEM  INTEGER, 
        MONTH         INTEGER CHECK (MONTH BETWEEN 1 AND 12), 
        YEAR          INTEGER CHECK (YEAR > 1985), 
        TOTAL         US_DOLLAR) 
      
     CREATE TABLE CANADIAN_SALES 
       (PRODUCT_ITEM  INTEGER, 
        MONTH         INTEGER CHECK (MONTH BETWEEN 1 AND 12), 
        YEAR          INTEGER CHECK (YEAR > 1985), 
        TOTAL         CANADIAN_DOLLAR) 
     
     CREATE TABLE GERMAN_SALES
       (PRODUCT_ITEM  INTEGER, 
        MONTH         INTEGER CHECK (MONTH BETWEEN 1 AND 12), 
        YEAR          INTEGER CHECK (YEAR > 1985), 
        TOTAL         EURO)

The UDTs in the above examples are created using the same CREATE DISTINCT TYPE statements in Example: Money. Note that the above examples use check constraints.