Returning TOP N Records
Returning only the first N records in a SQL query differs quite a bit between database platforms.
Here's some samples:
Microsoft SQL Server
SELECT TOP 10 column FROM table
PostgreSQL and MySQL
SELECT column FROM table
LIMIT 10
Oracle
SELECT column FROM table
WHERE ROWNUM <= 10
Sybase
SET rowcount 10
SELECT column FROM table
Firebird
SELECT FIRST 10 column
FROM table
Due to these differences if you want to keep your code database independent you should use the maxrows
attribute in the cfquery
tag in ColdFusion. The tradeoffs to database independance is
performance, I would expect maxrows to be slower than specifying the
rows in the SQL.
<cfquery datasource="#ds#" maxrows="10">
SELECT column FROM table
</cfquery>
PostgreSQL and MySQL have a cool feature that will let you return an
arbitrary range of rows (eg return rows 10-20). This is very handy for
displaying pages of records:
SELECT column FROM table
LIMIT 10 OFFSET 20
The above query will return rows 20-30
分享到:
相关推荐
在本文中,我们介绍了Spring Boot AOP中的@AfterReturning注解,它用于定义在目标方法成功返回后执行的切面逻辑。我们通过一个图书管理系统的实例演示了@AfterReturning的使用方式,并在成功查询图书时记录了查询的...
NULL 博文链接:https://futeng.iteye.com/blog/1833449
python库。 资源全名:django_pg_returning-1.0.0-py2.py3-none-any.whl
attr_copy: copy an attribute list, returning the size in bytes.
RETURNING 自己通常结合DML 语句使用。(INSERT UPDATE DELETE) 使用方法: UPDATE table_name SET expr1 RETURNING column_name INTO xxx INSERT: 返回的是添加后的值 UPDATE:返回时更新后的值 DELETE:返回删除...
top - 15:16:35 up 2 days, 20:45, 2 users, load average: 7.26, 7.17, 7.16 Tasks: 580 total, 2 running, 578 sleeping, 0 stopped, 0 zombie Cpu(s): 0.0%us, 0.7%sy, 0.0%ni, 99.3%id, 0.0%wa, 0.0%hi, 0.0%...
主要介绍了Spring AOP定义AfterReturning增加,结合实例形式分析了Spring面相切面AOP定义AfterReturning增加相关操作技巧与使用注意事项,需要的朋友可以参考下
An Eco-tour of returning to nature.zip
returning-DOM-elements-javascript-源码.rar
安装$ npm i top.gg-core定const top = require ( 'top.gg-core' ) ;... //post only server count | returning: booleantopgg . post ( { servers : client . guilds . cache . size , shard : { id : client . Shard
The specified CGI application misbehaved by not returning a complete set of HTTP headers
top - 15:16:35 up 2 days, 20:45, 2 users, load average: 7.26, 7.17, 7.16 Tasks: 580 total, 2 running, 578 sleeping, 0 stopped, 0 zombie Cpu(s): 0.0%us, 0.7%sy, 0.0%ni, 99.3%id, 0.0%wa, 0.0%hi, 0.0%si,...
Function_pointer_returning_function_pointer
Funtion with return values in c++
NULL 博文链接:https://caohong286.iteye.com/blog/1486738
May expose internal representation by returning reference to mutable object 描述:调用get方法,获得对象属性,获得的对象属性是一个可变的对象; b) 建议处理 Dead store to local variable 描述:对一个局部...