Home > Database > Mysql Tutorial > Summary of mysql interview questions

Summary of mysql interview questions

无忌哥哥
Release: 2020-09-02 15:41:40
Original
4378 people have browsed it

[Related topic recommendations: mysql interview questions (2020)]

1. What does a trigger do?

Answer: A trigger is a special stored procedure, which is mainly triggered and executed by events. It can enforce constraints to maintain data integrity and consistency, and can track operations within the database to prevent unauthorized updates and changes. Can be cascaded. For example, a trigger on a table contains a data operation on another table, and this operation will cause the trigger on that table to be triggered.

2. What is a stored procedure? What to call?

Answer: The stored procedure is a precompiled SQL statement. The advantage is that it allows a modular design, which means that it only needs to be created once and can be called multiple times in the program later. If a certain operation requires multiple executions of SQL, using stored procedures is faster than executing simple SQL statements. Stored procedures can be called using a command object.

3. What is the role of index? And what are its advantages and disadvantages?

Answer: An index is a special query table that the database search engine can use to speed up data retrieval. It is very similar to the table of contents of a book in real life. You can find the data you want without querying the entire book. Indexes can be unique. Creating an index allows you to specify a single column or multiple columns. The disadvantage is that it slows down data entry and increases the size of the database.

4. What is a memory leak?

Answer: Generally, the memory leak we refer to refers to the leak of heap memory. Heap memory is allocated by the program from the heap and can be of any size. The memory must be released after use. When an application creates an object using the keyword new, etc., it allocates a piece of memory for it from the heap. After use, the program calls free or delete to release the memory. Otherwise, the memory cannot be used. We say that the memory is leaked.

5. What is a transaction? What is a lock?

Answer: A transaction is a group of SQL statements that are bound together as a logical unit of work. If any statement operation fails, the entire operation will fail, and future operations will be rolled back to the state before the operation, or There is a node on it. To ensure that something is either executed or not executed, transactions can be used. For a grouped statement to be considered a transaction, it needs to pass the ACID tests, namely atomicity, consistency, isolation, and durability.

Lock: In all DBMS, locks are the key to realizing transactions. Locks can ensure the integrity and concurrency of transactions. Just like a lock in real life, it can prevent the owner of certain data from using certain data or data structures for a certain period of time. Of course, locks are also divided into levels.

6. What is a view? What is a cursor?

Answer: A view is a virtual table that has the same functions as a physical table. You can add, modify, query, and operate views. Views are usually a subset of rows or columns in one table or multiple tables. Modifications to the view do not affect the underlying tables. It makes it easier for us to obtain data compared to multi-table queries.

Cursor: It effectively processes the query result set as a unit. The cursor can be positioned on a specific row in the cell to retrieve one or more rows from the current row in the result set. You can make changes to the current row of the result set. Cursors are generally not used, but when data needs to be processed one by one, cursors are very important.

The above is the detailed content of Summary of mysql interview questions. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template