Leetcode HARD 3052 - Maximize Items FLOOR CASE WHEN SQL - Explained by Everyday Data Science

Published: 01 August 2024
on channel: Everyday Data Science
297
7

Question: https://leetcode.com/problems/maximiz...

SQL Schema:
Create table If Not Exists Inventory ( item_id int, item_type varchar(50), item_category varchar(50), square_footage decimal(10,2))
Truncate table Inventory
insert into Inventory (item_id, item_type, item_category, square_footage) values ('1374', 'prime_eligible', 'Watches', '68.0')
insert into Inventory (item_id, item_type, item_category, square_footage) values ('4245', 'not_prime', 'Art', '26.4')
insert into Inventory (item_id, item_type, item_category, square_footage) values ('5743', 'prime_eligible', 'Software', '325.0')
insert into Inventory (item_id, item_type, item_category, square_footage) values ('8543', 'not_prime', 'Clothing', '64.5')
insert into Inventory (item_id, item_type, item_category, square_footage) values ('2556', 'not_prime', 'Shoes', '15.0')
insert into Inventory (item_id, item_type, item_category, square_footage) values ('2452', 'prime_eligible', 'Scientific', '85.0')
insert into Inventory (item_id, item_type, item_category, square_footage) values ('3255', 'not_prime', 'Furniture', '22.6')
insert into Inventory (item_id, item_type, item_category, square_footage) values ('1672', 'prime_eligible', 'Beauty', '8.5')
insert into Inventory (item_id, item_type, item_category, square_footage) values ('4256', 'prime_eligible', 'Furniture', '55.5')
insert into Inventory (item_id, item_type, item_category, square_footage) values ('6325', 'prime_eligible', 'Food', '13.2')

Pandas Schema:
data = [[1374, 'prime_eligible', 'Watches', 68.0], [4245, 'not_prime', 'Art', 26.4], [5743, 'prime_eligible', 'Software', 325.0], [8543, 'not_prime', 'Clothing', 64.5], [2556, 'not_prime', 'Shoes', 15.0], [2452, 'prime_eligible', 'Scientific', 85.0], [3255, 'not_prime', 'Furniture', 22.6], [1672, 'prime_eligible', 'Beauty', 8.5], [4256, 'prime_eligible', 'Furniture', 55.5], [6325, 'prime_eligible', 'Food', 13.2]]
inventory = pd.DataFrame(data, columns=['item_id', 'item_type', 'item_category', 'square_footage']).astype({'item_id':'Int64', 'item_type':'object', 'item_category':'object', 'square_footage':'Float64'})

#leetcodesolutions #datascience #sql


On this page of the site you can watch the video online Leetcode HARD 3052 - Maximize Items FLOOR CASE WHEN SQL - Explained by Everyday Data Science with a duration of hours minute second in good quality, which was uploaded by the user Everyday Data Science 01 August 2024, share the link with friends and acquaintances, this video has already been watched 297 times on youtube and it was liked by 7 viewers. Enjoy your viewing!