Do you know all the MySQL interview questions that BAT must ask?

Get technical dry goods and industry information for the first time!

Do you know all the MySQL interview questions that BAT must ask?

The question bank in the applet is getting more and more abundant. Recently, many new MySQL interview questions have been added. Some of these interview questions are not common, but they are mandatory interview questions for BAT. Today I will take some interview questions to test everyone!

Do you know all the MySQL interview questions that BAT must ask?
1. What character set is latin1 in MySQL?

I believe everyone has seen this character set, and it is usually set when creating a database. It stands for ISO-8859-1 in Java. A total of 256 characters are included. On the basis of the ASCII character set, 128 characters commonly used in Western Europe (including letters in Germany and France) have been expanded, and 1 byte can also be used for encoding. The alias of ISO-8859-1 in MySQL is latin1.

2. Why do we usually recommend using utf8mb4 character set?

Many articles have written about this, saying that using utf8 will cause problems. For example, when we store emoji expressions, there will be problems that cannot be saved. But no one is in principle why it is lost. For this, we can check the difference between utf8 and utf8mb4 through the SHOW CHARSET like'utf8%'; command.

Do you know all the MySQL interview questions that BAT must ask?
The reason why it cannot be stored is that the UTF-8 encoding may be two, three, or four bytes. Emoji expressions are 4 bytes, and Mysql's utf8 encoding is up to 3 bytes, so the data cannot be inserted.

3. If the table xttblog exists and the name field does not exist in the table, then executing select * from xttblog where name ='Amateur Grass' will definitely report an error. May I ask at which stage the error is reported in the connector, analyzer, optimizer, and executor?

This question is a question I posted in the WeChat group yesterday, and many people answered it incorrectly. The answer is the analyzer. Because the connector is responsible for processing and managing connections, and authorization verification; the analyzer is for lexical analysis and grammatical analysis; the optimizer is for statement optimization, generating execution plans, and selecting indexes; the executor is actually executing SQL statements, and Return the result set. Therefore, the answer analyzer is right.

4. Why is the query cache removed in MySQL 5.8?

It is estimated that many people have not noticed this query cache. The new version of the 5.8 version of the MySQL database has removed the design of the query cache. And it is not recommended in version 5.7. The reason for the removal is that although the query cache can sometimes return data faster, it is too cumbersome to maintain. And the cache hit rate is too low. If the corresponding table has insert, update, delete, etc., then the cache has to be invalidated. If there is a function in the query statement, the query cache is discarded. Because the calculation of the function will be designed with too much uncertainty. There are some functions that cannot be cached at all, or there is no need to cache them. For example, select now() cannot be cached, and for example, select version() does not need to be cached. All things considered, MySQL removed it.

For more interview questions about MySQL, please refer to my interview question applet.

Guess you like

Origin blog.51cto.com/15127565/2666205