How to Perform Select query following this Bandi

Posted by Jayakumars under Sql Server on 7/31/2015 | Points: 10 | Views : 1133 | Status : [Member] [MVP] | Replies : 1
Hi
Bandi

How to solve this


This is my Table struture

Create Table Student
(
Enrolno int,
Name varchar(40),
Dob Date,
sex varchar(10),
DeptNo int
)


Create Table DEPARTMENT
(
DeptNo int,
DeptName varchar(40)
)

My Question this


1.List the Department-no and number of students in each department.

Mark as Answer if its helpful to you

Kumaraspcode2009@gmail.com



Responses

Posted by: Bandi on: 8/3/2015 [Member] [MVP] Platinum | Points: 25

Up
0
Down
SELECT d.DeptNo, COUNT(*) 
FROM Student s
JOIN DEPARTMENT d ON s.DeptNo = d.DeptNo
GROUP BY d.DeptNo


Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Jayakumars, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response