SQL Interview Questions and Answers — 50+ Questions

By Vaibhav Gupta | July 14, 2026 | 10 min read

Basic SQL Questions

1. What is the difference between WHERE and HAVING?

WHERE filters rows before GROUP BY. HAVING filters groups after GROUP BY.

2. What is a PRIMARY KEY?

A column that uniquely identifies each row. Cannot be NULL or duplicate.

3. What is the difference between DELETE and TRUNCATE?

DELETE: Can use WHERE, logged, can rollback. TRUNCATE: Removes all rows, faster, cannot rollback.

Practice SQL with DSWallah

WhatsApp for SQL Course Details →

Ready to Start Your Data Science Journey?

Join 300+ students who transformed their careers with DSWallah. IIT-certified mentor, 50+ real projects, placement support.

WhatsApp for Free Demo →