Interview questions
Frequently asked questions with concise model answers. Try answering aloud before expanding.
Difference between WHERE and HAVING? Easy
WHERE filters rows before grouping; HAVING filters groups after aggregation. WHERE can't use aggregate functions; HAVING can.
What is an index and when can it hurt? Medium
An index (usually a B-tree) speeds up lookups and joins. It costs disk space and slows INSERT/UPDATE/DELETE because the index must be maintained. Avoid over-indexing low-selectivity columns.
Explain normalisation. Medium
Organising tables to reduce redundancy: 1NF atomic values, 2NF no partial dependency on a composite key, 3NF no transitive dependencies. Analytical systems often denormalise for speed.