SQL WHRE, ORDER BY OPERATORLERİ

use HR
SELECT EMPLOYEE_ID,LAST_NAME,JOB_ID,SALARY


FROM EMPLOYEES
WHERE SALARY>=10000

AND JOB_ID LIKE '%MAN%' -- AND İLE TÜM KOSULLAR SAĞLANIRSA GELİR--

SELECT EMPLOYEE_ID,LAST_NAME,JOB_ID,SALARY
FROM EMPLOYEES
WHERE SALARY>=10000

OR JOB_ID LIKE '%MAN%' -- OR İLE KOŞULUN HERHANGİ BİRTANESİ SAĞLANIRSA GETİRİR--


SELECT EMPLOYEE_ID,LAST_NAME,JOB_ID,SALARY
FROM EMPLOYEES
WHERE  JOB_ID  NOT IN ( 'SA_REP' )-- IN KOMUTU İLE KOŞUL SAĞLANIRSA GETİRİR--


SELECT EMPLOYEE_ID,LAST_NAME,JOB_ID,SALARY
FROM EMPLOYEES
WHERE  (JOB_ID = 'SA_REP' 
OR JOB_ID ='AD_PRES')
AND SALARY>15000

--ORNEK MAASI 300 DEN BUYUK VE İSMİ K VE L İLE BASLAYAN MUSTERİLERİ GETİR

SELECT EMPLOYEE_ID,LAST_NAME,JOB_ID,SALARY     
FROM EMPLOYEES
WHERE  (LAST_NAME  LIKE'K%'  OR LAST_NAME LIKE 'L%') AND
 SALARY<3000

--SIRALAMA ORDER BY
--ORDER BY DESC TERS SIRALAMA

 SELECT EMPLOYEE_ID,LAST_NAME,JOB_ID,HIRE_DATE, SALARY AS MAAS
FROM EMPLOYEES
WHERE  SALARY BETWEEN 10000 AND 20000

ORDER BY  MAAS,HIRE_DATE -- MAASA GÖRE SIRALAYIP SONRA O MAAS ARASINDA TARİH ARALIĞINI VERİR AYRICA 5 İSE ORADA SELCTEKİ COLON SIRASIDIR



Bir cevap yazın

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir