Post

2021-05-25-TIL

2021-05-25-TIL

  • location, checkIn, checkOut 필터 검색

    location은 ‘서울’이면서 checkIn 날짜가 ‘2021-08-01’과 ‘2021-08-30’사이에 예약된 정보가 없는 방을 조회

1
2
3
SELECT * FROM room WHERE location = '서울' AND id
NOT IN
(SELECT room_id FROM reserve WHERE check_in < '2021-08-30' AND check_out > '2021-08-01');

http://www.gurubee.net/article/65624

  • location, checkIn, checkOut, max, min 필터 검색

    location은 ‘서울’이면서 checkIn 날짜가 ‘2021-08-01’과 ‘2021-08-30’사이에 예약된 정보가 없고, 가격은 max와 min 사이에 있는 방을 조회

1
2
3
4
SELECT * FROM room WHERE location = '서울' 
AND id NOT IN
(SELECT room_id FROM reserve WHERE check_in < '2021-08-30' AND check_out > '2021-08-01')
AND (charge BETWEEN 80000 AND 90000);
  • location, checkIn, checkOut, max, min, guests 필터 검색

    location은 ‘서울’이면서 checkIn 날짜가 ‘2021-08-01’과 ‘2021-08-30’사이에 예약된 정보가 없고, 가격은 max와 min 사이에 있고, 수용인원이 3명 이하인 방을 조회

1
2
3
4
5
SELECT * FROM room WHERE location = '서울' 
AND id NOT IN
(SELECT room_id FROM reserve WHERE check_in < '2021-08-30' AND check_out > '2021-08-01')
AND (charge BETWEEN 80000 AND 90000)
AND guests <= 3;

:dengdeng:

idpasswordnicknameemail
august1234Augbootaugust@gmail.com
lukeaugust1234Lukeluke@gmail.comaugust@gmail.com
ray1234Rayray@naver.com
team101010Shipship@codesquad.com
This post is licensed under CC BY 4.0 by the author.