filmov
tv
Hackerrank SQL Solutions | Ollivanders Inventory SQL Hackerrank Medium Problem
![preview_player](https://i.ytimg.com/vi/756bY8z-B0c/sddefault.jpg)
Показать описание
In this video we are solving "Ollivanders Inventory". This is a Medium SQL Problem on Hackerrank.
____________________________________________
SUBSCRIBE!
Do you want to understand how to solve SQL Problems in every detail? That's what my channel is about. When I was younger I thought I could never program because it looked way too difficult. The truth is that it takes time but with some patience anybody can do it! Follow me along and get better!
____________________________________________
SUPPORT MY CHANNEL
🙌The best way to support my channel right now is to give me a Super Thanks. You can do that by clicking thanks next to the title of the video. It is much appreciated!
____________________________________________
____________________________________________
0:00 Problem Description
0:55 Output Requirements
2:50 Code Age Relationship
4:38 Manual Solution
8:04 Start Query
10:27 Wands Table
11:08 Row Number Explanation
18:38 JOIN Wands and Wands_Property
Code:
WITH min_coins as (
SELECT
ROW_NUMBER() OVER(PARTITION BY code,power ORDER BY coins_needed asc) as RowNumber,
id,
code,
coins_needed,
power
FROM Wands
)
SELECT
id,
age,
coins_needed,
power
FROM Wands_Property wp
WHERE is_evil = 0
ORDER BY power desc, age desc
____________________________________________
SUBSCRIBE!
Do you want to understand how to solve SQL Problems in every detail? That's what my channel is about. When I was younger I thought I could never program because it looked way too difficult. The truth is that it takes time but with some patience anybody can do it! Follow me along and get better!
____________________________________________
SUPPORT MY CHANNEL
🙌The best way to support my channel right now is to give me a Super Thanks. You can do that by clicking thanks next to the title of the video. It is much appreciated!
____________________________________________
____________________________________________
0:00 Problem Description
0:55 Output Requirements
2:50 Code Age Relationship
4:38 Manual Solution
8:04 Start Query
10:27 Wands Table
11:08 Row Number Explanation
18:38 JOIN Wands and Wands_Property
Code:
WITH min_coins as (
SELECT
ROW_NUMBER() OVER(PARTITION BY code,power ORDER BY coins_needed asc) as RowNumber,
id,
code,
coins_needed,
power
FROM Wands
)
SELECT
id,
age,
coins_needed,
power
FROM Wands_Property wp
WHERE is_evil = 0
ORDER BY power desc, age desc
Комментарии