365 Days of Daily Coding: Day 141
I am quite tired today. But I am mustering all my might and will power to complete today’s challenge. Something I realised today is that spending significant time in social media like Instagram, Facebook and Tiktok can rewire your brain that can lead to shortening attention span to name a few. From here on, I have decided to only dedicate 2 hours of my time to social media. I am quite addicted to it. 1 hour in the morning at around 11 and 1 hour at night time. Hopefully, I can keep this promise to myself. Cheers! Will keep you guys updated on the progress and the status. 😅😄
Puzzle #26: Previous Year’s Sales

I tried the solution in the live oracle environment here.
WITH temp AS
(SELECT 2018 AS Yr, 352645 AS Amount FROM DUAL UNION ALL
SELECT 2017 AS Yr, 165565 AS Amount FROM DUAL UNION ALL
SELECT 2017 AS Yr, 254654 AS Amount FROM DUAL UNION ALL
SELECT 2016 AS Yr, 159521 AS Amount FROM DUAL UNION ALL
SELECT 2016 AS Yr, 251696 AS Amount FROM DUAL UNION ALL
SELECT 2016 AS Yr, 111894 AS Amount FROM DUAL)
SELECT * FROM
(
SELECT Yr, Amount
FROM temp
)
PIVOT
(
SUM(Amount)
FOR Yr IN (2018, 2017, 2016)
);

Leave a comment