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;
Can u explain how B is the answer for the question.
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?
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”
Yes