Skip to content

Commit b56934f

Browse files
committed
Solutions of All Medium SQL Hackerranks Task for Basic Level
1 parent 08cd56c commit b56934f

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SELECT ROUND(ABS(MIN(lat_n)-MAX(lat_n))+ABS(MIN(long_w)-MAX(long_w)),4) FROM STATION
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SELECT ROUND(SQRT(POWER(MAX(lat_n)-MIN(lat_n),2)+POWER(MAX(long_w)-MIN(long_w),2)),4) FROM STATION
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
-- Note: the difficulties werer when you tried to unite all and previously sorted 1 select was squizzed that's why order by at the end
2+
((SELECT CONCAT(NAME,'(',SUBSTRING(Occupation, 1, 1),')') AS COMPLICATEDNAME FROM OCCUPATIONS)
3+
UNION ALL
4+
(SELECT CONCAT('There are a total of ',COUNT(Occupation),' ',LOWER(Occupation),'s.') FROM OCCUPATIONS
5+
GROUP BY Occupation)
6+
)
7+
ORDER BY COMPLICATEDNAME

0 commit comments

Comments
 (0)