Most Asked Database Topics
High-frequency database concepts and SQL queries that keep showing up across software house interviews — ranked by how often companies ask them.
31 topics
- 1
Joins (types and queries)
SQLJoinsMediumExplain the different types of SQL joins (inner, left, right, full outer, self join) and write queries that combine data from two or more tables based on related columns.
Asked in 34 companies+29 - 2
Indexing (concept and query)
PerformanceIndexesMediumWhat a database index is, how it speeds up data retrieval, and how to decide which column(s) to index.
Asked in 30 companies+25 - 3
Normalization / Normal Forms
DesignNormalizationMediumThe process of organizing database tables to reduce redundancy and dependency, explained through the normal forms (1NF, 2NF, 3NF).
Asked in 23 companies+18 - 4
GROUP BY / HAVING / WHERE clause
SQLAggregationMediumHow to filter and group query results — WHERE filters individual rows, GROUP BY groups rows sharing a value, and HAVING filters those grouped results.
Asked in 18 companies+13 - 5
Stored Procedures
SQLProceduresMediumPrecompiled SQL code stored in the database that can be executed repeatedly — why they're used and how they differ from plain queries in terms of efficiency.
Asked in 14 companies+9 - 6
Database schema/ERD design
DesignERDMediumDesigning the structure of a database — drawing an Entity-Relationship Diagram (ERD) to represent entities, attributes, and relationships, then translating it into actual tables.
Asked in 13 companies+8 - 7
Triggers
SQLTriggersMediumDatabase objects that automatically execute a specified action in response to certain events (insert, update, delete) on a table.
Asked in 12 companies+7 - 8
Primary Key vs Foreign Key vs Unique Key
KeysConstraintsEasyThe different types of keys used to uniquely identify records and maintain relationships between tables.
Asked in 12 companies+7 - 9
Views
SQLViewsEasyVirtual tables created from the result of a stored query, used to simplify complex queries or restrict data access.
Asked in 11 companies+6 - 10
Nth highest/lowest salary query
SQLQueriesMediumA classic practical SQL task: write a query to find the 2nd, 3rd, or Nth highest (or lowest) salary from an employee/salary table.
Asked in 10 companies+5 - 11
ACID properties / Transactions
TransactionsMediumThe four properties (Atomicity, Consistency, Isolation, Durability) that guarantee reliable processing of database transactions.
Asked in 9 companies+4 - 12
Many-to-many relationship
DesignRelationshipsMediumHow to represent and implement a relationship where multiple records in one table relate to multiple records in another, typically using a junction/bridge table.
Asked in 8 companies+3 - 13
Denormalization
DesignPerformanceMediumThe process of intentionally introducing redundancy into a normalized database to improve read performance.
Asked in 7 companies+2 - 14
Subqueries / Nested queries
SQLQueriesMediumA query written inside another query, used to filter or compute values needed by the outer query.
Asked in 5 companies - 15
SQL vs NoSQL
ConceptsEasyComparing relational (SQL) databases with structured schemas against non-relational (NoSQL) databases with flexible schemas, and when to use each.
Asked in 4 companies+1 - 16
Constraints (CHECK, UNIQUE, NOT NULL)
ConstraintsEasyRules applied to table columns to enforce data integrity, such as preventing null values or duplicate entries.
Asked in 5 companies - 17
Database locking / concurrency control
ConcurrencyHardMechanisms used to manage simultaneous access to data by multiple transactions, preventing conflicts or data corruption.
Asked in 5 companies+1 - 18
Query optimization / performance
PerformanceHardTechniques for making a query run faster, especially on large datasets with many joins, subqueries, or indexes.
Asked in 4 companies+1 - 19
Aggregate functions (COUNT, SUM, AVG etc.)
SQLAggregationEasyBuilt-in SQL functions that perform a calculation on a set of values and return a single summary value.
Asked in 4 companies - 20
Bridge/junction table
DesignRelationshipsMediumAn intermediary table used to implement a many-to-many relationship between two other tables.
Asked in 4 companies - 21
DROP vs DELETE vs TRUNCATE
SQLEasyThe differences between these three commands for removing data or structures — DROP removes the whole table, DELETE removes specific rows, and TRUNCATE removes all rows quickly without logging individually.
Asked in 3 companies - 22
Self join
SQLJoinsMediumA join where a table is joined with itself, typically used to compare rows within the same table.
Asked in 3 companies - 23
SQL Injection
SecurityMediumA security vulnerability where malicious SQL code is inserted into a query through unsanitized user input.
Asked in 3 companies+2 - 24
DDL vs DML vs DCL
ConceptsEasyThe three categories of SQL commands — Data Definition Language (structure), Data Manipulation Language (data), and Data Control Language (permissions).
Asked in 3 companies - 25
One-to-one / one-to-many relationship
DesignRelationshipsEasyHow to model and implement relationships where one record relates to exactly one, or to multiple, records in another table.
Asked in 3 companies+1 - 26
Composite key
KeysEasyA primary key made up of two or more columns combined to uniquely identify a row.
Asked in 2 companies - 27
Database anomalies
DesignNormalizationMediumInconsistencies that can occur in poorly designed databases during insert, update, or delete operations — a key motivation for normalization.
Asked in 2 companies - 28
Cascading delete/update
ConstraintsMediumA foreign key behavior where deleting or updating a record automatically applies the same action to related records in other tables.
Asked in 2 companies - 29
Referential integrity
ConstraintsEasyA rule ensuring that foreign key values always correspond to an existing primary key in the related table.
Asked in 2 companies - 30
OLTP vs OLAP
ConceptsMediumComparing Online Transaction Processing systems (fast, frequent small transactions) with Online Analytical Processing systems (complex analytical queries on large datasets).
Asked in 1 companies - 31
Database backup/recovery
OperationsEasyStrategies and methods for backing up a database and restoring it in case of data loss or failure.
Asked in 1 companies