|
Создание таблицы
I*
Определения домена */
CREATE DOMAIN FIRSTNAME AS VARCHAR(15);
CREATE DOMAIN LASTNAME AS VARCHAR(20);
CREATE DOMAIN DEPTNO AS CHAR(3)
CHECK (VALUE = '000' OR (VALUE > '0' AND VALUE <= '999')
OR VALUE IS NULL);
CREATE DOMAIN JOBCODE AS VARCHAR(5)
CHECK(VALUE > '99999');
CREATE DOMAIN JOBGRADE AS SMALLINT
CHECK (VALUE BETWEEN 0 AND 6);
═════CREATE DOMAIN SALARY AS NUMERIC(15, 2)
═════DEFAULT 0 CHECK (VALUE > 0);
/* Таблица: EMPLOYEE, Владелец: SYSDBA */
CREATE TABLE EMPLOYEE (EMP_NO EMPNO NOT NULL,FIRST_NAME FIRSTNAME
NOT NULL,LAST_NAME LASTNAME NOT NULL,PHONE_EXT
VARCHAR(4),HIRE_DATE DATE DEFAULT 'NOW' NOT NULL,DEPT_NO DEPTNO
NOT NULL,JOB_CODE JOBCODE NOT NULL,JOB_GRADE JOBGRADE NOT
NULL,JOB_COUNTRY COUNTRYNAME NOT NULL,SALARY SALARY NOT
NULL,FULL_NAME COMPUTED BY (last_name || ', ' ||
first_name),PRIMARY KEY EMP_NO));
|
|