1Z0-051 QUESTION 8 子查询和JION的用法

QUESTION 8
View the Exhibit and examine the structure of the CUSTOMERS table.

Which two tasks would require subqueries or joins to be executed in a single statement? (Choose two.)


A. listing of customers who do not have a credit limit and were born before 1980
B. finding the number of customers, in each city, whose marital status is 'married'
C. finding the average credit limit of male customers residing in 'Tokyo' or 'Sydney'
D. listing of those customers whose credit limit is the same as the credit limit of customers residing in the
city 'Tokyo'
E. finding the number of customers, in each city, whose credit limit is more than the average credit limit of
all the customers

答案为:DE

解析:

--A选项不需要用到子查询或者jion:
select * from customers where cust_credit_limit='' and cust_year_of_birth<1980;
--B选项不需要用到子查询或者jion:
select cust_city,count(*) from customers where cust_maritial_status='married' group by cust_city; 
--C选项不需要用到子查询或者jion:
select * from customers where cust_credit_limit=avg(cust_credit_limit) and cust_gender='1' and cust_city in('Tokyo','Sydney')
--假设cust_gender=1为male
--D选项需要用到子查询或者jion:
select * from customers where cust_credit_limit=
 (select cust_credit_limit from customers where cust_city ='Tokyo')
--E选项需要用到子查询或者jion:
select cust_city,count(*) from customers where cust_id=
(select custid from customers where cust_credit_limit>=avg(cust_credit_limit)) group by cust_city

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值