Oracle Database Quiz Questions

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

In Oracle, the COUNT function is used to count the number of rows in a query result.

Q2
True / False

The SUM function in Oracle calculates the total sum of a numeric column.

Q3
True / False

In Oracle, the AVG function returns the average value of a numeric column.

Q4
True / False

The MIN function in Oracle returns the minimum value of a column, ignoring NULL values.

Q5
True / False

In Oracle, the MAX function can be used with both numeric and non-numeric data types.

Q6
True / False

The COUNT function in Oracle can count distinct values in a column using COUNT(DISTINCT column_name)

Q7
True / False

In Oracle, the SUM function can be used to calculate the total sum of a column with a mixture of numeric and non-numeric values.

Q8
True / False

In Oracle, you can use the AVG function in a HAVING clause to filter groups based on their average values.

Q9
True / False

The MIN and MAX functions in Oracle can be used together in a single query to find the range of values in a column.

Q10
True / False

The Oracle Certified Professional (OCP) exam includes knowledge on using the COUNT, SUM, AVG, MIN, and MAX functions effectively, understanding their limitations, and optimizing their performance in SQL queries.

Q11
Single Choice

In ORACLE SQL, what does the COUNT function return when used on a column?

Q12
Single Choice

Which ORACLE SQL function would you use to find the largest value in a numeric column?

Q13
Single Choice

What does the SUM function do in an ORACLE SQL query?

Q14
Single Choice

Given the following ORACLE SQL query: sqlWhat does this query return?

SQL Code
SELECT department_id, COUNT(*)
FROM employees
GROUP BY department_id;
Q15
Single Choice

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

SQL Code
SELECT department_id, AVG(salary)
FROM employees
GROUP BY department_id;
Q16
Single Choice

Which of the following ORACLE SQL queries will return the sum of salaries for all employees in each department where the sum exceeds 100,000?

Q17
Single Choice

Given the following ORACLE SQL query:What does this query return?

SQL Code
SELECT department_id, MIN(salary), MAX(salary)
FROM employees
GROUP BY department_id;
Q18
Single Choice

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

SQL Code
SELECT department_id, COUNT(employee_id), AVG(salary)
FROM employees
GROUP BY department_id
HAVING AVG(salary) > 50000;
Q19
Single Choice

Which of the following ORACLE SQL queries correctly finds the department with the highest average salary?

Q20
Single Choice

Given the following ORACLE SQL query:What does this query do?

SQL Code
SELECT job_id, SUM(salary)
FROM employees
GROUP BY job_id
HAVING SUM(salary) > (SELECT MAX(SUM(salary)) FROM employees GROUP BY department_id);
Q21
Multiple Choice

Which SQL code snippet correctly calculates the total number of employees in each department using the COUNT function in Oracle?

SQL Code
SELECT department_id, COUNT(*) AS num_employees
FROM employees
GROUP BY department_id;

SELECT department_id, COUNT(employee_id) AS num_employees
FROM employees
GROUP BY department_id;

SELECT department_id, COUNT(1) AS num_employees
FROM employees
GROUP BY department_id;
Q22
Multiple Choice

Which SQL code snippet demonstrates how to use the SUM function to calculate the total sales for each product in Oracle?

SQL Code
SELECT product_id, SUM(sales_amount) AS total_sales
FROM sales
GROUP BY product_id;

SELECT product_id, SUM(sales_amount)
FROM sales
GROUP BY product_id;

SELECT product_id, SUM(sales_amount) total_sales
FROM sales
GROUP BY product_id;
Q23
Multiple Choice

Which SQL code snippet uses the AVG function to calculate the average salary for each job title in Oracle?

SQL Code
SELECT job_title, AVG(salary) AS avg_salary
FROM employees
GROUP BY job_title;

SELECT job_title, AVG(salary)
FROM employees
GROUP BY job_title;

SELECT job_title, AVG(salary) avg_salary
FROM employees
GROUP BY job_title;
Q24
Multiple Choice

Which SQL code snippet demonstrates how to use the MIN function to find the minimum order amount for each customer in Oracle?

SQL Code
SELECT customer_id, MIN(order_amount) AS min_order
FROM orders
GROUP BY customer_id;

SELECT customer_id, MIN(order_amount)
FROM orders
GROUP BY customer_id;

SELECT customer_id, MIN(order_amount) min_order
FROM orders
GROUP BY customer_id;
Q25
Multiple Choice

Which SQL code snippet uses the MAX function to determine the highest salary in each department in Oracle?

SQL Code
SELECT department_id, MAX(salary) AS max_salary
FROM employees
GROUP BY department_id;

SELECT department_id, MAX(salary)
FROM employees
GROUP BY department_id;

SELECT department_id, MAX(salary) max_salary
FROM employees
GROUP BY department_id;
Q26
Multiple Choice

Which SQL code snippet demonstrates advanced use of the COUNT and SUM functions to calculate the number of orders and total order amount per customer in Oracle?

SQL Code
SELECT customer_id, COUNT(order_id) AS num_orders, SUM(order_amount) AS total_spent
FROM orders
GROUP BY customer_id;

SELECT customer_id, COUNT(order_id), SUM(order_amount)
FROM orders
GROUP BY customer_id;

SELECT customer_id, COUNT(order_id) num_orders, SUM(order_amount) total_spent
FROM orders
GROUP BY customer_id;
Q27
Multiple Choice

Which SQL code snippet demonstrates how to use the AVG and MIN functions together to find the average and minimum sales per region in Oracle?

SQL Code
SELECT region_id, AVG(sales_amount) AS avg_sales, MIN(sales_amount) AS min_sales
FROM sales
GROUP BY region_id;

SELECT region_id, AVG(sales_amount), MIN(sales_amount)
FROM sales
GROUP BY region_id;

SELECT region_id, AVG(sales_amount) avg_sales, MIN(sales_amount) min_sales
FROM sales
GROUP BY region_id;
Q28
Multiple Choice

Which SQL code snippet demonstrates certification-level use of the COUNT and AVG functions to analyze employee salaries by department in Oracle?

SQL Code
SELECT department_id, COUNT(*) AS num_employees, AVG(salary) AS avg_salary
FROM employees
GROUP BY department_id;

SELECT department_id, COUNT(*), AVG(salary)
FROM employees
GROUP BY department_id;

SELECT department_id, COUNT(*) num_employees, AVG(salary) avg_salary
FROM employees
GROUP BY department_id;
Q29
Multiple Choice

Which SQL code snippet demonstrates how to use the SUM and MAX functions together to calculate the total and highest sales for each product in Oracle?

SQL Code
SELECT product_id, SUM(sales_amount) AS total_sales, MAX(sales_amount) AS max_sales
FROM sales
GROUP BY product_id;

SELECT product_id, SUM(sales_amount), MAX(sales_amount)
FROM sales
GROUP BY product_id;

SELECT product_id, SUM(sales_amount) total_sales, MAX(sales_amount) max_sales
FROM sales
GROUP BY product_id;
Q30
Multiple Choice

Which SQL code snippet demonstrates certification-level use of COUNT, SUM, and AVG functions to generate a summary report of orders by customer in Oracle?

SQL Code
SELECT customer_id, COUNT(order_id) AS num_orders, SUM(order_amount) AS total_spent,
 AVG(order_amount) AS avg_order
FROM orders
GROUP BY customer_id;

SELECT customer_id, COUNT(order_id), SUM(order_amount),
 AVG(order_amount)
FROM orders
GROUP BY customer_id;

SELECT customer_id, COUNT(order_id) num_orders, SUM(order_amount) total_spent,
 AVG(order_amount) avg_order
FROM orders
GROUP BY customer_id;