Answered step by step
Verified Expert Solution
Question
1 Approved Answer
insert one row for each table ( give me the SQL code ) SQL> CREATE TABLE college ( 2 college_no NUHBER(5) NOT NULL, 3 college_name
insert one row for each table ( give me the SQL code )
SQL> CREATE TABLE college ( 2 college_no NUHBER(5) NOT NULL, 3 college_name UARCHAR2(10) NOT NULL, 4 PRINARY KEY (college_no) ); Table created. SQL> CREATE TABLE teacher ( 2 teacher_id NUHBER(8) NOT NULL, 3 first_name UARCHAR2(10) NOT NULL, 4 last_name UARCHAR2(10) NOT NULL, 5 salary NUHBER(5) NOT NULL, 6 email UARCHAR2 (20) NOT NULL, 7 PRIHARY KEY (teacher_id) ; Table created. SQL> CREATE TABLE course ( 2 course_no NUMBER(5) NOT NULL, 3 level_no NUMBER(5) NOT NULL, 4 course_name UARCHAR2(10) NOT NULL, 5 description UARCHAR2(20) NOT NULL, 6 no_of_credit_hours NUMBER(2) NOT NULL, 7 PR IMARY KEY (course_no) ); Table created. SQL> CREATE TABLE section ( 2 section_no NUMBER(5) NOT NULL, 3 semester year NUMBER(4) NOT NULL, 4 instructor_name UARCHAR2(10) NOT NULL, 5 PRINARY KEY (section_no)); Table created. SQL> CREATE TABLE teach ( 2 teacher_id NUMBER(8) NOT NULL, 3 course_no NUMBER(5) NOT NULL, 4 PRIMARY KEY (teacher_id,course_no), 5 FOREIGN KEY (teacher_id) 6 REFERENCES teacher (teacher_id), 7 FOREIGN KEY (course_no) 8 REFERENCES course(course_no) ); Table created. SQL> CREATE TABLE part_of ( 2 course_no NUHBER(5) NOT NULL, 3 section_no NUHBER(5) NOT NULL, 4 PRINARY KEY (course_no,section_no), 5 FOREIGN KEY (course_no) 6 REFERENCES course(course_no), 7 FOREIGN KEY (section_no) 8 REFERENCES section (section_no) ; Table created. SQL> CREATE TABLE department_( 2 dep_code NUHBER(5) NOT NULL, 3 name UARCHAR2(10) NOT NULL, 4 phones NUHBER(10) NOT NULL, 5 teacher_id NUMBER (8) NOT NULL, 6 college_no NUNBER(5) NOT NULL, 7 PRIHARY KEY (dep_code), 8 FOREIGN KEY (teacher_id) 9 REFERENCES teacher (tacher_id), 10 FOREIGN KEY (college_no) 11 REFERENCES college(college_no); ; Table created. SQL> CREATE TABLE student ( 2 student_no NUMBER(8) NOT NULL, nationa 1_id_noNUHBER(8) NOT NULL, phone NUHBER(10) NOT NULL, birthdate NUMBER (8) NOT NULL, gender UARCHAR2 (6) NOT NULL, first_name UARCHAR2(10) NOT NULL, last_name UARCHAR2(10) NOT NULL, city UARCHAR2(10) NOT NULL, street_no NUHBER(4) NOT NULL, postal_code NUHBER(5) NOT NULL, student_level NUMBER(8) NOT NULL, major_dep UARCHAR2(10) NOT NULL, dep_code NUMBER(4) NOT NULL, PRIHARY KEY (student_no), FOREIGN KEY (dep_code ) REFERENCES department_(dep_code) ); Table created. SQL> CREATE TABLE offers ( 2 dep_code NUMBER(5) NOT NULL, 3 course_no NUHBER(5) NOT NULL, 4 PRIHARY KEY (dep_code,course_no), 5 FOREIGN KEY (dep_code) 6 REFERENCES department_(dep_code), 7 FOREIGN KEY (course_n) 8 REFERENCES course(course_no) ); Table created. SQL> CREATE TABLE join ( 2 student_no NUHBER(8) NOT NULL, 3 course_no NUMBER(5) NOT NULL, 4 PRIHARY KEY (student_no,course_no), 5 FOREIGN KEY (student_no) 6 REFERENCES student(student_no), 7 FOREIGN KEY (course_no) 8 REFERENCES course(course_no) ); Table created. SQL> CREATE TABLE dep_phones ( 2 dep_code NUHBER(5) NOT NULL, 3 phones NUMBER(10) NOT NULL, 4 PRIMARY KEY (dep_code), 5 FOREIGN KEY (dep_code) 6 REFERENCES department_(dep_code) ); Table created
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started