Please help on this question. Thank You! classroom (building, room number, capac
ID: 3571933 • Letter: P
Question
Please help on this question. Thank You!
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
Here are the Answers of 4 queries for you:
Answer to a:
select ID, name,
count(course_id, sec_id, year,semester) as ‘Number of sections’
from instructor natural left outer join teaches
group by ID, name
Answer to b:
select ID, name,
(select count(*) as ‘Number of sections’
from teaches T where T.id = I.id)
from instructor I
Answer to c:
select course_id, sec_id, ID,
decode(name, NULL, ‘‘, name)
from (section natural left outer join teaches)
natural left outer join instructor
where semester=’Spring’ and year= 2010
Answer to d:
select dept_name, count(ID)
from department natural left outer join instructor
group by dept_name
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.