当前位置:网站首页>Oracle数据库中的“limit”查询
Oracle数据库中的“limit”查询
2022-07-31 05:10:00 【不习惯有你】
注意:仅用于技术讨论,切勿用于其他用途,一切后果与本人无关。
都知道limit函数适用于mysql数据库,在Oracle数据库中无法使用,当需要使用到分页查询时,我们可以用其他的方法进行代替。
Oracle数据库中区分单双引号
方法一:不等于法(通用法)
select * from user_tab_columns where table_name='ADMIN' and rownum = 1 and column_name<>'UNAME'
使用不等于号进行取反,这里的rownum=1输出的是一行,想输出两行可rownum<3.
还可以使用not in来进行排除
上面这种写法,如果排除的表名多了,语句就会很长,还有一种更好的办法,使用not in关键字,只需要把要排除的表名直接写进去就好了
select * from user_tab_columns where table_name='ADMIN' and rownum = 1 and column_name not in('ADMIN','MD5')
方法二:别名法
别名只能用于字段名,不可以用于表名
select * from (select column_name,rownum n from user_tab_columns where table_name= 'ADMIN') where n=2
rownum n 是别名,括号里面是子查询,我觉得这个语句是先执行后面的where,然后再对里面的进行查询。
扩展Oracle相关的查询语句:
select * from all_tables 查询出所有的表
select * from user_tables 查询出所有当前用户创建的表
select * from all_tab_columns 查询出所有的字段
select * from user_tab_columns 查询出所有当前用户创建的表
select * from v$version 查出版本
边栏推荐
猜你喜欢

C语言实验五 循环结构程序设计(二)
![[mysql improves query efficiency] Mysql database query is slow to solve the problem](/img/fa/502a2efdd37508f15541558851a254.png)
[mysql improves query efficiency] Mysql database query is slow to solve the problem

详解扫雷游戏(C语言)

【数据库学习】Redis 解析器&&单线程&&模型

If the account number or password is entered incorrectly for many times, the account will be banned.

运用flask框架发送短信验证码的流程及具体代码

vulhub靶场学习日记hackme2

数据库上机实验7 数据库设计

Interviewer, don't ask me to shake hands three times and wave four times again

剑指offer专项突击版 ---- 第2天
随机推荐
Swordsman Offer Special Assault Edition --- Day 3
Kubernetes加入集群的TOKEN值过期
pytorch中的一维、二维、三维卷积操作
剑指offer专项突击版 ---- 第 6 天
基于web3.0使用钱包Metamask的三方登陆
leetcode-每日一题1217. 玩筹码(贪心+位运算)
torch.normal function usage
数据库上机实验1 数据库定义语言
Why use Flink and how to get started with Flink?
Input length must be multiple of 8 when decrypting with padded cipher
The interviewer asked me how to divide the database and the table?Fortunately, I summed up a set of eight-part essays
实验7 UDP与TCP对比
三次握手与四次挥手
C语言实验二 数据类型、运算符和表达式
uni-app进阶之认证【day12】
02 【el和data的两种写法 MVVM模型】
Qt Creator + CMake 运行调试总会自动 build 所有目标
解决响应式数据依赖响应式数据无响应问题
Swordsman Offer Special Assault Edition ---- Day 6
The process and specific code of sending SMS verification code using flask framework