• 1、CREATE TABLE PERSON (
    PERSON_ID BIGINT NOT NULL,
    FIRST_NAME VARCHAR(35),
    LAST_NAMES VARCHAR (80),
    FULL_NAME COMPUTED BY FIRST_NAME ||' '|| LAST_NAMES,
    PHONE_NUMBER TEL_NUMBER);

    2、
    CREATE TABLE COUNTRY (
    COUNTRY COUNTRYNAME NOT NULL PRIMARY KEY,
    CURRENCY VARCHAR(10) NOT NULL);

    3、
    CREATE TABLE ORDER (
    ORDER_DATE DATE,
    CREATED_BY VARCHAR(31) DEFAULT CURRENT_USER,
    ORDER_AMOUNT DECIMAL(15,2));

    4、
    CREATE TABLE TITLES_RUSSIAN (
    TITLE_ID BIGINT NOT NULL,
    TITLE_EN VARCHAR(100),
    TITLE VARCHAR(100) CHARACTER SET WIN1251);

    5、
    CREATE TABLE PERSON (
    PERSON_ID BIGINT NOT NULL,
    FIRST_NAME VARCHAR(35) NOT NULL,
    LAST_NAMES VARCHAR (80) NOT NULL,
    FULL_NAME COMPUTED BY FIRST_NAME ||' '|| LAST_NAMES);

    6、
    CREATE TABLE PRICE_HISTORY (
    PRODUCT_ID D_IDENTITY NOT NULL, /* uses a domain */
    CHANGE_DATE DATE DEFAULT CURRENT_TIMESTAMP NOT NULL,
    UPDATER_ID D_PERSON NOT NULL, /* uses a domain */
    OLD_PRICE DECIMAL(13,2) NOT NULL,
    PERCENT_CHANGE DECIMAL(4,2)
    DEFAULT 0
    NOT NULL
    CHECK (PERCENT_CHANGE BETWEEN -50.00 AND 50.00),
    NEW_PRICE COMPUTED BY
    (OLD_PRICE (OLD_PRICE * PERCENT_CHANGE / 100)) );

    7、
    CREATE TABLE EMPLOYEE (
    FIRST_NAME VARCHAR(15) NOT NULL, /* assumption: an employee must have
    a first name */
    LAST_NAME VARCHAR(20) NOT NULL, /* assumption: an employee must have
    a last name */
    PHONE_EXT VARCHAR(4),
    HIRE_DATE DATE DEFAULT CURRENT_DATE NOT NULL,
    DEPT_NO CHAR(3) NOT NULL,
    JOB_CODE VARCHAR(5) NOT NULL,
    JOB_GRADE SMALLINT NOT NULL,
    JOB_COUNTRY VARCHAR(15) NOT NULL,
    SALARY NUMERIC (15, 2) DEFAULT 0 NOT NULL,
    FULL_NAME COMPUTED BY FIRST_NAME ||' '||LAST_NAME
    ) ;

    8、
    CREATE TABLE ATABLE (
    ID BIGINT NOT NULL,
    ANOTHER_COLUMN VARCHAR(20),
    CONSTRAINT PK_ATABLE PRIMARY KEY(ID) );

    9、
    CREATE TABLE ATEST (
    ID BIGINT NOT NULL,
    Chapter 16
    276
    DATA VARCHAR(10),
    CONSTRAINT PK_ATEST PRIMARY KEY(ID)
    USING DESC INDEX IDX_PK_ATEST;
    CAUTION
posted on 2010-07-08 06:22  A.wei  阅读(530)  评论(0编辑  收藏  举报