一些高难度的SQL面试题

一些高难度的SQL面试题

ID:38732414

大小:31.50 KB

页数:4页

时间:2019-06-18

一些高难度的SQL面试题_第1页
一些高难度的SQL面试题_第2页
一些高难度的SQL面试题_第3页
一些高难度的SQL面试题_第4页
资源描述:

《一些高难度的SQL面试题》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、1.根据如下表的查询结果,那么以下语句的结果是(知识点:notin/notexistsnull)以下的null代表真的null.SQL>select*fromusertable;USERIDUSERNAME———–—————-1user12null3user34null5user56user6SQL>select*fromusergrade;USERIDUSERNAMEGRADE———-—————-———-1user1902null807user7808user890执行语句:selectcount(*)fromusergradew

2、hereusernamenotin(selectusernamefromusertable);selectcount(*)fromusergradegwherenotexists(selectnullfromusertabletwheret.userid=g.useridandt.username=g.username);结果为:语句1(0)语句2(3)A:0B:1C:2D:3E:NULL2.在以下的表的显示结果中,以下语句的执行结果是(知识点:in/existsrownum)SQL>select*fromusertable;USE

3、RIDUSERNAME———–—————-1user12user23user34user45user5SQL>select*fromusergrade;USERNAMEGRADE—————-———-user990user880user780user290user1100user180执行语句Selectcount(*)fromusertablet1whereusernamein(selectusernamefromusergradet2whererownum<=1);Selectcount(*)fromusertablet1wher

4、eexists(select‘x’fromusergradet2wheret1.username=t2.usernameandrownum<=1);以上语句的执行结果是:()()A:0B:1C:2D:3根据以下的在不同会话与时间点的操作,判断结果是多少,其中时间T1<……原始表记录为;select*fromemp;EMPNODEPTNOSALARY—–————100155101150select*fromdept;DEPTNOSUM_OF_SALARY——————-11052可以看到,现在因为还没有部门2的员工,所以总薪水为null

5、,现在,有两个不同的用户(会话)在不同的时间点(按照特定的时间顺序)执行了一系列的操作,那么在其中或最后的结果为:timesession1session2———–——————————-———————————–T1insertintoempvalues(102,2,60)T2updateempsetdeptno=2whereempno=100T3updatedeptsetsum_of_salary=(selectsum(salary)fromempwhereemp.deptno=dept.deptno)wheredept.deptno

6、in(1,2);T4updatedeptsetsum_of_salary=(selectsum(salary)fromempwhereemp.deptno=dept.deptno)wheredept.deptnoin(1,2);T5commit;T6selectsum(salary)fromempgroupbydeptno;问题一:这里会话2的查询结果为:T7commit;=======到这里为此,所有事务都已完成,所以以下查询与会话已没有关系========T8selectsum(salary)fromempgroupbydept

7、no;问题二:这里查询结果为T9select*fromdept;问题三:这里查询的结果为问题一的结果()问题二的结果是()问题三的结果是()A:B:—————-—————-150150260255C:D:—————-—————-15011152115250E:F:—————-—————-11051110260255有表一的查询结果如下,该表为学生成绩表(知识点:关联更新)selectid,gradefromstudent_gradeIDGRADE——–———–150240370480530690表二为补考成绩表selectid,gr

8、adefromstudent_makeupIDGRADE——–———–160280560现在有一个dba通过如下语句把补考成绩更新到成绩表中,并提交:updatestudent_gradessets.grade=(selectt.gr

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。