1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 create table tb_class( classid int not null identity, classname nvarchar(16) not null, students int not null, teacher nvarchar(16) not null, primary key(classid)) insert into tb_class(classname,students,
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
create table tb_class(
classid int not null identity,
classname nvarchar(16) not null,
students int not null,
teacher nvarchar(16) not null,
primary key(classid))
insert into tb_class(classname,students,teacher)
values
('1班',25,'yl'),('2班',18,'wsp'),('3班',24,'yl'),('4班',25,'zhy'),
('5班',22,'wsp'),('6班',25,'yl'),('7班',20,'zhy'), ('8班',22,'wsp')
select sum(students) from tb_class group by teacher
select count(students) from tb_class group by teacher
select avg(students) from tb_class group by teacher
select max(students) from tb_class group by teacher
select min(students) from tb_class group by teacher
,
