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 |