Nettms · Building TomorrowAcademy of AI &
Engineering
Hire with us
Free admissionSign inStart free →
Interview Questions

SQL Interview Questions & Answers

The most common SQL interview questions with clear answers — joins, keys, indexes, window functions and more. Practise them live in a free AI mock interview.

Practise these in a free AI mock interview
  1. 1. What are the different types of JOINs?

    INNER (matches in both), LEFT and RIGHT (all rows from one side plus matches), FULL OUTER (all rows from both), and CROSS (every combination). A self-join joins a table to itself.

  2. 2. Primary key vs foreign key?

    A primary key uniquely identifies each row (unique, not null). A foreign key references another table's primary key, enforcing the relationship and integrity between tables.

  3. 3. What is an index and when should you use one?

    An index speeds up lookups, filters and sorts on a column, like a book's index. Add them on columns used in WHERE/JOIN/ORDER BY — but not everywhere, since indexes slow writes and use storage.

  4. 4. Explain GROUP BY with an example.

    GROUP BY collapses rows sharing a value so you can aggregate: SELECT region, SUM(sales) FROM orders GROUP BY region returns total sales per region.

  5. 5. What is a window function?

    A function that computes across a set of rows related to the current row without collapsing them — ROW_NUMBER(), RANK(), running SUM() OVER (PARTITION BY ... ORDER BY ...). Ideal for rankings and running totals.

  6. 6. Difference between DELETE, TRUNCATE and DROP?

    DELETE removes selected rows (can use WHERE, logged, roll-back-able). TRUNCATE quickly removes all rows with minimal logging. DROP removes the entire table structure.

  7. 7. What is a subquery?

    A query nested inside another, in SELECT, FROM or WHERE — e.g. find employees earning above the average using (SELECT AVG(salary) ...).

  8. 8. WHERE vs HAVING?

    WHERE filters rows before grouping; HAVING filters groups after GROUP BY. Use WHERE for raw conditions and HAVING for aggregate conditions.

  9. 9. How do you find duplicate rows in SQL?

    GROUP BY the columns that define a duplicate and use HAVING COUNT(*) > 1 to list the values that repeat.

  10. 10. Normalization vs denormalization?

    Normalization splits data to remove redundancy (better integrity, more joins). Denormalization combines data to speed reads (fewer joins, some redundancy) — common in reporting and analytics.

Knowing the answers isn’t enough — say them out loud

Practise these SQL questions in a free AI mock interview: answer by voice, get instant feedback on your strengths and the gaps to fix.

Start a free mock interviewBuild a free resume

Admissions open · free to apply

Request your admission

Attended a masterclass or have a friend's referral code? You get ₹15,000 off. Fill this and our team takes it from here — pay by cash or online.

Nettms · Building TomorrowAcademy of AI &
Engineering

Free masterclasses, live cohorts, and pan-India placement support. Building Tomorrow.

ISO CertifiedStartup IndiaPractitioner-taught

Programs

  • Applied AI Engineer
  • Data Analysis with Gen AI
  • BIM
  • All programs

Free Tools

  • Code Compiler
  • Python Playground
  • Pandas Playground
  • SQL Playground
  • AI Glossary
  • Success Stories

Free Learning

  • Free Masterclass
  • Free Learnings
  • Free Admission
  • Blog
  • Events
  • WhatsApp Channel
  • Newsletter

Workshops

  • AI Workshop
  • BIM Workshop
  • Refer & Earn

Company

  • About
  • Hire with us
  • Careers at Nettms
  • Contact
  • Privacy
  • Terms
  • Refund policy

Get the weekly drop.

One email a week — career insights, free masterclass invites, and what India's top employers are hiring for.

© 2026 Nettms Urban Habitat Pvt. Ltd. · 🌱 Building Tomorrow

Hyderabad, India

  • Home
  • Programs
  • Practice
  • Free
  • Account