Oracle Database Quiz Questions

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

The DISTINCT keyword in Oracle is used to return only unique values from a query.

Q2
True / False

In Oracle, you can use DISTINCT with a single column in a SELECT statement.

Q3
True / False

The DISTINCT keyword can be used with aggregate functions in Oracle.

Q4
True / False

In Oracle, the DISTINCT keyword can be used with multiple columns in a SELECT statement.

Q5
True / False

Using DISTINCT in Oracle always improves the performance of a query.

Q6
True / False

In Oracle, DISTINCT can be used in subqueries.

Q7
True / False

In Oracle, using DISTINCT with a large dataset can impact query performance and should be used judiciously.

Q8
True / False

The DISTINCT keyword in Oracle can be used with ORDER BY to sort the unique results.

Q9
True / False

In Oracle, DISTINCT can be used with GROUP BY to get unique groups.

Q10
True / False

The Oracle Certified Professional (OCP) exam includes knowledge on using the DISTINCT keyword effectively in queries and understanding its impact on performance.

Q11
Single Choice

What is the purpose of the DISTINCT keyword in an Oracle SQL query?

Q12
Single Choice

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

SQL Code
SELECT DISTINCT department_id FROM employees;
Q13
Single Choice

Which of the following is true about using DISTINCT in Oracle SQL?

Q14
Single Choice

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

SQL Code
SELECT DISTINCT job_id, department_id FROM employees;
Q15
Single Choice

What is the effect of using DISTINCT with the COUNT function in Oracle?

Q16
Single Choice

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

SQL Code
SELECT COUNT(DISTINCT department_id) FROM employees;
Q17
Single Choice

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

SQL Code
SELECT DISTINCT salary, COUNT(*) FROM employees GROUP BY salary;
Q18
Single Choice

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

SQL Code
SELECT DISTINCT ON (department_id) department_id, employee_id FROM employees;
Q19
Single Choice

How does Oracle handle NULL values when using the DISTINCT keyword in a query?

Q20
Single Choice

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

SQL Code
SELECT DISTINCT first_name, last_name FROM employees WHERE department_id IN (SELECT department_id FROM departments WHERE location_id = 1700);
Q21
Multiple Choice

Which SQL code snippet correctly uses the DISTINCT keyword to retrieve unique department IDs from the 'employees' table in Oracle?

SQL Code
SELECT DISTINCT department_id
FROM employees;

SELECT department_id
FROM employees
GROUP BY department_id;

SELECT department_id
FROM employees;
Q22
Multiple Choice

Which SQL code snippet demonstrates how to use DISTINCT to retrieve unique job titles from the 'employees' table in Oracle?

SQL Code
SELECT DISTINCT job_title
FROM employees;

SELECT job_title
FROM employees
GROUP BY job_title;

SELECT job_title
FROM employees
ORDER BY job_title;
Q23
Multiple Choice

Which SQL code snippet uses DISTINCT to retrieve unique combinations of department ID and job title from the 'employees' table in Oracle?

SQL Code
SELECT DISTINCT department_id, job_title
FROM employees;

SELECT department_id, job_title
FROM employees
GROUP BY department_id, job_title;

SELECT department_id, job_title
FROM employees
ORDER BY department_id, job_title;
Q24
Multiple Choice

Which SQL code snippet demonstrates how to use DISTINCT with COUNT to find the number of unique job titles in the 'employees' table in Oracle?

SQL Code
SELECT COUNT(DISTINCT job_title) AS unique_jobs
FROM employees;

SELECT COUNT(job_title) AS total_jobs
FROM employees;

SELECT COUNT(DISTINCT job_title)
FROM employees
WHERE department_id = 10;
Q25
Multiple Choice

Which SQL code snippet uses DISTINCT to retrieve unique city names from the 'locations' table in Oracle?

SQL Code
SELECT DISTINCT city
FROM locations;

SELECT city
FROM locations
GROUP BY city;

SELECT DISTINCT city
FROM locations
WHERE country_id = 'US';
Q26
Multiple Choice

Which SQL code snippet demonstrates advanced usage of DISTINCT to retrieve unique combinations of employee names and their departments in Oracle?

SQL Code
SELECT DISTINCT first_name, last_name, department_id
FROM employees;

SELECT first_name, last_name, department_id
FROM employees
GROUP BY first_name, last_name, department_id;

SELECT DISTINCT first_name, last_name
FROM employees
WHERE department_id > 10;
Q27
Multiple Choice

Which SQL code snippet uses DISTINCT to retrieve unique job titles from the 'employees' table where the salary is above a certain threshold in Oracle?

SQL Code
SELECT DISTINCT job_title
FROM employees
WHERE salary > 50000;

SELECT job_title
FROM employees
WHERE salary > 50000
GROUP BY job_title;

SELECT DISTINCT job_title
FROM employees
WHERE salary > 100000;
Q28
Multiple Choice

Which SQL code snippet demonstrates the advanced use of DISTINCT to retrieve unique customer names and order dates from the 'orders' table in Oracle?

SQL Code
SELECT DISTINCT customer_name, order_date
FROM orders;

SELECT customer_name, order_date
FROM orders
GROUP BY customer_name, order_date;

SELECT DISTINCT customer_name, order_date
FROM orders
WHERE order_date > SYSDATE - 30;
Q29
Multiple Choice

Which SQL code snippet uses DISTINCT to retrieve unique product IDs from the 'order_items' table where the quantity is above a certain number in Oracle?

SQL Code
SELECT DISTINCT product_id
FROM order_items
WHERE quantity > 10;

SELECT product_id
FROM order_items
WHERE quantity > 10
GROUP BY product_id;

SELECT DISTINCT product_id
FROM order_items
WHERE quantity > 50;
Q30
Multiple Choice

Which SQL code snippet demonstrates the certification-level use of DISTINCT to find the number of unique customers who placed orders in the last month in Oracle?

SQL Code
SELECT COUNT(DISTINCT customer_id) AS unique_customers
FROM orders
WHERE order_date > SYSDATE - 30;

SELECT DISTINCT customer_id
FROM orders
WHERE order_date > SYSDATE - 30;

SELECT COUNT(DISTINCT customer_id)
FROM orders WHERE order_date > SYSDATE - 30;