Which two queries would achieve the required result?

You need to generate a list of all customer last names with their credit limits from the CUSTOMERS
table. Those customers who do not have a credit limit should appear last in the list.
Which two queries would achieve the required result? (Choose two.)

You need to generate a list of all customer last names with their credit limits from the CUSTOMERS
table. Those customers who do not have a credit limit should appear last in the list.
Which two queries would achieve the required result? (Choose two.)

A.
SELECT cust_last_name, cust_credit_limit
FROM customers
ORDER BY cust_credit_limit DESC ;

B.
SELECT cust_last_name, cust_credit_limit
FROM customers
ORDER BY cust_credit_limit;

C.
SELECT cust_last_name, cust_credit_limit
FROM customers
ORDER BY cust_credit_limit NULLS LAST;

D.
SELECT cust_last_name, cust_credit_limit
FROM customers
ORDER BY cust_last_name, cust_credit_limit NULLS LAST;



Leave a Reply 4

Your email address will not be published. Required fields are marked *


kavitha

kavitha

Can u explain how B is the answer for the question.

banu

banu

By default the ORDER BY clause sorts numbers from max to min and NULL atlast?

Or sorts from min to max and NULL in last?

Justyna

Justyna

B and C is the same because:
– rows are sorted in the same way that is ASC (this is default order)
– Null values are displayed last for ascending sequences. It is the same like you use “ORDER BY NULLS LAST”.

In case descdending sorting – it is the same like “ORDER BY NULLS FIRST”