Pergunta de entrevista da empresa Meta

# # sales # products # +------------------+---------+ +---------------------+---------+ # | product_id | INTEGER |>--------| product_id | INTEGER | # | store_id | INTEGER | +---<| product_class_id | INTEGER | # | customer_id | INTEGER | | | brand_name | VARCHAR | # +---<| promotion_id | INTEGER | | | product_name | VARCHAR | # | | store_sales | DECIMAL | | | is_low_fat_flg | TINYINT | # | | store_cost | DECIMAL | | | is_recyclable_flg | TINYINT | # | | units_sold | DECIMAL | | | gross_weight | DECIMAL | # | | transaction_date | DATE | | | net_weight | DECIMAL | # | +------------------+---------+ | +---------------------+---------+ # | | # | # promotions | # product_classes # | +------------------+---------+ | +---------------------+---------+ # +----| promotion_id | INTEGER | +----| product_class_id | INTEGER | # | promotion_name | VARCHAR | | product_subcategory | VARCHAR | # | media_type | VARCHAR | | product_category | VARCHAR | # | cost | DECIMAL | | product_department | VARCHAR | # | start_date | DATE | | product_family | VARCHAR | # | end_date | DATE | +---------------------+---------+ # +------------------+---------+ # */ # Question 1: # -- What percent of all products in the grocery chain's catalog # -- are both low fat and recyclable? #

Respostas da entrevista

Sigiloso

9 de jul. de 2020

COUNT(CASE WHEN is_low_fat_flg ='Y' and is_recyclable_flg ='Y' THEN product_id END)*100 /COUNT(product_id) total FROM PRODUCTS

7

Sigiloso

25 de ago. de 2020

select ( case when is_lowFat = 'y' and is_recyclable_flag = 'Y' then product_id end )/count(product_id) as total from products

Sigiloso

14 de set. de 2020

Is there any data we can validate the sales data

Sigiloso

21 de set. de 2020

Any recent interview givers ?

Sigiloso

9 de abr. de 2021

select count(1) filter(where islowfat = 1 and isrecyclable = 1)/count(1) as percentage from products