Skill Test · SQL
SQL Online Test for Hiring & Assessment
An SQL online test measures a candidate's ability to query, transform, and reason about relational data — from correct join semantics and GROUP BY logic to subqueries, CTEs, and window functions. It identifies candidates who write correct SQL under realistic conditions, not just those who recall syntax from memory.
Topic breakdown
What the SQL test covers
JOINs and set operations
INNER, LEFT, RIGHT, FULL OUTER, and CROSS JOINs; UNION vs UNION ALL; INTERSECT and EXCEPT — when each produces duplicates and when it doesn't.
Aggregations and grouping
GROUP BY, HAVING vs WHERE (filter order matters), COUNT/SUM/AVG/MIN/MAX, and grouping on multiple columns with correct NULL handling.
Subqueries and CTEs
Correlated vs non-correlated subqueries, scalar subqueries in SELECT, EXISTS and NOT EXISTS, and WITH (CTE) for readable multi-step queries.
Window functions
ROW_NUMBER, RANK, DENSE_RANK for ranking; LAG and LEAD for row-over-row comparison; PARTITION BY and ORDER BY within OVER(); running totals with SUM() OVER().
Data manipulation
INSERT, UPDATE with JOIN, DELETE with subquery, and UPSERT patterns (INSERT ... ON DUPLICATE KEY / ON CONFLICT). Understanding transaction scope.
Query design and optimisation
Index usage basics, avoiding SELECT *, SARGable vs non-SARGable predicates, the cost of functions in WHERE clauses, and reading a basic execution plan.
Sample question
The kind of question candidates answer
Window functions — mid level
Given an orders table with columns order_id, customer_id, and order_total, write a query that returns each order along with that customer's running total of orders placed so far (ordered by order_id).
-- Correct answer:
SELECT
order_id,
customer_id,
order_total,
SUM(order_total) OVER (
PARTITION BY customer_id
ORDER BY order_id
ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
) AS running_total
FROM orders; Common wrong approaches
- Using a correlated subquery (works, but 10x slower on large tables)
- Forgetting PARTITION BY customer_id (gives a global running total, not per-customer)
- Using GROUP BY instead of a window function (loses individual row granularity)
What this question tests
Understanding when a window function is both semantically correct and more efficient than a correlated subquery or self-join. The PARTITION BY mistake (missing customer_id) is the most common production error — it produces results that look plausible but are wrong.
Who should take it
Roles this test screens for
Data Analyst
SQL is the primary tool. A core joins-aggregations-subqueries pack screens for the daily query work without requiring window function expertise at junior level.
Data / Backend Engineer
Pairing the SQL test with a Python test covers both query and scripting skill — the typical data engineering stack.
Full-Stack Developer
Screens whether a full-stack candidate can write maintainable queries rather than relying entirely on ORM abstractions — a practical signal for teams with complex reporting needs.
Relevant for IT & technical hiring and campus recruitment in India.
Format & difficulty
Duration, format, and difficulty levels
Duration
30–60 min
Configurable per test
Format
MCQ + Query writing
Output prediction + live SQL
Levels
Foundational — Advanced
Joins-only to window functions
FAQ
Common questions about the SQL online test
How long is an SQL online test?
A SQL screening test typically runs 30–45 minutes for MCQ and query-output questions. Tests requiring live SQL query writing run 45–60 minutes. Duration is configurable by the admin.
Is the SQL test free on AssessIQ?
The free tier lets you run SQL tests and review candidate results. Paid plans add higher candidate volumes and advanced proctoring. See the pricing page.
Which SQL dialect does the test use?
Questions are written in standard ANSI SQL, compatible with MySQL, PostgreSQL, and SQL Server. Dialect-specific syntax is flagged in the question where relevant.
Does the SQL test cover window functions?
Yes. ROW_NUMBER, RANK, DENSE_RANK, LAG, LEAD, PARTITION BY are included at mid and senior tiers. They are kept separate from the core pack so admins can include or exclude them by role.
What score is good on an SQL test for a data analyst role?
For data analyst roles, strong SQL fundamentals (joins, GROUP BY, HAVING, subqueries) matter most. A candidate in the top third of your cohort on a mid-level pack is typically a solid shortlist signal. AssessIQ shows the cohort distribution per test run.
Can SQL tests be combined with other skill tests?
Yes. Admins can combine SQL with Python, aptitude, or logical reasoning questions in a single timed session. This is common for data analyst and data engineer screening.
- Python Online Test
Pair with SQL for data analyst and data engineer roles.
- Java Online Test
Backend language screening for enterprise teams.
- Aptitude Test
Numerical reasoning for analyst and campus hiring.
- All skill tests →