📊 2026 Career Guide
⚡ 2026 Verified Program Offer: 6 Months 100% Live Training • ₹1,20,000 Flat Fee (₹10,000/mo 0% EMI) • Official IBM & Microsoft Badges • Guaranteed 6-Mo Paid Internship*
📥 Download 2026 Syllabus & Fee PDF →
FREE 2026 PDF DOWNLOAD • VERIFIED LAB CODE

📥 Download Complete 2026 Printable PDF Notes, Architecture Diagrams & GitHub Code

Get instant free access to the 2026 printable PDF cheat-sheet, runnable lab repositories, interview evaluation rubric, and AI Campus 6-Month Paid Corporate Internship roadmap.

Download Free PDF & Syllabus Roadmap →

Top 10 Senior SQL Querying, Indexing & Data Analytics Technical Interview Questions & Answers (2026)

Rigorous technical interview questions, mathematical foundations, code implementations, and architectural explanations asked during senior engineering and specialist hiring rounds at FAANG, Tier-1 MNCs, and high-growth AI unicorns.

Q1 What is the difference between RANK(), DENSE_RANK(), and ROW_NUMBER() in SQL?

ROW_NUMBER() assigns a unique sequential integer to every row within a partition regardless of ties.

RANK() assigns identical ranks to tied rows, skipping subsequent rank numbers (e.g. 1, 2, 2, 4).

DENSE_RANK() assigns identical ranks to ties without skipping numbers (e.g. 1, 2, 2, 3).

SQL EXAMPLE
SELECT employee_id, department_id, salary,
       ROW_NUMBER() OVER(PARTITION BY department_id ORDER BY salary DESC) as rn,
       RANK() OVER(PARTITION BY department_id ORDER BY salary DESC) as rk,
       DENSE_RANK() OVER(PARTITION BY department_id ORDER BY salary DESC) as drk
FROM employees;

Q2 How do Common Table Expressions (CTEs) work, and when do you use recursive CTEs?

CTEs define a temporary, named result set using WITH. Recursive CTEs refer to themselves to traverse hierarchical data such as organizational charts or nested bill-of-materials.

SQL EXAMPLE
WITH RECURSIVE EmpHierarchy AS (
    SELECT emp_id, manager_id, 1 as level
    FROM employees WHERE manager_id IS NULL
    UNION ALL
    SELECT e.emp_id, e.manager_id, h.level + 1
    FROM employees e
    JOIN EmpHierarchy h ON e.manager_id = h.emp_id
)
SELECT * FROM EmpHierarchy;

Q3 Explain the difference between B-Tree indexes, Hash indexes, and Composite indexes.

B-Tree indexes maintain balanced hierarchical trees that support range queries (<, >, BETWEEN) and equality queries.

Hash indexes only support exact equality (=) lookups with O(1) complexity.

Composite indexes cover multiple columns; queries must respect the leftmost prefix rule to utilize the index.

SQL EXAMPLE
CREATE INDEX idx_emp_dept_salary ON employees(department_id, salary DESC);

Q4 What is the difference between WHERE and HAVING clauses?

WHERE filters individual rows before aggregation occurs and cannot use aggregate functions.

HAVING filters aggregated groups after the GROUP BY clause has evaluated.

SQL EXAMPLE
SELECT department_id, AVG(salary) as avg_sal
FROM employees
WHERE status = 'Active'
GROUP BY department_id
HAVING AVG(salary) > 75000;

Q5 What are Correlated Subqueries and why can they cause significant performance bottlenecks?

A correlated subquery references columns from the outer query, forcing the database engine to execute the inner query once for every single candidate row in the outer query.

Rewriting correlated subqueries with JOINs or window functions allows the optimizer to execute single-pass hash or merge joins.

SQL EXAMPLE
# Correlated Subquery:
SELECT emp_name, salary FROM employees e1
WHERE salary > (SELECT AVG(salary) FROM employees e2 WHERE e2.dept_id = e1.dept_id);

Q6 Explain ACID properties in relational database management systems.

Atomicity guarantees all operations in a transaction succeed or all roll back.

Consistency ensures data meets all schema constraints and foreign keys.

Isolation prevents concurrent transactions from interfering (Read Committed, Repeatable Read, Serializable).

Durability guarantees committed changes survive power failures via write-ahead logging (WAL).

SQL EXAMPLE
BEGIN TRANSACTION;
UPDATE accounts SET balance = balance - 500 WHERE id = 101;
UPDATE accounts SET balance = balance + 500 WHERE id = 202;
COMMIT;

Q7 How do you find the Nth highest salary in SQL using window functions or LIMIT/OFFSET?

Using DENSE_RANK() ensures that salary ties are handled accurately across the enterprise.

SQL EXAMPLE
WITH RankedSalaries AS (
    SELECT salary, DENSE_RANK() OVER(ORDER BY salary DESC) as rnk
    FROM employees
)
SELECT DISTINCT salary FROM RankedSalaries WHERE rnk = 3;

Q8 What is the difference between UNION and UNION ALL?

UNION combines query results and performs a costly deduplication sort pass across all records.

UNION ALL concatenates datasets directly without deduplication, executing much faster when uniqueness is already guaranteed.

SQL EXAMPLE
SELECT customer_id FROM active_orders
UNION ALL
SELECT customer_id FROM archived_orders;

Q9 How do window aggregate functions with framing (ROWS BETWEEN) calculate rolling sums?

Framing specifications define the dynamic subset of rows within a partition evaluated for each row.

SQL EXAMPLE
SELECT transaction_date, amount,
       SUM(amount) OVER(ORDER BY transaction_date ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) as rolling_7d_sum
FROM daily_transactions;

Q10 What is database normalization (1NF, 2NF, 3NF, BCNF) vs denormalization in data warehousing?

Normalization eliminates data redundancy and update anomalies in OLTP systems.

Denormalization deliberately introduces redundancy into star schemas and snowflake schemas in data warehouses to eliminate expensive multi-table joins for analytical OLAP workloads.

SQL EXAMPLE
# Star Schema Design: Fact_Sales joined directly with Dim_Date, Dim_Store, Dim_Product
2026 Career Fast-Track

Accelerate Your Career with Guaranteed Paid Internship*

Transparent ₹1,20,000 Fee (Inclusive of GST) • ₹10,000/month No-Cost EMI • 6-Month Corporate Paid Internship (₹15,000 – ₹35,000/mo stipend) with official IBM & Microsoft Credly credentials.

POWER BI & ANALYTICS TRACK • Guaranteed 6-Month Paid Corporate Internship*

Data Analytics, Power BI (PL-300) & SQL with AI

Master Advanced SQL, Power BI DAX, Tableau, Python & Excel with IBM/Microsoft badges + Guaranteed 6-Month Paid Internship* (₹1,20,000 / ₹10,000 per month 0% EMI).

🔗 Explore Official 2026 Career & Certification Pathways