當前位置:首頁 » 編程語言 » sql查詢大學英語學生
擴展閱讀
webinf下怎麼引入js 2023-08-31 21:54:13
堡壘機怎麼打開web 2023-08-31 21:54:11

sql查詢大學英語學生

發布時間: 2022-05-09 12:30:48

『壹』 sql查詢選修了「大學英語」的學生姓名、學號、性別、專業和年齡,且按照年齡降序排序

select 姓名,學號,性別,專業,年齡
from table
where 選修課='大學英語'
order by 年齡 desc

『貳』 資料庫中sql查詢比英語系學生的平均年齡小的其他系的學生姓名,年齡,系部

select 學生姓名,年齡,系部 from
student where 系部<>'英語系' and
年齡<(select avg(年齡)from student where 系部='英語系')

『叄』 sql問題,高懸賞

use EDUC
select Sno,Sname,DATEDIFF(year,Sbirthday,GETDATE()) as Age from student
select * from SC where degree between 70 and 80
select Sno,Sname,Ssex,Sbirthday from student where YEAR(sbirthday)=1983
select * from course where Cname in ('高等數學','C語言','大學英語')
select Cno,COUNT(*) as 及格人數 from SC where DEGREE>60 group by cno having COUNT(*) >=2
涉及到具體的列名,可能有點不一樣,你自己注意下,語句是沒問題的,我這邊測試過了

『肆』 sql學生查詢問題!急,小難!

1.
select 學生.姓名,學生.學號,教師.編號 from 學生,教師,授課 where
授課.教師編號=教師.編號 and 授課.學生學號=學生.學號 and 授課.成績<60 and 授課.課程名稱='資料庫原理'

2.
select 學生.學號,學生.姓名,學生.成績 from 學生,授課 where 授課.課程名稱='英語' and 學生.專業='計算機'

3.
select 學生.學號,學生.姓名 ,學生.專業 from 學生,教師,授課 where
授課.教師編號=教師.編號 and 授課.學生學號=學生.學號 and
教師.姓名='張三' and 學生.成績>95

4.
update 教師 set 教師.所在部門='計算機' where 教師.編號=002

『伍』 關於access數據,以下三個SQL語句怎麼寫

--不給出表結構怎麼寫?
--1.
select學號as學生號碼,姓名,年齡from學生表where年齡>25

--2.
select課程名稱,掛科人數from(select課程名稱,count(*)掛科人數from課程表where成績<90groupby課程名稱)awherea.掛科人數>2

--3.
select課程名稱,count(*)優秀人數from課程表where課程名稱='大學英語'and成績>80and成績<90groupby課程名稱

『陸』 查詢每個學生的各科成績sql語句

1、查詢每個學生的各科成績sql語句:

select a.studentid,a.name,a.sex,v1.score as '語文',v2.score as '數學', v3.score as '英語',v4.score

as 『哲學』, (v1.score+v2.score+v3.score+v4.score)/4 as 『平均成績』 from Stuednt a
left join

(select studentid,score from grade where cid=(select cid from course where cname='語文'))as v1

on a.studentid=v1.studentid

left join

(select studentid,score from grade where cid=(select cid from course where cname='數學'))as v2

on a.studentid=v2.studentid

left join

(select studentid,score from grade where cid=(select cid from course where cname='英語'))as v3

on a.studentid=v3.studentid

left join

(select studentid,score from grade where cid=(select cid from course where cname='哲學'))as v4

on a.studentid=v4.studentid

order by a.studentid

2、sql資料庫介紹:

(1)SQL是Structured Query Language(結構化查詢語言)的縮寫。SQL是專為資料庫而建立的操作命令集,是一種功能齊全的資料庫語言。在使用它時,只需要發出"做什麼"的命令,"怎麼做"是不用使用者考慮的。

(2)SQL功能強大、簡單易學、使用方便,已經成為了資料庫操作的基礎,並且現在幾乎所有的資料庫均支持SQL。

(3)SQL資料庫的數據體系結構基本上是三級結構,但使用術語與傳統關系模型術語不同。

(4)在SQL中,關系模式(模式)稱為"基本表"(base table);存儲模式(內模式)稱為"存儲文件"(stored file);子模式(外模式)稱為"視圖"(view);元組稱為"行"(row);屬性稱為"列"(column)。

『柒』 SQL查詢所以選修英語的學生姓名

SELECT Sname
FROM Student
WHERE (EXISTS
(SELECT 1
FROM SC INNER JOIN
Course ON SC.Cno = Course.Cno
WHERE (SC.Sno = Student.Sno) AND (Course.Cname = '英語')))

『捌』 SQL資料庫的查詢怎麼寫呀幫幫忙拜託~

--1列出不及格記錄的學生名單
select distinct student.snum,sname
from sc,student
where sc.snum=student.snum and score<60

--2列出選修了計算機系課程的學生姓名和年齡(表中只有出生年月)
select student.sname,(year(getdate())-year(birthday ))as age
from student
where snum in
(
select sc.snum
from sc,course,[section]
where sc.secnum=[section].secnum and course.cnum=[section].cnum and course.dept='計算機系'
)

--3檢索選修了資料庫技術課程的學生姓名和系別
select student.sname,student.dept
from student
where student.snum in
(
select snum
from sc,[section],course
where sc.secnum=[section].secnum and course.cnum=[section].cnum
and cname='資料庫技術'
)

--4列出選修了所有課程的學生名單
select * from student
where not exists
(
select * from course
where not exists
(
select * from sc,section
where sc.secnum=section.secnum and student.snum=sc.snum
)
)

--5檢索每門課程成績都在80分以上的學生名單
select * from student
where snum in
(
select snum
from sc
group by snum
having min(score)>=80
)
--6檢索獲獎學金的學生 名單(每門課程在80分以上,平均成績在90分以上)
select * from student
where snum in
(
select snum
from sc
group by snum
having min(score)>=80 and avg(score)>=90
)
--7檢索選修了大學英語的學生名單和成績,並按成績從高到低排列
select student.snum,student.sname,sc.score
from sc,student
where student.snum in
(
select snum from sc,section,course
where sc.secnum=section.secnum and course.cnum=section.cnum and cname='大學英語'
)
order by score desc

--8統計每門課程的選修人數,輸出列明為課程號,人數
select cnum as 課程號,count(*) 人數
from section,sc
where section.secnum=sc.secnum
group by cnum
--9查詢選修了資料庫技術,沒有選修高等數學的學生姓名和系別
select student.sname,student.dept
from student
where student.snum in
(
select distinct snum from sc,section,course
where sc.secnum=section.secnum and section.cnum=course.cnum and course.cname='大學英語'
)
and student.snum not in
(
select distinct snum from sc,section,course
where sc.secnum=section.secnum and section.cnum=course.cnum and course.cname='高等數學'
)
--11統計每門課程的選課人數及不及格人數
select cnum,count(*) as 選課人數, case when
(
select count(*) from sc,section
where sc.secnum=section.secnum and score<60
group by cnum
) is NULL then 0 else (
select count(*) from sc,section
where sc.secnum=section.secnum and score<60
group by cnum
) end as 不及格人數
from sc,section
where sc.secnum=section.secnum
group by section.cnum

『玖』 access用一個sql表達某一個課程的參加總人數及平均分

select 課程名稱,count(*),avg(成績)

from a where 學號 like '19%' and 課程名稱=『大學英語』group by 課程名稱;

『拾』 檢索選修大學英語的學生名單和成績,成績高到低排,求改正!

沒仔細看你的CREATE,只看了最後的查詢語句,一眼就可以看出來,你的ORDER BY沒有任何用處。
你可以這樣想,SQL查詢是隨機的,那麼你先排序,然後在外層又SELECT一遍,豈不是排好的數據又被隨機打亂了?所以,ORDER BY一定是最外層的!