当前位置:网站首页>"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
边栏推荐
猜你喜欢
随机推荐
实验8 DNS解析
Sword Point Offer Special Assault Edition ---- Day 1
MySQL压缩包方式安装,傻瓜式教学
leetcode-每日一题731. 我的日程安排表 II
Linux中mysql密码修改方法(亲测可用)
第7章 网络层第1次练习题答案(第三版)
uni-app进阶之认证【day12】
代码块、Package,Import,封装(第六天)
mysql启动报错The server quit without updating PID file几种解决办法
C language tutorial (3) - if and loop
sqlmap注入教程 常用指令
Qt Creator + CMake 运行调试总会自动 build 所有目标
Redis管道技术/分区
闭包(四)----IIFE
feign调用不通问题,JSON parse error Illegal character ((CTRL-CHAR, code 31)) only regular white space (r
wpf ScrowViewer水平滚动
The process and specific code of sending SMS verification code using flask framework
C语言文件读、写、定位函数
tf.keras.utils.pad_sequences()
First acquaintance with Flask
![[JVM Loading]---Class Loading Mechanism](/img/b6/d1754cb6699d18602ca9a463571c0c.png)







