MySQL interview questions (b)

  1. Talk about MySQL, which has several locks?
    A: The table-level locking, row-level locks, page-level locking

  2. Talk about table-level locking features?
    A: The small overhead, locking fast, will not deadlock, but a lock that locks the whole table, so locking the large size, the probability of collision will occur lock up, concurrency is the lowest.

  3. Talk about row-level locking features?
    A: The cost of large, slow lock, there will be a deadlock, the lock is a row in the table, locked the smallest size and lowest probability of lock conflicts, it is the highest degree of concurrency.

  4. Talk page lock features?
    A: The time between overhead and locking table and row locks, also deadlock the locking granularity between table and row locks, general concurrency.

  5. What is the candidate key?
    A: The candidate key is collectively one or more attribute (s) having a key characteristic of the relationship.

  6. Primary key and candidate keys What is the difference?
    A: Each line of the primary key to uniquely identify the table, only one primary key of a table, the primary key is a candidate key and, by convention, the candidate keys may be designated as the primary key, and may be used for any foreign key references.

  7. What's in Mysql ENUM in use is?
    A: ENUM is a string object that specifies a set of predefined values, and can be used when creating the table, if the value of the Type field is several fixed, it is recommended to use ENUM.

  8. What to talk about Mysql driver is?
    Answer: Mysql driver is a program Mysql database developer for a certain kind of language development environments (such as java) can achieve a unified database calls and development.

  9. Mysql talk about drivers, which has several?
    A: So
    PHP driver
    JDBC Driver
    ODBC driver
    CWRAPPER
    PYTHON drivers
    PERL drivers
    RUBY drivers
    CAP11PHP driver
    Ado.net5.mxj

  10. A table, which has ID auto-increment primary keys, when the insert 16 records, delete records Articles 15, 16, then Mysql restart, and then insert a record, this record ID is 17 or 15?
    A: The type if the table storage engine is MyISAM, ID is 17, because MyISAM table types will increase from the maximum ID recorded in the data file, even if Mysql restart, the largest ID will not be lost. And if the table storage engine type is InnoDb, because InnoDb types of tables exist only to increase the maximum ID from memory, so restart the database or the table OPTIMIZE operations may result in the loss of the largest ID.

Published 297 original articles · won praise 311 · views 50000 +

Guess you like

Origin blog.csdn.net/weixin_38106322/article/details/105262556