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?

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?

A.
Option A

B.
Option B

C.
Option C

D.
Option D

Explanation:

If the ORDER BY clause is not used, the sort order is undefined, and the Oracle server may not
fetch rows in the same order for the same query twice. Use the ORDER BY clause to display the
rows in a specific order.
Note: Use the keywords NULLS FIRST or NULLS LAST to specify whether returned rows
containing null values should appear first or last in the ordering sequence. ANSWER C
Sorting
The default sort order is ascending:
• Numeric values are displayed with the lowest values first (for example, 1 to 999).
• Date values are displayed with the earliest value first (for example, 01-JAN-92 before 01-JAN-95).
• Character values are displayed in the alphabetical order (for example, “A” first and “Z” last).
• Null values are displayed last for ascending sequences and first for descending sequences.
– ANSWER B
• You can also sort by a column that is not in the SELECT list.



Leave a Reply 1

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


Sayed

Sayed

Yes, B & C. ORDER BY ASC put nulls at the bottoms and ORDER BY DESC does the opposite. However, NULLS LAST can force nulls to the bottoms.