ImageVerifierCode 换一换
格式:DOCX , 页数:11 ,大小:18.52KB ,
资源ID:1175531      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/1175531.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(oracle数据库常用的99条查询语句.docx)为本站会员(b****2)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

oracle数据库常用的99条查询语句.docx

1、oracle数据库常用的99条查询语句1. select * from emp;2. select empno, ename, job from emp;3. select empno 编号, ename 姓名, job 工作 from emp;4. select job from emp;5. select distinct job from emp;6. select distinct empno, job from emp;说明:因为雇员编号不重复, 所以此时证明所有的列没有重复,所以不能消除掉重复的列.7. 查询出雇员的编号, 姓名, 工作, 但是显示的格式:编号是: 7369 的雇员

2、, 姓名是: smith, 工作是: clearselect 编号是: | empno | 的雇员, 姓名是: | ename | , 工作是: | job from emp;8. 求出每个雇员的姓名及年薪select ename, sal * 12 income from emp;9. 求出工资大于 1500 的所有雇员信息select * from emp where sal 1500;10. 查询每月可以得到奖金的雇员信息select * from emp where comm is not null;11. 查询没有奖金的雇员信息select * from emp where comm

3、 is null;12. 查询出基本工资大于 1500 同时可以领取奖金的雇员信息select * from emp where sal 1500 and comm is not null;13. 查询出基本工资大于 1500 或者可以领取奖金的雇员信息select * from emp where sal 1500 or comm is not null;14. 查询出基本工资不大于 1500 或者不可以领取奖金的雇员信息select * from emp where not(sal 1500 and comm is not null);15. 查询基本工资大于 1500, 但是小于 300

4、0 的全部雇员信息select * from emp where sal 1500 and sal = 1500 and sal = 3000;select * from emp where sal between 1500 and 3000;17. 查询出在 1981 年雇佣的全部雇员信息(1981 年 1 月 1 日 到 1981 年 12 月 31 日之间的雇佣的雇员)select * from emp where hiredate between 1-1月-81 and 31-12月-81;18. 要求查询出姓名是 smith 的雇员信息select * from emp where

5、ename = SMITH;19. 要求查询出雇员是 7369, 7499, 7521 的雇员的具体信息select * from emp where empno = 7369 or empno = 7499 or empno = 7521;select * from emp where empno in(7369, 7499, 7521);20. 要求查询出雇员不是 7369, 7499, 7521 的雇员的具体信息select * from emp where empno not in(7369, 7499, 7521);21. 要求查询出姓名是 smith, allen, king 的雇

6、员信息select * from emp where ename in(SMITH, ALLEN, KING);22. 查询出所有雇员姓名中第二个字母包含 M 的雇员信息 select * from emp where ename like _M%;23. 查询出雇员姓名中包含字母 M 的雇员信息select * from emp where ename like %M%;24. 要求查询出在 1981 年雇佣的雇员信息select * from emp where hiredate like %81%;25. 查询工资中包含 5 的雇员信息select * from emp where sa

7、l like %5%;26. 查询雇员编号不是 7369 的雇员信息select * from emp where empno != 7369;select * from emp where empno 7369;27. 要求按照工资由低到高排序select * frm emp order by sal;select * from emp order by sal asc;28. 要求按照工资由高到低排序select * from emp order by sal desc;29. 要求查询出 20 部门的所有雇员信息, 查询的信息按照工资由高到低排序,如果工资相等,则按照雇佣日期由早到晚排序

8、.select * from emp where deptno = 20 order by sal desc, hiredate asc;30. 将小写字母变为大写字母select upper(hello) from dual;31. 将大写字母变为小写字母select lower(HELLO WORLD) from dual;32. 要求查询出姓名是 smith 的雇员信息select * from emp where ename = upper(smith);33. 使用 initcap() 函数将单词的第一个字母大写select initcap(hello world) from dua

9、l;34. 将雇员表中的雇员姓名变为开头字母大写select initcap(ename) from emp;35. 将字符串 hello 和 world 进行串联select concat(hello , world) from dual;36. 对字符串进行操作的常用字符处理函数select substr(hello, 1, 3) 截取字符串, length(hello) 字符串的长度, replace(hello, l, x) 字符串替换 from dual;select substr(hello, 0, 3) 截取字符串, length(hello) 字符串的长度, replace(h

10、ello, l, x) 字符串替换 from dual;37. 显示所有雇员的姓名及姓名的后三个字符select ename, substr(ename, length(ename) -2) from emp;select ename, substr(ename, -3, 3) from emp;38. 使用数值函数执行四舍五入操作select round(789.536) from dual;39. 要求将 789.536 数值保留两位小数select round(789.536, 2) from dual;40. 要求将 789.536 数值中的整数的十位进行四舍五入进位select ro

11、und(789.536, -2) from dual;41. 采用 trunc() 函数不会保留任何小数,而且小数点也不会执行四舍五入的操作select trunc(789.536) from dual;42. 通过 trunc() 也可以指定小数点的保留位数select trunc(789.536, 2) from dual;43. 作用负数表示位数select trunc(789.536, -2) from dual;44. 使用 mod() 函数可以进行取余的操作select mod(10, 3) from dual;45. 显示 10 部门雇员进入公司的星期数(当前日期 - 雇佣日期

12、= 天数 / 7 = 星期数)select empno, ename, round(sysdate - hiredate) / 7) from emp where deptno = 10;46. 日期函数months_between(): 求出给定日期范围的月数add_months(): 在指定的日期上加上指定的月数, 求出之后的日期next_day(): 指定日期的下一个日期last_day(): 求出给定日期当月的最后一天日期47. select empno, ename, months_between(sysdate, hiredate) from emp;select empno, e

13、name, round(months_between(sysdate, hiredate) from emp;48. select sysdate, add_months(sysdate, 4) from dual;49. select next_day(sysdate, 星期一) from dual;50. select last_day(sysdate) from dual;51. 转换函数to_char(): 转换成字符串to_number(): 转换成数字to_date(): 转换成日期52. 查询所有雇员的雇员编号, 姓名, 雇佣日期select empno, ename,to_ch

14、ar(hiredate, yyyy) year,to_char(hiredate, mm) months,to_char(hiredate, dd) dayfrom emp;select empno, ename, to_char(hiredate, yyyy-mm-dd) from emp;select empno, ename, to_char(hiredate, fmyyyy-mm-dd) from emp;53. 查询所有雇员的编号, 姓名和工资select empno, ename, sal from emp;select empno, ename, to_char(sal, 99,

15、999) from emp;select empno, ename, to_char(sal, L99,999) from emp;select empno, ename, to_char(sal, $99,999) from emp;54. select to_number(123) + to_number(123) from dual;55. 将一个字符串转换成日期类型select to_date(2009-01-01, yyyy-mm-dd) from dual;56. 求出每个雇员的年薪(要求加上奖金)select empno, ename, sal, comm, (sal + comm) * 12 from emp;select empno, ename, sal, comm, nvl(comm,

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1