SQL

posted by .

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 -

    How would you like for us to help you?

  • SQL -

    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 -

    If you give it an attempt, we can help you comment on your answer.
    Also, are you running MS SQL server or oracle?

  • SQL -

    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 -

    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.

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

  1. testing and selection of dogs

    please check this for me thank you Why should obedience instructors refuse to treat extremely aggressive dogs?
  2. Mat 126

    A community college has 3,000 students and 90 instructors. The college plans that enrollment will be 3,500 next year. How many new instructors should be hired if the college wants to keep the same student to instructor ratio?
  3. programing

    3.Write a query to display the annual salary of all employees in department_id 20. Display the names in increasing order or salary. 4.Write a query to display the average salary of employees. Label the column as ' Average Salary. 5.Write …
  4. math

    In how many ways can 8 instructors be assigned to five sections of a course in mathematics
  5. math write in sql

    I have this question i need to know how to do for a test coming up this week. a)Display the list of all course sections offered in Spring 2010, along with the names of the instructors teaching the section. If a section has more than …
  6. math write in sql

    Display the list of all departments, with the total number of instructors in each department, without using scalar subqueries. make sure to correctly handle departments with no instructors. Is this the right answer: select department.dept_name …
  7. structured query language math

    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, …
  8. Math

    In how many ways can 10 instructors be assigned to seven sections of a course in mathematics?
  9. Math

    In how many ways can 8 instructors be assigned to five sections of a course in mathematics?
  10. math

    students of class XI of a school were motivated to apply for NCC. from each section equal number of students opted for NCC. if there are 3x + 11 sections of class XI and total number of students in all the sections is represented by …

More Similar Questions