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

What is the best sql course?

541


how to drop an existing view in mysql? : Sql dba

583


How to call shell script from pl sql procedure?

639


What is delimiter in pl sql?

592


What is a trigger in sql?

646






What is the use of pl/sql table?

568


What is the difference between python and sql?

530


What is an inner join sql?

551


Is drop table faster than truncate?

561


What company owns postgresql?

570


How to select random rows from a table?

535


what are the limitations of identity column? : Transact sql

617


What is the difference between partitioning and sharding?

540


What does := mean in pl sql?

568


Why trigger is used in sql?

541