-
SQL select 조건 검색DataBases/MYSQL 2019. 3. 27. 14:46
[ 조건문 ]
A > B
<
<>
=
>=
<=
and
or
[ Null찾기 ]
select * from school where number is null
[ 문자열 중 찾기 ]
select * from school like '%ca';
select *from school like '_ca';
% = 다수의 불특정 문자
_ = 하나의 불특정 문자를의미
[ AND 번외 ]
select * from school where number <= 8 and number >= 1;
1 >= number <= 8
select * from school where number between 1 and 8;
[위와 동일함 ]
[ OR 번외 ]select * from school where number = 1 or number 5 or number 7;
select * from school where number is (1,5,7);
[ 위와 동일함 ]
select * from school where number not is (1,5,7);
[ 위와 동일함 ]
** NOT은 AND OR 바로 뒤에 나와야함.
ex ) select * from school where number = 1 and not number = 2;
총 정 리
[ select * ]
테이블 안에 모든 열들을 검색
[ = <> < > <= >= ]
등호, 부등호 연산자 사용가능
[ is NULL ]
NULL값을 조회
[ AND and OR ]
where 절에서 and 와 or을 사용하서 조건문들을 결합할 수 있음
[ NOT ]
결과의 반대값 찾기
[ BETWEEN ]
일정범위에 값 찾기
[ % 와 _ ]
문자열중 갯수 or 불특정 갯수의 문자열 찾기
'DataBases > MYSQL' 카테고리의 다른 글
mysql - 정규화란? (0) 2019.03.27 sql delete, update (0) 2019.03.27 트랜잭션이란? (0) 2019.03.26 데이터와테이블 - command (0) 2019.03.22 데이터와 테이블 - 도메인,속성,튜플 (0) 2019.03.22