DS TABLES - NOT NULL, CUS_INITIAL CHAR(1), CUS_AREACODE...

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

View Full Document Right Arrow Icon
CREATE TABLE CASES ( CASE_NUM CHAR(12) PRIMARY KEY, CASE_DATE DATETIME NOT NULL, CUS_NUM CHAR(9) NOT NULL, MAN_NUM CHAR(1) NOT NULL, PROD_NUM VARCHAR(2) NOT NULL, EMP_NUM CHAR(3) NOT NULL,) CASE_DESC VARCHAR(15) NOT NULL CHECK(CASE_DESC IN ('PHYS DMGE', 'HARDWARE', 'SOFTWARE', 'OTHER'), FOREIGN KEY (MAN_NUM) REFERENCES MANAGER, FOREIGN KEY (CUS_NUM) REFERENCES CUSTOMER, FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE, FOREIGN KEY (PROD_NUM) REFERENCES PRODUCT); CREATE TABLE MANAGER ( MAN_NUM CHAR(1) PRIMARY KEY, MAN_LNAME VARCHAR(15) NOT NULL, MAN_FNAME VARCHAR(15) NOT NULL, MAN_INITIAL CHAR(1), MAN_AREACODE CHAR(3) NOT NULL, MAN_PHONE CHAR(7) NOT NULL,); CREATE TABLE CUSTOMER ( CUS_NUM CHAR(9) PRIMARY KEY, CUS_LNAME VARCHAR(15) NOT NULL, CUS_FNAME VARCHAR(15)
Background image of page 1

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

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

Unformatted text preview: NOT NULL, CUS_INITIAL CHAR(1), CUS_AREACODE CHAR(3) NOT NULL, CUS_PHONE CHAR(7) NOT NULL,); CREATE TABLE EMPLOYEE ( EMP_NUM CHAR(2) PRIMARY KEY, EMP_LNAME VARCHAR(15) NOT NULL, EMP_FNAME VARCHAR(15) NOT NULL, EMP_INITIAL CHAR(1), EMP_AREACODE CHAR(3) NOT NULL, EMP_PHONE CHAR(7) NOT NULL,); CREATE TABLE PRODUCT ( PROD_NUM VARCHAR(2) PRIMARY KEY, PROD_NAME VARCHAR(20) NOT NULL,); Lessons learned: To use intger instead of char for numbers INSERTING IN CASES insert into cases values ('000000000004','2008-01-015','2','2','02','9','SOFTWARE','Y'); select count(distinct case_num),emp_num from cases where case_solved = 'N' group by emp_num...
View Full Document

This note was uploaded on 04/22/2008 for the course ACC 320 taught by Professor Brucebradford during the Spring '08 term at Fairfield.

Page1 / 2

DS TABLES - NOT NULL, CUS_INITIAL CHAR(1), CUS_AREACODE...

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