SELECT (CASE WHEN GRADES.GRADE < 8 THEN 'NULL' ELSE STUDENTS.NAME END), GRADES.GRADE, STUDENTS.MARKS
FROM STUDENTS, GRADES
WHERE STUDENTS.MARKS BETWEEN GRADES.MIN_MARK AND GRADES.MAX_MARK
ORDER BY GRADES.GRADE DESC, NAME ASC;
์ด ์ฝ๋์์๋ JOIN์ ์ฌ์ฉํ์ง ์์์ง๋ง, JOIN์ ์ฌ์ฉํ๋ฉด ๋ค์๊ณผ ๊ฐ์ด ORACLE ์ฝ๋๋ฅผ ์์ฑํ ์ ์๋ค.
SELECT (CASE WHEN B.GRADE < 8 THEN 'NULL' ELSE A.NAME END), B.GRADE, A.MARKS
FROM STUDENTS A
JOIN GRADES B
ON A.MARKS BETWEEN B.MIN_MARK AND B.MAX_MARK
ORDER BY B.GRADE DESC, A.NAME, A.MARKS;
Britney 10 95
Heraldo 10 94
Julia 10 96
Kristeen 10 100
Stuart 10 99
Amina 9 89
Christene 9 88
Salma 9 81
Samantha 9 87
Scarlet 9 80
Vivek 9 84
Aamina 8 77
Belvet 8 78
Paige 8 74
Priya 8 76
Priyanka 8 77
NULL 7 64
NULL 7 66
NULL 6 55
NULL 4 34
[ํ๋ก๊ทธ๋๋จธ์ค] ์ด๋ฆ์ el์ด ๋ค์ด๊ฐ๋ ๋๋ฌผ ์ฐพ๊ธฐ (String, Date/Oracle(SQL)) (0) | 2021.03.03 |
---|---|
[ํ๋ก๊ทธ๋๋จธ์ค] ๋ฃจ์์ ์๋ผ ์ฐพ๊ธฐ (SQL String, Date / Oracle) (0) | 2021.02.16 |
[HackerRank] Average Population of Each Continent (SQL/JOIN) (0) | 2021.02.01 |
[HackerRank] African Cities (SQL/JOIN) (0) | 2021.02.01 |
[HackerRank] Asian Population (SQL/JOIN) (0) | 2021.02.01 |