當前位置:首頁 » 編程語言 » 自測題SQL單表查詢
擴展閱讀
webinf下怎麼引入js 2023-08-31 21:54:13
堡壘機怎麼打開web 2023-08-31 21:54:11

自測題SQL單表查詢

發布時間: 2022-10-19 23:21:43

① 單表比較復雜的查詢 高分求sql

select * from 表 a,(
select count(1),name from (select distinct name,date from 表where 兩者之間的時間) b group by name having count(1)=(日期差值))
where a.name=b.name
搞定

不太懂你的說明,我QQ就是我名字,QQ上說吧

② sql語言,有一個成績單表,已知學生姓名,如何查詢名次

1、創建測試表,

create table test_score(name varchar2(20), score number);

③ SQL問題建表和查詢的題目

create table student(stuid char(10)primary key,stuname varchar(10),major varchar(50))
go
create table book(bid char(10)primary key,title char(50),author char(20))
go
create table borrow(borrowid char(10)primary key,stuid char(10)foreign key references
student(stuid),bid char(10)foreign key references book(bid),t_time datetime,b_time datetime)
go

select c.stuid,a.stuname,c.bid,b.title,c.t_time
from student a,book b,borrow c
where a.stuid=c.stuid and b.bid=c.bid and a.major='計算機'
and c.t_time between '2007-12-15' and '2008-01-08'

select * from student where stuid in(select stuid from borrow)

select x.stuname,y..title,z.t_time,z.b_time from student x,book y,borrow z
where x.stuid=z.stuid and y.bid=z.bid and y.author='張三'

select a.stuname,COUNT(*)as 未還數量 from student a,borrow b
where a.stuid=b.stuid and b.b_time<>null
group by a.stuname

④ SQL查詢題,求解

SELECT MAX(時間) FROM 表
GROUP BY 客戶
ORDER BY 客戶 時間 DESC

⑤ 請用SQL查詢完成下列各題目:

至少要給出表名和欄位名稱吧,湊合著看吧:
1. select 姓名,年齡 from 表名 where 家庭住址 like '%北京市%';
2. select 姓名 from 表名 where 性別="女" and 出生年份<>'1980';
3. select 姓名,家庭住址 from 表名where 性別='男' and 姓名 like '%國%';
4. select sum(成績),avg(成績) from 表名 where 課程='1';
5. select count(學號) from 表名 where 課程='2';
6. select a.* from 表1 a,表2 b where b.課程='computer English' and 成績>80 and a.學號=b.學號; (表1為課程成績表,表2為學生信息表)
7. select * from 表名 where 家庭住址=(select 家庭住址 from 表名 where 姓名='王華');
再往下沒法寫了,沒有表結構編不下去了...

⑥ sql數據查詢中單表查詢指什麼

就是說只查詢一個表,沒有和其它表進行聯合查詢的。

⑦ SQL 單表查詢

你這個sql 語句不是讀取列,而是輸出字元串"學號" 你試試select [學號] from xs
另外建議以後設計表的時候,不要用中文來命名表的列名