阅读量:2
在Oracle中实现查询第一条数据可以使用以下方法:
- 使用ROWNUM:
SELECT * FROM table_name WHERE ROWNUM = 1;
- 使用ROW_NUMBER()函数:
SELECT * FROM ( SELECT *, ROW_NUMBER() OVER (ORDER BY column_name) AS rn FROM table_name ) WHERE rn = 1;
- 使用FETCH FIRST 1 ROW ONLY:
SELECT * FROM table_name FETCH FIRST 1 ROW ONLY;