Database Paging Query

Source: Internet
Author: User

Paging Statements :

Oracle:

--This paging query method is not only for simple query of single table, but is complex for the inner query.

--Multi-table union queries or the most internal queries contain sort as valid

SELECT  *  from  ( 

select   rownum  RN , T.*   from  

( select  * &NBSP, from  ftnemr. Patient_visit)  t  where Span style= "Color:rgb (0,0,128); font-family: ' Courier new ' ">&NBSP; rownum &NBSP;<=&NBSP; 40  )  

WHERE RN >= +

ORDER by patient_id;

--This is a much lower performance than the above approach

SELECT  *  from  ( 

select   rownum  RN,&NBSP;T.*&NBSP; from &NBSP;

( select Span style= "Color:rgb (0,0,128); font-family: ' Courier new ' ">&NBSP;*&NBSP;  ftnemr. patient_visit)  T   

where  rn   between &NBSP; 21 Span style= "Color:rgb (0,0,128); font-family: ' Courier new ' ">&NBSP; and &NBSP; 40 &NBSP; Span style= "Color:rgb (0,0,128); font-family: ' Courier New ' ">

ORDER by patient_id


SQL Server:

-- Find out from article I to article No.

SELECT TOP Ten * FROM dbo. HIS_BA1

WHERE FID not in (SELECT TOP of the FID from dbo. His_ba1 ORDER by FID)


Mysql:

SELECT *  from Table LIMIT 5,Ten;//retrieving Record lines6- the

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.