Q1
True / FalseIn Oracle, the SELECT clause is the first clause executed in a SQL query.
The FROM clause is actually executed first, as it identifies the source tables for the query.
Q2
True / FalseThe WHERE clause in Oracle is used to filter rows before any grouping occurs.
The WHERE clause filters rows before they are grouped by the GROUP BY clause.
Q3
True / FalseIn Oracle, the ORDER BY clause is executed last in a SQL query.
The ORDER BY clause is executed last, as it sorts the final result set.
Q4
True / FalseThe GROUP BY clause in Oracle is executed after the WHERE clause but before the SELECT clause.
The GROUP BY clause is executed after the WHERE clause and before the SELECT clause to group the filtered rows.
Q5
True / FalseIn Oracle, the HAVING clause is used to filter groups after the GROUP BY clause is executed.
The HAVING clause filters groups after they have been created by the GROUP BY clause.
Q6
True / FalseThe FROM clause in Oracle is executed after the SELECT clause.
The FROM clause is executed before the SELECT clause to determine the source of the data.
Q7
True / FalseIn Oracle, subqueries in the FROM clause are executed after the main query's WHERE clause.
Subqueries in the FROM clause are executed before the main query's WHERE clause as they provide data for the main query.
Q8
True / FalseIn Oracle, the JOIN operations are performed after the FROM clause but before the WHERE clause.
JOIN operations are part of the FROM clause and are executed before the WHERE clause.
Q9
True / FalseIn Oracle, the DISTINCT keyword is applied after the SELECT clause has retrieved all rows.
The DISTINCT keyword is applied to the result set of the SELECT clause to remove duplicate rows.
Q10
True / FalseThe Oracle Certified Professional (OCP) exam includes knowledge on understanding the correct SQL execution order, which helps in writing optimized and accurate SQL queries.
The OCP certification covers advanced topics, including the correct execution order of SQL clauses, which is crucial for writing efficient and correct SQL queries.
Q12
Single ChoiceWhat is the correct order of execution in a basic SQL query?
The typical SQL execution order is FROM, WHERE, SELECT, and then ORDER BY.
Q17
Single ChoiceWhat will be the result of the following Oracle SQL query in terms of execution order?
SQL Code
SELECT employee_id, COUNT(*)
FROM employees
WHERE department_id = 10
GROUP BY employee_id
ORDER BY COUNT(*) DESC;
The SQL execution order in this query starts with the WHERE clause (filtering by department_id), followed by GROUP BY, and finally the ORDER BY.
Q20
Single ChoiceWhat is the execution order of the following Oracle SQL query?
SQL Code
SELECT department_id, AVG(salary)
FROM employees
WHERE job_id = 'IT_PROG'
GROUP BY department_id
HAVING AVG(salary) > 5000
ORDER BY AVG(salary) DESC;
The correct execution order is FROM, WHERE, GROUP BY, HAVING, SELECT, and finally ORDER BY, which reflects the logical sequence in which the query is processed.
Q23
Multiple ChoiceWhich SQL code snippet correctly follows the SQL execution order for combining results from two queries?
SQL Code
SELECT employee_id, first_name
FROM employees
WHERE department_id = 10
UNION ALL
SELECT employee_id, first_name
FROM employees
WHERE department_id = 20
ORDER BY first_name;
The correct execution order is FROM -> WHERE -> SELECT -> UNION ALL -> ORDER BY. Options A, B, and C follow this order correctly, while option D incorrectly places ORDER BY before UNION ALL.
Q24
Multiple ChoiceWhich SQL code snippet correctly follows the SQL execution order for performing a join operation before filtering data?
SQL Code
SELECT e.employee_id, e.first_name, d.department_name
FROM employees e
JOIN departments d ON e.department_id = d.department_id
WHERE e.salary > 5000
ORDER BY e.first_name;
The correct execution order is FROM -> JOIN -> WHERE -> SELECT -> ORDER BY. Options A, B, and C follow this order correctly, while option D incorrectly places WHERE before JOIN.
Q25
Multiple ChoiceWhich SQL code snippet correctly follows the SQL execution order for using subqueries in the SELECT clause?
SQL Code
SELECT e.employee_id, e.first_name,
(SELECT department_name FROM departments d WHERE d.department_id = e.department_id) AS department_name
FROM employees e
WHERE e.salary > 5000
ORDER BY e.first_name;
The correct execution order is FROM -> WHERE -> (Subquery in SELECT) -> SELECT -> ORDER BY. Options A, B, and C follow this order correctly, while option D incorrectly places WHERE inside the subquery.
Q26
Multiple ChoiceWhich SQL code snippet demonstrates advanced SQL execution order by using a window function after a join operation?
SQL Code
SELECT e.employee_id, e.first_name, d.department_name,
RANK() OVER (PARTITION BY d.department_id ORDER BY e.salary DESC) AS rank
FROM employees e
JOIN departments d ON e.department_id = d.department_id
ORDER BY e.first_name;
The correct execution order is FROM -> JOIN -> SELECT -> WINDOW FUNCTION -> ORDER BY. Options A, B, and C follow this order correctly, while option D incorrectly places the window function before the JOIN.
Q27
Multiple ChoiceWhich SQL code snippet demonstrates advanced SQL execution order by using a CTE (Common Table Expression) before performing a join?
SQL Code
WITH DepartmentSalaries AS (
SELECT department_id, AVG(salary) AS avg_salary
FROM employees
GROUP BY department_id)
SELECT e.employee_id, e.first_name, ds.avg_salary
FROM employees e
JOIN DepartmentSalaries ds ON e.department_id = ds.department_id
ORDER BY e.first_name;
The correct execution order is CTE -> FROM -> JOIN -> SELECT -> ORDER BY. Options A, B, and C follow this order correctly, while option D incorrectly places the CTE after the SELECT statement.
Q28
Multiple ChoiceWhich SQL code snippet demonstrates certification-level SQL execution order by applying multiple WHERE conditions before a join?
SQL Code
SELECT e.employee_id, e.first_name, d.department_name
FROM employees e
JOIN departments d ON e.department_id = d.department_id
WHERE e.salary > 5000 AND e.hire_date > '01-JAN-2020'
ORDER BY e.first_name;
The correct execution order is FROM -> WHERE -> JOIN -> SELECT -> ORDER BY. Options A, B, and C follow this order correctly, while option D incorrectly places WHERE after the JOIN.