chu*_*ash 12 limits sql-standard
目前是否计划标准化一种限制查询返回结果数量的最佳方法?
是否有 ANSI SQL 替代 MYSQL LIMIT 关键字的堆栈溢出问题?列出了用不同语言处理这种行为的各种方法:
DB2 -- select * from table fetch first 10 rows only
Informix -- select first 10 * from table
Microsoft SQL Server and Access -- select top 10 * from table
MySQL and PostgreSQL -- select * from table limit 10
Oracle -- select * from (select * from table) where rownum <= 10
Run Code Online (Sandbox Code Playgroud)
我不经常玩数据库,所以我在这里说的是无知,但似乎这是一个非常重要的功能 - 至少足够重要,当我看到它被留给供应商时我会挠头。
Phi*_*lᵀᴹ 20
我可以在 Internet 上找到的最新 SQL 标准草案(日期为 21/12/2011)具有以下可用于查询表达式的内容:
<result offset clause> ::=
OFFSET <offset row count> { ROW | ROWS }
<fetch first clause> ::=
FETCH { FIRST | NEXT } [ <fetch first quantity> ] { ROW | ROWS } { ONLY | WITH TIES }
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3926 次 |
| 最近记录: |