《{员工管理}程序员开发人员试题》由会员分享,可在线阅读,更多相关《{员工管理}程序员开发人员试题(12页珍藏版)》请在金锄头文库上搜索。
1、1、哪一个SQL有错误?A. SELECT * FROM emp_dept_vu;B. SELECT department_id, SUM(salary) FROM emp_dept_vuGROUP BY department_id;C. SELECT department_id, job_id, AVG(salary)FROM emp_dept_vuGROUP BY department_id, job_id;D. SELECT job_id, SUM(salary)FROM emp_dept_vuWHERE department_id IN (10,20)GROUP BY job_idHA
2、VING SUM(salary) 20000;E. 没有一个错误,都是对的.2、两张表结构如下:EMPLOYEES(EMPLOYEE_ID NUMBER Primary KeyFIRST_NAME VARCHAR2(25)LAST_NAME VARCHAR2(25)HIRE_DATE DATE)NEW_EMPLOYEES(EMPLOYEE_ID NUMBER Primary KeyNAME VARCHAR2(60))哪一个删除语句是正确的。A. DELETE FROM employeesWHERE employee_id = (SELECT employee_idFROM employees)
3、;B. DELETE * FROM employeesWHERE employee_id = (SELECT employee_idFROM new_employees);C. DELETE FROM employeesWHERE employee_id IN (SELECT employee_idFROM new_employeesWHERE name =Carrey);D. DELETE * FROM employeesWHERE employee_id IN (SELECT employee_idFROM new_employeesWHERE last_name =Carrey);3、显
4、示每个部门,最高SALARY,最小SALARY,且最小SALARY小于5000,最大SALARY大于15000。A. SELECT dept_id, MIN(salary), MAX(salary)FROM employeesWHERE MIN(salary) 15000;B. SELECT dept_id, MIN(salary), MAX(salary)FROM employeesWHERE MIN(salary) 15000GROUP BY dept_id;C. SELECT dept_id, MIN(salary), MAX(salary)FROM employeesHAVING MI
5、N(salary) 15000;D. SELECT dept_id, MIN(salary), MAX(salary)FROM employeesGROUP BY dept_idHAVING MIN(salary) 15000;E. SELECT dept_id, MIN(salary), MAX(salary)FROM employeesGROUP BY dept_id, salaryHAVING MIN(salary) 15000;4、执行SQL:SELECT * FROM ordersWHERE cust_id = (SELECT cust_id FROM customers WHERE
6、 cust_name = Smith);5、students表结构如下:STD_ID NUMBER(4)COURSE_ID VARCHAR2(10)START_DATE DATEEND_DATE DATE哪两个在列START_DATE上的运算是正确的?A. SUM(start_date)B. AVG(start_date)C. COUNT(start_date)D. AVG(start_date, end_date)E. MIN(start_date)F. MAXIMUM(start_date)6、EMPLOYEES表结构如下:EMP_ID NUMBER(4) NOT NULLLAST_NAM
7、E VARCHAR2(30) NOT NULLFIRST_NAME VARCHAR2(30)DEPT_ID NUMBER(2)哪个SQL语句实现last_name 为 Smith不同DEPT_ID的总数?A. SELECT COUNT(*)FROM employeesWHERE last_name=Smith;B. SELECT COUNT(dept_id)FROM employeesWHERE last_name=Smith;C. SELECT DISTINCT(COUNT(dept_id)FROM employeesWHERE last_name=Smith;D. SELECT COUNT
8、(DISTINCT dept_id)FROM employeesWHERE last_name=Smith;E. SELECT UNIQUE(dept_id)FROM employeesWHERE last_name=Smith;7、查询所有employees表中的数据,无论在departments表中是否department_id的记录。哪个查询是正确的?A. SELECT last_name, department_nameFROM employees NATURAL JOIN departments;B. SELECT last_name, department_nameFROM emp
9、loyees JOIN departments ;C. SELECT last_name, department_nameFROM employees e JOIN departments dON (e.department_id = d.department_id);D. SELECT last_name, department_nameFROM employees eRIGHT OUTER JOIN departments d ON (e.department_id = d.department_id);E. SELECT last_name, department_nameFROM em
10、ployees FULL JOIN departmentsON (e.department_id = d.department_id);F. SELECT last_name, department_nameFROM employees e LEFT OUTERJOIN departments d ON (e.department_id = d.department_id);8、执行以下SQL,哪个结果是正确的。SELECT e.employee_id Emp_id, e.emp_name Employee, e.salary,m.employee_id Mgr_id, m.emp_name
11、ManagerFROM employees e JOIN employees mON (e.mgr_id = m.employee_id)AND e.salary 4000;9、N张表等值联合查询,至少要写几个连接条件?A. NB. N-1C. N+110、哪三个查询没有问题?A. SELECT *FROM employeeswhere salary (SELECT MIN(salary)FROM employeesGROUP BY department_id);B. SELECT *FROM employeesWHERE salary = (SELECT AVG(salary)FROM em
12、ployeesGROUP BY department_id);C. SELECT distinct department_idFROM employeesWHERE salary ANY (SELECT AVG(salary)FROM employeesGROUP BY department_id);D. SELECT department_idFROM employeesWHERE salary ALL (SELECT AVG(salary)FROM employeesGROUP BY department_id);E. SELECT last_nameFROM employeesWHERE
13、 salary ANY (SELECT MAX(salary)FROM employeesGROUP BY department_id);F. SELECT department_idFROM employeesWHERE salary ALL (SELECT AVG(salary)FROM employeesGROUP BY AVG(SALARY);判断题:11、Insert into table_1(id,name) values(seq_table_1.nextval,test);这条SQL会报错( )12、select * from table_1 where create_dt =
14、to_date(2010-01-02 12:23:45,yyyy-mm-dd hh:mi:ss)这条SQL没有问题 ( )13、查询时使用索引一定能加快查询速度。( )14、取表中的前40条记录,以下SQL没有问题( )select t.*,rownum rn from ( select * from table_1 Where create_dt between sysdate - 100 and sysdate order by create_dt desc) t where rownum =4015、表table_1中的记录Id name1 aa2 bb3 cc表table_2中的记录ID name2 cc4 dd5 ff执行如下SQL,Select id from table_1UnionSelect id from table_2如果为:ID123245如果正确( )16、表EMPLOYEES如构如下:EMPLOYEE_ID NUMBER Primary KeyFIR