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 a full join sql?
What is t sql used for?
How to run sql statements through the web interface?
What is the main difference between sql and pl/sql?
What is the difference between local variables and global variables?
What do you understand by pl/sql records?
Differentiate between % rowtype and type record.
what is a trigger in mysql? : Sql dba
how to convert numeric values to character strings? : Sql dba
What is the sql query to display the current date?
what are set operators in sql? : Sql dba
Why do we use triggers?
Differences between Oracle 9i and 10g (Probably in terms of SQL and PL/SQL)?
Write a query to find the names of users that begin with "um" in sql?
What does select * from mean in sql?