SELECT UNIQUE dept FROM staff
SELECT DISTINCT dept FROM staff
SELECT (dept) UNIQUE FROM staff
SELECT (dept) DISTINCT FROM staff
第1题:
根据SQL标准,要查询表student中平均年龄age小于21的所在系dept及其平均年龄值,下面哪条语句适用?()
A select dept,avg(age) from student where avg(age)<21
B select dept,avg(age) from student group by dept having avg(age)<21
C select dept,avg(age) from student having avg(age)<21
D select dept,avg(age) from student group by dept where avg(age)<21
第2题:
Examine the description of the EMPLOYEES table:EMP_ID NUMBER(4) NOT NULLLAST_NAME VARCHAR2(30) NOT NULLFIRST_NAME VARCHAR2(30)DEPT_ID NUMBER(2)JOB_CAT VARCHARD2(30)SALARY NUMBER(8,2)Which statement shows the maximum salary paid in each job category of each department? ()
A. SELECT dept_id, job_cat, MAX(salary) FROM employees WHERE salary > MAX (salary);
B. SELECT dept_id, job_cat, MAX(salary) FROM employees GROUP BY dept_id,job_cat;
C. SELECT dept_id, job_cat, MAX(salary) FROM employees;
D. SELECT dept_id, job_cat, MAX(salary) FROM employees GROUP BY dept_id;
E. SELECT dept_id, job_cat, MAX(salary) FROM employees GROUP BY dept _ id job _ cat salary;
第3题:
Evaluate this SQL statement:SELECT e.emp_name, d.dept_nameFROM employees eJOIN departments dUSING (department_id)WHERE d.department_id NOT IN (10,40)ORSER BY dept_name;The statement fails when executed. Which change fixes the error? ()
A. remove the ORDER BY clause
B. remove the table alias prefix from the WHERE clause
C. remove the table alias from the SELECT clause
D. prefix the column in the USING clause with the table alias
E. prefix the column in the ORDER BY clause with the table alias
F. replace the condition "d.department_id NOT IN (10,40)" in the WHERE clause with "d.department_id <> 10 AND d.department_id <> 40"
第4题:
第5题:
查询全体主管的姓名(m name)、出生年份(birth)和所在部门(dept),要求用小写字母表示所有部门名,数据表名为manager实现该功能的语句为________。
A.select"m_name",出生年份:,birth,islower(dept)from manager
B.select m_name,"出生年份:",birth,islower(dept)from manager
C.select m_name,"出生年份:",birth,dept from manager
D.select m_name,"出生年份:",birth,upper(dept)from manager
第6题:
根据SQL标准,创建一个视图abc,通过该视图只能对表student中系dept为‘IS’的记录进行更新操作。下面哪条语句适用?()
A create view abc as select * from student where dept=’IS’
B create view abc as select * from student where dept=’IS’ with check option
C create view abc as student where dept=’IS’
D create view abc as select dept=’IS’ from student
第7题:
Scott issues the SQL statements:CREATE TABLE dept(deptno NUMBER(2),dname VARCHAR2(14),loc VARCHAR2(13)};GRANT SELECTON DEPTT0 SUE;If Sue needs to select from Scott‘s DEPT table, which command should she use?()
A.SELECT*FROMDEPT;
B.SELECT*FROMSCOTT.DEPT;
C.SELECT*FROMDBASCOTTDEPT;
D.SELECT*FROMALL_USERSWHEREUSER_NAME=‘;SCOTT‘;ANDTABLENAME=‘;DEPT‘;;
第8题:
A. GRANT select ON dept TO ALL_ USER;
B. GRANT select ON dept TO ALL;
C. GRANT QUERY ON dept TO ALL_USERS
D. GRANT select ON dept TO PUBLIC;
第9题:
A.SELECT UNIQUE dept FROM staff
B.SELECT DISTINCT dept FROM staff
C.SELECT (dept) UNIQUE FROM staff
D.SELECT (dept) DISTINCT FROM staff
第10题:
使用HQL查询所有部门信息,以下正确的是()。