InnoDB — SQL Technical Interview Questions & Answers
InnoDB
InnoDB
- InnoDB is the default storage engine. It gives transactions (COMMIT/ROLLBACK), FOREIGN KEYs, and crash recovery. This is the engine you want for students, fees, orders.
- MyISAM is older: table-level locks, no transactions, no FKs. Full-text search was its old selling point — InnoDB has fulltext now too.
- SHOW TABLE STATUS; Engine column. ALTER TABLE t ENGINE=InnoDB; to convert (backup first).
- Trap: creating MyISAM tables in 2026 and promising ACID.
- On the example next to this theory: InnoDB: create two demo rows, then SELECT qty >= 2 ordered. Say which labels come back.
Technical Interview Tip: InnoDB for ACID and FOREIGN KEY. Default in MySQL 8.
Code Examples for InnoDB
InnoDB — sample query
-- InnoDB
CREATE TABLE demo (
id INTEGER PRIMARY KEY,
label TEXT NOT NULL,
qty INTEGER DEFAULT 0
);
INSERT INTO demo (id, label, qty) VALUES
(1, 'alpha', 2),
(2, 'beta', 5);
SELECT label, qty FROM demo WHERE qty >= 2 ORDER BY qty DESC;InnoDB: create two demo rows, then SELECT qty >= 2 ordered. Say which labels come back.
How to Explain InnoDB to an Interviewer
Why InnoDB?
Transactions Foreign keys Crash-safe