- PostgreSQL Development Essentials
- Manpreet Kaur Baji Shaik
- 148字
- 2021-07-14 10:00:55
Using the LIMIT clause
The LIMIT
clause is used to retrieve a number of rows from a larger data set. It helps fetch the top n records. The LIMIT
and OFFSET
clauses allow you to retrieve just a portion of the rows that are generated by the rest of the query from a result set:
SELECT select_list FROM table_expression [LIMIT { number | ALL }] [OFFSET number]
If a limit count is given, no more than that many rows will be returned (but possibly fewer, if the query itself yields fewer rows). LIMIT ALL
is the same as omitting the LIMIT
clause.
The OFFSET
clause suggests skipping many rows before beginning to return rows. OFFSET 0
is the same as omitting the OFFSET
clause. If both OFFSET
and LIMIT
appear, then the OFFSET
rows will be skipped before starting to count the LIMIT
rows that are returned.
推薦閱讀
- Java逍遙游記
- Instant Testing with CasperJS
- GAE編程指南
- .NET之美:.NET關(guān)鍵技術(shù)深入解析
- PHP 7底層設(shè)計(jì)與源碼實(shí)現(xiàn)
- Django Design Patterns and Best Practices
- Visual Basic程序設(shè)計(jì)實(shí)驗(yàn)指導(dǎo)(第4版)
- 軟件架構(gòu):Python語言實(shí)現(xiàn)
- Java:High-Performance Apps with Java 9
- Node.js全程實(shí)例
- Mobile Device Exploitation Cookbook
- Android驅(qū)動(dòng)開發(fā)權(quán)威指南
- C語言程序設(shè)計(jì)簡明教程:Qt實(shí)戰(zhàn)
- Hands-On JavaScript for Python Developers
- Django Design Patterns and Best Practices