sql语句笔试题
❶ 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%
未完。。。 持续更新中。。。