8月2

 

User process:用户进程

Server process:服务器进程

Shared pool:共享池

Library cache:库高速缓存

Data dict cache:数据字典高速缓存

Database buffer cache:数据库缓冲区高速缓存

Redo log buffer cache:重做日志缓冲区

Parameter file:参数文件

Password file:口令文件

Data files:数据文件

Control files:控制文件

Redo log buffer cache:重做日志文件

Archived log files:归档日志文件

视图:保持数据的独立性

视图不允许做dml操作

视图和表示完全独立的两个类型,表被删除,视图还在,只是不能用。

在插入时会用到:

Sequence在后台表示某一行

Currval表示序列当前值

Nextval每调用一次,就变化一次。

索引时在表的基础上增加一些结构,索引的使用和维护都是系统自动完成。

create table emp (

    empno int constraint emp_empno_pk primary key,

    ename varchar2(20) constraint emp_ename_nn not null,

    email varchar2(50) constraint emp_email_uq unique,

    salary int constraint emp_salary_ck check(salary>0),

    deptno int constraint emp_deptno_fk references dept(deptno) on delete set null)或者on delete cascade

 

 

 

 

 

 

 

 

 

instead of trigger视图触发器

 

序列:

SQL> create sequence test_seq increment by 1 start with 1 maxvalue 1000 nocycle cache 20;

SQL> create table t1(x int primary key, y int);

SQL> insert into t1 values (test_seq.nextval, 11); 反复执行

SQL> select * from t1;

 

索引:

主键和唯一性约束自动创建索引:

SQL> select constraint_name, constraint_type from user_constraints where table_name='EMPLOYEES';

SQL> select index_name, index_type uniqueness from user_indexes where table_name='EMPLOYEES';

SQL> set autot on

SQL> select last_name from employees where employee_id=100; 走索引

SQL> select email from employees; 走索引

SQL> select last_name from employees where salary=2100; 全表扫描

SQL> create index emp_salary_ix on employees(salary);

SQL> select last_name from employees where salary=2100; 走索引

SQL> set autot off

 

posted on 2017-08-02 19:53  闹够了没有~  阅读(111)  评论(0编辑  收藏  举报