修改

alter table t1 add(y int); 添加
alter table t1 add(z int, a int);
alter table t1 drop(z,a); 删除
alter table t1 modify(y char); 修改类型
alter table t1 modify(y default 'a'); 默认字段改成a
alter table t1 disable novalidate constraint t1_x_pk; 关闭索引
insert into t1 values (1,'a');
insert into t1 values (1,'b');
alter table t1 enable validate consitraint t1_x_pk; 开启索引



视图
优点:
使复杂查询变简单

安全限制访问 限制对底层敏感地区的访问

数据库只限制到表级别

竖列:
整数的生成器

cycle 循环 nocycle 不循环 // 一般是不循环

cache 缓存 nocache 不缓存

nextval 每调用一次就增长 currval 至查看当前值

索引

改善查询系统

主键和唯一性约束自动创建索引:
SQL> select constraint_name, constraint_type from user_constraints where table_name='EMPLOYEES';
SQL> select index_name, index_type 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 @ 2017-08-06 14:48  罗汉泽  阅读(86)  评论(0编辑  收藏  举报