当前位置:网站首页>"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 2
uni-app进阶之内嵌应用【day14】
gin框架学习-Gin框架和Gorm框架搭建一个简单的API微服务
find、filter、map的区别
对递归的一些感悟
2021面经-拥抱变化
wpf wrapPanel居中并从左到右排列
07 【内置指令 自定义指令】
08 【生命周期 组件】
闭包(三)----执行环境
Yuan prospect and four track of the universe
字符串的扩展
局部变量成员变量、引用类型、this,static(第五天)
vulhub靶场学习日记hackme1
04 【计算属性 侦听属性】
数字孪生将成为进入“元宇宙”一项重要的途径
踏上编程之路,你必须要干的几件事
阿里云中mysql数据库被攻击了,最终数据找回来了
Linux修改MySQL数据库密码
什么是 GameFi?









