sql语句笔试题

求sql语句

select m.id ,k.name from (select max(idb) idnew , n.id from
(select m.idb,m.name,h.id from
(select count(*) as idb ,a.name from dept a join dept b on a.name 《=b.name group by a.name)
m join dept h on h.name=m.name) n group by n.id) m
join
(select m.idb,m.name,h.id from
(select count(*) as idb ,a.name from dept a join dept b on a.name 《=b.name group by a.name)
m join dept h on h.name=m.name) k on k.idb=m.idnew

本人初学sql语句,遇到一道笔试题,表为Student(s#,name,birthday),请问s后面带了一个#号是什么意思

#一般代表number的意思,估计是学生的学号之类的信息
s#是一个attribute,是一个整体,用到s#时一定要带上#,
其实你可以试试不带#,应该是会有error提醒你没有找到s,因为没有定义

SQL笔试题寻求答案

select count(*) ,case Fwage 》 5000 then 1 else 0 end as type1, case fage 》 32 then 1 else 0 end as type2 from emploreeinfo group by type1,type2
有个问题啊 就是你的month是什么形式的 年月日 还是数字形式 我按数字兆判形式给你写一个啊 如果是年-月的话 回头再给你写卖悔
我假设是同一年了 如果不是可以在left join 的on后面改条件
select s1.month,sum(s1.consume) as 当月消费, sum(s2.consume) as 上月中猜正消费, sum(s3.consume) as 下月消费, from student s1 left join student s2 on s1.month=s2.month+1 left join student s3 on s1.month=s3.month-1 group by s1.month

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、查询每个城市的员工总工资,总的店面面积(?),门老孙店的数量,员工数量,最高/最低工资数

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)
)
别的表类似。汪逗

建立多表视图时sql语句中不能使用哪些关键字一道笔试题···

create view view1
as
select A.学号,姓举肢名,图书名称
from A join C on A.学号=C.学号正祥世 join B on C.书号=B.书号
with check option
go
如果对您有帮助,请记得采纳为满意答宴山案,谢谢!祝您生活愉快!
vaela

关于数据库的一道笔试题: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