文档详情

oracle部分面试题—DBA数据库管理员JAVA程序员架构师必看.doc

发布:2017-03-11约9.47千字共10页下载文档
文本预览下载声明
-DBA数据库管理员JAVA程序员架构师必看 面试题一(厦门) Table: (员工emp1) id name 1 a 2 b 3 c 4 d Table:( 性别 sext) id sex 1 男 4 女 5 男 找出忘记填写性别的员工(用 Oracle 的两种方式) select id ,name from emp1 e where e.id not in(select id from sext); select id from emp1 minus select id from sext; select * from emp1 e where e.id all(select id from sext); select e.* from emp1 e,(select id from emp1 minus select id from sext) s where e.id = s.id; select e.id,e.name from emp1 e,sext s where e.id=s.id(+) and s.sex is null; select * from emp1 left outer join sext on emp1.id = sext.id where sext.sex is null; select * from emp1 e where not exists(select * from sext s where e.id = s.id); select * from emp1 where id not in (select emp1.id from emp1, sext where emp1.id = sext.id); select name from emp1 where id not in (select id from emp1 intersect select id from sext); SELECT * FROM emp1 e WHERE (SELECT COUNT(*) FROM (SELECT id FROM emp1 UNION ALL SELECT id FROM sext) t WHERE t.id = e.id) 2; 面试题二(上海) 表一(AAA) 商品名称 mc 商品总量 sl A 100 B 120 表二(BBB) 商品名称 mc 出库数量 sl A 10 A 20 B 10 B 20 B 30 用一条 Transact-SQL 语句算出商品 A,B 目前还剩多少? select AAA.mc, sl-e.sum_sl as leave from AAA, (select sum(sl) sum_sl,mc from BBB group by mc) e where AAA.mc = e.mc Oracle 教程 select AAA.mc,AAA.sl-(select sum(BBB.sl) from BBB where BBB.mc=AAA.mc) from AAA; 面试题三(上海) 人员情况表(employee)中字段包括,员工号(ID),姓名(name),年龄(age),文化程 度(wh):包括四种情况(本科以上,大专,高中,初中以下),现在我要根据年龄字段查 询统计出:表中文化程度为本科以上,大专,高中,初中以下,各有多少人,占总人数多 少。结果如下: 学历 年龄 人数 百分比 本科以上 20 34 14 大专 20 33 13 高中 20 33 13 初中以下 20 100 40 本科以上 21 50 20 。。。。。。 Transact-SQL 查询语句如何写? select wh,age,trunc(count(*)/(select count(*) from employee)*100) from employee group by wh,age; 面试题四(上海) 1. Heres two table STUDENT and SCORE_RANK, write a SQL, list all students name who ranks A Table STUDENT COLUMN NAME COLUMN TYPE Comment ID char(9) not nullable Student?s ID NAME Varchar(30) not nullable Student?s Name SCORE Int nullable Student?s score Table SCORE_RANK COLUMN NAME COLUMN TYPE Comment LO_SCORE Int not nullabl
显示全部
相似文档