- Paging
select * from emp;
select a.empno from (select * from emp) a;
select * from emp e where e.deptno in (select d.deptno from dept d where d.dname like '%A%')
--第一页
select * from (select rownum count,emp.* from emp) a where a.count>=1 and a.count<=3;
--第二页
select * from (select rownum count,emp.* from emp) a where a.count>=4 and a.count<=6;
- create private synonym to specify user permissions
GRANT CONNECT, CREATE SYNONYM TO yhy;
select * from scott.emp;
- Create private synonyms alias (Who is who created)
the Create E synonym for scott.emp;
select * from e
- create a total of synonyms
create public synonym pub_emp for scott.emp;
select * from pub_emp;
- Creating sequence
the Create Sequence jseq
Start with 1
INCREMENT by 1
select * from java0723
delete from java0723
insert into java0723 values (jseq.nextval, 'Xiong', '35723992', 'M', 'Zibo', to_date ( '2019-09-23', 'yyyy-mm-dd'), 10);
insert into java0723 values (jseq.nextval, 'bears two', '357239924', 'M', 'Zibo', to_date ( '2019-09-23', 'yyyy-mm-dd'), 10);
select jseq.currval from dual;
- assigned to the specified user permissions
grant create view to scott;
--创建视图
create view empinfo
as
select empno,ename,job,mgr,hiredate,sal,comm,emp.deptno from scott.emp join scott.dept on emp.deptno=dept.deptno
select * from empinfo
--index
- Create Test Table
Create Table t_testseq
(
ID Number,
name VARCHAR2 (10)
);
- create a sequence
Create Sequence seq_value
Start. 1 with
INCREMENT by. 1;
- General query
Select * from t_testseq where id = 99999 ;
- Create an index
the Create index TestIndex ON t_testseq (the above mentioned id);
- delete the index
drop index testIndex