select tablespace_name from dba_data_files;
--查询表空间
alter user scott account unlock;
alter user scott identified by 123456;
conn scott/123456
create table emp1 as select * from emp;
create unique index PK_UN on emp1(empno);
create bitmap index PK_BM on emp1(deptno);
conn system/12345678
GRANT CREATE VIEW TO SCOTT; --赋予scott权限
conn scott/123456
create view VIEW_01 as select empno, ename, sal, deptno from emp;
create view VIEW_01(员工号,员工名,工资,部门号) as select empno, ename, sal, deptno from emp;
create or replace view VIEW_01 as select empno 员工号01, ename 员工名, sal 工资, deptno 部门号 from emp;
创建一个视图,员工工资大于2000的员工的年工资
create or replace view view02 as select empno, ename, sal*12 as 年工资 from emp where sal>2000;
create or replace view view03 as select deptno,count(empno) 人数, avg(sal) 平均工资, job 职位 from emp group by job,deptno;
select * from view03;
SQL> create sequence sq_01;
序列已创建。
SQL> select sq_01.nextval from dual;
NEXTVAL
----------
1
SQL> select sq_01.currval from dual;
CURRVAL
----------
1
create table s( sno number(10), sname varchar2(10));
insert into s values(sq_01.nextval, 'sss');
alter sequence sq_01 maxvalue 15;
alter user scott account unlock;
alter user scott identified by 123456;
conn scott/123456
create table emp1 as select * from emp;
create unique index PK_UN on emp1(empno);
create bitmap index PK_BM on emp1(deptno);
conn system/12345678
GRANT CREATE VIEW TO SCOTT; --赋予scott权限
conn scott/123456
create view VIEW_01 as select empno, ename, sal, deptno from emp;
create view VIEW_01(员工号,员工名,工资,部门号) as select empno, ename, sal, deptno from emp;
create or replace view VIEW_01 as select empno 员工号01, ename 员工名, sal 工资, deptno 部门号 from emp;
创建一个视图,员工工资大于2000的员工的年工资
create or replace view view02 as select empno, ename, sal*12 as 年工资 from emp where sal>2000;
create or replace view view03 as select deptno,count(empno) 人数, avg(sal) 平均工资, job 职位 from emp group by job,deptno;
select * from view03;
SQL> create sequence sq_01;
序列已创建。
SQL> select sq_01.nextval from dual;
NEXTVAL
----------
1
SQL> select sq_01.currval from dual;
CURRVAL
----------
1
create table s( sno number(10), sname varchar2(10));
insert into s values(sq_01.nextval, 'sss');
alter sequence sq_01 maxvalue 15;