SQL and Database Design Questions
45 min · Intermediate
Almost every Java backend interview has an SQL round: write a query on a small table, then explain a database concept such as normalisation, indexes or transactions. Section 12 (SQL & Database Design) taught all of it with MySQL; this lesson revises the queries and model answers interviewers ask most.
Topics in this lesson
- Joins, WHERE vs HAVING, GROUP BY
- Classic queries: second highest salary, duplicates, Nth highest
- Normalisation 1NF to 3NF; primary and foreign keys
- Indexes, ACID and isolation levels
- DELETE vs TRUNCATE vs DROP
Interview questions this lesson answers
- What is the difference between INNER JOIN and LEFT JOIN?
- What is a self join? Give an example.
- What is a CROSS JOIN?
- Does MySQL support FULL OUTER JOIN?
- What is the difference between WHERE and HAVING?
- What is the order in which SQL clauses are logically executed?
- How do you find the second highest salary?
- How do you find the Nth highest salary?
- What is the difference between RANK, DENSE_RANK and ROW_NUMBER?
- What are window functions?
Sign in free to continue this lesson
Create a free account to read every lesson, practise with the exercises and keep track of your progress.