HackerRank MySQL - SQL Project Planning




You are given a table, Projects, containing three columns: Task_ID, Start_Date and End_Date. It is guaranteed that the difference between the End_Date and the Start_Date is equal to 1 day for each row in the table.



  1. SELECT START_DATE, MIN(END_DATE)
  2. FROM
  3. (SELECT START_DATE
  4. FROM PROJECTS
  5. WHERE START_DATE NOT IN
  6. (SELECT END_DATE
  7. FROM PROJECTS)) A,
  8. (SELECT END_DATE
  9. FROM PROJECTS
  10. WHERE END_DATE NOT IN
  11. (SELECT START_DATE
  12. FROM PROJECTS)) B
  13. WHERE START_DATE < END_DATE
  14. GROUP BY START_DATE
  15. ORDER BY (MIN(END_DATE) - START_DATE), START_DATE;
Please click on the like button if it worked

Solution not working or have any suggestions? Please send an email to [email protected]


donate a cup of tea :)


Join Our Facebook Group

Share this solution






codesadda.com

Codesadda.com is your home of programming solutions, tutorials, video tutorials and much more. Sign Up for our weekly newsletter to get update about new content.

Like us on Facebook | Connect with us on LinkedIn | Subscribe our Channel on Youtube