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 sql deadlock?
What programs use sql?
What are local and global variables and their differences?
What are the features of pl sql?
What is view explain with example?
how to extract a unit value from a date and time? : Sql dba
what is meant by urlencode and urldocode? : Sql dba
Are null values same as that of zero or a blank space?
What is group function in sql?
What is cte sql?
What can you do with pl sql?
What normalization means?
what are the advantages and disadvantages of views in a database? : Sql dba
what is a relationship and what are they? : Sql dba
How do you optimize a stored procedure in sql?