Sqlism
Loading…
Learning path

Crack Campus Placements with SQL

Almost every campus placement for IT services, analytics and product companies includes SQL, in the online test, the technical interview or both. The good news: the same twenty or so patterns come up again and again, and you can master them in a few focused weeks.

8 Modules
~6 hrs + practice
3 Portfolio Projects
0 of 8 modules complete

This path is built for students and freshers with no work experience. It goes from your first SELECT to the questions placement panels actually ask: second highest salary, duplicates, employees earning more than their manager, department-wise top earners, plus the DBMS theory (keys, normalization, ACID) that fills the viva. Every module links to a live lesson you can run in your browser, so you practise instead of just reading.

  1. 1

    SELECT, WHERE & Filtering

    30 min

    Every SQL answer starts here: choose columns with SELECT, rows with WHERE, and combine conditions with AND, OR, IN, BETWEEN and LIKE. Panels often test NULL handling here: = NULL never matches anything, so you need IS NULL.

    SELECT name, department_id, salary
    FROM employees
    WHERE salary BETWEEN 50000 AND 90000
      AND name LIKE 'A%'
      AND manager_id IS NOT NULL;
    Say your reasoning out loud in the interview: "I'm filtering first, then I'll sort." Panels grade your thinking, not just the final query.
  2. 2

    Sorting, DISTINCT & Limiting Results

    20 min

    ORDER BY sorts (ascending by default), DISTINCT removes duplicate rows from the result, and LIMIT / TOP / FETCH FIRST return only the first N rows. Knowing the syntax differences between MySQL, SQL Server and Oracle is a common viva question.

    SELECT DISTINCT department_id
    FROM employees
    ORDER BY department_id;
    
    SELECT name, salary
    FROM employees
    ORDER BY salary DESC
    LIMIT 3;          -- SQL Server: SELECT TOP 3 ...  Oracle: FETCH FIRST 3 ROWS ONLY
    Never rely on row order without ORDER BY. Without it the database may return rows in any order, even if it looks sorted today.
  3. 3

    GROUP BY, Aggregates & HAVING

    30 min

    Aggregate functions (COUNT, SUM, AVG, MIN, MAX) summarize groups created by GROUP BY. WHERE filters rows before grouping; HAVING filters groups after. "WHERE vs HAVING" is one of the most asked fresher questions.

    SELECT department_id, COUNT(*) AS employees, AVG(salary) AS avg_salary
    FROM employees
    WHERE hire_date >= '2021-01-01'
    GROUP BY department_id
    HAVING COUNT(*) >= 2;
    Every non-aggregated column in the SELECT must appear in GROUP BY. Forgetting this is the most common error in online tests.
  4. 4

    JOINs: Inner, Left, Right, Self

    40 min

    JOINs combine tables on a related column. INNER JOIN keeps only matches; LEFT JOIN keeps every row from the left table, with NULLs where there's no match. A self join joins a table to itself, which is the classic way to compare an employee with their manager.

    -- Classic: employees who earn more than their manager
    SELECT e.name AS employee, e.salary, m.name AS manager, m.salary AS manager_salary
    FROM employees e
    JOIN employees m ON m.id = e.manager_id
    WHERE e.salary > m.salary;
    Draw the two tables and the matching rows on paper before writing a join in an interview. It takes 20 seconds and prevents most join mistakes.
  5. 5

    Subqueries & the Nth Highest Salary

    35 min

    A subquery is a query inside another query. It's the traditional answer to placement favourites like "find the second highest salary" and "employees earning above the average". Know at least two ways to solve each; panels often ask "can you do it another way?".

    -- Second highest salary (handles duplicates of the top salary)
    SELECT MAX(salary) AS second_highest
    FROM employees
    WHERE salary < (SELECT MAX(salary) FROM employees);
    
    -- Employees earning more than the company average
    SELECT name, salary
    FROM employees
    WHERE salary > (SELECT AVG(salary) FROM employees);
    Mention edge cases unprompted: "What if two people share the top salary? What if there's only one employee?" That's what separates a selected candidate from a rejected one.
  6. 6

    Window Functions: RANK, DENSE_RANK, ROW_NUMBER

    40 min

    Window functions calculate across related rows without collapsing them. They're now standard in placement interviews for product and analytics companies. The top question: "highest paid employee in each department", solved with DENSE_RANK() partitioned by department.

    SELECT department_id, name, salary
    FROM (
        SELECT department_id, name, salary,
               DENSE_RANK() OVER (PARTITION BY department_id ORDER BY salary DESC) AS rnk
        FROM employees
    ) t
    WHERE rnk = 1;
    Be ready to explain the difference with ties: salaries 100, 100, 90 get ROW_NUMBER 1,2,3, RANK 1,1,3 and DENSE_RANK 1,1,2.
  7. 7

    Classic Placement Questions

    40 min

    A small set of problems appears in placement tests year after year: find duplicate rows, delete duplicates keeping one, count employees per department including empty departments, find departments with no employees, and display the Nth highest salary. Practise until you can write each in under three minutes.

    -- Find duplicate emails
    SELECT email, COUNT(*) AS copies
    FROM customers
    GROUP BY email
    HAVING COUNT(*) > 1;
    
    -- Departments with no employees
    SELECT d.name
    FROM departments d
    LEFT JOIN employees e ON e.department_id = d.id
    WHERE e.id IS NULL;
    After writing a query, trace it on 3-4 sample rows out loud. Interviewers often hand you a tiny table precisely to see if you check your own work.
  8. 8

    DBMS Theory: Keys, Normalization, ACID, DDL vs DML

    35 min

    The technical viva goes beyond queries. Expect: primary vs foreign vs unique key; DDL vs DML vs DCL vs TCL; DELETE vs TRUNCATE vs DROP; 1NF, 2NF and 3NF with an example; ACID properties of transactions; and what an index is and when not to use one.

    Prepare one short, concrete example for each theory topic. "A student table storing multiple phone numbers in one column breaks 1NF" lands far better than reciting a definition.

Practice on real projects

Turn practice into confidence before placement season.

Get interview-ready

Placement rounds usually include an online test (MCQs and query writing) and a technical interview. These resources cover both, and the 2-week plan below keeps you on track.

A 2-week revision plan

  1. Days 1–2: Modules 1–2. Do every lesson exercise, then 10 quiz questions at Beginner level.
  2. Days 3–4: Module 3 (GROUP BY & HAVING). Write 10 aggregation queries on the lesson tables from memory.
  3. Days 5–7: Module 4 (JOINs). Draw each join type on paper, then solve the JOIN question bank.
  4. Days 8–9: Module 5 (subqueries). Solve "Nth highest salary" three different ways.
  5. Days 10–11: Module 6 (window functions). Practise top-N per group until it takes under 3 minutes.
  6. Day 12: Module 7. Time yourself on every classic question.
  7. Days 13–14: Module 8 theory, then a mock interview: explain each answer out loud as you write it.

Validate what you've learned

25 questions covering everything above. Score 80% or higher to earn your Campus Placement Ready badge on your dashboard.

Upgrade to Sqlism Pro to take the validation quiz

25 questions · pass at 80%+ to earn your Campus Placement Ready badge on your dashboard. One-time payment, lifetime access.

Get Sqlism Pro