下面哪个语句关于GROUP BY 和HAVING语句的使用是正确的是?()
A: SELECT
JOB_ID, DEPARTMENT_ID, AVG(SALARY) FROM EMPLOYEES GROUP BY JOB_ID
HAVING AVG(SALARY) > 3000;
B: SELECT
JOB_ID, DEPARTMENT_ID, AVG(SALARY) FROM EMPLOYEES GROUP BY JOB_ID,
DEPARTMENT_ID HAVING AVG(SALARY) > 3000;
C: SELECT
JOB_ID, DEPARTMENT_ID, AVG(SALARY) FROM EMPLOYEES GROUP BY
AVG(SALARY) HAVING AVG(SALARY) > 3000;
D: FROM
EMPLOYEES GROUP BY JOB_ID, DEPARTMENT_ID HAVING SALARY > 3000;
A: SELECT
JOB_ID, DEPARTMENT_ID, AVG(SALARY) FROM EMPLOYEES GROUP BY JOB_ID
HAVING AVG(SALARY) > 3000;
B: SELECT
JOB_ID, DEPARTMENT_ID, AVG(SALARY) FROM EMPLOYEES GROUP BY JOB_ID,
DEPARTMENT_ID HAVING AVG(SALARY) > 3000;
C: SELECT
JOB_ID, DEPARTMENT_ID, AVG(SALARY) FROM EMPLOYEES GROUP BY
AVG(SALARY) HAVING AVG(SALARY) > 3000;
D: FROM
EMPLOYEES GROUP BY JOB_ID, DEPARTMENT_ID HAVING SALARY > 3000;
举一反三
- 下面哪个语句关于GROUP BY 和HAVING语句的使用是正确的?() A: A.SELECT JOB_ID , DEPARTMENT_ID , AVG(SALARY)FROM EMPLOYEES GROUP BY JOB_IDHAVING AVG(SALARY) > 3000; B: B.SELECT JOB_ID , DEPARTMENT_ID , AVG(SALARY)FROM EMPLOYEES GROUP BY JOB_ID ,DEPARTMENT_IDHAVING AVG(SALARY) > 3000; C: C.SELECT JOB_ID , DEPARTMENT_ID , AVG(SALARY)FROM EMPLOYEES GROUP BY AVG(SALARY)HAVING AVG(SALARY) > 3000; D: D.SELECT JOB_ID , DEPARTMENT_ID , AVG(SALARY)FROM EMPLOYEES GROUP BY JOB_ID , DEPARTMENT_IDHAVING SALARY > 3000;
- 以下语句错误的是() A: LECT rank, AVG(salary) FROM people HAVING AVG(salary) > 1000 GROUP BY rank; B: SELECT rank, AVG(salary) FROM people GROUP BY rank HAVING AVG(salary) > 1000 C: SELECT rank, AVG(salary) FROM people HAVING AVG(salary) > 1000 GROUP BY rank; D: SELECT AVG(salary) FROM people GROUP BY rank HAVING AVG(salary) > 1000; E: SELECT rank, AVG(salary) FROM people GROUP BY rank WHERE AVG(salary) > 1000;
- 表employees中有字段title表示职务,字段salary表示工资,求各个职务平均工资的T-SQL语句是( )。 A: SELECT AVG(SALARY) FROM EMPLOYEES WHERE TITLE B: SELECT AVG(SALARY) FROM EMPLOYEES GROUP BY TITLE C: SELECT AVG(TITLE) FROM EMPLOYEES GROUP BY SALARY D: SELECT SALARY FROM EMPLOYEES GROUP BY TITLE
- 查询各类别的公司中比该类别最小工资高300元的公司、工资、类别 A: SELECT name, salary, type FROM job AS s1 WHERE salary > (SELECT min(salary) FROM job AS s2 WHERE s1.type = s2.type GROUP BY type) ; B: SELECT name, salary, type FROM job AS s1 WHERE salary > (SELECT min(salary) FROM job AS s2 WHERE s1.type = s2.type ) + 300; C: SELECT name, salary, type FROM job WHERE salary > 300; D: SELECT name, salary, type FROM job AS s1 WHERE salary > (SELECT min(salary) FROM job AS s2 WHERE s1.type = s2.type GROUP BY type) + 300;
- 【单选题】显示图书信息表中不同书架图书的平均价格大于50元的书架号和平均价格。能得到正确结果的SELECT语句是 A: select casename,AVG(price) <br> from bookinfo group by casename where AVG(price)>50 B: select casename,AVG(price)>50 from bookinfo group by casename C: select casename,AVG(price) <br> from bookinfo<br> having AVG(price)>50 group by casename D: select casename,AVG(price) <br> from bookinfo group by casename<br> having AVG(price)>50