Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
22.01.12 - ์ค๋์ SQL
- Loading branch information
Showing
3 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
Date : 2022.01.12 | ||
Update : 2022.01.12 | ||
Source : Top Earners.sql | ||
Purpose : count / ์๋ธ์ฟผ๋ฆฌ | ||
url : https://www.hackerrank.com/challenges/earnings-of-employees/problem?isFullScreen=true | ||
Author : ๊นํ์ง (mildsalmon) | ||
Email : mildsalmon@gamil.com | ||
*/ | ||
|
||
-- count๋ฅผ ์ฌ์ฉํ ๋ ๋ค๋ฅธ ์ ์ด ์์ผ๋ฉด ๋ค๋ฅธ ์ ๋ค์ group by๋ก ๋ฌถ์ด์ค์ผํ๋ค. | ||
SELECT a.months*a.salary, COUNT(a.months*a.salary) | ||
FROM employee a | ||
WHERE a.months*a.salary = (SELECT MAX(b.months*b.salary) | ||
FROM employee b) | ||
GROUP BY a.months*a.salary | ||
; |
14 changes: 14 additions & 0 deletions
14
2. SQL/2. HackerRank/1. Easy/Weather Observation Station 13.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
Date : 2022.01.12 | ||
Update : 2022.01.12 | ||
Source : Weather Observation Station 13.sql | ||
Purpose : TRUNC / BETWEEN | ||
url : https://www.hackerrank.com/challenges/weather-observation-station-13/problem?isFullScreen=true | ||
Author : ๊นํ์ง (mildsalmon) | ||
Email : mildsalmon@gamil.com | ||
*/ | ||
|
||
SELECT TRUNC(SUM(LAT_N), 4) | ||
FROM STATION | ||
WHERE LAT_N BETWEEN 38.7880 AND 137.2345 | ||
; |
13 changes: 13 additions & 0 deletions
13
2. SQL/2. HackerRank/1. Easy/Weather Observation Station 2.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
Date : 2022.01.12 | ||
Update : 2022.01.12 | ||
Source : Weather Observation Station 2.sql | ||
Purpose : ROUND / SUM | ||
url : https://www.hackerrank.com/challenges/weather-observation-station-2/problem?isFullScreen=true | ||
Author : ๊นํ์ง (mildsalmon) | ||
Email : mildsalmon@gamil.com | ||
*/ | ||
|
||
SELECT ROUND(SUM(LAT_N), 2), ROUND(SUM(LONG_W), 2) | ||
FROM station | ||
; |