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.
Answers were Sorted based on User's Feedback
Answer / monalisa.dalbehera
select count(s.student_id),c.cource_name
from student s,course c
where c.course_id=s.course_id
group by c.course_name;
Is This Answer Correct ? | 48 Yes | 3 No |
Answer / pradip d
select count(student_name),course_name from student,course
where course.course_id=student.course_id group by course_name;
Is This Answer Correct ? | 18 Yes | 8 No |
Answer / 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 |
Answer / neo28
select Course_Id, Course_Name, count(Student_id) from
(
select c.Course_Id, c.Course_Name, s.Student_id
from Student s, Course c
where s.Course_Id(+) = c.Course_Id
) group by Course_Id
order by Course_Id;
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / iamanocp
select c.course_id, count(s.student_id)
from student s, course c
where s.course_id = c.course_id
group by c.course_id;
Is This Answer Correct ? | 2 Yes | 2 No |
Answer / lova raju allumalla
select count(stud_name),course_name from student s,course c
where s.course_id = c.course_id group by course_name
/
Is This Answer Correct ? | 2 Yes | 2 No |
Answer / cm
select s.stud_name,c.course_name from student s,course c
where s.course_id = c.course_id group by
s.stud_name,c.course_name;
Is This Answer Correct ? | 1 Yes | 2 No |
Answer / dinakar
select course_id,count(*) from student where course_id in
(select course_id From course)
GROUP BY COURSE_ID
Is This Answer Correct ? | 2 Yes | 4 No |
Answer / guest
select count(student_id),course_name ,student_name
from student s, course c
where s.course_id = c.course_id
group by course_id
order by student_id desc
Is This Answer Correct ? | 2 Yes | 5 No |
What is sql data?
What is the order of sql select?
what is organisational index?
How do I view a sql database?
What are the methods of filing?
How can you save or place your msg in a table?
How do I save a stored procedure?
what is the difference between rownum pseudo column and row_number() function? : Sql dba
what are the differences between get and post methods in form submitting. Give the case where we can use get and we can use post methods? : Sql dba
Define commit, rollback and savepoint?
Define concurrency control. : Transact sql
i have a column which may contain this kind of value: 123*67_80,12*8889_5,34*8_874 ,12*7_7 (can contain space before a comma, and this string length can be anything) now i want to split this value into two column like: column1: 123*67,12*8889,34*8,12*7 column2: 80,5,874,7 use function for this