Table Student has 3 columns,Student_id,Student_Name &
Course_Id. Table Course has 2 columns, Course_Id &
Course_Name.Write a query to listdown all the Courses and
number of student in each course.

Answer Posted / kalyan

SELECT COURSE_NAME,COUNT(B.STUDENT_ID) NO_OF_STUDENTS
FROM COURSE A LEFT OUTER JOIN STUDENT B
USING (COURSE_ID)
GROUP BY A.COURSE_NAME

OR

SELECT COURSE_NAME,COUNT(B.STUDENT_ID) NO_OF_STUDENTS
FROM COURSE A , STUDENT B
WHERE A.COURSE_ID = B.COURSE_ID(+)
GROUP BY A.COURSE_NAME

This will list all the courses with no of students

Is This Answer Correct ?    8 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how to use case expression? : Sql dba

733


What is sql profiler in oracle?

759


Is nosql faster than sql?

745


Can you select everything, but 1 or 2 fields, without writer's cramp?

689


Does user triggers have entry for trigger with compilation errors?

792






How do you respond to dementia behavior?

720


How can I speed up sql query?

707


Explain how you can copy a file to file content and file to pl/sql table in advance pl/sql?

735


How do you update a sql procedure?

766


How many indexes can be created on a table in sql?

685


Explain what is rdbms?

780


What is the difference between numeric and autonumber?

698


What is use of term?

794


Explain the methods used to protect source code of pl/sql.

734


What is cursor explain with example?

733