The results of the mysql in function are different from expected, and the exception is null.

Source: Internet
Author: User

The results of the mysql in function are different from expected. After the exception of null is processed several times, the number of accounts in the game reaches. Some operations on the whole point lead to slow server response. Later, I found that, as developers, there is no need to store accounts without actual content. For games, there is no need to store accounts without roles. After all, some accounts with roles cannot even reach 1%. So I decided to delete these accounts with no roles. Select count (*) from user; + ---------- + | count (*) | + ---------- + | 1004897 | + ---------- + select count (*) from player; + ---------- + | count (*) | + ---------- + | 57342 | + ---------- + delete from user where id not in (select user_id from player) + ---------- + | count (*) | + ---------- + | 0 | + ---------- + I am confused about the problem, because the user id and the player user_id are unique and I accidentally think of null. Check whether the select user_id from player contains null, resulting in an exception in the result. After deleting the record, everything is normal. It seems that null is not close to the language, which requires special consideration. It is also a special case in the database ..

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.