当前位置:网站首页>"limit" query in Oracle database
"limit" query in Oracle database
2022-07-31 05:52:00 【not used to having you】
Note: For technical discussion only, do not use for other purposes, all consequences have nothing to do with me.
We all know that the limit function is suitable for mysql database and cannot be used in Oracle database. When we need to use paging query, we can replace it with other methods.
Distinguish single and double quotation marks in Oracle database
Method 1: Not equal method (general method)
select * from user_tab_columns where table_name='ADMIN' and rownum = 1 and column_name<>'UNAME'
Use the unequal sign to invert, where rownum=1 outputs one row, if you want to output two rows, rownum<3.
You can also use not in to exclude
In the above way of writing, if there are too many table names to be excluded, the statement will be very long. There is a better way, using the not in keyword, only need to put the table to be excludedJust write the name directly.
select * from user_tab_columns where table_name='ADMIN' and rownum = 1 and column_name not in('ADMIN','MD5')
Method 2: Alias method
Aliases can only be used for field names, not for table names
select * from (select column_name,rownum n from user_tab_columns where table_name= 'ADMIN') where n=2
rownum n is an alias, and the parentheses are subqueries. I think this statement is to execute the following where first, and then query the inside.
Extended Oracle related query statement:
select * from all_tables query all tables
select * from user_tables Query all tables created by the current user
select * from all_tab_columns query all fields
select * from user_tab_columns Query all tables created by the current user
select * from v$version find out version
边栏推荐
- Sword Point Offer Special Assault Edition ---- Day 1
- 【swagger关闭】生产环境关闭swagger方法
- uni-app进阶之认证【day12】
- win11中利用IIS10搭建asp网站
- 【数据库学习】Redis 解析器&&单线程&&模型
- gin框架学习-JWT认证
- 【云原生】微服务Nacos的简单介绍与使用
- 【ubuntu20.04安装MySQL以及MySQL-workbench可视化工具】
- 字符串的扩展
- GUCCI, LV and other luxury giant universe how to layout yuan, other brands should keep up with?
猜你喜欢
随机推荐
Linux modify MySQL database password
Sword Point Offer Special Assault Edition ---- Day 2
闭包(五)----一个常见的循环
数据库上机实验1 数据库定义语言
File operations in C language (1)
Error: Cannot find module 'D:\Application\nodejs\node_modules\npm\bin\npm-cli.js'
【ubuntu20.04安装MySQL以及MySQL-workbench可视化工具】
Redis:简单实用
vulhub靶场学习日记SickOs1.2
字符串的新增方法
10 【组件编码流程 组件自定义事件 全局事件总线】
11 【组件通信】
[Elastic-Job source code analysis] - job listener
第7章 网络层第2次练习题答案(第三版)
04 【计算属性 侦听属性】
gin框架学习-Casbin入门指南(ACL、RBAC、域内RBAC模型)
Detailed explanation of pointers in C language
了解SSRF,这一篇就足够了
12 【网页布局总结 元素的显示与隐藏】
GUCCI、LV等奢侈品巨头如何布局元宇宙的,其他品牌应该跟上吗?







