Returns the number of rows of data before

 In practice, we may be based on some sort after, just before the show how many pieces of data, then you need based on different databases, using different keywords

一、SQL Server/Access

  select number of top / percentage from table

  Such as:

  select top 10 from ticket --- ticket return the first 10 rows in the data table

  select top 10 from ticket where name = 'test' --- returns the first 10 rows in the data table ticket, name of the test

  select top 10 from ticket order by id desc --- 10 before returning the id data for reverse

  select top 10 percent from ticket --- return ticket data table top 10% 

Two, MySQL

  select * from table limit starting value, number of

  Such as:

  select * from ticket limit 1,5 --- return ticket table, rows 1-5

三、Oracle

  select * from table where ROWNUM<=数量

  Such as:

  select * from ticket where ROWNUM <= 10 --- return list, the first 10 rows ticket

 

 

This article comes from: https://www.cnblogs.com/smallstone2018/p/11165421.html

 

Guess you like

Origin www.cnblogs.com/JonaLin/p/11165503.html