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
In questa pagina del sito puoi guardare il video online Leetcode HARD 3052 - Maximize Items FLOOR CASE WHEN SQL - Explained by Everyday Data Science della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Everyday Data Science 01 agosto 2024, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 297 volte e gli è piaciuto 7 spettatori. Buona visione!