close
以下四者結果一樣
--Non-Equijoins
--有join就有on
select e.LAST_NAME,e.SALARY,j.GRADE_LEVEL--3.所要顯示的欄位
from EMPLOYEES e join JOB_GRADES j--1.所需資料表
on e.SALARY between j.LOWEST_SAL and j.HIGHEST_SAL--2.篩選條件:查詢salary符合在兩個欄位值之間時
select e.LAST_NAME,e.SALARY,j.GRADE_LEVEL--3.所要顯示的欄位
from EMPLOYEES e join JOB_GRADES j--1.所需資料表
on e.SALARY >=j.LOWEST_SAL and e.SALARY<=j.HIGHEST_SAL--2.篩選條件:查詢salary符合在兩個欄位值之間時
select e.LAST_NAME,e.SALARY,j.GRADE_LEVEL
from EMPLOYEES e , JOB_GRADES j
where e.SALARY between j.LOWEST_SAL and j.HIGHEST_SAL
select e.LAST_NAME,e.SALARY,j.GRADE_LEVEL
from EMPLOYEES e , JOB_GRADES j
where e.SALARY >=j.LOWEST_SAL and e.SALARY<=j.HIGHEST_SAL
LAST_NAME | SALARY | GRADE_LEVEL |
Matos | 2600 | A |
Vargas | 2500 | A |
Lorentz | 4200 | B |
Mourgos | 5800 | B |
Rajs | 3500 | B |
Davies | 3100 | B |
Whalen | 4400 | B |
Hunold | 9000 | C |
Ernst | 6000 | C |
Taylor | 8600 | C |
Grant | 7000 | C |
Fay | 6000 | C |
Gietz | 8300 | C |
Zlotkey | 10500 | D |
Abel | 11000 | D |
Hartstein | 13000 | D |
Higgins | 12000 | D |
King | 24000 | E |
Kochhar | 17000 | E |
De Haan | 17000 | E |
全站熱搜
留言列表