interview.practice

SQL and Relational Databases interview questions

Answer aloud before opening each explanation. Focus on the reasoning, not memorized wording.

FoundationsQueriesRelationshipsAggregationReliabilityPerformanceSecurityDesign

0/8 saved answers | 8 questions shown

01What is a primary key?FoundationsBeginner

Model answer

A column or column set that uniquely identifies each row.

Why

Stable identity supports references, updates, and relationships.

02What is the logical role of WHERE?QueriesBeginner

Model answer

It filters rows before later result operations.

Why

WHERE limits which source rows participate in a query.

03How do INNER JOIN and LEFT JOIN differ?RelationshipsIntermediate

Model answer

INNER keeps matches; LEFT also keeps unmatched left rows.

Why

The required treatment of missing relationships determines the join.

04Why must selected non-aggregate columns usually appear in GROUP BY?AggregationIntermediate

Model answer

The database needs one defined value for each output group.

Why

Grouping determines the granularity of aggregate output.

05What does transaction atomicity mean?ReliabilityIntermediate

Model answer

All changes commit together or none do.

Why

Atomicity prevents partially completed business operations.

06Why not index every column?PerformanceAdvanced

Model answer

Indexes consume storage and slow writes and maintenance.

Why

Indexes should support measured query patterns.

07How do parameterized queries prevent injection?SecurityAdvanced

Model answer

They send values separately from SQL syntax.

Why

The database parses user values as data rather than executable structure.

08What problem does normalization address?DesignAdvanced

Model answer

Duplicated facts and update anomalies.

Why

Normalized relations keep each fact in a controlled place.

Back to track