1.oracle 修改某列属性
alter table ttt modify ccc NUMBER(10) NULL;
2.特殊情况,需要用sql查询表的主键
3.设置某一列的默认值 Alter table 表名 modify 列名 default ‘AAA’
4.应尽量避免在 where 子句中使用 or 来连接条件,否则将导致引擎放弃使用索引而进行全表扫描,如:
select id from t where num=10 or num=20
可以这样查询:
select id from t where num=10
union all
select id from t where num=20
1.查询所有没有主键的表
select table_name
from user_tables a
where not exists (select *
from user_constraints b
where b.constraint_type = 'P'
and a.table_name = b.table_name)
1.查看所有的函数和存储过程
select name from user_source where type='PROCEDURE' group by name;
select name from user_source where type='FUNCTION' group by name;
1,PL/SQL看执行计划,看时间Cost
2.检索条件 加索引,加快查询速度
3.优化器,
推荐工具: Tosska SQL Tuning Expert 分32位64位,
https://www.cnblogs.com/dbexpert/p/9045767.html
本质就是利用Oracle的hint功能,指定执行计划
4.表连接的访问方法
union all 不去重复数据
union会去除重复数据
union与join的区别
join有连接条件,union是把结果一起显示(条件是列相同,类型相同)
4. oracle怎么查询所有的表空间的名称?
select tablespace_name from user_tablespaces;