northwoods - - script to create NORTHWOODS database -...

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

View Full Document Right Arrow Icon
-- script to create NORTHWOODS database -- modified 9/11/2007 jchen - DROP TABLE enrollment CASCADE CONSTRAINTS; DROP TABLE course_section CASCADE CONSTRAINTS; DROP TABLE term CASCADE CONSTRAINTS; DROP TABLE course CASCADE CONSTRAINTS; DROP TABLE student CASCADE CONSTRAINTS; DROP TABLE faculty CASCADE CONSTRAINTS; DROP TABLE location CASCADE CONSTRAINTS; D CREATE TABLE LOCATION (loc_id NUMBER(6), bldg_code VARCHAR2(10), room VARCHAR2(6), capacity NUMBER(5), CONSTRAINT location_loc_id_pk PRIMARY KEY (loc_id)); C CREATE TABLE faculty (f_id NUMBER(6), f_last VARCHAR2(30), f_first VARCHAR2(30), f_mi CHAR(1), loc_id NUMBER(5), f_phone VARCHAR2(10), f_rank VARCHAR2(9), f_super NUMBER(6), f_pin NUMBER(4), f_image BLOB, CONSTRAINT faculty_f_id_pk PRIMARY KEY(f_id), CONSTRAINT faculty_loc_id_fk FOREIGN KEY (loc_id) REFERENCES location(loc_id)); C CREATE TABLE student (s_id VARCHAR2(6), s_last VARCHAR2(30), s_first VARCHAR2(30), s_mi CHAR(1), s_address VARCHAR2(25), s_city VARCHAR2(20), s_state CHAR(2), s_zip VARCHAR2(10), s_phone VARCHAR2(10), s_class CHAR(2), s_dob DATE, s_pin NUMBER(4), f_id NUMBER(6), time_enrolled INTERVAL YEAR TO MONTH, CONSTRAINT student_s_id_pk PRIMARY KEY (s_id), CONSTRAINT student_f_id_fk FOREIGN KEY (f_id) REFERENCES faculty(f_id)); C CREATE TABLE TERM (term_id NUMBER(6), term_desc VARCHAR2(20), status VARCHAR2(20), start_date DATE, CONSTRAINT term_term_id_pk PRIMARY KEY (term_id), CONSTRAINT term_status_cc CHECK ((status = 'OPEN') OR (status = 'CLOSED'))); C CREATE TABLE COURSE
Background image of page 1

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

View Full DocumentRight Arrow Icon
(course_no VARCHAR2(7), course_name VARCHAR2(25), credits NUMBER(2), CONSTRAINT course_course_no_pk PRIMARY KEY(course_no)); C CREATE TABLE COURSE_SECTION (c_sec_id NUMBER(6), course_no VARCHAR2(7) CONSTRAINT course_section_courseid_nn NOT NULL, term_id NUMBER(6) CONSTRAINT course_section_termid_nn NOT NULL, sec_num NUMBER(2) CONSTRAINT course_section_secnum_nn NOT NULL, f_id NUMBER(6), c_sec_day VARCHAR2(10), c_sec_time DATE, c_sec_duration INTERVAL DAY TO SECOND, loc_id NUMBER(6), max_enrl NUMBER(4) CONSTRAINT course_section_maxenrl_nn NOT NULL, CONSTRAINT course_section_csec_id_pk PRIMARY KEY (c_sec_id), CONSTRAINT course_section_cid_fk FOREIGN KEY (course_no) REFERENCES course(course_no), c CONSTRAINT course_section_loc_id_fk FOREIGN KEY (loc_id) REFERENCES location(loc_id), CONSTRAINT course_section_termid_fk FOREIGN KEY (term_id) REFERENCES term(term_id),
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 6

northwoods - - script to create NORTHWOODS database -...

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

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