Frederik Müller
Frederik Müller
  • Видео 127
  • Просмотров 592 019
*HARD* IBM SQL Interview Question (StrataScratch 10538)
Solution and walkthrough of a real SQL interview question for Data Scientist and Data Analyst technical coding interviews. This question was asked by IBM and is called "Friday Purchases".
Try this question on StrataScratch: platform.stratascratch.com/coding/10358-friday-purchases?via=frederik
Find me on LinkedIn: linkedin.com/in/frederikmueller/
0:00 Intro
0:18 Problem Statement
2:09 Solution Walkthrough
7:57 The Calendar Problem
12:15 Outro
Playlists:
ruclips.net/p/PLdrw9_aIADIO_l7hCd4xiJ2mBwiOb4jkU
ruclips.net/p/PLdrw9_aIADIPAMJW8I_S-S747oyiRtzpS
ruclips.net/p/PLdrw9_aIADIO0O8PYds0sND0ELokLQ4bv
ruclips.net/p/PLdrw9_aIADINpdkxu_RHaY16QmG8-mRSm
ruclips.net/p/PLdrw9_aIADIMSQe_-m6xknIdPPNiYngKh
ruclips.n...
Просмотров: 275

Видео

LeetCode 1907: Count Salary Categories [SQL]
Просмотров 2722 месяца назад
Solution and walkthrough of a real SQL interview question for Data Scientist and Data Analyst technical coding interviews. This question is marked as medium and is called "Count Salary Categories". 0:00 Intro 0:16 Problem Statement 2:03 Solution Walkthrough 9:07 Outro Try this question: leetcode.com/problems/count-salary-categories/ LeetCode SQL 50 Study Plan: leetcode.com/studyplan/top-sql-50/...
LeetCode 1683: Invalid Tweets [SQL]
Просмотров 4652 месяца назад
Solution and walkthrough of a real SQL interview question for Data Scientist and Data Analyst technical coding interviews. This question is marked as easy and is called "Invalid Tweets". 0:00 Intro 0:07 Problem Statement 1:11 Solution 3:06 LENGTH() vs. CHAR_LENGTH() 6:09 Outro Try this question: leetcode.com/problems/invalid-tweets/ Check out StrataScratch: www.stratascratch.com/?via=frederik F...
LeetCode 584: Find Customer Referee [SQL]
Просмотров 3343 месяца назад
Solution and walkthrough of a real SQL interview question for Data Scientist and Data Analyst technical coding interviews. This question is marked as easy and is called "Find Customer Referee". Try this question: leetcode.com/problems/find-customer-referee/ Check out StrataScratch: www.stratascratch.com/?via=frederik Find me on LinkedIn: linkedin.com/in/frederikmueller/ 0:00 Intro 0:18 Problem ...
LeetCode 1148: Article Views I [SQL]
Просмотров 3283 месяца назад
Solution and walkthrough of a real SQL interview question for Data Scientist and Data Analyst technical coding interviews. This question is marked as easy and is called "Article Views I". Try this question: leetcode.com/problems/article-views-i/ Check out StrataScratch: www.stratascratch.com/?via=frederik Find me on LinkedIn: linkedin.com/in/frederikmueller/ Playlists: ruclips.net/p/PLdrw9_aIAD...
LeetCode 1581: Customer Who Visited but Did Not Make Any Transactions [SQL]
Просмотров 7954 месяца назад
Solution and walkthrough of a real SQL interview question for Data Scientist and Data Analyst technical coding interviews. This question is marked as easy and is called "Customer Who Visited but Did Not Make Any Transactions". 0:00 Intro 0:07 Problem Statement 1:41 Subquery (WHERE NOT IN) Solution 5:10 LEFT JOIN Solution 10:31 Problem Discussion 11:12 Outro Try this question: leetcode.com/probl...
LeetCode 1978: Employees Whose Manager Left the Company [SQL]
Просмотров 3354 месяца назад
Solution and walkthrough of a real SQL interview question for Data Scientist and Data Analyst technical coding interviews. This question is marked as easy and is called "Employees Whose Manager Left the Company". Try this question: leetcode.com/problems/employees-whose-manager-left-the-company/ Check out StrataScratch: www.stratascratch.com?via=frederik Find me on LinkedIn: linkedin.com/in/fred...
LeetCode 2356: Number of Unique Subjects Taught by Each Teacher [SQL]
Просмотров 4454 месяца назад
Solution and walkthrough of a real SQL interview question for Data Scientist and Data Analyst technical coding interviews. This question is marked as easy and is called "Number of Unique Subjects Taught by Each Teacher". Try this question: leetcode.com/problems/number-of-unique-subjects-taught-by-each-teacher/ Check out StrataScratch: www.stratascratch.com?via=frederik Find me on LinkedIn: link...
LeetCode 1934: Confirmation Rate [SQL]
Просмотров 1,2 тыс.4 месяца назад
LeetCode 1934: Confirmation Rate [SQL]
*HARD* Walmart SQL Interview Question (StrataScratch 9900: Median Salary)
Просмотров 7145 месяцев назад
*HARD* Walmart SQL Interview Question (StrataScratch 9900: Median Salary)
*HARD* Microsoft SQL Interview Question for Data Scientists and Data Analysts (StrataScratch 10300)
Просмотров 7899 месяцев назад
*HARD* Microsoft SQL Interview Question for Data Scientists and Data Analysts (StrataScratch 10300)
*HARD* Apple SQL Interview Question for Data Scientists and Data Analysts (StrataScratch 2029)
Просмотров 8989 месяцев назад
*HARD* Apple SQL Interview Question for Data Scientists and Data Analysts (StrataScratch 2029)
Salesforce SQL Interview Question for Data Scientists and Data Analysts (StrataScratch 9905)
Просмотров 84110 месяцев назад
Salesforce SQL Interview Question for Data Scientists and Data Analysts (StrataScratch 9905)
*HARD* Meta/Facebook SQL Interview Question for Data Scientists/Analysts (StrataScratch 10297)
Просмотров 1,4 тыс.10 месяцев назад
*HARD* Meta/Facebook SQL Interview Question for Data Scientists/Analysts (StrataScratch 10297)
*HARD* Amazon SQL Interview Question for Data Scientists and Data Analysts (StrataScratch 10314)
Просмотров 1,2 тыс.10 месяцев назад
*HARD* Amazon SQL Interview Question for Data Scientists and Data Analysts (StrataScratch 10314)
Tesla SQL Interview Question for Data Scientists and Data Analysts (StrataScratch 10318)
Просмотров 1,6 тыс.10 месяцев назад
Tesla SQL Interview Question for Data Scientists and Data Analysts (StrataScratch 10318)
TikTok ByteDance SQL Interview Question for Data Scientists and Data Analysts (StrataScratch 2145)
Просмотров 2,3 тыс.11 месяцев назад
TikTok ByteDance SQL Interview Question for Data Scientists and Data Analysts (StrataScratch 2145)
Starbucks SQL Interview Question for Data Scientists and Data Analysts (StrataScratch9867)
Просмотров 77611 месяцев назад
Starbucks SQL Interview Question for Data Scientists and Data Analysts (StrataScratch9867)
Tata Consultancy Services SQL Interview Question (StrataScratch 2144)
Просмотров 3,1 тыс.11 месяцев назад
Tata Consultancy Services SQL Interview Question (StrataScratch 2144)
NVIDIA SQL Interview Question for Data Scientists and Data Analysts (StrataScratch 10163)
Просмотров 76811 месяцев назад
NVIDIA SQL Interview Question for Data Scientists and Data Analysts (StrataScratch 10163)
Google SQL Interview Question for Data Scientists and Data Analysts (StrataScratch 10351)
Просмотров 90011 месяцев назад
Google SQL Interview Question for Data Scientists and Data Analysts (StrataScratch 10351)
SQL Window Functions Tutorial | Window Functions in SQL
Просмотров 1,1 тыс.Год назад
SQL Window Functions Tutorial | Window Functions in SQL
The Difference Between WHERE and HAVING | WHERE vs. HAVING in SQL
Просмотров 2,2 тыс.Год назад
The Difference Between WHERE and HAVING | WHERE vs. HAVING in SQL
Shopify SQL Interview Question for Data Scientists and Data Analysts (StrataScratch 2118)
Просмотров 2,7 тыс.2 года назад
Shopify SQL Interview Question for Data Scientists and Data Analysts (StrataScratch 2118)
*HARD* Twitch SQL Interview Question for Data Scientists and Data Analysts (StrataScratch 2012)
Просмотров 1,4 тыс.2 года назад
*HARD* Twitch SQL Interview Question for Data Scientists and Data Analysts (StrataScratch 2012)
Another Meta / Facebook SQL Interview Question for Data Scientists / Analysts (StrataScratch 2086)
Просмотров 1,8 тыс.2 года назад
Another Meta / Facebook SQL Interview Question for Data Scientists / Analysts (StrataScratch 2086)
Another Google SQL Interview Question for Data Scientists and Data Analysts (StrataScratch 2098)
Просмотров 2,3 тыс.2 года назад
Another Google SQL Interview Question for Data Scientists and Data Analysts (StrataScratch 2098)
Another Airbnb SQL Interview Question for Data Scientists and Data Analysts (StrataScratch 9636)
Просмотров 1,6 тыс.2 года назад
Another Airbnb SQL Interview Question for Data Scientists and Data Analysts (StrataScratch 9636)
Instacart SQL Interview Question for Data Scientists and Data Analysts (StrataScratch 2087)
Просмотров 3,1 тыс.2 года назад
Instacart SQL Interview Question for Data Scientists and Data Analysts (StrataScratch 2087)
DoorDash SQL Interview Question for Data Scientists and Data Analysts (StrataScratch 2035)
Просмотров 4 тыс.2 года назад
DoorDash SQL Interview Question for Data Scientists and Data Analysts (StrataScratch 2035)

Комментарии

  • @aadilzikre
    @aadilzikre День назад

    Why not simply order by active users and select the top 2 rows? Rank is an overkill for this question no?

    • @frederikmuller
      @frederikmuller День назад

      yes, you’re totally righty. that would work but one of the test cases fails with the example data when just using LIMIT. they want to include ties which usually wouldn’t happen for user counts on a large service.

    • @aadilzikre
      @aadilzikre День назад

      @@frederikmuller got it. Makes sense.

  • @cnausp7000
    @cnausp7000 2 дня назад

    What do you think of this one? SELECT 'Low Salary' AS category, COUNT(*) AS accounts_count FROM Accounts WHERE income < 20000 UNION ALL SELECT 'Average Salary' AS category, COUNT(*) AS accounts_count FROM Accounts WHERE income BETWEEN 20000 AND 50000 UNION ALL SELECT 'High Salary' AS category, COUNT(*) AS accounts_count FROM Accounts WHERE income > 50000;

  • @frederikmuller
    @frederikmuller 3 дня назад

    MentorCruise: mentors.to/frederikmuller LinkedIn: www.linkedin.com/in/frederikmueller/

  • @sqlserverhelper8067
    @sqlserverhelper8067 3 дня назад

    Nice explanation. In general, would a LEFT JOIN be faster than a RIGHT JOIN or will it be just the same?

    • @frederikmuller
      @frederikmuller 3 дня назад

      They're both the same type of JOIN, just in a different order. It really depends on how big the tables are.

  • @Tortchen-me8dn
    @Tortchen-me8dn 3 дня назад

    w

  • @davidreilly5215
    @davidreilly5215 6 дней назад

    Never thought of joining the tables. I used a window function with cte as ( SELECT person_id, person_name, SUM(weight) OVER(order by turn) as added_weight FROM Queue ) SELECT person_name FROM cte WHERE added_weight <= 1000 ORDER BY added_weight DESC LIMIT 1;

  • @minakshi_119
    @minakshi_119 17 дней назад

    with cte as (select employee_id from Emp1 where manager_id in( select employee_id from Emp1 where manager_id in( select employee_id from Emp1 where manager_id=1))) select employee_id from cte where employee_id!=1 is this correct??

  • @user-zk6je9mg5e
    @user-zk6je9mg5e 21 день назад

    Why should we use subquery instead of 3😮

  • @mitrakaramloo943
    @mitrakaramloo943 21 день назад

    select product_id, sum(case when store='store1' then price end) as store1, sum(case when store='store2' then price end) as store2, sum(case when store='store3' then price end) as store3 from Products group by product_id

  • @mitrakaramloo943
    @mitrakaramloo943 21 день назад

    WITH OrderCounts AS ( SELECT customer_number, COUNT(*) AS order_count FROM Orders GROUP BY customer_number), MaxOrderCount AS ( SELECT MAX(order_count) AS max_order_count FROM OrderCounts) SELECT customer_number FROM OrderCounts WHERE order_count = (SELECT max_order_count FROM MaxOrderCount);

  • @mahmoudhosny8881
    @mahmoudhosny8881 23 дня назад

    MAX() OVER ( PARTITION BY department ORDER BY salary ) ? 🤔 Been practicing my SQL today 😂

  • @seanwayland
    @seanwayland 27 дней назад

    I think the Join answer is faster than the nested query.

  • @arwakalavadwala834
    @arwakalavadwala834 27 дней назад

    why didn't you use WHERE AVG(PRICES) after group by??

    • @frederikmuller
      @frederikmuller 3 дня назад

      you can't use AVG() in a WHERE clause, you'll have to use HAVING

  • @user-lx7ou9st8c
    @user-lx7ou9st8c 28 дней назад

    There might be same highest salary for more than one user per department ( say 1100 two times for audit department) that's why rank or dense_rank is preferred

  • @Tortchen-me8dn
    @Tortchen-me8dn 29 дней назад

    nice

  • @jaimegcia
    @jaimegcia Месяц назад

    Thank you so much for this man, It really helps. As someone currently looking for a related job, this helps feed my confidence.

    • @frederikmuller
      @frederikmuller 29 дней назад

      hang in there and good luck with your interviews!

  • @user-zf3it3vw2e
    @user-zf3it3vw2e Месяц назад

    very helpful

  • @onionsandwich
    @onionsandwich Месяц назад

    You are the Nick White of Leetcode Database explanation.

  • @CruiserPup
    @CruiserPup Месяц назад

    Great video and explanation, thank you!

  • @allahjoseph
    @allahjoseph Месяц назад

    Thanks for your walk troughs & nice audio !!!

  • @immortal-human
    @immortal-human Месяц назад

    use dark mode plz

  • @temenoscom3498
    @temenoscom3498 Месяц назад

    great work, thanks.

  • @dineshshinde1999
    @dineshshinde1999 Месяц назад

    please do not refer his code. its a wrong code

    • @frederikmuller
      @frederikmuller Месяц назад

      the question has been updated since recording this video, check out the pinned comment for the updated solution.

  • @TimBryan
    @TimBryan Месяц назад

    Thank you! This was really helpful.

  • @andresjvazquez
    @andresjvazquez 2 месяца назад

    Your content is top class !

  • @kinjalshah498
    @kinjalshah498 2 месяца назад

    select department, avg(salary) as median from (select department,salary, count(*) over (partition by department) as ct, row_number() over (partition by department order by salary) as rn from employee) a where rn between ct/2 and ct/2+1 group by department

  • @xiamojq621
    @xiamojq621 2 месяца назад

    Your content is interesting but i wish you had videos on topic including A/B testing since it is your specialty I'm not forcing you it's just a proposal since there is few cotent on the topic

    • @frederikmuller
      @frederikmuller 2 месяца назад

      Thanks for letting me know. I plan to cover some different topics soon but also want to finish up the SQL 50 playlist. Also, let me know if there’s anything else you’d like to see.

  • @DarkGT
    @DarkGT 2 месяца назад

    Not a analyst interview, but on manual data mining task I was asked to spend that much time doing real work free of charge. I did only half of it and I said that I give the rest if I'm selected to move ahead since it is a real data with real use. They gave up on me since I didn't fail (completely) on the scam.

    • @frederikmuller
      @frederikmuller 2 месяца назад

      oh my god so they actually made you do work for them

    • @DarkGT
      @DarkGT 2 месяца назад

      @@frederikmuller Yes, I was desperate to find a job so I was ready with whatever bs interview tests employers have. Don't be me, don't fail for it.

  • @aniketjaswal10
    @aniketjaswal10 2 месяца назад

    Alex The Analyst also said similarly in a data analysis interview prep video that he did about 2 weeks ago. But I've seen that a lot of companies give out these assignments so idk what are we supposed to do as a job seeker especially in the current job market situation.

    • @frederikmuller
      @frederikmuller 2 месяца назад

      yes, it’s a tough situation. the more people push back the more industry standards will change.

  • @user-bb7mn8qz2o
    @user-bb7mn8qz2o 2 месяца назад

    just 2 line !!! great select contest_id,round(count(user_id) * 100.0/(select count(user_id) from users),2) as percentage from register group by contest_id order by percentage desc,contest_id when i try this, Time Limit Exceeded

  • @user-bb7mn8qz2o
    @user-bb7mn8qz2o 2 месяца назад

    super helpful

  • @samuraychik111
    @samuraychik111 2 месяца назад

    declare @weight int = 0 declare @turn int = 1 declare @currentweight int while @weight !=1000 begin select @currentweight = (select weight from elevator where turn = @turn) if @currentweight + @weight<1000 begin set @weight = @weight+@currentweight set @turn=@turn+1 end else if @currentweight + @weight = 1000 begin select name from elevator where turn = @turn break end end (((its terrible but it works)

    • @frederikmuller
      @frederikmuller 2 месяца назад

      interesting, thanks for sharing 🤔

  • @AKothavikramreddy
    @AKothavikramreddy 2 месяца назад

    the logic behind this is, sum of the lengths of any two sides of the triangle should be greater than the third side.

  • @ashwinikumar2492
    @ashwinikumar2492 2 месяца назад

    Interesting solution. I just wanted to know how would this solution fair in comparison to window functions when you have a larger data size and limit?

  • @arun-sundar5964
    @arun-sundar5964 2 месяца назад

    Broo u r awesome! Thanks

  • @Bess_Gates
    @Bess_Gates 2 месяца назад

    sub++ i love the way you explain this thank you

  • @saktibiswal6445
    @saktibiswal6445 2 месяца назад

    Is the latter function available in MS SQL Server?

    • @frederikmuller
      @frederikmuller 2 месяца назад

      no, but there’s LEN() and DATALENGTH()

  • @Hsalz
    @Hsalz 2 месяца назад

    Cool! Thanks for sharing.

  • @edwardleonardo8392
    @edwardleonardo8392 2 месяца назад

    Thats a very interesting fact you have shared with us!

  • @bhaskarpathak8094
    @bhaskarpathak8094 2 месяца назад

    Try this also select a.name FROM employee a LEFT join employee b ON a.id = b.managerId HAVING COUNT(a.name) >= 5

  • @sabaokangan
    @sabaokangan 3 месяца назад

    Beautiful explanation for us newbies ❤ from NYC

  • @MO3az-hw9qy
    @MO3az-hw9qy 3 месяца назад

    WITH purchase AS ( SELECT user_id, created_at - LAG(created_at) OVER(PARTITION BY user_id ORDER BY created_at) AS difference FROM amazon_transactions ), result As (SELECT CASE WHEN difference >= 0 AND difference <= 7 THEN user_id ELSE NULL END AS user_id_filtered FROM purchase) select distinct user_id_filtered FROM result ORDER by user_id_filtered

  • @sabaokangan
    @sabaokangan 3 месяца назад

    Love your guidance 🙏

  • @harsh_36
    @harsh_36 3 месяца назад

    Thank you so much! I went through other solutions. This was way easier to understand. This is the first time I got to know that "where" can be used like this.

  • @alyssali6690
    @alyssali6690 3 месяца назад

    I couldn't solve it two years ago for my meta interview (campus hire, final round). Today when I was working on a similar query and I solved it within 5 minutes. The query took me back to 2 years ago and now I found your solution exactly matched mine. How time flies.

    • @frederikmuller
      @frederikmuller 3 месяца назад

      Thanks for sharing your story! You definitely made a lot of progress.

  • @sabaokangan
    @sabaokangan 3 месяца назад

    Love u bro

  • @JakkaniPrabhas
    @JakkaniPrabhas 3 месяца назад

    I haven't got 96.35% beats what's the reason and typed same code u explained

    • @frederikmuller
      @frederikmuller 3 месяца назад

      SQL runtime really doesn’t differ that much as it is optimized by the interpreter after submission, the beats % is quite random on leetcode and depends on factors like server load etc.

  • @Harsha-D311
    @Harsha-D311 3 месяца назад

    Hi 😂😂

  • @mervynchacko8352
    @mervynchacko8352 3 месяца назад

    Is there a reason why the below code does not work? select Sales.product_id, min(Sales.year) 'first_year', Sales.quantity, Sales.price from Sales left join Product using(product_id) group by 1

  • @andresjvazquez
    @andresjvazquez 3 месяца назад

    Thank you so much for sharing with us aspiring engineers Frederik! I'm 16 and in High School, where SQL isn't really taught as much as it should be

    • @frederikmuller
      @frederikmuller 3 месяца назад

      That’s awesome! And yes, SQL isn’t taught enough even at university which is why I made this channel. You’re definitely set up for success if you start practicing this early in your life!