SQL Project Planning 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 SQL Project Planning 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 a,b from (
select min(start_date) a ,max(end_date) b,max(end_date) - min(start_date) as c from (
select a.start_date,a.end_date,row_number() over(order by start_date) rn from (select * from (
select start_date,end_date,lag(end_date) over(order by start_date) led
from Projects
)a
where nvl(led,sysdate+10000) <> start_date)a
union all
select a.start_date,a.end_date,row_number() over(order by start_date) rn from (select * from (
select start_date,end_date,lead(start_date) over(order by start_date) lsd
from Projects
)a
where nvl(lsd,sysdate+10000) <> end_date)a )
group by rn) order by c,1;
SQL (Basic)
SQL (Intermediate)
SQL (Advanced)
Basic Select
Advanced Select
Aggregation
Basic Join
Advanced Join
Alternative Queries
Leave a comment below