早教吧作业答案频道 -->英语-->
sql笔试题有两个表第一个TableStoreStore-id(PK)CitySpacewh1NewYork370wh2Beijing500wh3NewYork200wh4London400……这是第一个表TableEmployee(EmployeeInStore)Store-id(FK)Emp-ID(PK)SalaryWH1e1
题目详情
sql笔试题
有两个表
第一个
Table Store
Store-id(PK) City Space
wh1 New York 370
wh2 Beijing 500
wh3 New York 200
wh4 London 400
……
这是第一个表
Table Employee(Employee In Store) Store-id(FK) Emp-ID(PK) Salary WH1 e1 1220 wh1 e3 1210 wh2 e4 1250 WH2 e6 1230 …… 第二个表
1Get the average salary of each store
2Get the average salary of each city
3find cities in which there exists salary less than 1000
4Get the average salary of cities there exists salary less than 1000(can create temporary tables)
5Get the employees who are paid the max salary for each city.( can create temporary tables)
6Get the total salary the total space ,the number of the store ,the number of the employee and maximum salary of every city.Show the results as following layout.( can create temporary table)
有两个表
第一个
Table Store
Store-id(PK) City Space
wh1 New York 370
wh2 Beijing 500
wh3 New York 200
wh4 London 400
……
这是第一个表
Table Employee(Employee In Store) Store-id(FK) Emp-ID(PK) Salary WH1 e1 1220 wh1 e3 1210 wh2 e4 1250 WH2 e6 1230 …… 第二个表
1Get the average salary of each store
2Get the average salary of each city
3find cities in which there exists salary less than 1000
4Get the average salary of cities there exists salary less than 1000(can create temporary tables)
5Get the employees who are paid the max salary for each city.( can create temporary tables)
6Get the total salary the total space ,the number of the store ,the number of the employee and maximum salary of every city.Show the results as following layout.( can create temporary table)
▼优质解答
答案和解析
两个表第一个store(store_id,city,space)
第二个employee(store_id,emp_id,salary)
1、每家店的平均工资
\x09select 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
第二个employee(store_id,emp_id,salary)
1、每家店的平均工资
\x09select 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
看了 sql笔试题有两个表第一个T...的网友还看了以下:
Ⅰ.下面是s能级p能级的原子轨道图,试回答问题:s电子的原子轨道呈形,每个s能级有个原子轨道;p电 2020-05-14 …
判断以下命题是否正确:(1)“所有的S是P”和“所有的S不是P”相否定;(2)“有些S不是P”那么 2020-05-16 …
下列命题只有一个为真①所有S不是P②如果所有S是M,那么有的P是M③有的S是P.S与P之间具有何种 2020-05-22 …
一个逻辑问题,求S与P是何种外延关系设下列四句中只有一句是真的.请问:哪一句是真的?S与P是何种外 2020-05-22 …
阅读下列算法,指出算法A的功能和时间复杂度,其中h、g分别为单循环链表中两个节点指针.voidB( 2020-06-12 …
下列算法,指出算法A的功能和时间复杂度,其中h、g分别为单循环链表中两个节点指针.VoidB(in 2020-07-23 …
已知集合M、P、S,满足M∪P=M∪S,则()A.P=SB.M∩P=M∩SC.M∩(P∪S)=M∩ 2020-07-30 …
突然发现了一个问题哦,m/p/s,这道题是应该把m/p堪为一个整体再*1/s,还是p/s,再用m*s 2020-11-11 …
如果用总长为60m的篱笆围成一个长方形场地,设长方形的面积为S(m2),周长为p(m),一边长为a( 2020-11-21 …
数据结构算法问题voedBB(LNode*s,LNode*q){p=s;while(p->next! 2021-01-22 …