The mysql Database id cannot be deleted because the database has not been involved for a long time, and the SQL statements have forgotten a lot. Recently, this is only because the backend server uses Mysql to store data. In order to make online time statistics, the server must record the online status of users in some time periods. In fact, implementation is not very difficult, but when there are multiple lines, it may involve writing data to the database from multiple servers. At this time, it is very difficult to determine if the id has an upper layer. Therefore, the id should be updated automatically. For example, if column a is defined as unique and the value is 1, the following statements have the same effect, that is, once the entry and exit records contain a = 1, directly update c = c + 1 without executing c = 3. 1 insert into table (a, B, c) values (1, 2, 3) on duplicate key update c = c + 1; 1 update table set c = c + 1 where a = 1; it is also worth mentioning that this statement is in mysql, but not in standard SQL statements.