The requirements are as follows: I have a table with the basic data, and a field is the management number. My goal is to first query the latest management number, generate a new management number according to the rules, and then insert the new data into the table because the query does not lock the table. so the two threads may find the same management number in the middle of the insert query? The key is the following MYSQL statement that inserts multiple records: [SQL] INSERT INTO clients (client_id, client_name, client_type) SELECT supplier_id, supplier_name, 'advertising' FROM suppliers WHERE not exists (select * from clients where clients. client_id = suppliers. supplier_id); INSERT a single record: [SQL] INSERT INTO clients (client_id, client_name, client_type) SELECT 10345, 'ibm ', 'advertising' FROM dual WHERE not exists (select * from clients wh Ere clients. client_id = 10345); therefore, you can check that the management number does not exist during insertion. If the insertion is unsuccessful, the latest management number is retrieved and re-calculated before insertion until the operation is successful. There are many such cases, such as tickets for trains and cinemas. Due to the large amount of concurrent processing, tickets with tickets are often found. However, this ticket has been sold when an order is placed, I don't know how these systems are handled. Author meditatorzhang