Oracle SQL sample database

前端 未结 6 1807
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-11 08:45

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:15

    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.

提交回复
热议问题