MySQL Interview Questions 2026
Published July 22, 2026 · Updated July 22, 2026
7 MySQL interview questions from Infosys, TCS, Paytm, Oracle. All difficulty levels, all roles. Upvoted by engineers who were asked them.
7 questions
Companies: Infosys, TCS, Paytm, Oracle
430 upvotes
MySQL Questions by Company
Infosys (1)
Infosys
Medium
System Design round
JavaSpring BootMySQL
Design a library management system. Include entities (Book, Member, Loan), relationships, and key operations: borrow, return, search, fine calculation. Discuss how to handle concurrent borrows of the last copy of a book.
↑ 61 upvotes · 22 engineers asked this · SDE2
TCS (2)
TCS
Medium
Technical round
MySQLPostgreSQL
Write a SQL query to find the second highest salary from an Employee table. Show at least two approaches: using LIMIT/OFFSET, using a subquery with MAX, and using DENSE_RANK(). Discuss which is most efficient and why.
↑ 55 upvotes · 58 engineers asked this · SDE2
TCS
Medium
System Design round
JavaSpring BootMySQL
Design a library management system with online book reservation. Students can search, reserve, and borrow books. Librarians can manage inventory. Cover the database schema, REST APIs, and how you handle concurrent reservations of the last copy.
↑ 54 upvotes · 33 engineers asked this · SDE2
Paytm (1)
Paytm
Hard
System Design round
MySQLRedisDistributed Systems
Design Paytm's wallet system that supports deposits, withdrawals, peer-to-peer transfers, and merchant payments.
Ensure ACID properties for all transfers, discuss optimistic vs pessimistic locking, and explain how you handle a split-brain scenario where two nodes disagree on a wallet balance.
↑ 58 upvotes · 57 engineers asked this · SDE2
Oracle (3)
Oracle
Medium
Technical round
PostgreSQLMySQL
Explain Oracle's MVCC (Multi-Version Concurrency Control) and how it enables consistent reads without blocking writers.
How does it differ from SQL Server's locking approach? What are the downsides of MVCC (undo log growth, long-running transactions)?
↑ 88 upvotes · 33 engineers asked this · SDE2
Oracle
Hard
Technical round
PostgreSQLMySQLJava
Explain Oracle's redo log and undo log. How do they work together to provide crash recovery and read consistency? Walk through what happens when a transaction commits, then the server crashes, then restarts.
↑ 51 upvotes · 31 engineers asked this · SDE2
Oracle
Medium
Technical round
PostgreSQLMySQL
Write a SQL query to find the Nth highest salary from an Employee table without using LIMIT/TOP. Then solve it with a window function (DENSE_RANK) and explain which is more portable across Oracle, PostgreSQL, and MySQL.
↑ 63 upvotes · 42 engineers asked this · SDE1
Practice these questions with AI feedback
Get instant grading on your answers, identify your weak areas, and generate a personalised 14-day study plan — all free.
Build my study plan →
Frequently asked questions
Design a library management system. Include entities (Book, Member, Loan), relationships, and key operations: borrow, return, search, fine calculation. Discuss how to handle concurrent borrows of the last copy of a book.
Design a library management system. Include entities (Book, Member, Loan), relationships, and key operations: borrow, return, search, fine calculation. Discuss how to handle concurrent borrows of the last copy of a book.
Write a SQL query to find the second highest salary from an Employee table. Show at least two approaches: using LIMIT/OFFSET, using a subquery with MAX, and using DENSE_RANK(). Discuss which is most efficient and why.
Write a SQL query to find the second highest salary from an Employee table. Show at least two approaches: using LIMIT/OFFSET, using a subquery with MAX, and using DENSE_RANK(). Discuss which is most efficient and why.
Design Paytm's wallet system that supports deposits, withdrawals, peer-to-peer transfers, and merchant payments.
Design Paytm's wallet system that supports deposits, withdrawals, peer-to-peer transfers, and merchant payments.
Ensure ACID properties for all transfers, discuss optimistic vs pessimistic locking, and explain how you handle a split-brain scenario where two nodes disagree on a wallet balance.
Explain Oracle's MVCC (Multi-Version Concurrency Control) and how it enables consistent reads without blocking writers.
Explain Oracle's MVCC (Multi-Version Concurrency Control) and how it enables consistent reads without blocking writers.
How does it differ from SQL Server's locking approach? What are the downsides of MVCC (undo log growth, long-running transactions)?
Explain Oracle's redo log and undo log. How do they work together to provide crash recovery and read consistency? Walk through what happens when a transaction commits, then the server crashes, then restarts.
Explain Oracle's redo log and undo log. How do they work together to provide crash recovery and read consistency? Walk through what happens when a transaction commits, then the server crashes, then restarts.