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

Sample Database
HP NonStop SQL/MX Reference Manual540440-003
D-4
DEPT Table
deptnum
);
This statement creates the EMPLIST view:
CREATE VIEW emplist
AS SELECT
empnum
, first_name
, last_name
, deptnum
, jobcode
FROM employee;
DEPT Table
This statement creates the DEPT table:
CREATE TABLE samdbcat.persnl.dept
( deptnum NUMERIC (4) UNSIGNED
NO DEFAULT
NOT NULL NOT DROPPABLE
HEADING 'Dept/Num'
,deptname CHARACTER (12)
NO DEFAULT
NOT NULL NOT DROPPABLE
HEADING 'Dept/Name'
,manager NUMERIC (4) UNSIGNED
NO DEFAULT
NOT NULL NOT DROPPABLE
HEADING 'Mgr'
,rptdept NUMERIC (4) UNSIGNED
DEFAULT 0
NOT NULL NOT DROPPABLE
HEADING 'Rpt/Dept'
,location VARCHAR (18)
DEFAULT 0
NOT NULL NOT DROPPABLE
HEADING 'Location'
,PRIMARY KEY (deptnum) NOT DROPPABLE
);
This statement creates the MGRNUM_CONSTRNT constraint:
ALTER TABLE dept
ADD CONSTRAINT mgrnum_constrnt
CHECK (manager BETWEEN 0000 AND 9999);
This statement creates the DEPTNUM_CONSTRNT constraint:
ALTER TABLE dept
ADD CONSTRAINT deptnum_constrnt