77范文网 - 专业文章范例文档资料分享平台

Oracle常用代码总结

来源:网络收集 时间:2021-04-05 下载这篇文档 手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:或QQ: 处理(尽可能给您提供完整文档),感谢您的支持与谅解。点击这里给我发消息

java开发中的总结 大家可以看看哦

建表语句:
1.bak_emp:
create table bak_emp(empno number(4) primary key,ename varchar2(30),job varchar2(30),mgr number(4),hiredate date,sal number(7,2),comm number(5,2),deptno number(4));
2.acount_asscess:
create table account_asscess(accountno char(15) not null,flag int,money number(10,2));
3.depositor:
create table depositor(accountno char(15) primary key,money number(10,2) not null);
基础查询:
select * from guyuan;(全部查询)
select employee_id,job_id from guyuan;(按列名查询)
select fast_name 姓名,job_id 工作,department_id 部门 from guyuan;(列别名查询)

简单查询:
select * from guyuan where salary between 8000 and 30000;(临界条件查询)
select * from guyuan where department_id = 30;(根据值查询)
select * from guyuan where fast_name = 'Berry';
select * from guyuan where salary <= 6000;(模糊范围查询)
select * from guyuan where salary between 5000 and 30000;(between。。。and...)
select * from guyuan where manager_id in(1001,1003);(in指定值查询)
select * from guyuan where fast_name like '_e%';(第二个字符为e的查询)
select * from guyuan where fast_name like 'B%';(首字母为B的查询)
select * from guyuan where manager_id is null;(列中空值查询)
select * from guyuan where salary >=9000 and job_id like '%项目%';(字符串查询)
select * from guyuan where job_id not in('项目经理','董事');(not in查询)
select * from guyuan where job_id = '项目经理' or job_id = '开发人员';(or查询)
select * from guyuan where job_id like '%项目%' or job_id like '开发%' and salary > 6000;(条件查询+or+and)
select fast_name,job_id,salary from guyuan order by salary;(分组排序 升序)
select fast_name,job_id,salary from guyuan order by salary desc;(分组排序 降序)
select fast_name,job_id,salary,hiredate from guyuan order by hiredate;
select fast_name,salary,commission,salary+commission total from guyuan order by total;(分组排序+组函数)
select fast_name,salary,commission,salary+commission total from guyuan order by total desc;
select employee_id,fast_name,salary,department_id from guyuan order by salary,department_id desc;(多条件分组排序+组函数)
select distinct department_id,job_id from guyuan;(取消重复)
select fast_name,job_id,salary,mod(salary,5000) from guyuan;(整除取余函数)
select fast_name,hiredate from guyuan;(日期函数)
select fast_name,hiredate,sysdate,(-(sysdate-hiredate))/7 from guyuan;(系统时间,雇用周)
select add_months('1-1月-2011',8) from dual;(add_months函数)


简单函数:
select employee_id,fast_name from guyuan where LOWER(fast_name) = 'forever'(使用小写函数转化后为引号的内容)
select employee_i
d,fast_name from guyuan where Upper(fast_name) = 'FOREVER';(使用大写函数转化后为引号的内容)
select employee_id,concat(fast_name,job_id),lpad(salary,10,'*'),le

百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说教育文库Oracle常用代码总结在线全文阅读。

Oracle常用代码总结.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印 下载失败或者文档不完整,请联系客服人员解决!
本文链接:https://www.77cn.com.cn/wenku/jiaoyu/1206105.html(转载请注明文章来源)
Copyright © 2008-2022 免费范文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ: 邮箱:tiandhx2@hotmail.com
苏ICP备16052595号-18
× 注册会员免费下载(下载后可以自由复制和排版)
注册会员下载
全站内容免费自由复制
注册会员下载
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: