55 조건에 맞는 사용자 정보 조회하기
SELECT u.USER_ID
, u.NICKNAME
, CONCAT(u.CITY, ' ', u.STREET_ADDRESS1 , ' ',u.STREET_ADDRESS2) AS 전체주소
, CONCAT(
SUBSTRING(u.TLNO, 1, 3), "-",
SUBSTRING(u.TLNO, 4, 4), "-",
SUBSTRING(u.TLNO, 8)
) AS 전화번호
FROM USED_GOODS_BOARD AS b
INNER JOIN USED_GOODS_USER AS u
ON b.WRITER_ID = u.USER_ID
GROUP BY b.WRITER_ID
HAVING COUNT(b.WRITER_ID) >= 3
ORDER BY u.USER_ID DESC
56 특정 옵션이 포함된 자동차 리스트 구하
SELECT *
FROM CAR_RENTAL_COMPANY_CAR
WHERE OPTIONS LIKE '%네비게이션%'
ORDER BY CAR_ID DESC
57 조건에 부합하는 중고거래 상태 조회하기
SELECT BOARD_ID, WRITER_ID, TITLE, PRICE,
CASE WHEN STATUS='SALE' THEN '판매중'
WHEN STATUS='RESERVED' THEN '예약중'
WHEN STATUS='DONE' THEN '거래완료' END STATUS
FROM USED_GOODS_BOARD
WHERE CREATED_DATE LIKE '2022-10-05%'
ORDER BY BOARD_ID DESC