Every backend interview includes SQL. The good news: daily work uses a small, learnable subset.
The core queries
SELECT name, cgpa FROM students WHERE cgpa >= 8 ORDER BY cgpa DESC LIMIT 10;
INSERT INTO students (name, dept, cgpa) VALUES ("Priya", "CSE", 8.9);
UPDATE students SET cgpa = 9.1 WHERE id = 42;
DELETE FROM students WHERE id = 42; -- ALWAYS with WHERE!JOIN โ the interview filter
SELECT s.name, m.subject, m.grade FROM students s JOIN marks m ON m.student_id = s.id WHERE s.dept = "CSE";
- INNER JOIN: only rows with matches in both tables
- LEFT JOIN: all left rows; NULLs where right has no match
- Classic question: "students with no marks" โ LEFT JOIN +
WHERE m.id IS NULL
Aggregates
SELECT dept, COUNT(*) AS total, AVG(cgpa) AS avg_cgpa FROM students GROUP BY dept HAVING AVG(cgpa) > 7.5;
WHERE filters rows; HAVING filters groups โ a guaranteed interview line. Practice free on SQLBolt or HackerRank's SQL track, and review DBMS concepts before placements.