365 Days of Daily Coding: Day Day 48
Today was a day when I was supposed to wake up at 7 am and I woke up at 9 am. I have been wanting to wake up early but I can’t really seem to. I work late and as a result, I wake up late.
I read the message boards on wallstreet bets the entire day cause I am really excited what unfolds. Mark Cuban, the shark tank investor had a QandA session which was really cool. Reading twice the answers, he gave me an impression that the shorts covered their position when RobinHood closed buying for retail buyers. What’s more interesting is that market manipulation of stocks such as GME have been going on for many many years and that the market manipulators have always go unharmed and that this is not going to be any different. Such is the corruption. It makes me question if I want to even invest in the market when I can’t trust it. Although I do believe that I am somehow one way or the other indirectly owning these corporate shares cause of EPF (retirement funds). There’s always a max probability that I am gonna lose if I pick individual stocks. This prolly might be also the reason why some people encourage index funds or ETFs for long term.
I have learnt a lot about investing and the stock market in the past 4 days or so. I am sure it has been the same for many people new to investing.
I also finally seem to understand the importance of blockchain and the importance of transparency that it brings very crucial in cases like market manipulation.
It’s been an exciting day today since I solved my first question posted by others. I feel like I have just leveled up which is extremely satisfying. I can’t wait to practice python.
The question poseted on reddit is here.
My solution:
SELECT store_id, title FROM(
SELECT DISTINCT i.store_id, f.title, count(rental_id) AS counts,
ROW_NUMBER() OVER (PARTITION BY store_id ORDER BY COUNT(rental_id) DESC) AS rnk
FROM inventory i JOIN film f
ON i.film_id = f.film_id
JOIN rental r ON r.inventory_id = i.inventory_id
GROUP BY store_id, title
ORDER BY store_id, rnk
) AS l
WHERE rnk <= 5;

Leave a comment