issue 117apr 27mmxxvi
est. 2017
Sun, 27 Apr 2026
vol. IX · no. 117
PapersAdda
placement intelligence, since 2017
640+ briefs · 24 campuses · by reservation
verified offers · sourced from r/developersIndia
razorpay₹65.00 LPA· iit-d · sde-1google₹54.00 LPA· iiit-h · swe-imicrosoft₹49.50 LPA· iit-b · sdeatlassian₹38.00 LPA· nit-w · sde-1amazon₹44.20 LPA· bits-p · sde-1uber₹42.00 LPA· iit-kgp · sde-1razorpay₹65.00 LPA· iit-d · sde-1google₹54.00 LPA· iiit-h · swe-imicrosoft₹49.50 LPA· iit-b · sdeatlassian₹38.00 LPA· nit-w · sde-1amazon₹44.20 LPA· bits-p · sde-1uber₹42.00 LPA· iit-kgp · sde-1

Top 24 DBMS vs RDBMS Interview Questions & Answers (2026)

22 min read
Interview Questions
Updated: 8 Jun 2026
Aditya Sharma
Aditya's Edit

PapersAdda 2026 Placement Cycle

By Aditya Sharma·Founder & Editor, PapersAdda

What changed in 2026 drives

Mass-recruiter offer letters are flatter for 2026 batch - the 4-5 LPA ASE band has barely budged in three years while inflation eats real wages. Premium tracks (Digital, Pro, Elite, Specialist) are still where the differential lives, and they are entirely test-driven. If you are aiming higher than the default offer, the coding round is not optional pageantry - it is the entire interview.

What I'd actually study for this

  • 01Two solid coding-round answers (1 medium-hard DSA each, with edge-case discussion) > five half-baked ones
  • 02One real project you can defend end-to-end - file paths, design decisions, and what you would change
  • 03One DBMS schema you actually built (not a textbook ER diagram), with at least 3 join-heavy queries written from memory
  • 04Three behavioural STAR stories: failure recovered, conflict handled, ownership taken

Where most candidates trip up

The single biggest mistake is treating company-specific guides as primary prep and DSA as secondary. It is the opposite. Mass recruiters use the test as a filter, but premium tracks at every IT services company use coding to allocate offer band. Spend 70% of prep time on DSA + system fundamentals, 20% on company-specific patterns, 10% on HR rehearsal. Reverse that ratio and you collect the default offer.

Editorial commentary by Aditya Sharma · written for PapersAdda · not generated, not aggregated.

Last Updated: June 2026 | Level: Beginner to Advanced | Format: Q&A with Comparison Tables and Examples

DBMS vs RDBMS and SQL vs NoSQL are among the most fundamental database interview questions. Candidates report these appearing as "warm-up" questions at service companies (TCS, Infosys, Wipro) and as more detailed system design questions at product companies. Based on public preparation resources and candidate-reported accounts, CAP theorem and database selection rationale are commonly asked at backend SDE interviews.


Table of Contents

  1. DBMS vs RDBMS Basics (Q1-Q8)
  2. Relational Model Deep Dive (Q9-Q14)
  3. RDBMS vs NoSQL (Q15-Q20)
  4. Database Selection (Q21-Q24)

DBMS vs RDBMS Basics

Q1. What is a DBMS? What are its functions? Easy

A Database Management System (DBMS) is software that creates, maintains, and manages access to databases. It acts as an interface between users/applications and the stored data.

Core functions:

FunctionDescription
Data definitionDefine the structure of data (schema: tables, types, constraints)
Data manipulationInsert, update, delete, and query data
Data securityControl who can access what data (authentication, authorization)
Concurrency controlManage simultaneous access from multiple users/applications
Backup and recoveryProtect data from loss and restore after failures
Integrity enforcementEnsure data satisfies constraints (NOT NULL, UNIQUE, FK)
Data abstractionHide physical storage details from users

Examples: MySQL, PostgreSQL, Oracle, SQL Server (RDBMS); MongoDB, Redis, Cassandra (NoSQL DBMS); Microsoft Access, FoxPro (file-based DBMS, older generation).


Q2. What is an RDBMS? What makes it relational? Easy

A Relational Database Management System (RDBMS) stores data in tables (relations) with rows and columns, enforces relationships between tables using keys, and uses SQL for data access.

What makes it relational (Codd's 12 rules, simplified):

  1. Data represented in tables (relations).
  2. Relationships enforced via primary and foreign keys.
  3. Data accessed via SQL (set-based, declarative language).
  4. ACID transactions.
  5. No duplicate rows (enforced by PK constraint).
  6. Data independence (physical storage details hidden from logical schema).

Examples: MySQL, PostgreSQL, Oracle Database, Microsoft SQL Server, SQLite, MariaDB.


Q3. What are the differences between DBMS and RDBMS? Easy

AspectDBMSRDBMS
Data storageAny model (hierarchical, network, flat file, relational)Tables with rows and columns
RelationshipsOptional, not enforced by systemEnforced via foreign keys and referential integrity
NormalizationNot requiredSupported and encouraged
Query languageVariesSQL (standardized)
ACID complianceNot alwaysYes (typically)
SecurityBasicRole-based access control, row-level security
ExamplesFile system, XML databases, early flat-file systemsMySQL, PostgreSQL, Oracle, SQL Server
RedundancyMay be highReduced via normalization

Key statement: All RDBMS are DBMS. Not all DBMS are RDBMS.


Q4. What is the relational model? Who invented it? Easy

The relational model was proposed by Edgar F. Codd at IBM in 1970 in his landmark paper "A Relational Model of Data for Large Shared Data Banks."

Core concepts:

ConceptDescription
Relation (Table)A set of tuples with the same attributes
Tuple (Row)A single record/instance
Attribute (Column)A named property of the relation with a domain (data type)
DomainThe set of valid values for an attribute
SchemaThe name of the relation and its attributes
InstanceThe actual data in the relation at a point in time

Mathematical foundation: Relations are based on set theory. A relation is a subset of the Cartesian product of its attribute domains. No duplicate tuples (set property). Order of tuples does not matter. Order of attributes does not matter (addressed by name, not position).


Q5. What is data abstraction in DBMS? What are the three levels? Medium

Data abstraction hides implementation details from users, showing only what is needed at each level.

Three-schema architecture (ANSI-SPARC):

External Level (View)
    Users/applications see only the data they need.
    Multiple views of the same data.
    Example: HR app sees employee name and salary; payroll app sees salary and tax details.
          ↑
Conceptual Level (Logical Schema)
    How the data is logically organized (tables, columns, relationships).
    Independent of physical storage.
    Example: tables Employees(emp_id, name, dept_id, salary), Departments(dept_id, name).
          ↑
Internal Level (Physical Schema)
    How data is physically stored on disk.
    Index structures, file organization, storage blocks.
    Example: B+tree on emp_id, data stored in heap file /var/lib/mysql/employees.ibd.

Why three levels?

  • Physical independence: change storage format without changing logical schema.
  • Logical independence: change logical schema without changing application views (in theory; harder in practice).

Q6. What is SQL? What are its sub-languages? Easy

SQL (Structured Query Language) is the standard declarative language for managing data in relational databases.

SQL sub-languages:

Sub-languageCommandsPurpose
DDL (Data Definition Language)CREATE, ALTER, DROP, TRUNCATEDefine/modify schema structure
DML (Data Manipulation Language)SELECT, INSERT, UPDATE, DELETEManipulate data (read/write)
DCL (Data Control Language)GRANT, REVOKEControl access permissions
TCL (Transaction Control Language)COMMIT, ROLLBACK, SAVEPOINTManage transactions
DQL (Data Query Language)SELECTQuery data (sometimes separated from DML)

Examples:

-- DDL
CREATE TABLE employees (emp_id INT PRIMARY KEY, name VARCHAR(100));

-- DML
INSERT INTO employees VALUES (1, 'Alice');
SELECT * FROM employees WHERE emp_id = 1;
UPDATE employees SET name = 'Alice Smith' WHERE emp_id = 1;
DELETE FROM employees WHERE emp_id = 1;

-- DCL
GRANT SELECT ON employees TO 'hr_user'@'localhost';

-- TCL
BEGIN; UPDATE ...; COMMIT;

Q7. What is the difference between DELETE, TRUNCATE, and DROP? Easy

CommandRemovesRolls back?Triggers?Auto-commit?Resets auto-increment?
DELETESpecific rows (or all with no WHERE)Yes (can ROLLBACK)Yes (row-level triggers fire)NoNo
TRUNCATEAll rows in tableNo (or limited)No (in most DBMS)Yes (auto-commits)Yes
DROPEntire table (data + structure)NoNoYesN/A (table gone)
DELETE FROM employees WHERE dept_id = 10;     -- Removes specific rows, transactional
DELETE FROM employees;                         -- Removes all rows, transactional

TRUNCATE TABLE employees;                      -- Removes all rows, faster, DDL operation

DROP TABLE employees;                          -- Removes entire table structure + data

When to use:

  • DELETE: When you need to remove specific rows and may want to rollback.
  • TRUNCATE: When you want to empty a table fast (no WHERE needed, no rollback needed).
  • DROP: When the table is no longer needed at all.

Q8. What is the difference between WHERE and HAVING? Easy

Covered also in joins (Q13). Key differences:

-- WHERE: filters individual rows before any grouping
SELECT dept_id, COUNT(*) FROM employees
WHERE salary > 50000               -- Only rows where salary > 50000 are included
GROUP BY dept_id;

-- HAVING: filters groups after GROUP BY
SELECT dept_id, COUNT(*) FROM employees
GROUP BY dept_id
HAVING COUNT(*) > 5;               -- Only groups with more than 5 employees

-- Combining both:
SELECT dept_id, AVG(salary) FROM employees
WHERE hire_date > '2020-01-01'     -- Filter rows first
GROUP BY dept_id
HAVING AVG(salary) > 60000;        -- Then filter groups

Rule: If you can filter before grouping, use WHERE (more efficient: fewer rows to group). Use HAVING only when filtering on aggregate values.


Relational Model Deep Dive

Q9. What are the different types of keys in RDBMS? Easy

Key TypeDefinitionExample
Primary KeyUniquely identifies each row; NOT NULL; only one per tableemployee_id in employees table
Candidate KeyAny column/set that could serve as PK; minimal superkey{employee_id}, {email} both are CKs
SuperkeyAny set of columns that uniquely identifies rows; may have extra columns{employee_id, name} is a superkey
Foreign KeyColumn that references the PK of another table; enforces referential integritydept_id in employees referencing departments.dept_id
Unique KeyEnforces uniqueness; allows one NULL; multiple per tableemail column with UNIQUE constraint
Composite KeyA key consisting of two or more columns(student_id, course_id) in enrollment
Surrogate KeyArtificially generated key (not from business data); usually auto-incrementauto-increment id column
Natural KeyA key derived from business dataAadhar number, PAN number

Q10. What is referential integrity? How is it enforced? Medium

Referential integrity ensures that a foreign key value in one table must match an existing primary key value in the referenced table (or be NULL).

CREATE TABLE departments (
    dept_id   INT PRIMARY KEY,
    dept_name VARCHAR(100)
);

CREATE TABLE employees (
    emp_id  INT PRIMARY KEY,
    name    VARCHAR(100),
    dept_id INT REFERENCES departments(dept_id)  -- FK constraint
);

-- Referential integrity violation attempts:
INSERT INTO employees VALUES (1, 'Alice', 99);  -- dept_id=99 does not exist -> ERROR
DELETE FROM departments WHERE dept_id = 10;     -- If employees reference dept 10 -> ERROR (default)

ON DELETE / ON UPDATE actions:

ActionBehavior
RESTRICT / NO ACTIONReject the delete/update if referenced rows exist
CASCADEDelete/update matching rows in child table automatically
SET NULLSet FK to NULL in child when referenced row deleted
SET DEFAULTSet FK to default value when referenced row deleted
CREATE TABLE employees (
    dept_id INT REFERENCES departments(dept_id)
    ON DELETE CASCADE    -- When a dept is deleted, all its employees are deleted too
    ON UPDATE CASCADE    -- When dept_id changes, it propagates to employees
);

Q11. What is an entity-relationship (ER) model? Medium

The ER model is a conceptual data model used to design databases visually before creating SQL tables.

Key components:

ComponentSymbol (text representation)Description
EntityRectangleReal-world object (Student, Course, Employee)
AttributeOvalProperty of an entity (Name, Age, ID)
RelationshipDiamondAssociation between entities (Enrolls, Works in)
Key attributeOval with underlineUnique identifier attribute
Multi-valued attributeDouble ovalAttribute with multiple values (phone numbers)
Derived attributeDashed ovalCalculated from others (Age from DOB)
Weak entityDouble rectangleEntity that depends on another (OrderItem depends on Order)

Cardinality ratios:

One-to-One (1:1): Employee HAS one Passport.
One-to-Many (1:N): Department HAS MANY Employees.
Many-to-Many (M:N): Students ENROLL in MANY Courses. Courses have MANY Students.

M:N relationship implementation in SQL:

-- M:N requires a junction/association table:
CREATE TABLE student_course (
    student_id INT REFERENCES students(id),
    course_id  INT REFERENCES courses(id),
    PRIMARY KEY (student_id, course_id)
);

Q12. What is the difference between a table and a view? Medium

AspectTableView
StorageStores actual data on diskStores a query definition (no data)
UpdatesINSERT/UPDATE/DELETE directlyLimited (updatable views: simple views only)
PerformanceDirect accessQuery executed on every access (unless materialized)
Data freshnessAlways currentAlways current (query runs each time)
SecurityRow/column-level accessCan restrict which rows/columns users see
DefinitionCREATE TABLECREATE VIEW
-- Create a view:
CREATE VIEW emp_engineering AS
SELECT emp_id, name, salary
FROM employees
WHERE dept_id = 10;

-- Query the view like a table:
SELECT * FROM emp_engineering WHERE salary > 50000;
-- Equivalent to:
SELECT emp_id, name, salary FROM employees WHERE dept_id = 10 AND salary > 50000;

Materialized View: A view that physically stores the query results. Must be refreshed to see new data. Fast reads, stale data risk. Used in OLAP/reporting.


Q13. What is a stored procedure? How does it differ from a function? Medium

AspectStored ProcedureFunction
Return value0 or more values (via OUT params)Must return exactly 1 value
Used inExecuted with CALL/EXECUsed in SQL expressions
Side effectsCan have side effects (INSERT, UPDATE)Should be side-effect free (pure function)
TransactionsCan include transaction control (COMMIT, ROLLBACK)Usually cannot
Error handlingCan include TRY-CATCH blocksLimited
-- Stored procedure:
CREATE PROCEDURE update_salary(IN emp_id INT, IN raise_pct DECIMAL(5,2))
BEGIN
    UPDATE employees
    SET salary = salary * (1 + raise_pct/100)
    WHERE employees.emp_id = emp_id;
END;

CALL update_salary(42, 10.0);  -- Give employee 42 a 10% raise

-- Function:
CREATE FUNCTION get_salary(emp_id INT) RETURNS DECIMAL(10,2)
BEGIN
    DECLARE sal DECIMAL(10,2);
    SELECT salary INTO sal FROM employees WHERE employees.emp_id = emp_id;
    RETURN sal;
END;

SELECT get_salary(42);  -- Used in SELECT
SELECT * FROM employees WHERE salary > get_salary(42);  -- Used in condition

Q14. What is a trigger? Give an example. Medium

A trigger is a stored procedure that executes automatically in response to a table event (INSERT, UPDATE, DELETE).

-- Audit trigger: log every salary change
CREATE TABLE salary_audit (
    emp_id INT, old_salary DECIMAL, new_salary DECIMAL, changed_at TIMESTAMP
);

CREATE TRIGGER log_salary_change
AFTER UPDATE ON employees
FOR EACH ROW
BEGIN
    IF OLD.salary <> NEW.salary THEN
        INSERT INTO salary_audit VALUES (NEW.emp_id, OLD.salary, NEW.salary, NOW());
    END IF;
END;

-- Now every UPDATE to employees.salary automatically logs to salary_audit.

Trigger timing:

TimingDescription
BEFORE INSERT/UPDATE/DELETEExecute before the operation; can modify values or cancel
AFTER INSERT/UPDATE/DELETEExecute after; for audit logs, cascading changes
INSTEAD OFReplace the operation (for views that are not directly updatable)

Caution: Triggers are invisible to application code. They add database-side logic that can cause unexpected behavior, slow down writes, and make debugging harder. Use judiciously for audit, not business logic.


RDBMS vs NoSQL

Q15. What is a NoSQL database? What are its main types? Easy

NoSQL ("Not only SQL") databases are non-relational databases designed for specific data models, providing horizontal scalability and flexible schemas.

Main NoSQL types:

TypeDescriptionExamplesBest for
DocumentSemi-structured documents (JSON/BSON)MongoDB, CouchDBUser profiles, product catalogs, content
Key-ValueSimple key->value pairs, very fastRedis, DynamoDB, MemcachedSession store, caching, leaderboards
Wide-ColumnTables with dynamic columns per rowCassandra, HBase, BigtableTime-series, event logs, high-write IoT
GraphNodes and edges with propertiesNeo4j, Amazon NeptuneSocial networks, recommendations, fraud detection
Time-seriesOptimized for timestamped dataInfluxDB, TimescaleDBMetrics, monitoring, financial data
SearchFull-text search and analyticsElasticsearch, OpenSearchLog analysis, product search

Q16. What are the main differences between RDBMS and NoSQL? Medium

AspectRDBMS (SQL)NoSQL
SchemaFixed, must define before dataFlexible (schema-on-read)
RelationshipsForeign keys, JOINsEmbedded documents or application-level
ACIDFull ACID (usually)Eventual consistency (often); some have ACID
ScalabilityVertical scaling (more powerful server)Horizontal scaling (more servers)
Query languageSQL (standardized, powerful)DB-specific APIs (no standard)
JoinsNative SQL JOINsDenormalized or application-level
TransactionsMulti-table ACIDSingle-document (usually) or limited multi-doc
Use caseComplex queries, relational data, consistency-criticalScale, flexibility, specific data patterns

Q17. What is the CAP theorem? Hard

CAP theorem (Brewer's theorem, 2000): A distributed data store can guarantee at most TWO of these three properties simultaneously:

PropertyMeaning
C (Consistency)Every read receives the most recent write or an error (all nodes agree on data)
A (Availability)Every request receives a non-error response (but may not be the latest data)
P (Partition tolerance)System continues operating even when network partitions (messages lost between nodes) occur

Why you cannot have all three: Network partitions are inevitable in distributed systems. So the real choice is between C and A when a partition occurs.

System classifications:

TypeWhat they guaranteeExamples
CPConsistent + Partition tolerantMongoDB (w=majority), HBase, Zookeeper, CockroachDB
APAvailable + Partition tolerantCassandra, CouchDB, DynamoDB (default), DNS
CAConsistent + AvailableTraditional RDBMS (single node, no partition) -- not truly distributed

Modern nuance: PACELC (extension of CAP): Even without partition, there is a latency vs consistency trade-off (ELC). Lower latency = lower consistency (you must choose).


Q18. What is eventual consistency? Medium

Eventual consistency is a consistency model where:

  • A system guarantees that if no new updates are made, eventually all replicas will converge to the same value.
  • During convergence, different nodes may serve different (stale) values.

Timeline:

User A writes: counter = 100 (to Node 1)
  t=0: Node 1 = 100, Node 2 = 99, Node 3 = 99  (replication in progress)
  t=1: Node 1 = 100, Node 2 = 100, Node 3 = 99
  t=2: Node 1 = 100, Node 2 = 100, Node 3 = 100  (converged)

When it is acceptable:

  • Social media likes/view counts (stale for milliseconds is fine).
  • DNS (cache propagation takes time; fine for most URLs).
  • Product recommendations (slightly stale = no harm).

When it is NOT acceptable:

  • Bank balance (must be strongly consistent: every read sees latest commit).
  • Inventory: if 1 item remains and 2 users buy simultaneously with eventual consistency, both could "succeed."

Cassandra's consistency: Configurable per-query via consistency level. QUORUM reads and writes give strong consistency for practical purposes; ONE gives eventual consistency with better performance.


Q19. What is ACID vs BASE? Easy

ACID (traditional RDBMS):

  • Atomicity: all or nothing.
  • Consistency: valid state always.
  • Isolation: concurrent transactions do not interfere.
  • Durability: committed data survives failures.

BASE (many NoSQL systems):

  • Basically Available: system guarantees availability (with possible stale data).
  • Soft state: system state may change over time even without input (due to replication convergence).
  • Eventually consistent: data will become consistent eventually.

Analogy: ACID = Bank (every transaction is exact and immediate, no ambiguity). BASE = Social media like count (briefly inconsistent but eventually correct, prioritizes availability).

Are these mutually exclusive? No. Some modern distributed databases (CockroachDB, Google Spanner, YugabyteDB) offer ACID compliance across distributed nodes (using Paxos/Raft consensus), blurring the old ACID vs BASE divide.


Q20. What is horizontal vs vertical scaling? Easy

AspectVertical Scaling (Scale Up)Horizontal Scaling (Scale Out)
MethodAdd more resources to existing server (more CPU, RAM, SSD)Add more servers to distribute load
LimitPhysical machine limits (max ~4TB RAM, ~100 CPU cores)Near unlimited (add as many servers as needed)
CostExponentially expensive at high endLinear cost (commodity hardware)
DowntimeOften requires restart for hardware upgradeAdd nodes without downtime
ComplexitySimple (no distributed systems issues)Complex (data partitioning, consistency, coordination)
RDBMS fitGood for vertical; limited for horizontalHard to shard relational data without losing JOINs
NoSQL fitSupports bothDesigned for horizontal

RDBMS horizontal scaling options:

  • Read replicas: Scale reads by routing SELECT to replicas. Writes still go to primary.
  • Sharding: Partition data across multiple DB instances by key range or hash. Complicates cross-shard JOINs.
  • NewSQL (CockroachDB, TiDB): Full SQL, ACID, and horizontal scaling. The modern answer to this problem.

Database Selection

Q21. How do you choose between SQL and NoSQL for a new project? Hard

Choose SQL (RDBMS) when:

  • Data is structured and relational (entities with clear relationships).
  • Transactions involve multiple tables (financial operations, inventory).
  • Complex queries with JOINs are required.
  • Data integrity and consistency are critical.
  • Schema is stable and well-understood.
  • Team expertise: SQL is universal, large talent pool.

Choose NoSQL when:

  • Data is document-like (JSON, variable structure per record).
  • Need to scale writes horizontally to many servers.
  • Workload is simple key-value or time-series.
  • Schema evolves rapidly (agile development, new fields per document).
  • Specific data pattern: graph traversal, full-text search, high-frequency time series.

Choose both (polyglot persistence) when:

  • Different parts of the application need different stores.
  • Example: PostgreSQL for financial transactions + Redis for session cache + Elasticsearch for product search.

Decision matrix:

NeedBest choice
ACID transactions across tablesPostgreSQL, MySQL
High-speed key-value cacheRedis
Flexible document storageMongoDB
Time-series sensor dataInfluxDB, TimescaleDB
Social graph traversalNeo4j
Massive write throughput (IoT logs)Cassandra
Full-text product searchElasticsearch

Q22. What is a NewSQL database? Hard

NewSQL databases combine the ACID properties and SQL interface of relational databases with the horizontal scalability of NoSQL.

Key features:

  • Full SQL support.
  • ACID transactions across distributed nodes.
  • Horizontal scaling via data partitioning.
  • Distributed consensus (Paxos, Raft) for consistency.

Examples:

SystemDeveloperKey feature
CockroachDBCockroach LabsInspired by Google Spanner; distributed SQL
TiDBPingCAPMySQL-compatible distributed SQL
Google SpannerGoogleExternal consistency; global scale; TrueTime
YugabyteDBYugabytePostgreSQL-compatible distributed SQL
VoltDBVoltDB Inc.In-memory ACID; extreme throughput

Trade-off vs traditional RDBMS:

  • Higher write latency (consensus protocol adds round trips).
  • More complex operations.
  • Higher cost.
  • Justified for: globally distributed applications, multi-region ACID requirements.

Q23. What is database partitioning? What are the strategies? Hard

Partitioning divides a large table into smaller physical pieces to improve manageability, performance, and availability.

Types:

TypeDescriptionExample
Horizontal (Sharding)Rows distributed across partitions based on keyOrders 1-1M on Shard 1, 1M-2M on Shard 2
VerticalColumns split across partitionsFrequently-accessed cols in one partition, BLOBs in another
Range partitioningBased on value ranges of a columnOrders by month: partition per month
Hash partitioningHash of key determines partitionHASH(user_id) % 4 -> 4 partitions
List partitioningExplicit list of values per partitionIndia orders in Partition_IN, US orders in Partition_US
CompositeCombination (e.g., range + hash)Year range first, then hash within year

Benefits:

  • Query performance: queries on a specific partition only scan that partition.
  • Maintenance: archive/drop old partitions easily (delete partition vs DELETE millions of rows).
  • Parallelism: parallel queries across partitions.

MySQL partition example:

CREATE TABLE orders (
    order_id INT,
    order_date DATE,
    amount DECIMAL
) PARTITION BY RANGE (YEAR(order_date)) (
    PARTITION p2022 VALUES LESS THAN (2023),
    PARTITION p2023 VALUES LESS THAN (2024),
    PARTITION p2024 VALUES LESS THAN (2025),
    PARTITION pmax  VALUES LESS THAN MAXVALUE
);

Q24. What are common database interview questions asked about system design? Hard

At system design level, database questions focus on trade-offs and choices, not just definitions:

Common system design + database questions:

1. "Design the database for an e-commerce platform like Amazon." Expected: tables for Users, Products, Orders, OrderItems, Inventory, Payments, Reviews, Addresses. Discuss normalization, indexes on order_date, product_id, user_id. Consider partitioning Orders by date.

2. "How would you handle 1 billion rows in a users table?" Expected: sharding by user_id hash, read replicas for scaling reads, cache layer (Redis) for hot user records, archiving old/inactive users.

3. "Should you use SQL or NoSQL for a real-time leaderboard?" Expected: Redis Sorted Sets (ZADD/ZRANK) for O(log n) leaderboard operations. No SQL needed.

4. "How do you prevent duplicate payments?" Expected: idempotency key (unique transaction ID in payments table with UNIQUE constraint). Retry with same key is idempotent.

5. "Your database is slow. Where do you start?" Expected: EXPLAIN plan, check for missing indexes, check for N+1 queries, check slow query log, check buffer pool hit rate, check connection pool exhaustion.

PapersAdda tip: For every technology choice in system design, articulate the WHY. "I chose PostgreSQL because we need ACID transactions for payments and the relational schema maps well to our order-line-item structure. We'd add Redis for session caching to reduce DB load on hot paths."


FAQ

Q: Is MongoDB ACID compliant? MongoDB has supported multi-document ACID transactions since version 4.0 (released 2018). Before that, only single-document operations were atomic. As of 4.0+, it is ACID-compliant for multi-document transactions, though with some performance trade-offs compared to single-document operations.

Q: What is the difference between a database and a schema in MySQL? In MySQL, DATABASE and SCHEMA are synonymous. CREATE DATABASE myapp and CREATE SCHEMA myapp do the same thing. In PostgreSQL, a database contains schemas, and schemas contain tables (an extra level of namespace).

Q: Can you do JOINs in NoSQL? Not in the traditional SQL way. NoSQL databases handle relationships by: (a) embedding related documents (denormalization), (b) application-level joins (fetch both documents, join in code), or (c) some NoSQL databases (MongoDB since 3.2) support $lookup (a limited LEFT OUTER JOIN equivalent).


Related PapersAdda guides:

Methodology applied to this articlelast verified 8 Jun 2026
Sources used
Public exam-pattern documents, official recruiter pages, and verified candidate reports on r/developersIndia and LinkedIn.
Verification window
Page last edited 8 Jun 2026 by Aditya Sharma. Numbers and patterns sanity-checked against the most recent 2026 cycle drives we tracked.
What we did NOT do
  • No fabricated salary numbers or success rates. If we quote a range, it's sourced.
  • No noun-substituted templates. This article was not generated by swapping company names in a stock prompt.
  • No paid placements, sponsored coaching links, or affiliate-shilled course pushes.
Verification policy: /editorial-standards/. Found something incorrect? Submit a correction - we respond within 48 hours.

Explore this topic cluster

More resources in Interview Questions

Use the category hub to browse similar questions, exam patterns, salary guides, and preparation resources related to this topic.

Paid contributor programme

Sat this this year? Share your story, earn ₹500.

First-person experience reports help future candidates prep smarter. We pay verified contributors ₹500 via UPI per accepted story - with byline.

Submit your story →

Ready to practice?

Take a free timed mock test

Put what you learned into practice. Our mock tests match the 2026 pattern with timer, navigator, reveal, and score breakdown. No signup.

Start Free Mock Test →

More from PapersAdda

Share this guide: