SQL where절에서 활용가능한 연산자

권원중·2023년 4월 27일
0

구디아카데미

목록 보기
3/23
post-thumbnail
SELECT * FROM employees
WHERE gender = 'M' -- = 문자, 숫자
LIMIT 0, 10;

SELECT * FROM employees
WHERE emp_no = 10005; -- = 문자, 숫자

SELECT * FROM employees
WHERE emp_no < 10005;

SELECT * FROM employees
WHERE first_name < 'C';

SELECT * FROM employees
WHERE emp_no = 10005 OR emp_no = 10008;

SELECT * FROM employees
WHERE emp_no IN (10005, 10008);

SELECT * FROM employees
WHERE emp_no >= 10005 and emp_no <= 10008;

SELECT * FROM employees
WHERE emp_no BETWEEN 10005 and 10008;

SELECT * FROM employees
WHERE first_name LIKE 'Anneke';

SELECT * FROM employees
WHERE first_name = 'Anneke';

SELECT * FROM employees
WHERE first_name LIKE 'A%';

SELECT * FROM employees
WHERE first_name LIKE '%a';

SELECT * FROM employees
WHERE first_name LIKE '%ab%';

SELECT * FROM 학생
WHERE 이름 LIKE '_미_';


SELECT *
FROM employees
WHERE first_name LIKE '%be%' OR last_name LIKE '%be%';

SELECT concat(first_name,' ',last_name) fullname
FROM employees
WHERE concat(first_name,' ',last_name) LIKE '%be%';

sql : where 절에서 사용할 수 있는 연산자이므로 where 절을 활용할 수 있는것들을 쓰자

0개의 댓글