SQL Challenge - Data Analyst Interviews!: Solve SQL Question LIKE a PRO! EP SQL - 21/50

preview_player
Показать описание
Stay connected for the latest updates, job opportunities, and data analysis tips!

Download the code/query/tables/dataset :

JOIN the SQL 3 Days 12 hour live workshop Batch-02

Let's grow together!

My Github to download the data & tables

Ready to CRUSH your Data Analyst or Business Analyst interview? Join me on this 50-DAY SQL INTERVIEW CHALLENGE!

In this video, we'll dive DEEP into an ACTUAL Interview Question for Business Analyst and Data Analyst interview question. I'll walk you through:

Understanding the problem statement: We'll break down the question clearly and identify key requirements.
Building the optimal SQL query: Step-by-step, we'll craft an efficient and accurate solution using JOINs, aggregations, and filters.
Explaining your thought process: Learn how to articulate your problem-solving approach and showcase your SQL expertise.
BONUS TIPS & TRICKS: Gain valuable insights for acing your SQL interview with confidence.
Don't forget to:

Like this video and subscribe for more daily challenge videos!
Leave a comment with your own approach to the question.
Share this video with your fellow job seekers!
This is just the beginning! Subscribe now and stay tuned for Day 2's challenge!

Music cc: YouTube-Channel Liborio Conti
Рекомендации по теме
Комментарии
Автор

I solved the que like this:
select product_name, round((price*quantity_sold)*100.00/(select sum((price*quantity_sold)) from products), 2) as perc_contri from products


Task solution for MS SQL Server:
select product_name, round((price*quantity_sold)*100.00/(select sum((price*quantity_sold)) from products), 2) as perc_contri from products
where product_name in ('MacBook Pro', 'iPhone')

divyanshisharma
Автор

Task Solution
select
product_id,
product_name,
price*quantity_sold as revenue_by_product,
sum(price*quantity_sold) from products_rev)*100, 2) as
from products_rev where product_name in ('MacBook Pro', 'iPhone')

pavi
Автор

select product_name, price * quantity_sold as revenue_of_product,
round(price * quantity_sold/(Select sum(price * quantity_sold) from products) * 100, 2) as percentage_contribution
from products
where product_name in ('MacBook Pro', 'Iphone')

shubhamtripathi
Автор

select * from
(select
product_id,
product_name,
price*quantity_sold as revenue_by_product,
sum(price*quantity_sold) from products) *100, 2) as contribution
from products) as subquery
where Product_name in ('MacBook Pro', 'iPhone')

RahulThakur-fdri
Автор

select product_id, product_name, price, quantity_sold, (price*quantity_sold) as total_price,
round( (price*quantity_sold)/(select sum(price*quantity_sold) from products)*100, 2)
as percentage
from
products where product_name in ('Macbook Pro', 'iphone');

moureanyuvi
Автор

select product_name, price* quantity_sold as rev_product
, round(price* quantity_sold / (SELECT SUM(price * quantity_sold) from products_21)*100, 2) as contri from products_21
where product_name in ('MacBook Pro', 'iPhone') ;

bsupritbaviskar
Автор

SELECT
product_id,
product_name,
price * quantity_sold as revenue_by_product,
ROUND(price * quantity_sold/(SELECT SUM(price * quantity_sold) from products) * 100, 2) as contribution
FROM products
where product_name in ('Macbook Pro', 'iphone')
;

heyrobined
visit shbcf.ru