- All 25 questions run against one four-table schema whose CREATE TABLE and INSERT script is in the article, so every result can be checked row by row.
- The set moves from SELECT and WHERE through joins, GROUP BY, subqueries and CTEs to window functions, ROWNUM pagination and CONNECT BY.
- Oracle FreeSQL (formerly Live SQL) runs the whole script for free in a browser; generic editors running MySQL or SQLite fail on NVL, ROWNUM and CONNECT BY.
- Interview favorites are included: correlated subqueries, the NOT IN trap with NULLs, top earner per group and why ROWNUM is assigned before ORDER BY.
- Plan two to four hours for a first pass, then rebuild the same skills on a real dataset to turn practice into portfolio projects.
What schema do these Oracle SQL practice questions run against?
Every question below runs against one small schema with four tables: departments, employees, projects and timesheets. Run the script once, then compare each of your answers with the expected result printed under the question. An answer you cannot check is only a claim; with the same rows behind all 25 queries, you can verify everything row by row.
Oracle remains a fixture of banks, insurers, telecom operators and public administrations: in the 2025 Stack Overflow Developer Survey, 10.4% of professional developers reported working with it, which makes it one of the few commercial databases in the top ten. If a job posting mentions Oracle, these are the patterns you will be asked about.
The four tables and their columns
CREATE TABLE departments (
dept_id NUMBER PRIMARY KEY,
dept_name VARCHAR2(30) NOT NULL,
location VARCHAR2(30)
);
CREATE TABLE employees (
emp_id NUMBER PRIMARY KEY,
emp_name VARCHAR2(40) NOT NULL,
salary NUMBER(8,2),
commission_pct NUMBER(3,2),
hire_date DATE,
dept_id NUMBER REFERENCES departments (dept_id),
manager_id NUMBER REFERENCES employees (emp_id)
);
CREATE TABLE projects (
proj_id NUMBER PRIMARY KEY,
proj_name VARCHAR2(40) NOT NULL,
budget NUMBER(10,2),
dept_id NUMBER REFERENCES departments (dept_id)
);
CREATE TABLE timesheets (
ts_id NUMBER PRIMARY KEY,
emp_id NUMBER REFERENCES employees (emp_id),
proj_id NUMBER REFERENCES projects (proj_id),
work_date DATE,
hours NUMBER(4,1)
);The manager_id column points back at emp_id, which makes the self-join and hierarchical questions possible. commission_pct is NULL for several employees, which feeds the NULL questions.
The sample rows to load before you start
INSERT INTO departments VALUES (10, 'Finance', 'Paris');
INSERT INTO departments VALUES (20, 'Data', 'Dakar');
INSERT INTO departments VALUES (30, 'Marketing', 'Dubai');
INSERT INTO employees VALUES (100, 'Amina Diallo', 9000, NULL, DATE '2019-03-01', 20, NULL);
INSERT INTO employees VALUES (101, 'Lucas Martin', 7200, 0.10, DATE '2020-06-15', 10, 100);
INSERT INTO employees VALUES (102, 'Fatou Ndiaye', 7200, NULL, DATE '2021-01-10', 20, 100);
INSERT INTO employees VALUES (103, 'Chloé Bernard', 4800, 0.05, DATE '2022-09-01', 10, 101);
INSERT INTO employees VALUES (104, 'Karim Benali', 5600, NULL, DATE '2021-11-20', 20, 102);
INSERT INTO employees VALUES (105, 'Sofia Rossi', 5600, 0.08, DATE '2023-02-14', 20, 102);
INSERT INTO employees VALUES (106, 'Yann Le Goff', 4500, NULL, DATE '2024-04-01', 30, 100);
INSERT INTO employees VALUES (107, 'Awa Traoré', 3900, NULL, DATE '2024-10-07', 10, 101);
INSERT INTO projects VALUES (1, 'Revenue forecast', 40000, 10);
INSERT INTO projects VALUES (2, 'Customer churn', 60000, 20);
INSERT INTO projects VALUES (3, 'Data platform', 90000, 20);
INSERT INTO projects VALUES (4, 'Budget dashboard', 25000, 10);
INSERT INTO timesheets VALUES (1, 101, 1, DATE '2026-10-01', 6);
INSERT INTO timesheets VALUES (2, 103, 1, DATE '2026-10-01', 7);
INSERT INTO timesheets VALUES (3, 102, 2, DATE '2026-10-02', 8);
INSERT INTO timesheets VALUES (4, 104, 2, DATE '2026-10-02', 6);
INSERT INTO timesheets VALUES (5, 105, 3, DATE '2026-10-05', 7);
INSERT INTO timesheets VALUES (6, 104, 3, DATE '2026-10-06', 8);
INSERT INTO timesheets VALUES (7, 101, 4, DATE '2026-10-07', 4);
INSERT INTO timesheets VALUES (8, 103, 4, DATE '2026-10-08', 6);
INSERT INTO timesheets VALUES (9, 102, 3, DATE '2026-10-09', 5);
INSERT INTO timesheets VALUES (10, 105, 2, DATE '2026-10-12', 6);
INSERT INTO timesheets VALUES (11, 104, 2, DATE '2026-10-13', 7);
INSERT INTO timesheets VALUES (12, 103, 1, DATE '2026-10-14', 8);
INSERT INTO timesheets VALUES (13, 106, 3, DATE '2026-10-15', 3);
INSERT INTO timesheets VALUES (14, 104, 3, DATE '2026-10-16', 5);
INSERT INTO timesheets VALUES (15, 100, 3, DATE '2026-10-20', 2);
COMMIT;The data is deliberately small but not too clean: the Marketing department has no project (for the LEFT JOIN questions), Awa Traoré has no timesheet entry (for NOT EXISTS), two salaries tie at 5,600 within the same department (for ranking) and two timesheet rows share the same date (for running totals).
Which basic SELECT and WHERE questions should you master first?
Filtering, sorting and limiting (Q1 to Q4)
Q1. List every employee's name and salary.
SELECT emp_name, salary
FROM employees
ORDER BY emp_id;Expected: 8 rows. Without ORDER BY, Oracle guarantees no particular order, not even insertion order. Always sort when the order matters.
Q2. Show the employees who earn more than 5,000.
SELECT emp_name, salary
FROM employees
WHERE salary > 5000
ORDER BY emp_id;Expected: 5 rows (Amina Diallo, Lucas Martin, Fatou Ndiaye, Karim Benali, Sofia Rossi).
Q3. Sort employees by salary, highest first.
SELECT emp_name, salary
FROM employees
ORDER BY salary DESC, emp_id;Expected: 8 rows, from Amina Diallo (9,000) to Awa Traoré (3,900). The second sort key, emp_id, decides the order of tied salaries; without it, two runs can return them in a different order.
Q4. Return the three highest-paid employees.
SELECT emp_name, salary
FROM employees
ORDER BY salary DESC, emp_id
FETCH FIRST 3 ROWS ONLY;Expected result
| Name | Salary |
|---|---|
| Amina Diallo | 9000 |
| Lucas Martin | 7200 |
| Fatou Ndiaye | 7200 |
The row limiting clause (FETCH FIRST) is available since Oracle 12c and is described in the SELECT reference. Replace ONLY with WITH TIES to include every employee tied with the third one.
NULL values and distinct counts (Q5 to Q7)
Q5. Find the employees with no commission.
SELECT emp_name
FROM employees
WHERE commission_pct IS NULL
ORDER BY emp_id;Expected: 5 rows (Amina Diallo, Fatou Ndiaye, Karim Benali, Yann Le Goff, Awa Traoré). Writing commission_pct = NULL returns no rows at all, because a comparison with NULL is never true.
Q6. Display every commission, replacing NULL with 0.
SELECT emp_name, NVL(commission_pct, 0) AS commission
FROM employees
ORDER BY emp_id;Expected: 8 rows, with 0 for the five employees without a commission and 0.10, 0.05 and 0.08 for the others. NVL is Oracle-specific; COALESCE does the same job in standard SQL.
Q7. Count the number of distinct departments that have employees.
SELECT COUNT(DISTINCT dept_id) AS nb_departments
FROM employees;Expected: 3.
How do you practice JOINs and GROUP BY with real Oracle tables?
Joins (Q8 to Q11)
Q8. Show each employee with the name of their department.
SELECT e.emp_name, d.dept_name
FROM employees e
JOIN departments d ON d.dept_id = e.dept_id
ORDER BY e.emp_id;Expected: 8 rows (four in Data, three in Finance, one in Marketing).
Q9. List every department with its projects, including departments that have none.
SELECT d.dept_name, p.proj_name
FROM departments d
LEFT JOIN projects p ON p.dept_id = d.dept_id
ORDER BY d.dept_id, p.proj_id;Expected result
| Department | Project |
|---|---|
| Finance | Revenue forecast |
| Finance | Budget dashboard |
| Data | Customer churn |
| Data | Data platform |
| Marketing | (null) |
An inner join would return 4 rows and silently drop Marketing. That difference is exactly what interviewers check.
Q10. Total the hours each employee logged on each project (three-table join).
SELECT e.emp_name, p.proj_name, SUM(t.hours) AS hours
FROM timesheets t
JOIN employees e ON e.emp_id = t.emp_id
JOIN projects p ON p.proj_id = t.proj_id
GROUP BY e.emp_id, e.emp_name, p.proj_id, p.proj_name
ORDER BY e.emp_id, p.proj_id;Expected: 12 rows. For example, Chloé Bernard logged 15 hours on Revenue forecast and Karim Benali 13 hours on each of his two projects.
Q11. Show each employee with their manager's name (self-join).
SELECT e.emp_name, m.emp_name AS manager_name
FROM employees e
LEFT JOIN employees m ON m.emp_id = e.manager_id
ORDER BY e.emp_id;Expected: 8 rows, with a NULL manager for Amina Diallo. With an inner join you would get 7 rows, because the person at the top of the chart has no manager.
Aggregation (Q12 to Q14)
Q12. Total hours per employee, highest first.
SELECT e.emp_name, SUM(t.hours) AS total_hours
FROM employees e
JOIN timesheets t ON t.emp_id = e.emp_id
GROUP BY e.emp_id, e.emp_name
ORDER BY total_hours DESC, e.emp_id;Expected result
| Name | Total hours |
|---|---|
| Karim Benali | 26 |
| Chloé Bernard | 21 |
| Fatou Ndiaye | 13 |
| Sofia Rossi | 13 |
| Lucas Martin | 10 |
| Yann Le Goff | 3 |
| Amina Diallo | 2 |
Awa Traoré does not appear: she has no timesheet row. To show her with 0, start from employees with a LEFT JOIN and wrap the sum in NVL.
Q13. Keep only the employees with at least three timesheet entries.
SELECT e.emp_name, COUNT(*) AS nb_entries
FROM employees e
JOIN timesheets t ON t.emp_id = e.emp_id
GROUP BY e.emp_id, e.emp_name
HAVING COUNT(*) >= 3
ORDER BY nb_entries DESC;Expected: 2 rows (Karim Benali with 4 entries, Chloé Bernard with 3). HAVING filters groups after aggregation; WHERE could not use COUNT(*).
Q14. Total hours per project, keeping projects with at least 20 hours, sorted descending.
SELECT p.proj_name, p.budget, SUM(t.hours) AS total_hours
FROM projects p
JOIN timesheets t ON t.proj_id = p.proj_id
GROUP BY p.proj_id, p.proj_name, p.budget
HAVING SUM(t.hours) >= 20
ORDER BY total_hours DESC;Expected result
| Project | Budget | Total hours |
|---|---|---|
| Data platform | 90000 | 30 |
| Customer churn | 60000 | 27 |
| Revenue forecast | 40000 | 21 |
Which subquery and CTE questions come up most in Oracle interviews?
Correlated subqueries and NOT EXISTS (Q15 to Q17)
Q15. Find the employees who earn more than the average salary of their own department.
SELECT e.emp_name, e.salary, e.dept_id
FROM employees e
WHERE e.salary > (SELECT AVG(x.salary)
FROM employees x
WHERE x.dept_id = e.dept_id)
ORDER BY e.emp_id;Expected result
| Name | Salary | Department |
|---|---|---|
| Amina Diallo | 9000 | 20 |
| Lucas Martin | 7200 | 10 |
| Fatou Ndiaye | 7200 | 20 |
The averages are 5,300 in Finance, 6,850 in Data and 4,500 in Marketing, where the only employee cannot earn more than himself. The subquery is correlated because it refers to e.dept_id from the outer query: logically, it is evaluated for each row.
Q16. Find the employees with no timesheet entry, then the employees who manage nobody.
-- Employees with no timesheet entry
SELECT e.emp_name
FROM employees e
WHERE NOT EXISTS (SELECT 1 FROM timesheets t WHERE t.emp_id = e.emp_id);
-- The NOT IN trap: employees who manage nobody
SELECT emp_name
FROM employees
WHERE emp_id NOT IN (SELECT manager_id FROM employees); -- returns 0 rows
SELECT e.emp_name
FROM employees e
WHERE NOT EXISTS (SELECT 1 FROM employees m WHERE m.manager_id = e.emp_id)
ORDER BY e.emp_id; -- returns 5 rowsThe first query returns Awa Traoré. The second is the classic trap: manager_id is NULL for Amina Diallo, so the subquery contains a NULL and NOT IN returns no rows at all. NOT EXISTS returns the expected 5 employees (Chloé Bernard, Karim Benali, Sofia Rossi, Yann Le Goff, Awa Traoré). This single example settles the NOT IN versus NOT EXISTS question in an interview.
Q17. Show each employee's latest timesheet date, then rewrite the query with a join.
-- Version 1: correlated subquery in the SELECT list
SELECT e.emp_name,
(SELECT MAX(t.work_date) FROM timesheets t WHERE t.emp_id = e.emp_id) AS last_day
FROM employees e
ORDER BY e.emp_id;
-- Version 2: one join and one aggregation
SELECT e.emp_name, MAX(t.work_date) AS last_day
FROM employees e
LEFT JOIN timesheets t ON t.emp_id = e.emp_id
GROUP BY e.emp_id, e.emp_name
ORDER BY e.emp_id;Expected: 8 rows in both versions, with NULL for Awa Traoré and 2026-10-20 for Amina Diallo. The second version reads the timesheets table once, which usually scales better; be ready to explain why, and to mention that the optimizer may rewrite either form.
CTEs with the WITH clause (Q18 and Q19)
Q18. Compute the budget per logged hour for each project, using a CTE.
WITH project_hours AS (
SELECT proj_id, SUM(hours) AS total_hours
FROM timesheets
GROUP BY proj_id
)
SELECT p.proj_name, p.budget, h.total_hours,
ROUND(p.budget / h.total_hours, 2) AS budget_per_hour
FROM projects p
JOIN project_hours h ON h.proj_id = p.proj_id
ORDER BY budget_per_hour DESC;Expected result
| Project | Budget | Hours | Budget per hour |
|---|---|---|---|
| Data platform | 90000 | 30 | 3000 |
| Budget dashboard | 25000 | 10 | 2500 |
| Customer churn | 60000 | 27 | 2222.22 |
| Revenue forecast | 40000 | 21 | 1904.76 |
Q19. Chain two CTEs to rank employees by hours within their department.
WITH emp_hours AS (
SELECT emp_id, SUM(hours) AS total_hours
FROM timesheets
GROUP BY emp_id
),
ranked AS (
SELECT e.emp_name, e.dept_id, h.total_hours,
RANK() OVER (PARTITION BY e.dept_id ORDER BY h.total_hours DESC) AS rnk
FROM employees e
JOIN emp_hours h ON h.emp_id = e.emp_id
)
SELECT emp_name, dept_id, total_hours, rnk
FROM ranked
ORDER BY dept_id, rnk;Expected result
| Name | Department | Hours | Rank |
|---|---|---|---|
| Chloé Bernard | 10 | 21 | 1 |
| Lucas Martin | 10 | 10 | 2 |
| Karim Benali | 20 | 26 | 1 |
| Fatou Ndiaye | 20 | 13 | 2 |
| Sofia Rossi | 20 | 13 | 2 |
| Amina Diallo | 20 | 2 | 4 |
| Yann Le Goff | 30 | 3 | 1 |
Fatou Ndiaye and Sofia Rossi tie at 13 hours, so both are ranked 2 and Amina Diallo comes 4th: RANK leaves a gap after a tie. The interview question behind this one is simple: can you break a messy request into named steps that you can test one by one?
How do Oracle window function questions differ from T-SQL practice?
Ranking and running totals (Q20 to Q22)
Q20. Rank employees by salary within each department with ROW_NUMBER, RANK and DENSE_RANK.
SELECT emp_name, dept_id, salary,
ROW_NUMBER() OVER (PARTITION BY dept_id ORDER BY salary DESC, emp_id) AS row_num,
RANK() OVER (PARTITION BY dept_id ORDER BY salary DESC) AS rnk,
DENSE_RANK() OVER (PARTITION BY dept_id ORDER BY salary DESC) AS dense_rnk
FROM employees
ORDER BY dept_id, salary DESC, emp_id;Expected result
| Name | Dept. | Salary | ROW_NUMBER | RANK | DENSE_RANK |
|---|---|---|---|---|---|
| Lucas Martin | 10 | 7200 | 1 | 1 | 1 |
| Chloé Bernard | 10 | 4800 | 2 | 2 | 2 |
| Awa Traoré | 10 | 3900 | 3 | 3 | 3 |
| Amina Diallo | 20 | 9000 | 1 | 1 | 1 |
| Fatou Ndiaye | 20 | 7200 | 2 | 2 | 2 |
| Karim Benali | 20 | 5600 | 3 | 3 | 3 |
| Sofia Rossi | 20 | 5600 | 4 | 3 | 3 |
| Yann Le Goff | 30 | 4500 | 1 | 1 | 1 |
Karim Benali and Sofia Rossi tie at 5,600: RANK and DENSE_RANK give them both 3, while ROW_NUMBER separates them using emp_id.
Q21. Return the top earner in each department.
SELECT dept_id, emp_name, salary
FROM (
SELECT e.*, RANK() OVER (PARTITION BY dept_id ORDER BY salary DESC) AS rnk
FROM employees e
)
WHERE rnk = 1
ORDER BY dept_id;Expected: 3 rows (Lucas Martin in Finance, Amina Diallo in Data, Yann Le Goff in Marketing). Oracle does not allow window functions in WHERE, hence the subquery.
Q22. Compute a running total of hours by date, first with the default frame, then with an explicit frame.
-- Default frame: rows that share a date get the same running total
SELECT work_date, ts_id, hours,
SUM(hours) OVER (ORDER BY work_date) AS running_default
FROM timesheets
ORDER BY work_date, ts_id;
-- Explicit frame: one running total per row
SELECT work_date, ts_id, hours,
SUM(hours) OVER (ORDER BY work_date, ts_id
ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS running_rows
FROM timesheets
ORDER BY work_date, ts_id;Expected result (first 5 of 15 rows)
| Date | ts_id | Hours | Default frame | ROWS |
|---|---|---|---|---|
| 2026-10-01 | 1 | 6 | 13 | 6 |
| 2026-10-01 | 2 | 7 | 13 | 13 |
| 2026-10-02 | 3 | 8 | 27 | 21 |
| 2026-10-02 | 4 | 6 | 27 | 27 |
| 2026-10-05 | 5 | 7 | 34 | 34 |
With ORDER BY and no frame clause, the window includes every row that shares the current date, so the two entries of October 1 both show 13. With an explicit ROWS frame and a tiebreaker, each row gets its own total. Both versions end at 88 hours.
Oracle versus T-SQL: the differences to know
| Need | Oracle | SQL Server (T-SQL) |
|---|---|---|
| Replace NULL | NVL(col, 0) | ISNULL(col, 0) |
| Top N rows | FETCH FIRST n ROWS ONLY | TOP (n) |
| Top N with ties | FETCH FIRST n ROWS WITH TIES | TOP (n) WITH TIES |
| Pagination | OFFSET … FETCH NEXT, or ROWNUM | OFFSET … FETCH NEXT |
| Hierarchies | CONNECT BY or recursive WITH | Recursive CTE |
The window functions themselves behave the same way; Microsoft documents them in its OVER clause reference.
How do you handle Oracle-specific questions like ROWNUM and CONNECT BY?
Pagination with ROWNUM or FETCH (Q23)
Q23. Return the second page of employees, three per page, ordered by salary.
-- Classic pattern (any Oracle version)
SELECT emp_name, salary
FROM (
SELECT a.*, ROWNUM AS rn
FROM (SELECT emp_name, salary FROM employees ORDER BY salary DESC, emp_id) a
WHERE ROWNUM <= 6
)
WHERE rn > 3;
-- Row limiting clause (Oracle 12c and later)
SELECT emp_name, salary
FROM employees
ORDER BY salary DESC, emp_id
OFFSET 3 ROWS FETCH NEXT 3 ROWS ONLY;Expected result
| Name | Salary |
|---|---|
| Karim Benali | 5600 |
| Sofia Rossi | 5600 |
| Chloé Bernard | 4800 |
Both versions return the same rows. As the ROWNUM documentation explains, ROWNUM is assigned before ORDER BY in the same query block, and a row only receives a number if the previous one passed the filter. That is why the naive WHERE ROWNUM > 3 returns nothing, and why the classic pattern needs two nested queries.
Hierarchical queries with CONNECT BY (Q24 and Q25)
Q24. Display the org chart with each employee's level.
SELECT LEVEL,
LPAD(' ', 2 * (LEVEL - 1)) || emp_name AS org_chart
FROM employees
START WITH manager_id IS NULL
CONNECT BY PRIOR emp_id = manager_id
ORDER SIBLINGS BY emp_name;Expected result
| LEVEL | Org chart |
|---|---|
| 1 | Amina Diallo |
| 2 | Fatou Ndiaye |
| 3 | Karim Benali |
| 3 | Sofia Rossi |
| 2 | Lucas Martin |
| 3 | Awa Traoré |
| 3 | Chloé Bernard |
| 2 | Yann Le Goff |
Q25. Show each employee's full reporting chain and whether they manage anyone.
SELECT LEVEL,
SYS_CONNECT_BY_PATH(emp_name, '/') AS reporting_chain,
CONNECT_BY_ISLEAF AS is_leaf
FROM employees
START WITH manager_id IS NULL
CONNECT BY PRIOR emp_id = manager_id
ORDER SIBLINGS BY emp_name;Expected result
| LEVEL | Reporting chain | IS_LEAF |
|---|---|---|
| 1 | /Amina Diallo | 0 |
| 2 | /Amina Diallo/Fatou Ndiaye | 0 |
| 3 | /Amina Diallo/Fatou Ndiaye/Karim Benali | 1 |
| 3 | /Amina Diallo/Fatou Ndiaye/Sofia Rossi | 1 |
| 2 | /Amina Diallo/Lucas Martin | 0 |
| 3 | /Amina Diallo/Lucas Martin/Awa Traoré | 1 |
| 3 | /Amina Diallo/Lucas Martin/Chloé Bernard | 1 |
| 2 | /Amina Diallo/Yann Le Goff | 1 |
CONNECT_BY_ISLEAF equals 1 for the five employees who manage nobody, the same five returned by NOT EXISTS in Q16. START WITH, CONNECT BY PRIOR, SYS_CONNECT_BY_PATH and ORDER SIBLINGS BY are all described in Oracle's hierarchical queries documentation.
Where can you run these Oracle SQL questions for free?
| Environment | What it offers | Limits |
|---|---|---|
| Oracle FreeSQL | A free browser worksheet (formerly Oracle Live SQL): paste the script and run every query, CONNECT BY and ROWNUM included | Requires a free Oracle account to save your work |
| Oracle AI Database 26ai Free | The free local edition of Oracle: your own schemas and persistent data | An installation or a container to set up |
| Generic online editors | Quick to open | They usually run MySQL or SQLite: NVL, ROWNUM, CONNECT BY and FETCH FIRST fail or need rewriting |
Check which engine runs behind an editor before you paste an Oracle question: an error on NVL usually means you are not on Oracle.
How do you turn SQL practice into job-ready skills?
Finish the 25 questions, then rebuild the same skills on a real dataset: load a public dataset, clean it with NVL, aggregate it with GROUP BY, rank it with window functions and write a three-sentence recommendation a manager could act on. Recruiters look at what you built more than at the number of exercises you completed. Document two or three of these projects so an interviewer can read your SQL, not just hear about it.
Self-study is enough to learn the syntax. What it rarely provides is someone who reviews your queries, a deadline and practice explaining your choices out loud. That is what DataSAI, a data science, AI and cloud computing consulting company, offers through its academy. The Data Analyst Bootcamp takes you from Excel to SQL, Power BI and Python in 10 weeks of live classes, in English or French, on projects built around one business case. Classes start on January 4, 2027, with launch pricing until December 18. Before you choose, compare providers with our guide to data analyst bootcamp costs.
Conclusion
These 25 questions cover what Oracle SQL interviews actually test: filtering and NULLs, joins that keep or drop rows, aggregation, correlated subqueries and the NOT IN trap, CTEs, window functions with their frames, ROWNUM pagination and CONNECT BY hierarchies. Run each query against the schema, compare it with the expected result and, when yours differs, find out why before moving on. That habit, more than the number of queries, is what makes the practice stick.
FAQ
Are these Oracle SQL practice questions suitable for beginners?
Yes. Questions 1 to 7 cover SELECT, WHERE, ORDER BY and NULL handling before anything harder. You only need to run the CREATE TABLE and INSERT script at the top of the article, then compare each query with its expected result. No prior Oracle experience is assumed.
Can I run these questions in MySQL or PostgreSQL?
Partly. The joins, GROUP BY, subqueries, CTEs and window functions carry over, but Oracle-specific syntax does not: NVL, ROWNUM, CONNECT BY and, in MySQL, FETCH FIRST fail or need rewriting. Oracle FreeSQL runs the full script for free in a browser.
Do these questions match what Oracle SQL interviews ask?
Closely. Correlated subqueries, NOT EXISTS versus NOT IN, the top earner per department and the reason ROWNUM is assigned before ORDER BY are standard interview material. Several questions also ask you to rewrite a query and explain which version scales better, which is how interviewers test understanding.
Is there a PDF of the 25 questions and answers?
No PDF is provided. The full script and all 25 answers are on this page, which is better for practice: you can copy each query into Oracle FreeSQL and check the result instead of retyping it.
How long does it take to work through all 25 questions?
Plan two to four focused hours for a first pass. Basic queries and joins go quickly; window functions, CONNECT BY and ROWNUM pagination need more thought. A second pass a week later helps the patterns stick.
Sources accessed November 27, 2026: Oracle Database SQL Language Reference, SELECT (row limiting clause), Oracle, ROWNUM pseudocolumn, Oracle, hierarchical queries, Oracle, NVL, Microsoft, T-SQL OVER clause, Oracle FreeSQL, Oracle AI Database 26ai Free, Stack Overflow, 2025 Developer Survey (technology). Expected results were computed on the schema provided in the article.
Want to present your query results clearly? Read how to build a BI dashboard that reads in 30 seconds and our Power BI, Tableau and Looker comparison. Ready for a structured program? Discover the Data Analyst Bootcamp. All prices are on the pricing page.
Preparing for a data engineer interview? Our article on SQL interview questions for data engineers walks through eight pipeline questions with working queries and the interviewer's rubric.