Sql

CREATE USERSTUDENT IDENTIFIED BY STUDENT;

1/6

DbSchema

CREATE TABLE STUDENT.COURSE ( COURSE_NONUMBER( 8 )NOT NULL, DESCRIPTIONVARCHAR2( 50 )NULL, COSTNUMBER( 9, 2 )NULL, PREREQUISTENUMBER( 8 )NULL, CREATED_BYVARCHAR2( 30 )NOT NULL, CREATED_DATEDATE NOT NULL, MODIFIED_BYVARCHAR2( 30 )NOT NULL, MODIFIED_DATEDATE NOT NULL, CONSTRAINT PK_TABLE_0PRIMARY KEY ( COURSE_NO ) ); COMMENT ON TABLE STUDENT.COURSE IS 'Information of course.' ; CREATE TABLE STUDENT.ENROLLMENT ( STUDENT_IDNUMBER( 8 )NOT NULL, SECTION_IDNUMBER( 8 )NOT NULL, ENROLL_DATEDATE NOT NULL, FINAL_GRADENUMBER( 3 )NULL, CREATED_BYVARCHAR2( 30 )NOT NULL, CREATED_DATEDATE NOT NULL, MODIFIED_BYVARCHAR2( 30 )NOT NULL, MODIFIED_DATEDATE NOT NULL, CONSTRAINT PK_ENROLLMENTUNIQUE ( SECTION_ID ), CONSTRAINT PK_ENROLLMENT_0UNIQUE ( STUDENT_ID ) ); COMMENT ON TABLE STUDENT.ENROLLMENT IS 'Information for a student registered for a particular section of a particular cours CREATE TABLE STUDENT.GRADE ( STUDENT_IDNUMBER( 8 )NOT NULL, SECTION_IDNUMBER( 8 )NOT NULL, GRADE_TYPE_CODECHAR( 2 )NOT NULL, GRADE_CODE_OCCURANCENUMBER( 38 )NOT NULL, NUMERIC_GRADENUMBER( 3 )NOT NULL, COMMENTSVARCHAR2( 2000 )NULL, CREATED_BYVARCHAR2( 30 )NOT NULL, CREATED_DATEDATE NOT NULL, MODIFIED_BYVARCHAR2( 30 )NOT NULL, MODIFIED_DATEDATE NOT NULL, CONSTRAINT PK_GRADEUNIQUE ( SECTION_ID ), CONSTRAINT PK_GRADE_0UNIQUE ( GRADE_TYPE_CODE ), CONSTRAINT PK_GRADE_1UNIQUE ( STUDENT_ID ) ); COMMENT ON TABLE STUDENT.GRADE IS 'The individual grades a student received for a particular section(class)'; CREATE TABLE STUDENT.GRADE_CONVERSION ( LETTER_GRADEVARCHAR2( 2 )NOT NULL, GRADE_POINTNUMBER( 3, 2 )NOT NULL, MAX_GRADENUMBER( 3 )NOT NULL, MIN_GRADENUMBER( 3 )NOT NULL, CREATED_BYVARCHAR2( 30 )NOT NULL, CREATED_DATEDATE NOT NULL, MODIFIED_BYVARCHAR2( 30 )NOT NULL, MODIFIED_DATEDATE NOT NULL, CONSTRAINT PK_TABLE_6PRIMARY KEY ( LETTER_GRADE ) ); COMMENT ON TABLE STUDENT.GRADE_CONVERSION IS 'Converts a number grade to a letter grade.'; CREATE TABLE STUDENT.GRADE_TYPE ( GRADE_TYPE_CODECHAR( 2 )NOT NULL, DESCRIPTIONVARCHAR2( 50 )NOT NULL, CREATED_BYVARCHAR2( 30 )NOT NULL, CREATED_DATEDATE NOT NULL, MODIFIED_BYVARCHAR2( 30 )NOT NULL,

Sql

2/6

DbSchema

e(class).';

SqlMODIFIED_DATEDATE NOT NULL, CONSTRAINT PK_TABLE_5PRIMARY KEY ( GRADE_TYPE_CODE ) );

3/6

DbSchema

COMMENT ON TABLE STUDENT.GRADE_TYPE IS 'Lookup table for a grade type(code) and its description'; CREATE TABLE STUDENT.GRADE_TYPE_WEIGHT ( SECTION_IDNUMBER( 8 )NOT NULL, GRADE_TYPE_CODECHAR( 2 )NOT NULL, NUMBER_PER_SECTIONNUMBER( 3 )NOT NULL, PERCENT_OF_FINAL_GRADENUMBER( 3 )NOT NULL, DROP_LOWESTCHAR( 1 )NOT NULL, CREATED_BYVARCHAR2( 30 )NOT NULL, CREATED_DATEDATE NOT NULL, MODIFIED_BYVARCHAR2( 30 )NOT NULL, MODIFIED_DATEDATE NOT NULL ); CREATE INDEX IDX_GRADE_TYPE_WEIGHTON STUDENT.GRADE_TYPE_WEIGHT ( GRADE_TYPE_CODE ); COMMENT ON TABLE STUDENT.GRADE_TYPE_WEIGHT IS 'Information on how the final grade for a particular section is computed; for CREATE TABLE STUDENT.INSTRUCTER ( INSTRUCTER_IDNUMBER( 8 )NOT NULL, SALUTATIONVARCHAR2( 5 )NULL, FIRST_NAMEVARCHAR2( 25 )NULL, LAST_NAMEVARCHAR2( 25 )NULL, STREET_ADDRESSVARCHAR2( 50 )NULL, ZIPVARCHAR2( 5 )NULL, PHONEVARCHAR2( 15 )NULL, CREATED_BYVARCHAR2( 30 )NOT NULL, CREATED_DATEDATE NOT NULL, MODIFIED_BYVARCHAR2( 30 )NOT NULL, MODIFIED_DATEDATE NOT NULL, CONSTRAINT PK_TABLE_3PRIMARY KEY ( INSTRUCTER_ID ), CONSTRAINT PK_INSTRUCTERUNIQUE ( ZIP ) ); COMMENT ON TABLE STUDENT.INSTRUCTER IS 'Profile information for an instructer.'; CREATE TABLE STUDENT.SECTION ( SECTION_IDNUMBER( 8 )NOT NULL, COURSE_NONUMBER( 8 )NOT NULL, SECTION_NONUMBER( 3 )NOT NULL, START_DATE_TIMEDATE NULL, LOCATIONVARCHAR2( 50 )NULL, INSTRUCTOR_IDNUMBER( 8 )NOT NULL, CAPACITYNUMBER( 3 )NULL, CREATED_BYVARCHAR2( 30 )NOT NULL, CREATED_DATEDATE NOT NULL, MODIFIED_BYVARCHAR2( 30 )NOT NULL, MODIFIED_DATEDATE NOT NULL, CONSTRAINT PK_TABLE_1PRIMARY KEY ( SECTION_ID ), CONSTRAINT PK_SECTIONUNIQUE ( COURSE_NO ) ); COMMENT ON TABLE STUDENT.SECTION IS 'Information for an individual section(class) of a particular course'; CREATE TABLE STUDENT.STUDENT ( STUDENT_IDNUMBER( 8 )NOT NULL, SALUTATIONVARCHAR2( 5 )NULL, FIRST_NAMEVARCHAR2( 25 )NULL, LAST_NAMEVARCHAR2( 25 )NOT NULL, STREET_ADDRESSVARCHAR2( 50 )NULL, ZIPVARCHAR2( 6 )NOT NULL, PHONEVARCHAR2( 15 )NULL, EMPLOYERVARCHAR2( 50 )NULL, REGISTRATION_DATEDATE NOT NULL, CREATED_BYVARCHAR2( 30 )NOT NULL, CREATED_DATEDATE NOT NULL,

Sql

4/6

DbSchema

r example the midterm constitutes 50%, the quiz 10%, and the final exam 40% of the final grade.';

SqlMODIFIED_BYVARCHAR2( 30 )NOT NULL,
MODIFIED_DATEDATE NOT NULL, CONSTRAINT PK_TABLE_2PRIMARY KEY ( STUDENT_ID ), CONSTRAINT PK_STUDENTUNIQUE ( ZIP ) );

5/6

DbSchema

COMMENT ON TABLE STUDENT.STUDENT IS 'PROILE INFORMATION FOR A STUDENT CREATE TABLE STUDENT.ZIPCODE ( ZIPVARCHAR2( 5 )NOT NULL, CITYVARCHAR2( 25 )NULL, STATEVARCHAR2( 2 )NULL, CREATED_BYVARCHAR2( 30 )NOT NULL, CREATED_DATEDATE NOT NULL, MODIFIED_BYVARCHAR2( 30 )NOT NULL, MODIFIED_DATEDATE NOT NULL, CONSTRAINT PK_TABLE_4PRIMARY KEY ( ZIP ) ); COMMENT ON TABLE STUDENT.ZIPCODE IS 'CITY, STATE, AND ZIP INFORMATION';

';

ALTER TABLE STUDENT.COURSE ADD CONSTRAINT FK_COURSEFOREIGN KEY ( COURSE_NO )REFERENCES STUDENT.SECTION( COURSE_NO )ON DELETE ALTER TABLE STUDENT.GRADE_TYPE_WEIGHT ADD CONSTRAINT FK_GRADE_TYPE_WEIGHTFOREIGN KEY ( GRADE_TYPE_CODE )REFERENCES STUDENT ALTER TABLE STUDENT.SECTION ADD CONSTRAINT FK_SECTIONFOREIGN KEY ( SECTION_ID )REFERENCES STUDENT.ENROLLMENT( SECTION_ID ALTER TABLE STUDENT.SECTION ADD CONSTRAINT FK_SECTION_0FOREIGN KEY ( SECTION_ID )REFERENCES STUDENT.GRADE( SECTION_ID )ON ALTER TABLE STUDENT.STUDENT ADD CONSTRAINT FK_STUDENTFOREIGN KEY ( STUDENT_ID )REFERENCES STUDENT.ENROLLMENT( STUDENT_ID ALTER TABLE STUDENT.STUDENT ADD CONSTRAINT FK_STUDENT_0FOREIGN KEY ( STUDENT_ID )REFERENCES STUDENT.GRADE( STUDENT_ID )ON ALTER TABLE STUDENT.ZIPCODE ADD CONSTRAINT FK_ZIPCODEFOREIGN KEY ( ZIP )REFERENCES STUDENT.INSTRUCTER( ZIP )ON DELETE CASCADE ALTER TABLE STUDENT.ZIPCODE ADD CONSTRAINT FK_ZIPCODE_0FOREIGN KEY ( ZIP )REFERENCES STUDENT.STUDENT( ZIP )ON DELETE CASCADE

Sql

6/6

DbSchema

DELETE CASCADE; STUDENT.GRADE( GRADE_TYPE_CODE )ON DELETE CASCADE; )ON DELETE CASCADE; ON DELETE CASCADE; )ON DELETE CASCADE; ON DELETE CASCADE; CASCADE; CASCADE;

Sign up to vote on this title
UsefulNot useful

Master Your Semester with Scribd & The New York Times

Special offer: Get 4 months of Scribd and The New York Times for just $1.87 per week!

Master Your Semester with a Special Offer from Scribd & The New York Times