Posted by joe on Friday, July 22, 2011 at 10:45pm.
Display a list of all instructors, showing their ID, name, and the number of sections that they have taught. Make sure to show the number of sections as 0 for instructors who have not taught any section. Your query should use an outerjoin, and should not use scalar subqueries.
b) Write the same query as above, but using a scalar subquery,without outerjoin.
- SQL - DrBob222, Friday, July 22, 2011 at 11:03pm
How would you like for us to help you?
- SQL - joe, Saturday, July 23, 2011 at 2:35pm
This is a practice problem that the book has no answer for and needed to see how these two problems are done so i can be prepared for a test next week. The both need to be written in structured query langauge.
- SQL - MathMate, Saturday, July 23, 2011 at 4:04pm
If you give it an attempt, we can help you comment on your answer.
Also, are you running MS SQL server or oracle?
- SQL - joe, Saturday, July 23, 2011 at 7:26pm
Im am running oracle.
Here is what i have for the first query:select ID, name,
from instructor natural left
outer join section
where sec_id >= 0.
- SQL - MathMate, Saturday, July 23, 2011 at 9:28pm
As a start, you may want to display the sections so you can manually count how many there are for each instructor for comparing with later results.
I believe the out join syntax looks like this:
select ID, name, section from instructor outer join on instructor.section = courses.section;
You will have to experiment with the different parameters of the outer join clause to get exactly what you want.
Once this is done, you can remove the many printed lines using count() function to return the number of sections each instructor teaches.
Answer this Question
More Related Questions
- structured query language math - Display a list of all instructors, showing ...
- math write in sql - I have this question i need to know how to do for a test ...
- math write in sql - Display the list of all departments, with the total number ...
- Mat 126 - A community college has 3,000 students and 90 instructors. The college...
- testing and selection of dogs - please check this for me thank you Why should ...
- Math - In how many ways can 8 instructors be assigned to five sections of a ...
- math - In how many ways can 8 instructors be assigned to five sections of a ...
- Math - In how many ways can 10 instructors be assigned to seven sections of a ...
- math - Organizer of school graduation does have three sections of chairs. 1120 ...
- Math - A company manufactures fence sections for residential use. The number, s...