Game Test-DATABASE statement 1

Source: Internet
Author: User

Select Id,name,energy from db_name where engrgy between ' and ' 201 '
1 Ordering of output content requires the use of order by ASC for DESC from small to large
Select Id,name,energy from db_name where Engrgy between ' "and ' 201 ' order by energy ASC
From small to large, they rank 100 and 201.
The column name after order by can also be sorted by the number of columns in the query result, starting with 1, both of which result.

Select Id,name,energy from db_name where engrgy between ' + ' and ' 201 ' ORDER by 3 ASC


the query above uses the SQL function to calculate 1 query interval engrgy sum of the function
Select Id,name,energy from db_name where Engrgy between ' "and ' 201 ' ORDER BY 3 ASC Change statement to
Select Id,name,sum from db_name where engrgy between ', ' and ' 201 ' ORDER by 3 ASC
Max uses the same thing.

Select Id,name,max from db_name where engrgy between ', ' and ' 201 ' ORDER by 3 ASC
you can also see a few conditions at a time, but this time the ID and name are not valid.
query does not change results
Select Id,name,max, Min (energy), Avg. from db_name where engrgy between ' + ' 201 ' ORDER by 3 asc

testing needs to know what the key fields you need to query are
or with energy?
See how many counts, and of course you can see how many line the output station has
Select Id,name,count from db_name where engrgy between ', ' and ' 201 ' ORDER by 3 ASC
The output result is
ID Name count (energy)
design to the function of the
ID here is unique, so not suitable. Here we're going to change the rule ID can appear more than once but associate name
Select Id,name,sum (energy) from the DB_NAME Group by ID
Add the physical strength of the same ID.
An energy extension of more than 1000 is listed below
because the function is involved
Select Id,name,sum (energy) from the DB_NAME GROUP by ID has sum (energy) >1000

Multi-Table Query
We're going to look at 1 arenas. Db_arena and User table Db_role These 2 tables are strongly correlated
Find a unique field ID
Sort by Rank
Select Role.id,role.name,arena.rank,role.name,role.energy from Db_arena arena,db_role role where role.id = Arena.id Group BU Bank
the input results contain 2 table contents.

Game Test-DATABASE statement 1

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.