Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | |||||
| 3 | 4 | 5 | 6 | 7 | 8 | 9 |
| 10 | 11 | 12 | 13 | 14 | 15 | 16 |
| 17 | 18 | 19 | 20 | 21 | 22 | 23 |
| 24 | 25 | 26 | 27 | 28 | 29 | 30 |
| 31 |
Tags
- 필기
- Real MySQL
- Python
- 미니프로젝트
- 정보처리기사
- Jackson
- hackerrank
- jsp
- 항해99
- 회고
- 성적프로그램
- post
- 스터디
- If
- LeetCode
- Til
- 2020년 일정
- 책리뷰
- 서평
- 주간회고
- 함수형 코딩
- algorithms
- 2020년 정보처리기사 4회
- 알고리즘
- 2020년 제4회 정보처리기사 필기 문제 분석
- 뇌정리
- sqldeveloper
- 코드숨
- java
- git
Archives
- Today
- Total
조컴퓨터
leetcode 197. Rising Temperature 본문


1) SELF JOIN
1-1)
SELECT *
FROM Weather w1, Weather w2
WHERE DATE_ADD(w1.recordDate, INTERVAL 1 DAY) = w2.recordDate
AND w1.Temperature < w2.Temperature
1-1) 결과
{"headers": ["Id", "RecordDate", "Temperature", "Id", "RecordDate", "Temperature"],
"values": [[1, "2015-01-01", 10, 2, "2015-01-02", 25], [3, "2015-01-03", 20, 4, "2015-01-04", 30]]}
2) w2.Id
2-1)
SELECT w2.Id AS Id
FROM Weather w1, Weather w2
WHERE DATE_ADD(w1.recordDate, INTERVAL 1 DAY) = w2.recordDate
AND w1.Temperature < w2.Temperature
2-1) 결과
{"headers": ["Id"], "values": [[2], [4]]}
SUCCESS!!
'LeetCode > SQL' 카테고리의 다른 글
| leetcode 181. Employees Earning More Than Their Managers (0) | 2021.01.18 |
|---|---|
| leetcode 1179. Reformat Department Table (0) | 2021.01.18 |