Oracle分页查询,check

(一)分页查询
分页查询根据rownum(行号)来进行分页限制,其中要用嵌套的select语句来进行查询。

!--第一层的rownum需要在order by rownum 排序之后查询出来
select * from(select t2.* from (select rownum r,t.* from emp t order by rownum) t2 where t2.r>=1) t3 where t3.r<=5

(二)check语句
check的语句就是检查,在存储数据的时候,是否有不符合表的数据插入。不符合则不能插入。

create table test_table(
       t_id number(10),
       t_name varchar2(10),
       t_age number(2),
       constraint check_age check (t_age>18 and t_age<36)
)

!--当向表中插入的t_age不在限制范围内,就会报错。
!--当表创建成功之后添加check,前提是表中的t_age都符合现在添加的限制条件,否则会出现违反检查约束条件错误
alter table test_table add constraint check_age check (t_age>18 and t_age<60)
!--删除check检查约束
alter table test_table drop constraint check_age

(三)NOT NULL约束

!--根据上面的表设置非空约束
alter table test_table modify t_name not null

!--设置为可以为null
alter table test_table modify t_name null
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值