FIGURE 5.7 THE M:N RELATIONSHIP BETWEEN STUDENT AND CLASS Database name: Ch05 Tinycollege STUDENT ENROLL CLASS PK STU NUM H is written in PK,FK1 OPK,FK2 STU NUM CLASS_CODE is found in PK CLASS CODE STU_LNAME STU_FNAME ENROLL_GRADE CRS_CODE CLASS_SECTION STU_INIT Table name: STUDENT (first four fields) STU NUM STU_LNAME STU FNAME Table name: ENROLL Table name: CLASS (first three fields) STU_INIT CLASS CODE STU_NUM ENROLL_GRADE CLASS CODE CRS CODE CLASS SECTION 321452 Bowser William C 10014 321452 C 10012 ACCT-211 1 324257 Smithson Anne K 10014 324257 B 10013 ACCT-211 2 324258 Brewer Juliette 10018 321452 A 10014 ACCT-211 3 324269 Oblonski Walter H 10018 324257 B 10015 ACCT-212 1 324273 Smith John 10021 321452 C 10016 ACCT-212 2 324274 Katinga 324291 Robertson 324299 Smith Raphael 10021 324257 C 10017 CIS-220 1 Gerald T 10018 CIS-220 2 John B 10019 CIS-220 3, 10020 CIS-420 1 10021 QM-261 1 10022 QM-261 2 10023 QM-362 1 10024 QM-362 2 10025 MATH-243 1 FIGURE 5.7 THE M:N RELATIONSHIP BETWEEN STUDENT AND CLASS Database name: Ch05 Tinycollege STUDENT ENROLL CLASS PK STU NUM H is written in PK,FK1 OPK,FK2 STU NUM CLASS_CODE is found in PK CLASS CODE STU_LNAME STU_FNAME ENROLL_GRADE CRS_CODE CLASS_SECTION STU_INIT Table name: STUDENT (first four fields) STU NUM STU_LNAME STU FNAME Table name: ENROLL Table name: CLASS (first three fields) STU_INIT CLASS CODE STU_NUM ENROLL_GRADE CLASS CODE CRS CODE CLASS SECTION 321452 Bowser William C 10014 321452 C 10012 ACCT-211 1 324257 Smithson Anne K 10014 324257 B 10013 ACCT-211 2 324258 Brewer Juliette 10018 321452 A 10014 ACCT-211 3 324269 Oblonski Walter H 10018 324257 B 10015 ACCT-212 1 324273 Smith John 10021 321452 C 10016 ACCT-212 2 324274 Katinga 324291 Robertson 324299 Smith Raphael 10021 324257 C 10017 CIS-220 1 Gerald T 10018 CIS-220 2 John B 10019 CIS-220 3, 10020 CIS-420 1 10021 QM-261 1 10022 QM-261 2 10023 QM-362 1 10024 QM-362 2 10025 MATH-243 1
Im having trouble getting this code to run. Please use the diagram and find the numbers by counting the characters in each section. THats how you find the numbers.
CREATE TABLE ENROLL (
CLASS_CODE CHAR(2) NOT NULL,
STU_NUM CHAR(2) NOT NULL,
ENROLL_GRADE CHAR(2) NOT NULL,
FOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE),
FOREIGN KEY(STU_NUM) REFERENCES STUDENT(STU_NUM),
PRIMARY KEY(CLASS_CODE, STU_NUM)
);
**** Implementation of Composite Primary Key
*** Insert multiple records at once.
INSERT ALL
INTO customer (first_name, last_name) VALUES ('Kristen', 'Rowley')
INTO customer (first_name, last_name) VALUES ('Jed', 'Tomlinson')
INTO customer (first_name, last_name) VALUES ('Margie', 'Escobar')
INTO customer (first_name, last_name) VALUES ('Harriette', 'Mejia')
INTO customer (first_name, last_name) VALUES ('Francis', 'Little')
SELECT * FROM dual;
Step by step
Solved in 2 steps