sql statement to sort --- TOP and PERCENT limit the query

Before a query 10


Example:
the Select
Top 10
student number, student name, age, gender, home address,
the From
tb_Student
the Order By ASC student numbers

 

10 b after inquiry


The SELECT
Top 10
the From
tb_Student
the Order By DESC number of students

 

c 50% of the previous query sales book information
the Select
Top 50 Percent
ISBN, title
number Sum (sales) as the total sales of
the From
tb_Book
Group By
ISBN, title, author
Order By 3 desc

 

d to check stock at 20% of book information after


The SELECT
Top 20 Percent
*
the From
tb_BookMessage
the Order By number of existing ASC

Guess you like

Origin www.cnblogs.com/Wxw1992/p/11240654.html