OCP-1Z0-051-Question Analysis-14th question

Source: Internet
Author: User

14.Using the MERs table, you need to generate a report that shows 50% of each credit
Amount in each income level. The report shocould NOT show any repeated credit amounts in each income level.
Which query wocould give the required result?
(Meaning: to use a customer table, you need to make a report to list 50% of the credit limit of each income grade and remove duplicate values. Which of the following query statements can get this result ?)
A.
SELECT cust_income_level and DISTINCT cust_credit_limit * 0.50
AS "50% Credit Limit"
FROM MERs MERS;
B.
Select distinct cust_income_level, DISTINCT cust_credit_limit * 0.50
AS "50% Credit Limit"
FROM MERs MERS;
C.
Select distinct cust_income_level ''cust_credit_limit * 0.50
AS "50% Credit Limit"
FROM MERs MERS;
D.
SELECT cust_income_level ''cust_credit_limit * 0.50
AS "50% Credit Limit"
FROM MERs MERS;

Answer: C

Question Analysis:

This question is about the usage of distinct:
1. distinct can only be placed before the first field, such as Select distinct x, y from t,
2. When there are multiple fields in distinct, it means that all fields have the same value before they are considered as repeated values, such as Select distinct x, y from t,
Deduplication is considered only when the values of x and y are the same.

So option AB is a syntax error. Option D does not remove duplicate values.
In fact, C is also a bit wrong. The correct method is:

SELECT DISTINCT cust_income_level || cust_credit_limit * 0.50 AS "50% Credit Limit" FROM customers; 

The ''In the statement should be replaced with a connector |

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.