BETWEEN AND – Toán tử
Nội dung
1. Mô tả
- Toán tử BETWEEN AND lấy ra các dòng nằm trong phạm vi giữa 2 giá trị.
2. Cú pháp
SELECT Cột_1, Cột_2,... Cột_n
FROM Tên_bảng
WHERE Tên_cột BETWEEN Giá_trị_1 AND Giá_trị_2
3. Ví dụ
SELECT EMPLOYEE_ID, LAST_NAME, SALARY, DEPARTMENT_ID, HIRE_DATE
FROM EMPLOYEES
WHERE HIRE_DATE BETWEEN '2003-09-01' AND '2003-09-30'
SELECT EMPLOYEE_ID, LAST_NAME, SALARY, DEPARTMENT_ID, HIRE_DATE
FROM EMPLOYEES
WHERE SALARY BETWEEN 3500 AND 4000