急求用SQL查詢學生的所有選課資訊的語句該怎麼寫?前面

2021-03-21 16:26:43 字數 2997 閱讀 8451

1樓:匿名使用者

select student.sname,course.**ame--查詢學生名,課程名

from student,course,sc where student.sno=sc.sno and course.**o=sc.**o--三個表之間的關聯

order by student.sname --按姓名排序欄位名有跟你不一樣的,自行修改一下

寫出查詢沒有選課的學生的所有資訊的sql語句,要求用in子句和關聯兩種

2樓:匿名使用者

in: select * from student where student_id not in (select distinct student_id from course);

join:select s.* from student s left join course c on s.

student_id = c.student_id where c.course_id is null;

以學生表為資料來源,用sql語句實現選擇查詢,查詢所有學生資訊,該怎樣寫

3樓:匿名使用者

select * from where 欄位(如姓名) like '%李%'

將查詢出所有的姓名中帶有了「李」字的學生,如李剛,王李子select * from where 欄位(如姓名) like '李%'

這個是前面配置就只能查詢出以李開頭的學生姓名,如:李剛,李豔,但不能查詢出王李子

4樓:

select * from 學生表

急急急!!!怎麼用sql語句查詢student表中年齡最小的前三名學生資訊?

5樓:匿名使用者

select top 3 * from student order by age asc

top 3 是前3個學生的意思, order by age asc 的意思是根據年齡升序排列, 也就是說最前面的就是年齡最小的。 (當然你沒有考慮到的是3個最小的年齡一樣的話, 是不是還要加個條件, 比如學號, 性別)

6樓:匿名使用者

select top 3 * from student order by 年齡 asc

7樓:匿名使用者

hjghghgjhgjh

用sql語句查詢所有學生(包括未選課的學生)的學號、姓名(sname)、該學生所選課程的平均分。提示:用外

查詢尚未選課的所有學生的基本情況。。。sql語句

8樓:匿名使用者

你的資料表結構怎麼樣?

估計是一個學生表,一個選課表,選課表有一個學生id作為外來鍵

select * from students where studentid not in (select distinct studentid from course)

sql:查詢所有學生的學號、姓名、入學成績、選課門數和平均分。結果要求顯示如下

9樓:

你select * from 表的時候,from兩個表。

後邊再where 表1.id = 表2.id

暈了,我說的id也就是主外來鍵關係的列。也就是你說的學號

10樓:匿名使用者

現在的學生啊 照著書一點點做比打這些字容易多了

請幫忙寫出下列sql語句的步驟: 1.查詢成績表的所有成績 2.查詢學生的學號,姓名和年齡 (接著在下面)

11樓:楓啦啦

你表的欄位和表的關係都沒給....

只能認為表裡面有所有的欄位了...

1 select * from 成績表

2 select 學號,姓名,年齡 from 學生資訊表

3 select 學號,姓名,課程名,成績 from 選課表

4 select * from 學生資訊表 where 姓名 like '張%'

5 select top 4 * from 學生資訊表 where 學號 like '9952%'

6 select count(*) as 男生人數 from 學生資訊表 where 性別='男'

7 select * form 學生資訊表 where 性別='女' and 黨員='是'

8 select 學號 from 成績表 where 成績》80 and 成績<90

9 select 學號,姓名 from 成績表 where 成績<60

ps:這題,如果姓名不在成績表中的話應該是:

select 學號,姓名 from 成績表,學生資訊表 where 成績表.學號=學生資訊表.學號 and 成績表.成績<60

10 select 學號,姓名,性別 from 學生資訊表 order by 學號 desc

這裡我把"學生表"寫成"學生資訊表",是為了看著更清楚

如果要改的話,自己看著改

12樓:匿名使用者

1,select * from 成績表

2,select 學好,姓名,年齡 from 學生表

寫一個sql語句,查詢選修了5門課程的學生學號和姓名

13樓:匿名使用者

select 學號,姓名

from student

where 學號=(select 學號

from sc

wehere sum(課程編號)>5

group by 課程編號)

14樓:

select stuno,stuname from student where stuno in(select stuno from sc)

你試一下朋友

寫出查詢沒有選課的學生的所有資訊的SQL語句,要求用in子句

in select from student where student id not in select distinct student id from course join select s.from student s left join course c on s.student id ...

SQL 查詢每門課程的課程名 選課學生姓名及其學號,選課人數

我的學生資料庫跟你的差不多,我就用我的這些表給你做了個 select c.o,s.sname,s.sno,選課人數 from course c left join sc on c.o sc.o left join student s on s.sno sc.sno left join select ...

5用SQL命令查詢所有學生的學號 姓名 總成績 平均成績

你的表是 來什麼名?表源 裡有哪些欄位?假如你的學bai生表是dustudent,學號的欄位名是 學號 姓zhi名dao的欄位名是 姓名 成績的欄位名是 成績 那麼查詢所有學生的學號就是 select 學號,姓名,evg 成績 sum 成績 from student 應該就是這樣的了你執行一下試試 ...