Please help on these two questions. Schema is given above! classroom (building,
ID: 3571903 • Letter: P
Question
Please help on these two questions. Schema is given above!
classroom (building, room number, capacity) department (dept name, building, budget) course (course id, title, dept name, credits) instructor (ID, name, dept name, salary) section (course id, sec id, semester, year, building, room number, time slot id) teaches(ID, course id, sec id, semester, year) student (ID, name, depl name, tot cred) takes(ID, course id, sec id, semester, year,grade) advisors ID, i-ID) time slot time slot id, day, start time, end time) prereq Courseld, prereg-do Figure 2.9 Schema of the university database.Explanation / Answer
FOR EACH ROW /* A VARIABLE IN DEPT_NAME
DECLARE
NUMBER X;
BEGIN
SELECT COUNT (*) INTO X /* QUERY TO FIND OUT IF PART HAS ALREADY BEEN*/
FROM pending_section /* recordered-if yes, x=1, if no, x=0*/
WHERE building =:course;
IF X=0
THEN /* BUILDING HAS NOT BEEN REORDERED YET, SO REORDERED*/
INSERT INTO course_id
VALUES (newlcourse, new.reorder_course_id, sysdate);
END IF;
END;
------------------------------------------------------------------------------------------------------------------------------------------------------------------
NEXT SOLUTION
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
FOR EACH ROW /* A VARIABLE IN DEPT_NAME
DECLARE
NUMBER X;
BEGIN
SELECT COUNT (*) INTO X /* QUERY TO FIND OUT IF PART HAS ALREADY BEEN*/
FROM pending_section /* recordered-if yes, x=1, if no, x=0*/
WHERE building =:course;
IF X=0
THEN /* BUILDING HAS NOT BEEN REORDERED YET, SO REORDERED*/
INSERT INTO course_id
VALUES (newlcourse, new.reorder_course_id, sysdate);
END IF;
END;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.