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

加入VIP,免费下载
 

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

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

下载须知

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

版权提示 | 免责声明

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

SQL笔试经文档格式.docx

1、select max(sal) as 最高工资,min(sal) as 最低工资,deptno as 部门号 from emp where job = group by deptno;3 对于emp中最低工资小于1000的部门,列出job为的员工的部门号,最低工资,最高工资 select max(sal) as 最高工资,min(sal) as 最低工资,deptno as 部门号 from emp as b where job= and 1000(select min(sal) from emp as a where a.deptno=b.deptno) group by b.deptno

2、4 根据部门号由高而低,工资有低而高列出每个员工的姓名,部门号,工资 select deptno as 部门号,ename as 姓名,sal as 工资 from emp order by deptno desc,sal asc 5 写出对上题的另一解决方法 (请补充) 6 列出张三所在部门中每个员工的姓名与部门号 select ename,deptno from emp where deptno = (select deptno from emp where ename = ) 7 列出每个员工的姓名,工作,部门号,部门名 select ename,job,emp.deptno,dept.

3、dname from emp,dept where emp.deptno=dept.deptno 8 列出emp中工作为的员工的姓名,工作,部门号,部门名 select ename,job,dept.deptno,dname from emp,dept where dept.deptno=emp.deptno and job=9 对于emp中有管理者的员工,列出姓名,管理者姓名(管理者外键为mgr) select a.ename as 姓名,b.ename as 管理者 from emp as a,emp as b where a.mgr is not null and a.mgr=b.emp

4、no 10 对于dept表中,列出所有部门名,部门号,同时列出各部门工作为的员工名与工作 select dname as 部门名,dept.deptno as 部门号,ename as 员工名,job as 工作 from dept,emp where dept.deptno *= emp.deptno and job = 11 对于工资高于本部门平均水平的员工,列出部门号,姓名,工资,按部门号排序 select a.deptno as 部门号,a.ename as 姓名,a.sal as 工资 from emp as a where a.sal(select avg(sal) from em

5、p as b where a.deptno=b.deptno) order by a.deptno 12 对于emp,列出各个部门中平均工资高于本部门平均水平的员工数和部门号,按部门号排序 select count(a.sal) as 员工数,a.deptno as 部门号 from emp as a (select avg(sal) from emp as b where a.deptno=b.deptno) group by a.deptno order by a.deptno 13 对于emp中工资高于本部门平均水平,人数多与1人的,列出部门号,人数,按部门号排序 select coun

6、t(a.empno) as 员工数,a.deptno as 部门号,avg(sal) as 平均工资 from emp as a where (select count(c.empno) from emp as c where c.deptno=a.deptno and c.sal(select avg(sal) from emp as b where c.deptno=b.deptno)1 group by a.deptno order by a.deptno 14 对于emp中低于自己工资至少5人的员工,列出其部门号,姓名,工资,以及工资少于自己的人数 select a.deptno,a.

7、ename,a.sal,(select count(b.ename) from emp as b where b.sala.sal) as 人数 from emp as a where (select count(b.ename) from emp as b where b.sal5 - -sql structured query language -DML-Data Manipulation Language-数据操作语言 query information (SELECT), add new rows (INSERT), modify existing rows (UPDATE), del

8、ete existing rows (DELETE), perform a conditional update or insert operation (MERGE), see an execution plan of SQL (EXPLAIN PLAN), and lock a table to restrict access (LOCK TABLE). -DDL-Data Definition Language-数据定义语言 create, modify,drop, or rename objects (CREATE,ALTER,DROP,RENAME), remove all rows

9、 from a database object without dropping the structure (TRUNCATE), manage access privileges (GRANT,REVOKE), audit database use (AUDIT,NOAUDIT) and add a description about an object to the dictionary (COMMENT). -Transaction Control事务控制语句 save the changes(COMMIT) or discard the changes (ROLLBACK) made

10、 by DML statements. Also included in the transaction-control statements are statements to set a point or marker in the transaction for possible rollback (SAVEPOINT) and to define the properties for the transaction (SET TRANSACTION). Used to manage the properties of the database. There isonly one sta

11、tement in this category (ALTER SYSTEM). -DCL-Data Control Language-与开发关系不是很密切,用于权限的分配与回收 grant,revoke,data control -Session Control control the session properties (ALTER SESSION) and to enable/disable roles (SET ROLE). -System Control - select的用法 -每个员工的所有信息 select * from emp -每个人的部门编号,姓名,薪水 select d

12、eptno,ename,sal from emp;-每个人的年薪 select ename,sal*12 from emp;-计算2*3的值 select 2*3 from emp;-计算2*3的值(dual) select 2*3 from dual;select * from dual;-得到当前时间 select sysdate from dual -可以给列起别名,比如求每个人的年薪 select ename,sal*12 salperyear from emp;-如果别名中有空格,需要用双引号 select ename,sal*12 sal per year from emp;-如果

13、没有内容,则为空 select comm from emp;-当空字段参与计算,则结果是null -例如:计算每个人的全年的收入包括月薪和年终奖 select ename,sal*12+comm from emp;-可以将多个字符串拼在一起。比如:求每个人的薪水,格式为smith-sal-123 select ename|-sal-|sal from emp;-如果字符串中有单引号,需要用另外一个单引号转义,比如:这样一个字符串: hes friend s sal is-distinct 关键词的用法 -求有哪些个部门 select distinct deptno from emp -可以用来修饰多个字段。求有哪些个部门和job的组合 select distinct deptno,job from emp where关键词的用法 -可以是数值类型的等值判断。求10这个部门的所有员工 select * from emp where deptno=20 -可以是字符串类型的等值判断。求叫KING的这个人的信息 select * from emp where ename = KING-也可以是不等值判断。求薪水小于2000的员工信息 select

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

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