Last Updated: 08 Sep 2010
MySQL Interview Questions
- Explain the basic CRUD operations (CREATE, UPDATE, DELETE) and how you'd use SQL to perform them.
- Explain the
WHEREclause on a
SELECTstatement, what it does and how it works.
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 CASCADEclause 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
- Is there anything special about
NULLvalues in MySQL (or SQL in general?) How do you test for a
- What's the difference between a
TIMESTAMPfield and a
DATETIMEfield? Advanced question: can you describe the different handling of timezones between
- 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=1run 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.)
- 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.