Mysql entertainment explanation table relationship
In the previous chapter we talked about the wide range of applications of databases. Without the database, we may not be able to move forward in the future.
There are quite a lot of boys and girls learning computers now. Especially among the aboriginal Internet users born in the 80s and 90s, many people love to play games. We explain the relationship between tables through the user equipment information in the game.
Withdrawing money from the bank, transferring money, and sending red envelopes are also the most commonly used bank card operations in our daily life. We also use bank card deposits and withdrawals to explain the relationship between tables.
The relationship between equipment and users in the game
A character in the game has a helmet, clothes, boots, weapons, and necklaces.
And, each different weapon will add different attack and defense values. Then we can simulate the table design of the game in this way.
Note: The following is only for everyone to better understand the relationship between the game, users and equipment.
User table
User ID | Username | Mask | Boots | Weapon |
---|---|---|---|---|
Skeleton King | 1 | |||
Chaos Knight | 4 | | 2||
centaur | 7 |
Equipment table
Equipment name | Recovery Blood | Recovery Magic | Defense | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
10 | 3 | 5 | 2 | ||||||||||||||||
22 | 4 | 1 | 3 | ||||||||||||||||
3 | 4 | 5 | 4 | ||||||||||||||||
1 | 3 | 4 | 5 | ||||||||||||||||
5 | 6 | 3 | 6 | ||||||||||||||||
13 | 32 | 32 | 7 | ||||||||||||||||
11 | 33 | 45 |
Bank Card ID | Bank Card Number | Password | Whether to freeze | Balance |
---|---|---|---|---|
1 | ##6222 0202 0002 66014e10adc3949ba59abbe56e057f20f883e | 0 | 12345.00 | |
##5423 4321 4567 8889 | 5bd2026f128662763c532f2f4b6f2476 | 1 | 45.58 |
Scene simulation:
After the user inserts the card and enters the correct password. Then you can withdraw money- In social engineering, people like to use the same password. Therefore, the user's password must be encrypted again and cannot be decrypted reversely. Because I am afraid that after seeing a certain user's password, I will use this password to try the user's other bank cards.
- We stipulate by ourselves: the freezing status can be set to 0 (not frozen) and 1 (frozen). If the bank receives notice from the court. Then set the freeze status to 1. If you have money, you are not allowed to withdraw it. (This business logic needs to be implemented in the program).
- If the user withdraws money or deposits money, the user's balance will be increased or decreased. At the same time, the records will be recorded in the transaction flow.