SQL 4주차

임호중·2023년 4월 27일
0

"Subquery" 이용하여 큰쿼리문 안에 작은 커리문들을 섞어 만듬.

=Where 필드 in (subquery)

ex) select * from pointuser
where point > (select avg(point) from pointuser
where used_id in (select used_id from users
where name = '이**')

=select 필드, (subquery) from

*with table1 as (subquery1), table2 as (subquery2)
=from (subquery1=table1) a
inner join (subquery2=table2) b

substring(필드,1시작포인트,10몇글자까지)
substring_index(필드,'@이부분에서',1앞부분만
-1뒷부분만)

*Case when point > 1000 then 'nice' else 'bad' end

profile
안녕하세요. 백엔드 개발자되려구요

0개의 댓글