Back to Tech Interviews

MySQL Database Interview Master

100+ MySQL interview questions covering InnoDB architecture, B-Tree indexes, EXPLAIN execution plans, ACID transactions, locking, and replication.

Total: 100 QuestionsLearned: 0 / 100 (0%)
Difficulty Filters

Tools & Options
Showing 100 of 100 questions
Beginner
What is MySQL?

MySQL is an open-source Relational Database Management System (RDBMS) that uses Structured Query Language (SQL). It is one of the most popular databases in the world, known for its reliability, ease of use, and performance. It follows a client-server architecture and is a core component of the LAMP (Linux, Apache, MySQL, PHP/Python/Perl) stack.

Beginner
What are the main features of MySQL?

Primary features of MySQL include:

1. **Relational Database System**: Stores data in tables with rows and columns.

2. **High Performance**: Optimized for fast read and write operations.

3. **Scalability**: Can handle large datasets and high traffic with ease.

4. **ACID Compliance**: Supports transactions via InnoDB engine.

5. **Security**: Multi-layered security with host-based verification and encrypted connections.

Beginner
What is the difference between MySQL and SQL?

SQL (Structured Query Language) is a standard language used to interact with databases. MySQL is an actual software project (an RDBMS) that implements SQL.

- **SQL**: A language.

- **MySQL**: A database engine that understands that language.

Beginner
What is the default port for MySQL?
Beginner
What is a database in MySQL?
Beginner
What are the common data types in MySQL?
Beginner
What is the difference between CHAR and VARCHAR?
Beginner
How do you create a table in MySQL?
Beginner
What is a Primary Key?
Beginner
What is a Foreign Key?
Beginner
What is the difference between DELETE and TRUNCATE?
Beginner
What is a Unique Constraint?
Beginner
How do you add a new column to an existing table?
Beginner
What is the auto_increment attribute?
Beginner
How do you insert data into a MySQL table?
Beginner
What is the WHERE clause used for?
Beginner
What is the LIMIT clause?
Beginner
How do you sort results in MySQL?
Beginner
What are Aggregate Functions?
Beginner
What is the use of the DISTINCT keyword?
Beginner
What is a NULL value?
Beginner
How do you update existing data in a table?
Beginner
How do you delete a database or a table?
Beginner
What is the LIKE operator?
Beginner
What is the default storage engine for MySQL?
Intermediate
How do you explain Inner Join in MySQL?
Intermediate
Explain Left Join and Right Join.
Intermediate
What is a Cross Join?
Intermediate
How do you use the GROUP BY clause?
Intermediate
What is the difference between WHERE and HAVING?
Intermediate
What is an Index in MySQL?
Intermediate
What are the different types of Indexes in MySQL?
Intermediate
What is a View in MySQL?
Intermediate
What are Stored Procedures?
Intermediate
What is a Trigger?
Intermediate
What is a Transaction in MySQL?
Intermediate
What are COMMIT and ROLLBACK?
Intermediate
What is the difference between a Function and a Stored Procedure?
Intermediate
How do you check current running queries in MySQL?
Intermediate
What is a Full-Text Search?
Intermediate
What is Query Optimization?
Intermediate
How do you use the EXPLAIN keyword?
Intermediate
What is a Subquery?
Intermediate
What is the difference between UNION and UNION ALL?
Intermediate
What is the COALESCE() function?
Intermediate
What is a Composite Index?
Intermediate
How do you find the second highest salary from a table?
Intermediate
What is Referential Integrity?
Intermediate
What are the ON DELETE CASCADE and ON UPDATE CASCADE options?
Intermediate
What is the difference between NOW() and CURDATE()?
Advanced
What are the different isolation levels in MySQL?
Advanced
Explain the ACID properties in MySQL.
Advanced
What is Deadlock in MySQL and how to handle it?
Advanced
What is the difference between Optimistic and Pessimistic Locking?
Advanced
What is a Binary Log (Binlog) in MySQL?
Advanced
How does MySQL Replication work?
Advanced
What is the difference between Statement-Based and Row-Based Replication?
Advanced
What is horizontal and vertical scaling in MySQL?
Advanced
What is Sharding?
Advanced
Explain Query Cache in MySQL.
Advanced
What is a Buffer Pool in InnoDB?
Advanced
What are Hidden Columns in MySQL 8.0?
Advanced
What is the difference between MyISAM and InnoDB?
Advanced
How to perform a backup of a MySQL database?
Advanced
What is slow query log?
Advanced
Explain Window Functions in MySQL 8.0.
Advanced
What are Common Table Expressions (CTEs)?
Advanced
What is JSON support in MySQL?
Advanced
Explain the concept of 'Covering Index'.
Advanced
What is the purpose of the Performance Schema?
Advanced
What is an 'Upsert' in MySQL?
Advanced
How to secure a MySQL installation?
Advanced
What is the difference between a Temporary Table and a Derived Table?
Advanced
What is 'Ghost Rows' or 'Phantom Read'?
Advanced
What is adaptive hash index?
Scenario
How to find duplicate records in a table?
Scenario
How to delete duplicate records keeping only one?
Scenario
Write a query to get the nth highest salary.
Scenario
How to select rows with a date in the last 30 days?
Scenario
How to find rows where a column contains only numbers?
Scenario
Scenario: Your production database is slow. What are your first steps?
Scenario
How to swap values of two columns in a single UPDATE statement?
Scenario
How to copy data from one table to another?
Scenario
How to find the length of the longest string in a column?
Scenario
Scenario: You need to store hierarchical data (like categories/subcategories). How do you design it?
Scenario
How to get the first 3 characters of a string?
Scenario
How to combine first_name and last_name into one column?
Scenario
How to find the number of days between two dates?
Scenario
Scenario: A user reports they can't login, but the database seems fine. What DB-related things do you check?
Scenario
How to get the last inserted ID?
Scenario
How to return a random row from a table?
Scenario
How to convert a string to uppercase?
Scenario
How to check the version of MySQL you are using?
Scenario
Scenario: You want to ensure no two orders are placed for the same product at the exact same millisecond. How?
Scenario
How to find all tables in a database?
Scenario
How to rename a table?
Scenario
How to grant all privileges to a user on a specific database?
Scenario
How to see the structure of a table?
Scenario
Scenario: You deleted a row by mistake. How do you get it back?
Scenario
How to empty a table without deleting it?

Technical Interview Mastery Blueprint

Proven methodologies and frameworks to succeed in technical and architecture rounds.

1. The Engineering STAR Technique

When responding to architectural or situational questions, structure your answer using Situation, Technical Constraint, Action, and Measurable Result. Rather than jumping straight to syntax, articulate the business problem, why certain patterns (e.g. caching, queuing, immutability) were selected over alternatives, and what latency or throughput improvements were achieved.

2. Defending Architectural Trade-Offs

Senior interviewers evaluate how you weigh trade-offs. Always explain why you chose an approach: e.g., memory overhead vs CPU cycle speed, consistency vs availability (CAP theorem), or normalized schemas vs denormalized fast reads. Stating the drawbacks of your own proposal demonstrates maturity and production experience.

3. Clean Code & Edge-Case Proactivity

In live-coding rounds, communicate your thinking aloud before typing. State edge cases explicitly: null or undefined inputs, extreme boundary values, concurrency races, and network timeouts. Writing modular, well-named functions with deterministic unit tests separates junior candidates from staff-level engineers.

4. Antipatterns to Avoid

Avoid reciting memorized definitions without practical context. Never dismiss non-functional requirements such as security (CSRF, injection, token rotation), observability (logging, metrics), and accessibility (ARIA, semantic standards). Always ask clarifying scope questions before writing complex implementations.

Continuous learning: Practice daily, mark completed questions as learned, and revisit difficult concepts.Explore All Interview Tracks →

Explore Related Tools

Hand-picked utilities and calculators related to this tool.

Related Tools