orcale基础摘要
来源:互联网 发布:linux cp拷贝进度条 编辑:程序博客网 时间:2024/05/16 02:12
1. alter session set nls_date_format='yyyy=mm-dd';
2. trunc(4.5) -> 4 round(4.5) -> 5
3. select 'Hello' || name || '!' from bbs;
4. initcap 首字母大写 initcap(字段)
tower 小写 tower(字段)
upper 大写 upper(字段)
replace 替换 replace(字段,原值,替换为)
substr 字符串截取 substr(字段,开始位置,结果位置)
length 长度 length(字段)
nvl 空值转换 nvl(字段,转换为)
decode if elseif... decode(字段,if,{},elseif,{},elseif,{}......)
sign 正负值1 -1 0 sign(-5) -> -1
5. alter table a add primary key(id); 加主键
alter table a add modify(name not null); 加非空
alter table a add check(sex in('男','女')); 加检查
alter table a add check(sal between 500 and 1000); 加检查
6. select table_name from user_tables; 当前用户拥有表
select talbe_name from all_tables; 拥有+他人授权
7. 1)instersect select name from a instersect select name from b;
2)union .. union ..
3)minus .. minus ..
a 1,2,3,4,5,6
b 4,5,6
1)4,5,6 交集
2)1,2,3,4,5,6 合集
3)1,2,3 差集
8. create table a as select * from b;
复制表(不能复制约束)
create table a as select * from b where 1=2;
复制结构
insert into a select * from b;
insert into a(name) select name from b;
9. alter table a add(job varchar2(1)); 添加字段
alter table a modify(job varchar2(20)); 修改字段属性
alter table a drop colomn job; 删除字段
rename a to aa; 改表名
10. create synonym xxx from scott.emp; 同义词
-〉
select * from scott.emp;
select * from xxx;
11. grant select on emp to yan; 授权
grant 权限 on 表 to 用户;
12. create index idx_hiredate on emp(hiredate); 索引
drop index idx_hiredate;
- orcale基础摘要
- Orcale基础复习
- ORCALE
- orcale
- Diameter基础协议摘要
- Python基础笔记摘要
- Linux基础学习摘要
- C++基础摘要
- Linux基础命令摘要
- LINUX - 基础摘要 01
- 前端基础摘要
- 数据库orcale (sql基础) 第一天
- java基础摘要(一)
- mysql——基础摘要
- java基础--环境搭建摘要
- Commerce学习摘要(基础部分)
- 摘要下java基础小结
- Perl学习笔记1-基础摘要
- 费加罗的婚礼
- 几位男同胞被骗经历——BS女骗子,特别是利用感情骗人的女人
- .NET中日志信息写入Windows日志中解决方案
- 关于多条件查询的SQL语句
- BIOS问答
- orcale基础摘要
- 月薪8000元的司机给我上了震撼的一课
- ASP中数据库调用时常见错误的现象和解决
- Linux下文件压缩解压
- 搭建完工
- 使用JAXB处理XML文档
- SESSION
- C#发送邮件
- CSS样式控制图片裁切显示