SQL/MX 2.x Reference Manual (H06.04+)

Sample Database
HP NonStop SQL/MX Reference Manual540440-003
D-3
DDL Statements for the Sample Database
DDL Statements for the Sample Database
The data definition language statements that create sample database objects are listed
next. For more information on the setmxdb script and how to install the sample
database, see the SQL/MX Quick Start.
EMPLOYEE Table
This statement creates the EMPLOYEE table:
CREATE TABLE samdbcat.persnl.employee
( empnum NUMERIC (4) UNSIGNED
NO DEFAULT
NOT NULL NOT DROPPABLE
HEADING 'Employee/Number'
,first_name CHARACTER (15)
DEFAULT ' '
NOT NULL NOT DROPPABLE
HEADING 'First Name'
,last_name CHARACTER (20)
DEFAULT ' '
NOT NULL NOT DROPPABLE
HEADING 'Last Name'
,deptnum NUMERIC (4)
UNSIGNED
NO DEFAULT
NOT NULL NOT DROPPABLE
HEADING 'Dept/Num'
,jobcode NUMERIC (4) UNSIGNED
DEFAULT NULL
HEADING 'Job/Code'
,salary NUMERIC (8, 2) UNSIGNED
DEFAULT NULL
HEADING 'Salary'
,PRIMARY KEY (empnum) NOT DROPPABLE
);
This statement creates the EMPNUM_CONSTRNT constraint:
ALTER TABLE employee
ADD CONSTRAINT empnum_constrnt
CHECK (empnum BETWEEN 0001 and 9999);
This statement creates the XEMPNAME index:
CREATE INDEX xempname
ON employee (
last_name
, first_name
);
This statement creates the XEMPDEPT index:
CREATE INDEX xempdept
ON employee (