1주차는 where
---> select *(전체) from 테이블
where 필드

  • 같지 않음을 나타낼때는 !=
    ex) select * from users
    where user_name !='남**'

  • 범위 조건은 between and
    ex) select * from orders
    where created_at between '2022-11-20' and '2022-11-25'
    (20일부터 어제까지 가져온다는 의미)

  • 포함 조건은 in
    ex) select * from orders
    where payment_method in (taxbill,money)

  • 패턴 조건은 like
    %와 같이 오는데 %는 무엇이 들어가도 상관없다는 의미
    ex) select
    from orders
    where email like '%naver.com'

  • 일부데이터 가져오기 limit
    ex) select * from orders
    where email like '&gmail.com'
    limit 5

  • 중복데이터 제외 가져오기 distinct
    ex) select distinct(payment_method) from orders

  • 갯수 세기 count
    ex) select count(*) from users
    where name = '황**'

    배운거 정리 끄읕! 자러가야지(뿌듯)

profile
빅데이터를 배우자🥹

0개의 댓글