SQL statements in game testing and SQL statements in game Testing
The basic content will not be written here.
One compound condition is often used in game tests.
In the game, you usually need to check the remaining user money. For example, an energy field indicates physical strength.
Table name: db_role key field id, name (unique)
The condition to be queried is that energy is in the first gear of 1500, and the second gear is 500 ~ Between 1000
Statement is
Select id, name, energy from db_name whereenergy = 1500 OR (energy> = 500 andenergy <1000)
If you like as, you can add the as select id as xxx, name as xxx, energy as xxx
* If the energy you want to verify has a fixed number of 100 200 300 400
Select id, name, energy from db_name where engrgy in (100,200,300,400)
You can search and print the existing ones. Numbers that do not exist cannot be searched.
You can also use the in keyword field roldid (id) to query multiple roles)
Take 100 and 200 between two values, including 100 and 200.
Select id, name, energy from db_name where engrgy between '000000' and '000000'
If you want to include a 210
Select id, name, energy from db_name where engrgy between '000000' and '000000' OR (engrgy in (100 ))
Fuzzy search
Select id, name, energy from db_name where engrgy like '% number'
Note that if the number is "0%", the query is 0.