Oracle Database Quiz Questions

Course Name:Oracle
Chapter Name:Chapter 7 - DQL (Data Query Language)
Lesson Content Link:ORDER BY
Current Quiz Count:30
Progress
0%
Q1
True / False

The ORDER BY clause in Oracle is used to sort the result set of a query.

Q2
True / False

In Oracle, the ORDER BY clause must be placed before the WHERE clause in a query.

Q3
True / False

By default, the ORDER BY clause in Oracle sorts the result set in ascending order.

Q4
True / False

In Oracle, you can use the ORDER BY clause to sort results by multiple columns.

Q5
True / False

In Oracle, the ORDER BY clause can sort results in descending order using the DESC keyword.

Q6
True / False

In Oracle, you can use column aliases in the ORDER BY clause.

Q7
True / False

In Oracle, you can use the ORDER BY clause with a subquery to sort the subquery's results.

Q8
True / False

In Oracle, the ORDER BY clause can include expressions and functions to define custom sorting criteria.

Q9
True / False

In Oracle, using ORDER BY in a query with a large dataset always improves performance.

Q10
True / False

The Oracle Certified Professional (OCP) exam includes knowledge on optimizing the ORDER BY clause for performance and understanding its interaction with indexes and execution plans.

Q11
Single Choice

What is the purpose of the ORDER BY clause in an Oracle SQL query?

Q12
Single Choice

Consider the following Oracle SQL query:What will this query do?

SQL Code
SELECT * FROM employees ORDER BY last_name;
Q13
Single Choice

Which of the following is the default sort order used by the ORDER BY clause in Oracle?

Q14
Single Choice

Consider the following Oracle SQL query:What will this query return?

SQL Code
SELECT * FROM products ORDER BY price DESC;
Q15
Single Choice

What is the effect of using multiple columns in the ORDER BY clause in an Oracle SQL query?

Q16
Single Choice

Consider the following Oracle SQL query:How will the result set be sorted?

SQL Code
SELECT * FROM employees ORDER BY department_id, salary DESC;
Q17
Single Choice

What happens when you use ORDER BY on a column that contains NULL values in Oracle?

Q18
Single Choice

Consider the following Oracle SQL query:What does the NULLS LAST clause do in this query?

SQL Code
SELECT * FROM orders ORDER BY order_date NULLS LAST;
Q19
Single Choice

What will be the result of executing the following Oracle SQL query?

SQL Code
SELECT * FROM employees ORDER BY hire_date, salary;
Q20
Single Choice

In an Oracle certification exam, you encounter the following SQL statement:What does this query return?

SQL Code
SELECT department_id, COUNT(*) FROM employees GROUP BY department_id ORDER BY COUNT(*) DESC, department_id ASC;
Q21
Multiple Choice

Which SQL code snippet correctly uses the ORDER BY clause to sort employees by their last names in ascending order in Oracle?

SQL Code
SELECT *
FROM employees
ORDER BY last_name ASC;

SELECT *
FROM employees
ORDER BY last_name DESC;

SELECT last_name, first_name
FROM employees
ORDER BY last_name;
Q22
Multiple Choice

Which SQL code snippet demonstrates how to use ORDER BY to sort orders by order date in descending order in Oracle?

SQL Code
SELECT *
FROM orders
ORDER BY order_date DESC;

SELECT *
FROM orders
ORDER BY order_date ASC;

SELECT order_id, order_date
FROM orders
ORDER BY order_date DESC;
Q23
Multiple Choice

Which SQL code snippet uses ORDER BY to sort products first by category and then by price in ascending order in Oracle?

SQL Code
SELECT *
FROM products
ORDER BY category_id, price ASC;

SELECT *
FROM products
ORDER BY category_id DESC, price ASC;

SELECT category_id, price
FROM products
ORDER BY category_id, price;
Q24
Multiple Choice

Which SQL code snippet demonstrates how to use ORDER BY to sort customers by their city in alphabetical order in Oracle?

SQL Code
SELECT *
FROM customers
ORDER BY city ASC;

SELECT *
FROM customers
ORDER BY city DESC;

SELECT customer_id, city
FROM customers
ORDER BY city;
Q25
Multiple Choice

Which SQL code snippet uses ORDER BY to sort the sales data by amount in descending order and then by sale date in ascending order in Oracle?

SQL Code
SELECT *
FROM sales
ORDER BY amount DESC, sale_date ASC;

SELECT *
FROM sales
ORDER BY amount ASC, sale_date DESC;

SELECT amount, sale_date
FROM sales
ORDER BY amount DESC, sale_date ASC;
Q26
Multiple Choice

Which SQL code snippet demonstrates advanced use of ORDER BY to sort employees by department and within each department by hire date in ascending order in Oracle?

SQL Code
SELECT *
FROM employees
ORDER BY department_id, hire_date ASC;

SELECT *
FROM employees
ORDER BY department_id DESC, hire_date ASC;

SELECT department_id, hire_date
FROM employees
ORDER BY department_id, hire_date;
Q27
Multiple Choice

Which SQL code snippet uses ORDER BY to sort orders by customer ID in ascending order and then by order total in descending order in Oracle?

SQL Code
SELECT *
FROM orders
ORDER BY customer_id ASC, order_total DESC;

SELECT *
FROM orders
ORDER BY customer_id DESC, order_total ASC;

SELECT customer_id, order_total
FROM orders
ORDER BY customer_id ASC, order_total DESC;
Q28
Multiple Choice

Which SQL code snippet demonstrates advanced use of ORDER BY to sort products by category in descending order and then by product name in ascending order in Oracle?

SQL Code
SELECT *
FROM products
ORDER BY category_id DESC, product_name ASC;

SELECT *
FROM products
ORDER BY category_id ASC, product_name DESC;

SELECT category_id, product_name
FROM products
ORDER BY category_id DESC, product_name ASC;
Q29
Multiple Choice

Which SQL code snippet uses ORDER BY to retrieve the top 10 highest paid employees sorted by salary in descending order in Oracle?

SQL Code
SELECT *
FROM employees
ORDER BY salary DESC
FETCH FIRST 10 ROWS ONLY;

SELECT *
FROM employees
ORDER BY salary ASC
FETCH FIRST 10 ROWS ONLY;

SELECT salary, first_name
FROM employees
ORDER BY salary DESC
FETCH FIRST 10 ROWS ONLY;
Q30
Multiple Choice

Which SQL code snippet demonstrates the certification-level use of ORDER BY to retrieve products sorted by their sales rank in ascending order, then by name in descending order in Oracle?

SQL Code
SELECT *
FROM products
ORDER BY sales_rank ASC, product_name DESC;

SELECT *
FROM products
ORDER BY sales_rank DESC, product_name ASC;

SELECT sales_rank, product_name
FROM products
ORDER BY sales_rank ASC, product_name DESC;