Oracle SQL sample database

前端 未结 6 2134
离开以前
离开以前 2021-02-11 08:59

I\'m trying to learn Oracle SQL by database Supplied by it. I found somewhere tasks to be done. Database structure is supplied by Oracle:

CREATE TABLE EMP
(EMPNO         


        
6条回答
  •  暖寄归人
    2021-02-11 09:06

    With your `select:

    select ename, salgrade.grade, dept.dname from emp, salgrade, dept
    WHERE emp.sal BETWEEN salgrade.losal AND salgrade.hisal
    AND emp.deptno = dept.deptno group by salgrade.grade, dept.dname, emp.ename
    

    when you group by salgrade.grade, dept.dname, emp.ename the results will be grouped into those three values. You also put the results BETWEEN salgrade.losal AND salgrade.hisal so it will give all employees that have the salary in that interval. It's not restricting anything to the greater one got it? And that's why you have WARD 2 SALES and MARTIN 2 SALES.

提交回复
热议问题