assgn2_creat_db2 - - Course: SE 4M03 - Student: Franek F. -...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
-- Course: SE 4M03 -- Student: Franek F. -- Student No: 0000000 CONNECT TO SE4M03; CREATE TABLE EMPLOYEE ( EMPLOYEENO CHAR(6) NOT NULL, PRIMARY KEY (EMPLOYEENO), CHECK (('0' <= SUBSTR(EMPLOYEENO,1,1) AND SUBSTR(EMPLOYEENO,1,1) <= '9') AND ('0' <= SUBSTR(EMPLOYEENO,2,1) AND SUBSTR(EMPLOYEENO,2,1) <= '9') AND ('0' <= SUBSTR(EMPLOYEENO,3,1) AND SUBSTR(EMPLOYEENO,3,1) <= '9') AND ('0' <= SUBSTR(EMPLOYEENO,4,1) AND SUBSTR(EMPLOYEENO,4,1) <= '9') AND ('0' <= SUBSTR(EMPLOYEENO,5,1) AND SUBSTR(EMPLOYEENO,5,1) <= '9') AND ('0' <= SUBSTR(EMPLOYEENO,6,1) AND SUBSTR(EMPLOYEENO,6,1) <= '9')) ); CREATE TABLE MANAGER ( EMPLOYEENO CHAR(6) NOT NULL, PRIMARY KEY (EMPLOYEENO), FOREIGN KEY (EMPLOYEENO) REFERENCES EMPLOYEE ); CREATE TABLE WORKER ( EMPLOYEENO CHAR(6) NOT NULL, MANAGERNO CHAR(6) NOT NULL, PRIMARY KEY (EMPLOYEENO), FOREIGN KEY (EMPLOYEENO) REFERENCES EMPLOYEE, FOREIGN KEY (MANAGERNO) REFERENCES MANAGER(EMPLOYEENO) ); CREATE TABLE HASPHONE ( EMPLOYEENO CHAR(6) NOT NULL, AREA_CODE CHAR(3) NOT NULL, NUMBER CHAR(6) NOT NULL, PRIMARY KEY (EMPLOYEENO,AREA_CODE,NUMBER), FOREIGN KEY (EMPLOYEENO) REFERENCES EMPLOYEE, CHECK (('0' <= SUBSTR(AREA_CODE,1) AND SUBSTR(AREA_CODE,1) <= '9') AND ('0' <= SUBSTR(AREA_CODE,2,1) AND SUBSTR(AREA_CODE,2,1) <= '9') AND ('0' <= SUBSTR(AREA_CODE,3,1) AND SUBSTR(AREA_CODE,3,1) <= '9')), CHECK (('0' <= SUBSTR(NUMBER,1,1) AND SUBSTR(NUMBER,1,1) <= '9') AND
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/31/2010 for the course CAS SE4M03 taught by Professor Franek during the Winter '10 term at McMaster University.

Page1 / 3

assgn2_creat_db2 - - Course: SE 4M03 - Student: Franek F. -...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online