Duration: 10-14 days
Goal: Understand database basics and simple queries
- Database concepts (tables, rows, columns)
- Basic SQL syntax
- SELECT statements
- WHERE clause
- ORDER BY and LIMIT
- Basic data types
This builds your fundamental understanding. Without these basics, you can't progress to complex queries. Most placement tests start with these concepts.
-
Database Structure
- Understanding tables and relationships
- Primary keys concept
-
SELECT Statements
SELECT column1, column2 FROM table_name; SELECT * FROM employees;
-
Filtering Data
SELECT * FROM employees WHERE salary > 50000; SELECT name FROM students WHERE age BETWEEN 18 AND 25;
-
Sorting Results
SELECT * FROM products ORDER BY price DESC; SELECT * FROM employees ORDER BY name ASC LIMIT 10;
- HackerRank: Basic Select challenges
- LeetCode: Easy SQL problems (595, 584, 183)
- GeeksforGeeks: SQL basics section
Duration: 10-14 days
Goal: Master conditional logic and built-in functions
- Advanced WHERE conditions
- String functions
- Date/time functions
- Mathematical functions
- NULL handling
- Pattern matching
Placement tests heavily focus on data manipulation and cleaning. These skills show your ability to work with real-world messy data.
-
Advanced Filtering
SELECT * FROM orders WHERE order_date >= '2023-01-01' AND status IN ('completed', 'shipped');
-
String Functions
SELECT UPPER(name), LENGTH(email) FROM users; SELECT * FROM products WHERE name LIKE '%phone%';
-
Date Functions
SELECT YEAR(hire_date), MONTH(hire_date) FROM employees; SELECT * FROM orders WHERE DATEDIFF(NOW(), order_date) <= 30;
-
NULL Handling
SELECT COALESCE(phone, 'N/A') FROM contacts; SELECT * FROM users WHERE email IS NOT NULL;
- HackerRank: Advanced Select, Basic Aggregation
- LeetCode: Problems 196, 175, 181
- GeeksforGeeks: SQL functions practice
Duration: 10-14 days
Goal: Master data summarization and analytical queries
- Aggregate functions (COUNT, SUM, AVG, MAX, MIN)
- GROUP BY clause
- HAVING clause
- Multiple grouping levels
This is where SQL becomes powerful for data analysis. 70% of placement SQL questions involve some form of aggregation. Companies want to see if you can derive insights from data.
-
Basic Aggregation
SELECT COUNT(*) FROM employees; SELECT AVG(salary), MAX(salary) FROM employees;
-
GROUP BY
SELECT department, COUNT(*) as emp_count FROM employees GROUP BY department;
-
HAVING Clause
SELECT department, AVG(salary) FROM employees GROUP BY department HAVING AVG(salary) > 60000;
-
Multiple Grouping
SELECT department, job_title, COUNT(*) FROM employees GROUP BY department, job_title;
- HackerRank: Aggregation section (all problems)
- LeetCode: Problems 182, 197, 511
- GeeksforGeeks: GROUP BY and HAVING exercises
Duration: 14 days
Goal: Master table relationships and complex data retrieval
- INNER JOIN
- LEFT/RIGHT JOIN
- FULL OUTER JOIN
- SELF JOIN
- Multiple table joins
This is the make-or-break phase for placements. Join questions are extremely common and test your understanding of relational databases. Most complex real-world queries involve joins.
-
INNER JOIN
SELECT e.name, d.department_name FROM employees e INNER JOIN departments d ON e.dept_id = d.id;
-
LEFT JOIN
SELECT c.name, o.order_date FROM customers c LEFT JOIN orders o ON c.id = o.customer_id;
-
SELF JOIN
SELECT e1.name as employee, e2.name as manager FROM employees e1 JOIN employees e2 ON e1.manager_id = e2.id;
-
Multiple Joins
SELECT c.name, o.order_date, p.product_name FROM customers c JOIN orders o ON c.id = o.customer_id JOIN order_items oi ON o.id = oi.order_id JOIN products p ON oi.product_id = p.id;
- HackerRank: Basic Join, Advanced Join
- LeetCode: Problems 570, 577, 580, 262
- GeeksforGeeks: SQL Joins comprehensive practice
Duration: 14 days
Goal: Handle complex nested queries and advanced SQL features
- Correlated and non-correlated subqueries
- EXISTS and NOT EXISTS
- Window functions (ROW_NUMBER, RANK, DENSE_RANK)
- Common Table Expressions (CTEs)
This separates good candidates from great ones. Advanced concepts show deep SQL understanding and are often used in senior-level questions during placements.
-
Subqueries
SELECT name FROM employees WHERE salary > (SELECT AVG(salary) FROM employees);
-
Correlated Subqueries
SELECT name, salary FROM employees e1 WHERE salary > (SELECT AVG(salary) FROM employees e2 WHERE e2.department = e1.department);
-
Window Functions
SELECT name, salary, RANK() OVER (ORDER BY salary DESC) as salary_rank FROM employees;
-
Common Table Expressions
WITH dept_avg AS ( SELECT department, AVG(salary) as avg_sal FROM employees GROUP BY department ) SELECT * FROM dept_avg WHERE avg_sal > 70000;
- HackerRank: Alternative Queries, Advanced Select
- LeetCode: Medium/Hard problems (180, 184, 185)
- GeeksforGeeks: Advanced SQL queries
Duration: 14 days
Goal: Performance optimization and interview-specific preparation
- Query optimization techniques
- Index understanding
- Execution plans
- Complex real-world scenarios
- Time/space complexity in SQL
Placements often include optimization questions. Understanding performance shows you can write production-ready code, not just functional queries.
-
Query Optimization
- Using indexes effectively
- Avoiding unnecessary JOINs
- Proper WHERE clause placement
-
Interview Patterns
- Ranking problems
- Running totals
- Date-based analytics
- Finding duplicates/gaps
-
Complex Scenarios
-- Find employees earning more than their department average SELECT e.name, e.salary, d.dept_name FROM employees e JOIN departments d ON e.dept_id = d.id WHERE e.salary > ( SELECT AVG(salary) FROM employees e2 WHERE e2.dept_id = e.dept_id );
- HackerRank: All remaining challenges
- LeetCode: Hard problems (262, 601, 1479)
- GeeksforGeeks: Interview preparation section
- Theory: 1 hour/day
- Practice: 1.5-2 hours/day
- Platform rotation: Alternate between HackerRank and LeetCode
- Theory: 30 minutes/day
- Practice: 2-2.5 hours/day
- Mock interviews: 2-3 sessions/week
- Complete domains in order
- Focus on SQL badge completion
- Great for structured learning
- Sort by acceptance rate (start high)
- Focus on company-specific questions
- Practice under time pressure
- Use for concept clarification
- Good for Indian placement patterns
- Practice their interview section
- Solve 5-7 problems daily
- 90%+ accuracy on basic queries
- Solve 3-5 problems daily
- Understand joins intuitively
- Solve 2-4 complex problems daily
- Optimize existing solutions
- Time Management: Allocate 2 minutes for easy, 5 minutes for medium, 10 minutes for hard problems during practice
- Pattern Recognition: Keep a notebook of common query patterns
- Mock Tests: Take timed tests weekly from Week 6 onwards
- Company Research: Focus on SQL patterns of your target companies
- Code Review: Always review and optimize your accepted solutions