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 denormalization in a database?
What is a dynamic query?
What is write ahead logging in sql server?
What is dynamic sql in pl sql?
What is a database? Explain
What is Collation Sensitivity ? What are the various type ?
What is the purpose of the sql select top clause?
How much ram can sql express use?
What do you mean by stored procedures? How do we use it?
Why plvtab is considered as the easiest way to access the pl/sql table?
What is dialect in sql?
What is mutating trigger?
Why is the cursor important?
What is the sql query to display the current date?
What is a dirty read sql?