Complete SQL mastery with hands-on practice for Software engineers
Complete hands-on SQL practice guide designed for Test Engineers preparing for technical interviews.
- ✅ Basic SELECT, WHERE, ORDER BY
- ✅ Aggregate Functions (COUNT, SUM, AVG, MIN, MAX)
- ✅ GROUP BY and HAVING
- ✅ All JOIN types (INNER, LEFT, RIGHT, FULL)
- ✅ Subqueries
- ✅ CASE statements, UNION, Date functions
- ✅ Window Functions (ROW_NUMBER, RANK, DENSE_RANK)
- ✅ Test data validation queries
- ✅ Complex multi-table joins
- ✅ Advanced subqueries and CTEs
- ✅ 50+ interview questions (Easy → Hard)
- ✅ Performance optimization
- ✅ Real-world testing scenarios
This repository uses a practice database with these tables:
employees- Employee informationdepartments- Department detailsprojects- Project informationemployee_projects- Many-to-many relationship
- PostgreSQL installed (or use db-fiddle.com)
- Basic command line knowledge
- 2 days of dedicated practice time
# Run the setup script
psql -U postgres -f sample-data/create-tables.sql
psql -U postgres -f sample-data/insert-data.sqlOr use online: Copy contents of sample-data/create-tables.sql to db-fiddle.com
| Time | Topic | Files |
|---|---|---|
| Hour 1 | Setup & Basics | 01-setup-and-basics.sql |
| Hour 2 | Aggregate Functions | 02-aggregate-functions.sql |
| Hour 3 | JOINs | 03-joins.sql |
| Hour 4 | Subqueries | 04-subqueries.sql |
| Hour 5-6 | CASE, UNION, Dates | 05-case-union-dates.sql |
| Hour 7-8 | Window Functions | 06-window-functions.sql |
| Evening | Practice | Complete all Day 1 exercises |
| Time | Topic | Files |
|---|---|---|
| Hour 1-2 | Test Data Validation | 01-test-data-validation.sql |
| Hour 3 | Complex Queries | 02-complex-queries.sql |
| Hour 4-5 | Interview Questions | 03-interview-easy.sql, 04-interview-medium.sql |
| Hour 6-7 | Hard Problems | 05-interview-hard.sql |
| Hour 8 | Optimization | 06-optimization.sql |
| Evening | Mock Interview | Practice explaining solutions |
Located in interview-prep/top-50-questions.sql
Categories:
- Easy (1-15): Basic SELECT, WHERE, GROUP BY
- Medium (16-35): JOINs, Subqueries, Window Functions
- Hard (36-50): Complex queries, CTEs, Optimization
- FAANG:
interview-prep/company-specific/faang-questions.sql - Banking/Finance:
interview-prep/company-specific/banking-questions.sql - FinTech:
interview-prep/company-specific/fintech-questions.sql
Quick reference guides:
- DB Fiddle - PostgreSQL, MySQL, SQLite
- SQL Fiddle - Multiple databases
- PostgreSQL Tutorial
- LeetCode Database - 200+ problems
- HackerRank SQL - Structured learning
- SQLZoo - Interactive tutorials
- StrataScratch - Real interview questions
- Type every query - Don't copy-paste, muscle memory matters
- Understand, don't memorize - Know why queries work
- Practice explaining - You'll need to explain your logic in interviews
- Time yourself - Interview questions have time limits
- Review mistakes - Learn from errors
You will be able to:
- ✅ Write complex SQL queries confidently
- ✅ Handle any SQL question in technical interviews
- ✅ Validate test data effectively
- ✅ Optimize query performance
- ✅ Explain your thought process clearly
- Day 1 - All fundamentals completed
- Day 1 - All exercises solved
- Day 2 - Advanced topics completed
- Day 2 - All exercises solved
- Solved 30+ LeetCode SQL problems
- Completed mock interview practice
- Can explain top 20 interview questions
Found a bug or have suggestions? Feel free to open an issue or submit a pull request!
This repository is for educational purposes. Feel free to use and share!
Created by Revathi Devineni - Test Engineer specializing in QA Automation
⭐ Star this repo if you find it helpful!
��� Questions? Open an issue or reach out!
Happy Learning! ���#