當前位置:首頁 » 編程語言 » sql語句筆試題

sql語句筆試題

發布時間: 2023-02-05 23:55:18

sql server 筆試題,求答案,急!!!!!!!!!!!!!!

這套筆試題你想拿上100分,也該懸賞上100分。
輸上基本上都有答案,看看SQL2005的書

create database STU --創建資料庫
use login1
go

create table STUDENT --建表
(
SNO char(10) primary key,
SNAME varchar(8),
SEX char(2) default 男,--默認值為男,只能輸入男或女
SAGE int,
SDEPT VARCHAR(20)
)

別的表類似。

❷ 關於資料庫的一道筆試題:select * from table1……

select t1.name,t1.value,t2.value,t3.value from (select name,value from table1 where name = 'a' and rownum <=1 ) t1 inner join
(select name,value from table1 where value <> (select value from table1 where name ='a' and rownum <=1) and rownum <=1) t2 on
t2.name = t1.name join table1 t3 on t3.name = t1.name and t1.value <>t3.value and t3.value <>t2.value

這個可以顯示 a 100 200 400

❸ sql筆試題,幫幫小弟!

二個我都有在我的電腦上測試,都是可以的,請參考。

第一題的答案
SELECT a, COUNT(*)
FROM (SELECT a = CASE WHEN score >= 0 AND
score < 10 THEN '0-9' WHEN score >= 10 AND
score < 20 THEN '10-19' WHEN score >= 20 AND
score < 30 THEN '20-29' WHEN score >= 30 AND
score < 40 THEN '30-39' WHEN score >= 40 AND
score < 50 THEN '40-49' WHEN score >= 50 AND
score < 60 THEN '50-59' WHEN score >= 60 AND
score < 70 THEN '60-69' WHEN score >= 70 AND
score < 80 THEN '70-79' WHEN score >= 80 AND
score < 90 THEN '80-89' WHEN score >= 90 AND
score < 100 THEN '90-99' ELSE '100' END
FROM student) a
GROUP BY a

第二題的答案
SELECT TOP 10 ip, countip
FROM (SELECT ip, COUNT(*) AS countip
FROM records
GROUP BY ip) a
ORDER BY countip DESC

❹ sql筆試題

兩個表第一個store(store_id,city,space)
第二個employee(store_id,emp_id,salary)
1、每家店的平均工資
select t1.store_id,AVG(salary) from store t1 inner join employee t2 on t1.store_id=t2.store_di
group by t1.store_id

2、每個城市的平均工資
select t1.city,AVG(salary) from store t1 inner join employee t2 on t1.store_id=t2.store_di
group by t1.city
3、查找該城市存在員工工資低於1000的城市信息
select distinct t1.city
from store t1 inner join employee t2 on t1.store_id=t2.store_id
where t2.salary<1000

4、查找城市其職工工資有低於1000的該城市職工平均工資
select t1.city,avg(t2.salary)
from store t1 inner join employee t2 on t1.store_id=t2.store_id
where exists(select * from employee t3
where t1.store_id=t3.store_id and t3.salary<1000)
group by t1.city

其他的自己看吧,比較簡單
5、每個城市工資最高的員工信息
select t2.city,t1.* from employee t1 inner join store t2 on t1.store_id=t2.store_id
where exists(
select * from (
select t1.city,max(salary) from store t1 inner join employee t2 on t1.store_id=t2.store_di
group by t1.city) tt where t1.city=tt.city and t2.salary=tt.salary)
6、查詢每個城市的員工總工資,總的店面面積(?),門店的數量,員工數量,最高/最低工資數

❺ Mysql|數據分析搞懂這15道SQL題目筆試就穩了

現有以下三張表

寫出SQL語句:查詢產品名稱=「A葯品」,在北京醫院2018~2019兩年的銷售「金額」,排除兩年銷售金額總和>1000000的醫院,要求查詢結果如下表。

寫出SQL語句,查詢題1的銷量表中2019年任意連續三個月銷售額都>0的醫院。
返回欄位:HospitalId,SalesMonth(2019年銷量>0的所有月份,逗號隔開)

以下是微信聊天記錄表

寫出SQL語句:按月統計2020年的微信回復率

發送次數 = 一組好友在一個自然天內的所有發送記錄計為1次。

回復率計算公式 =(發送次數在兩個自然天內被回復)/發送次數*100%

未完。。。 持續更新中。。。

熱點內容
qq密碼的資料庫 發布:2025-07-08 14:54:50 瀏覽:4
多圖床源碼 發布:2025-07-08 14:46:36 瀏覽:572
sqldblinkoracle 發布:2025-07-08 14:44:50 瀏覽:606
ip重復訪問伺服器會報警嗎 發布:2025-07-08 14:44:13 瀏覽:80
pro編譯器 發布:2025-07-08 14:30:20 瀏覽:388
mysql如何導出存儲過程 發布:2025-07-08 14:13:16 瀏覽:542
無效配置什麼意思 發布:2025-07-08 14:04:54 瀏覽:765
matlab編程入門 發布:2025-07-08 14:04:52 瀏覽:483
和平精英安卓發動態怎麼發圖片 發布:2025-07-08 14:02:16 瀏覽:525
怎麼創建輔助dns伺服器 發布:2025-07-08 14:01:23 瀏覽:303