PostgreSQL 8.3';s相当于Oracle';是罗纳姆吗?
在Oracle中,您可以执行以下操作:PostgreSQL 8.3';s相当于Oracle';是罗纳姆吗?,sql,postgresql-8.3,Sql,Postgresql 8.3,在Oracle中,您可以执行以下操作: select rownum, -- here's the magic name as country, population as pop_mil from country where name like 'C%' and member = true order by population; 得到 rownum country pop_mil ------ -------- -
select
rownum, -- here's the magic
name as country,
population as pop_mil
from
country
where
name like 'C%' and
member = true
order by
population;
得到
rownum country pop_mil
------ -------- -------
1 Croatia 5
2 Chad 11
3 Cuba 11
4 Canada 35
5 Colombia 48
6 China 1360
请注意,rownum与行在表中的存储方式无关。它是一个伪列,在完成所有筛选和排序操作后枚举结果集中的行
我知道在版本>=8.4()中有一个解决方法(行数()超过…
),但我的数据库是8.3,短期内没有迁移计划
-在PostgreSQL 8.3中有没有办法做到这一点?升级到受支持的Postgres版本。8.3是结束life@a_horse_with_no_name写一个答案,说明8.3中无法完成,我会接受。