当前位置:网站首页>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 查出版本
边栏推荐
猜你喜欢
![[Introduction to MySQL 8 to Mastery] Basics - silent installation of MySQL on Linux system, cross-version upgrade](/img/af/7a2cdcc6535c04c508c9ddf9ee0cb2.png)
[Introduction to MySQL 8 to Mastery] Basics - silent installation of MySQL on Linux system, cross-version upgrade

剑指offer专项突击版 ---- 第2天

Why use Flink and how to get started with Flink?

Quickly master concurrent programming --- the basics

The process and specific code of sending SMS verification code using flask framework

【LeetCode-SQL每日一练】——2. 第二高的薪水

Interview Redis High Reliability | Master-Slave Mode, Sentinel Mode, Cluster Cluster Mode
uni-app进阶之认证【day12】

vulhub靶场学习日记SickOs1.2
uni-app进阶之内嵌应用【day14】
随机推荐
uni-app进阶之样式框架/生产环境【day10】
[mysql improves query efficiency] Mysql database query is slow to solve the problem
vulhub靶场学习日记hackme1
torch.normal函数用法
Proteus 8 Professional安装教程
wpf wrapPanel居中并从左到右排列
a different object with the same identifier value was already associated with the session
【数据库学习】Redis 解析器&&单线程&&模型
“档次法”——用于物品体积分布不均匀的01背包问题的求解方法
Distributed Transactions - Introduction to Distributed Transactions, Distributed Transaction Framework Seata (AT Mode, Tcc Mode, Tcc Vs AT), Distributed Transactions - MQ
账号或密码多次输入错误,进行账号封禁
Volatility取证工具使用日记
Goodbye to the cumbersome Excel, mastering data analysis and processing technology depends on it
Kubernetes certificate validity period modification
leetcode-2321. 拼接数组的最大分数(差分+枚举)
剑指offer专项突击版 ---- 第1天
关于小白安装nodejs遇到的问题(npm WARN config global `--global`, `--local` are deprecated. Use `--location=glob)
10 【组件编码流程 组件自定义事件 全局事件总线】
tf.keras.utils.pad_sequences()
MySQL (updating)