SQL/MX 2.x Reference Manual (G06.24+, H06.03+)
Sample Database
HP NonStop SQL/MX Reference Manual—523725-004
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










