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
What is the best sql course?
how to drop an existing view in mysql? : Sql dba
How to call shell script from pl sql procedure?
What is delimiter in pl sql?
What is a trigger in sql?
What is the use of pl/sql table?
What is the difference between python and sql?
What is an inner join sql?
Is drop table faster than truncate?
What company owns postgresql?
How to select random rows from a table?
what are the limitations of identity column? : Transact sql
What is the difference between partitioning and sharding?
What does := mean in pl sql?
Why trigger is used in sql?