Q1
True / FalseIn Oracle, the COUNT function is used to count the number of rows in a query result.
The COUNT function returns the number of rows in a query result, including rows with NULL values.
Q2
True / FalseThe SUM function in Oracle calculates the total sum of a numeric column.
The SUM function calculates the total sum of the values in a numeric column.
Q3
True / FalseIn Oracle, the AVG function returns the average value of a numeric column.
The AVG function calculates the average of the values in a numeric column.
Q4
True / FalseThe MIN function in Oracle returns the minimum value of a column, ignoring NULL values.
The MIN function returns the smallest non-NULL value in a column.
Q5
True / FalseIn Oracle, the MAX function can be used with both numeric and non-numeric data types.
The MAX function can be used to find the largest value in a column, and it works with both numeric and non-numeric data types such as strings and dates.
Q6
True / FalseThe COUNT function in Oracle can count distinct values in a column using COUNT(DISTINCT column_name)
The COUNT function can be used with the DISTINCT keyword to count only the unique values in a column.
Q7
True / FalseIn Oracle, the SUM function can be used to calculate the total sum of a column with a mixture of numeric and non-numeric values.
The SUM function can only be used on numeric columns. Non-numeric values will cause an error.
Q8
True / FalseIn Oracle, you can use the AVG function in a HAVING clause to filter groups based on their average values.
The AVG function can be used in the HAVING clause to filter groups based on the average values of a column.
Q9
True / FalseThe MIN and MAX functions in Oracle can be used together in a single query to find the range of values in a column.
The MIN and MAX functions can be used in the same query to find the smallest and largest values in a column, effectively determining the range.
Q10
True / FalseThe 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.
The OCP certification covers advanced topics, including the effective use of the COUNT, SUM, AVG, MIN, and MAX functions, understanding their limitations, and optimizing their performance in SQL queries.
Q26
Multiple ChoiceWhich 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;
Options A, B, and C correctly demonstrate advanced use of the COUNT and SUM functions to calculate the number of orders and total order amount per customer. Option D is incorrect because it does not group by customer_id.
Q27
Multiple ChoiceWhich 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;
Options A, B, and C correctly use the AVG and MIN functions together to find the average and minimum sales per region. Option D is incorrect because it does not group by region_id.
Q28
Multiple ChoiceWhich 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;
Options A, B, and C correctly demonstrate certification-level use of the COUNT and AVG functions to analyze employee salaries by department. Option D is incorrect because it does not group by department_id.
Q29
Multiple ChoiceWhich 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;
Options A, B, and C correctly use the SUM and MAX functions together to calculate the total and highest sales for each product. Option D is incorrect because it does not group by product_id.
Q30
Multiple ChoiceWhich 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;
Options A, B, and C correctly demonstrate certification-level use of COUNT, SUM, and AVG functions to generate a summary report of orders by customer. Option D is incorrect because it does not group by customer_id.