본문 바로가기
카테고리 없음

쿼리문 효율적인 검색 방법, Drop과 Delete 차이

by 인디코더 2019. 1. 26.

WHERE 절에서 조건을 주어서 SELECT하는 방법


WHERE 조건절에서 사이값 조건 차이.. BETWEEN...AND와 AND의 차이

1
2
3
4
5
6
select * from student where '2019'>id and id>'2010'
# 2019보다 작은 애들을 구함.
# 2010보다 큰 애들을 구함 
# 교집합을 구함.
select * from student where between '2019'>id and id>'2010'
# 2019부터 시작해서 2010까지를 구하게 되는 것임.
cs


OR 조건의 차이

1
2
3
4
select * from student where belong = 'MSE' or belong = 'ESE' or belong = 'CSE';
# for문을 3번 돌게 됨.
select * from student where belong in ('mse''ese''cse');
# for문을 한번만 돌게 됨.
cs


Drop과 Delete의 차이

DROP과 DELETE의 차이. 

1
2
3
4
5
6
7
8
9
DROP DATABASE db_name; 
DROP TABLE table_name; 
 
DELETE FROM table_name; 
DELETE FROM table_name WHERE _id = 20070103;
 
#DROP은 자체를 삭제하는 것이고
#DELETE는 TABLE내에 있는 데이터만 삭제 하는 것이다.
 
cs

출처 : https://futurists.tistory.com/12?category=587334


반응형