tux> $ export ISC_USER=SYSDBA
tux> $ export ISC_PASSWORD=secret
tux> isql employee
Database: employee, User: sysdba
SQL> -- MAke a copy of the employee table into this database.
SQL> copy employee employee_2;
SQL> -- Compare table structures...
SQL> show table employee;
EMP_NO (EMPNO) SMALLINT Not Null
FIRST_NAME (FIRSTNAME) VARCHAR(15) Not Null
LAST_NAME (LASTNAME) VARCHAR(20) Not Null
PHONE_EXT VARCHAR(4) Nullable
HIRE_DATE TIMESTAMP Not Null DEFAULT 'NOW'
DEPT_NO (DEPTNO) CHAR(3) Not Null
CHECK (VALUE = '000' OR
(VALUE > '0' AND VALUE <= '999') OR VALUE IS NULL)
JOB_CODE (JOBCODE) VARCHAR(5) Not Null
CHECK (VALUE > '99999')
JOB_GRADE (JOBGRADE) SMALLINT Not Null
CHECK (VALUE BETWEEN 0 AND 6)
JOB_COUNTRY (COUNTRYNAME) VARCHAR(15) Not Null
SALARY (SALARY) NUMERIC(10, 2) Not Null DEFAULT 0
CHECK (VALUE > 0)
FULL_NAME Computed by: (last_name || ', ' || first_name)
CONSTRAINT INTEG_28:
Foreign key (DEPT_NO) References DEPARTMENT (DEPT_NO)
CONSTRAINT INTEG_29:
Foreign key (JOB_CODE, JOB_GRADE, JOB_COUNTRY)
References JOB (JOB_CODE, JOB_GRADE, JOB_COUNTRY)
CONSTRAINT INTEG_27:
Primary key (EMP_NO)
CONSTRAINT INTEG_30:
CHECK ( salary >= (SELECT min_salary FROM job WHERE
job.job_code = employee.job_code AND
job.job_grade = employee.job_grade AND
job.job_country = employee.job_country) AND
salary <= (SELECT max_salary FROM job WHERE
job.job_code = employee.job_code AND
job.job_grade = employee.job_grade AND
job.job_country = employee.job_country))
Triggers on Table EMPLOYEE:
SET_EMP_NO, Sequence: 0, Type: BEFORE INSERT, Active
SAVE_SALARY_CHANGE, Sequence: 0, Type: AFTER UPDATE, Active
SQL> show table employee_2;
EMP_NO (EMPNO) SMALLINT Not Null
FIRST_NAME (FIRSTNAME) VARCHAR(15) Not Null
LAST_NAME (LASTNAME) VARCHAR(20) Not Null
PHONE_EXT VARCHAR(4) Nullable
HIRE_DATE TIMESTAMP Not Null DEFAULT 'NOW'
DEPT_NO (DEPTNO) CHAR(3) Not Null
CHECK (VALUE = '000' OR
(VALUE > '0' AND VALUE <= '999') OR VALUE IS NULL)
JOB_CODE (JOBCODE) VARCHAR(5) Not Null
CHECK (VALUE > '99999')
JOB_GRADE (JOBGRADE) SMALLINT Not Null
CHECK (VALUE BETWEEN 0 AND 6)
JOB_COUNTRY (COUNTRYNAME) VARCHAR(15) Not Null
SALARY (SALARY) NUMERIC(10, 2) Not Null DEFAULT 0
CHECK (VALUE > 0)
FULL_NAME Computed by: (last_name || ', ' || first_name)
CONSTRAINT INTEG_93:
Primary key (EMP_NO)
SQL> -- Check indices on both tables...
SQL> show indices employee;
NAMEX INDEX ON EMPLOYEE(LAST_NAME, FIRST_NAME)
RDB$FOREIGN8 INDEX ON EMPLOYEE(DEPT_NO)
RDB$FOREIGN9 INDEX ON EMPLOYEE(JOB_CODE, JOB_GRADE, JOB_COUNTRY)
RDB$PRIMARY7 UNIQUE INDEX ON EMPLOYEE(EMP_NO)
SQL> show indices employee_2;
RDB$PRIMARY27 UNIQUE INDEX ON EMPLOYEE_2(EMP_NO)
SQL> -- Check data counts on both tables...
SQL> select count(*) from employee;
COUNT
============
42
SQL> select count(*) from employee_2;
COUNT
============
0