当前位置:网站首页>"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
边栏推荐
猜你喜欢
随机推荐
【Elastic-Job源码分析】——作业监听器
Year-end summary - the years are quiet~
leetcode-每日一题735. 行星碰撞(栈模拟)
PHP中abstract(抽象)、final(最终)和static(静态)原理与用法
Kubernetes certificate validity period modification
uni-app进阶之自定义【day13】
13 【代理配置 插槽】
【uiautomation】微信好友列表获取(存储到txt中)
对于输出点是时间戳的渗透测试方法(以Oracle数据库为例)
The MySQL database in Alibaba Cloud was attacked, and the data was finally recovered
leetcode-每日一题565. 数组嵌套(标记图和并查集)
Flask-based three-party login process
【C语言3个基本结构详解——顺序、选择、循环】
sqlmap注入教程 常用指令
永恒之蓝漏洞复现
Getting to know regular expressions
Redis 事务学习有感
Detailed explanation of pointers in C language
联盟链的真实场景在哪里
wpf ScrowViewer水平滚动