Last Updated: 28 Jun 2023


Author: dordal

MySQL Interview Questions

  • Explain the basic CRUD operations (CREATE, UPDATE, DELETE) and how you'd use SQL to perform them.
  • Explain the WHERE clause on a SELECT statement, what it does and how it works.
  • Explain GROUP BY. What does it do, and when do you have to use it?
  • What is a view? Why would you want to use one?
  • What is a trigger? Why are triggers good and bad?
  • What's an index? Advanced: What are the different types of indexes?
  • What's a foreign key? What does the ON CASCADE clause do when creating a foreign key?
  • Explain what a transaction is, when you'd want to use one, and when you probably wouldn't want to use one.
  • Explain the MySQL architecture (e.g. the three layers… networking/connection layer, query parsing, and the storage engine)
  • Explain the differences between InnoDB and MyISAM. When would you want to use each?
  • Talk to me about the process you'd use for optimizing an SQL query.
  • What's the difference between CHAR, VARCHAR, TEXT and BLOB datatypes?
  • Is there anything special about NULL values in MySQL (or SQL in general?) How do you test for a NULL value?
  • What's the difference between a TIMESTAMP field and a DATETIME field? Advanced question: can you describe the different handling of timezones between TIMESTAMP and DATETIME?
  • Explain locking principles in MySQL. Table level locks, page-level locks, and row-level locks. Which storage engines can do which? Explain what shared vs. exclusive locks are.
  • Why does DELETE FROM `mytable` run very quickly, whereas DELETE FROM `mytable` WHERE 1=1 run very slowly, if 'mytable' has a large number of records? (e.g. the former just deletes and recreates the table on disk, whereas the latter will delete each row one-by-one.)

PHP/MySQL Questions

  • Explain the difference between the standard MySQL libraries (e.g. mysql_connect() ) and the MySQLi libraries (e.g. mysqli_connect() )
  • Walk me through the basic process for connecting to a MySQL database and querying some information.


Enter your comment. Wiki syntax is allowed: