当前位置:网站首页>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 查出版本
边栏推荐
- The TOKEN value of Kubernetes joining the cluster expires
- The process and specific code of sending SMS verification code using flask framework
- docker安装postgresSQL和设置自定义数据目录
- 剑指offer基础版 ---- 第26天
- C语言实验四 循环结构程序设计(一)
- About the problems encountered by Xiaobai installing nodejs (npm WARN config global `--global`, `--local` are deprecated. Use `--location=glob)
- mysql 的简单运用命令
- 初涉C语言
- leetcode-每日一题731. 我的日程安排表 II
- 剑指offer专项突击版 --- 第 3 天
猜你喜欢
随机推荐
Anaconda configure environment directives
对list集合进行分页,并将数据显示在页面中
Interviewer, don't ask me to shake hands three times and wave four times again
04 【计算属性 侦听属性】
剑指offer基础版 --- 第22天
leetcode-每日一题731. 我的日程安排表 II
leetcode-每日一题735. 行星碰撞(栈模拟)
关于superset集成到自己的项目中
数字取证autopsy工具用法
Redis 事务学习有感
剑指offer专项突击版 --- 第 3 天
wpf wrapPanel居中并从左到右排列
第7章 网络层第2次练习题答案(第三版)
11 【定位】
leetcode-1833. 雪糕的最大数量(排序+贪心)
闭包(二)
Refinement of the four major collection frameworks: Summary of List core knowledge
13 【代理配置 插槽】
leetcode-每日一题1252. 奇数值单元格的数目(模拟优化)
剑指offer基础版 ---- 第27天








