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 purpose of design view?
What are the different types of constraints?
Explain what is a database?
how many groups of data types? : Sql dba
how to check server status with 'mysqladmin'? : Sql dba
How do you update a value in sql?
How can we link a sql database to an existing android app?
What is left join in postgresql?
What is the difference between inner join and outer join?
How many sql commands are there?
What is function and procedure in pl sql?
How to combine two stored procedures in sql?
What is db journal file?
What is data control language?
What are the different datatypes available in PL/SQL?