Sql每個班級課程平均成績
1. 一張學生成績表內SQL查詢每個班級每門課程的平均分
select avg(分數) as 平均分, rtrim(cast(sum(case when 分數>=60 then 1 end)/count(*)*100 as char(10)))+'%' as 及格率 from A group by 班級,課程
2. sql題 查詢每位同學的課程門數、總成績、平均成績」的SQL語句是什麼
selectavg(成績欄位)平均成績,sum(成績欄位)總成績,count(課程欄位)課程門數from表groupby學生欄位;
3. 如何用SQL語句查詢各門課程的平均成績
創建表:
SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOSET ANSI_PADDING ONGOCREATE TABLE [dbo].[stuscore]
( [name] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL,
[subject] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL,
[score] [int] NULL,
[stuid] [int] NULL)
ON [PRIMARY]
GO
SET ANSI_PADDING OFF
插入數據:
insert into dbo.stuscore values ('張三','數學',89,1);
insert into dbo.stuscore values ('張三','語文',80,1);
insert into dbo.stuscore values ('張三','英語',70,1);
insert into dbo.stuscore values ('李四','數學',90,2);
insert into dbo.stuscore values ('李四','語文',70,2);
insert into dbo.stuscore values ('李四','英語',80,2);
查詢結果如下:
列出各門課程的平均成績:
select subject,AVG(score)平均成績 from stuscore
group by subject;
4. SQL查詢語句,要得到每個班每門課程的平均分,以及每個班的人數。如圖:
select 班級,avage(語文) as 語文,avage(數學) as 數學,count(*) as 人數 from table groub by 班級
5. sql 查詢每個班級每門課程選課人數和平均分
select class,cname,count(sno) as '選課人數',avg(grade) as '平均版分權'
from student a join sc b on a.sno=b.sno join course c on b.cno=c.cno
group by class,cname
6. 查詢每位同學的課程門數、總成績、平均成績」的SQL語句是什麼
SQL語句如下:
SELECT 學號, Count(課程編號) AS 課程總數, Sum(成績) AS 總分數, Avg(成績) AS 平均分
FROM 成績表
GROUP BY 學號;
SQL常用操作語句如下:
選擇:select * from table1 where 范圍
插入:insert into table1(field1,field2) values(value1,value2)
刪除:delete from table1 where 范圍
更新:update table1 set field1=value1 where 范圍
查找:select * from table1 where field1 like 』%value1%』
排序:select * from table1 order by field1,field2 [desc]
總數:select count as totalcount from table1
求和:select sum(field1) as sumvalue from table1
平均:select avg(field1) as avgvalue from table1
最大:select max(field1) as maxvalue from table1
最小:select min(field1) as minvalue from table1
7. 用SQL查詢,某門課程每個班的總平均分(從高到低排列)
SELECT
AVG(數學)from
分數表
group
by
班級
order
by
AVG(數學)DESC
希望是滿意答案,急需!!!!!!!!謝謝
8. SQL求每個學生平均成績
select student.學號,student.姓名, course.課程名,(select avg(sc.成績版) from sc where sc.學號權=student.學號) as 平均成績 from student inner join sc on student.學號=sc.學號 inner join course on sc.課程號=course.課程號
9. SQL問題:如何分別給每個班算平均分
select 班級,avg(table.科目1) as 別名 ,avg(table.科目2) as 別名2,...,
from 表名
group by 班級
SQL查詢語句,要得到每個班每門課程的平均分,專以及每屬個班的人數
select 班級,avage(table.科目) as 別名,avage(科目2) as 別名2,count(*) as 人數 from table groub by 班級