Weather Observation Station 20 MediumSQL (Intermediate) – HackerRank Solution SQL, Best and Optimal Solutions , All you need.
Solutions of SQL all HackerRank:
Here are all the Solutions of All of SQL of Hacker Rank , Leave a comment for similar posts
SQL Weather Observation Station 20 MediumSQL (Intermediate) HackerRank Solution
/*
Enter your query here.
Please append a semicolon ";" at the end of the query and enter your query in a single line to avoid error.
*/
SELECT CAST( AVG(1.0 * LAT_N) AS NUMERIC(20,4))
FROM
(
SELECT LAT_N,
ra = ROW_NUMBER() OVER (ORDER BY LAT_N, id),
rd = ROW_NUMBER() OVER (ORDER BY LAT_N DESC, id DESC)
FROM STATION
) AS x
WHERE ra BETWEEN rd - 1 AND rd + 1;
SQL (Basic)
SQL (Intermediate)
SQL (Advanced)
Basic Select
Advanced Select
Aggregation
Basic Join
Advanced Join
Alternative Queries
Leave a comment below