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

Explain locks? : Transact sql

654


What is the difference between a query and a report?

585


What is the difference among union, minus and intersect?

634


What are the sql aggregate functions?

714


What is fmtonly in sql?

624






What is scope of pl sql developer in future?

672


How do I trace sql profiler?

596


what are the differences between require and include, include_once and require_once? : Sql dba

643


Is sql a backend language?

741


How to call a javascript function from pl sql?

649


What are the different sql commands?

623


what is sql in mysql? : Sql dba

677


what are set operators in sql? : Sql dba

630


what are string data types? : Sql dba

601


how to start mysql server? : Sql dba

736