OCP-1Z0-051-题目解析-第14题
来源:互联网 发布:网络信息安全大会 编辑:程序博客网 时间:2024/05/21 15:14
14. Using the CUSTOMERS table, you need to generate a report that shows 50% of each credit
amount in each income level. The report should NOT show any repeated credit amounts in each income level.
Which query would give the required result?
(题意:使用客户表,需要做一个报表,列出每个收入等级的信用额度的50%,并去除重复值。下面的哪个查询语句可以得到这个结果?)
A.
SELECT cust_income_level, DISTINCT cust_credit_limit * 0.50
AS "50% Credit Limit"
FROM customers;
B.
SELECT DISTINCT cust_income_level, DISTINCT cust_credit_limit * 0.50
AS "50% Credit Limit"
FROM customers;
C.
SELECT DISTINCT cust_income_level ' ' cust_credit_limit * 0.50
AS "50% Credit Limit"
FROM customers;
D.
SELECT cust_income_level ' ' cust_credit_limit * 0.50
AS "50% Credit Limit"
FROM customers;
语句中的''应该换成连接符||
amount in each income level. The report should NOT show any repeated credit amounts in each income level.
Which query would give the required result?
(题意:使用客户表,需要做一个报表,列出每个收入等级的信用额度的50%,并去除重复值。下面的哪个查询语句可以得到这个结果?)
A.
SELECT cust_income_level, DISTINCT cust_credit_limit * 0.50
AS "50% Credit Limit"
FROM customers;
B.
SELECT DISTINCT cust_income_level, DISTINCT cust_credit_limit * 0.50
AS "50% Credit Limit"
FROM customers;
C.
SELECT DISTINCT cust_income_level ' ' cust_credit_limit * 0.50
AS "50% Credit Limit"
FROM customers;
D.
SELECT cust_income_level ' ' cust_credit_limit * 0.50
AS "50% Credit Limit"
FROM customers;
Answer: C
题目解析:
这道题是关于distinct的用法:
1.distinct只能放在第一个字段的前面,如Select distinct x,y from t,
2.当distinct后有多个字段时,表示所有字段的值都相同才视为重复值,如Select distinct x,y from t,
只有当x,y的值都相同时,才视为重复值去除。
所以选项AB是语法错误,选项D没有去除重复值,不合题意。
其实C也有点错误,正确的写法是:
SELECT DISTINCT cust_income_level || cust_credit_limit * 0.50 AS "50% Credit Limit" FROM customers;
语句中的''应该换成连接符||
0 0
- OCP-1Z0-051-题目解析-第14题
- OCP-1Z0-051-题目解析-第1题
- OCP-1Z0-051-题目解析-第2题
- OCP-1Z0-051-题目解析-第3题
- OCP-1Z0-051-题目解析-第4题
- OCP-1Z0-051-题目解析-第5题
- OCP-1Z0-051-题目解析-第6题
- OCP-1Z0-051-题目解析-第7题
- OCP-1Z0-051-题目解析-第8题
- OCP-1Z0-051-题目解析-第9题
- OCP-1Z0-051-题目解析-第10题
- OCP-1Z0-051-题目解析-第11题
- OCP-1Z0-051-题目解析-第12题
- OCP-1Z0-051-题目解析-第13题
- OCP-1Z0-051-题目解析-第15题
- OCP-1Z0-051-题目解析-第16题
- OCP-1Z0-051-题目解析-第17题
- OCP-1Z0-051-题目解析-第18题
- POJ 3628 Bookshelf 2 题解
- 【Java】Upload file to web services
- 华为机试-将整数倒序输出,剔除重复数据
- Mybatis3.2.6+oracle例子
- 安装Django环境(nginx+uwsgi + mysql)
- OCP-1Z0-051-题目解析-第14题
- Iterator和Enumeration比较
- 40 个很有用的 Mac OS X Shell 脚本和终端命令
- 浅谈C++多态性
- Unity3d UnityEditor编辑器定制和开发插件
- MAP 电话号码
- js 二维数组值被覆盖问题
- DWR3 高级主题之反向Ajax(DWR3介绍)
- SQL中case...when使用技巧