首页 > 中学考试杂题 > 题目详情
oracle group by和having用法这是我遇到的一道原题Examine the description of
题目内容:
oracle group by和having用法
这是我遇到的一道原题
Examine the description of the EMPLOYEES table:
EMP_ID NUMBER(4) NOT NULL LAST_
NAME VARCHAR2(30) NOT NULL
FIRST_NAME VARCHAR2(30)
DEPT_ID NUMBER(2)
JOB_CAT VARCHAR2(30)
SALARY NUMBER(8,2)
Which statement shows the department ID,minimum salary,and maximum salary paid in that
department,only if the minimum salary is less than 5000 and maximum salary is more than 15000?
然后给的解答是:SELECT dept_id,MIN(salary),MAX(salary)
FROM employees
GROUP BY dept_id
HAVING MIN(salary) < 5000 AND MAX(salary) > 15000;
为什么这里只要group by dept_id就可以?
能通俗的为我解释一下么,group by 和having到底是怎么回事?
oracle group by和having用法
这是我遇到的一道原题
Examine the description of the EMPLOYEES table:
EMP_ID NUMBER(4) NOT NULL LAST_
NAME VARCHAR2(30) NOT NULL
FIRST_NAME VARCHAR2(30)
DEPT_ID NUMBER(2)
JOB_CAT VARCHAR2(30)
SALARY NUMBER(8,2)
Which statement shows the department ID,minimum salary,and maximum salary paid in that
department,only if the minimum salary is less than 5000 and maximum salary is more than 15000?
然后给的解答是:SELECT dept_id,MIN(salary),MAX(salary)
FROM employees
GROUP BY dept_id
HAVING MIN(salary) < 5000 AND MAX(salary) > 15000;
为什么这里只要group by dept_id就可以?
能通俗的为我解释一下么,group by 和having到底是怎么回事?
这是我遇到的一道原题
Examine the description of the EMPLOYEES table:
EMP_ID NUMBER(4) NOT NULL LAST_
NAME VARCHAR2(30) NOT NULL
FIRST_NAME VARCHAR2(30)
DEPT_ID NUMBER(2)
JOB_CAT VARCHAR2(30)
SALARY NUMBER(8,2)
Which statement shows the department ID,minimum salary,and maximum salary paid in that
department,only if the minimum salary is less than 5000 and maximum salary is more than 15000?
然后给的解答是:SELECT dept_id,MIN(salary),MAX(salary)
FROM employees
GROUP BY dept_id
HAVING MIN(salary) < 5000 AND MAX(salary) > 15000;
为什么这里只要group by dept_id就可以?
能通俗的为我解释一下么,group by 和having到底是怎么回事?
本题链接: