Case Statements in MySQL | Intermediate MySQL

Поделиться
HTML-код
  • Опубликовано: 27 сен 2024

Комментарии • 61

  • @sparkle_ko
    @sparkle_ko 3 месяца назад +61

    'On death's door' is WILD 💀💀😭😭

    • @favelg.cooper9118
      @favelg.cooper9118 2 месяца назад +3

      I had to stop cus I was laughing way too hard

    • @oracam437
      @oracam437 28 дней назад

      Very insulting to label people like that especially on You Tube.

  • @real__memes
    @real__memes 4 месяца назад +21

    Poor Jerry man, he's not only old but doesn't get a raise as well. Feel bad for the bloke

  • @marysoil3209
    @marysoil3209 3 месяца назад +5

    I really like your way of explaining things and giving us the real-life example on how to properly use them. Thank you for putting so much effort making this kind of content. Hope you make more, I wanna learn a lot from you!

  • @collettecollettec
    @collettecollettec 7 месяцев назад +11

    omg, i'm working on a project of my own with the exact same table title. this is great timing!

  • @nategraham3980
    @nategraham3980 Месяц назад +6

    Jerry Gergich can never catch a break

  • @BruceBeck-f1n
    @BruceBeck-f1n 4 месяца назад +7

    I use something like a CASE Statement in Excel's Power Query A LOT. Very powerful. Same idea as a CASE statement in MySQL (and probably MSSQLSVR, PostreSQL, etc.) Another "Thumbs Up" lesson in my opinion. Glad to have this treasure trove of knowledge to fall back on if I get stuck going down a MySQL rabbit hole (Read in your best "Elmer Fudd" voice - Got to love those rascally rabbits...😁)

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

    Your tutorials and way of explaining is really really good, this stuff is really interesting and I am really enjoying studying because of you, thank you soo much!!

  • @alihanemretunc7789
    @alihanemretunc7789 Месяц назад +1

    thank you your lessons have been really helpful. Just one thing, maybe mentioning ELSE would be nice here

  • @Seftehandle
    @Seftehandle 7 месяцев назад +1

    Great vid, i would use the statement of finance id as first statement and then add the 2 consequtive when end

  • @alicdngwenya5081
    @alicdngwenya5081 7 месяцев назад

    Hello Alex, your positive impact on lives is evident, and I've been following your journey. Your work is commendable. I'm eager to collaborate with you to make a difference in the lives of struggling youth who are losing hope due to unemployment, turning to substances. Together, we can bring positive change."

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

    My man said “my parents gonna love me for this one” after the brutal KO, the on death’s door. 😭😂😂😂
    Btw this series is amazing till now❤

  • @Seftehandle
    @Seftehandle 7 месяцев назад +2

    Loved it!

  • @megan_mackenzie
    @megan_mackenzie 7 месяцев назад +6

    Ron's age/birthday data isn't there 😂😂😂

  • @AliAli-li4ys
    @AliAli-li4ys 7 месяцев назад

    Alex can you please provide a discount code for your website? Can you also suggest/recommend what course should I begin with. Please respond 😇
    I don’t mean to spam your comment section. Just hoping to grab your attention.

  • @Pragya3421
    @Pragya3421 5 месяцев назад +2

    In case of finance, Isn't it the salary should be as per 5 or 7 % as per the bracket and Bonus should be 10%? Bcoz bonus is one time only.

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

      I was wondering the same thing. My assumption would be it's a 7% increase with a 10% bonus. However, in the real world I think Alex is just going over the stakeholder's condition(Which is what the bonus is for a finance dept).

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

      I understood where you are coming from and thought the same, however could be like the below poster mentioned. That the finance dept does not get a pay increase and solely bonuses?

  • @fpawluszmtg
    @fpawluszmtg Месяц назад +1

    It blows my mind how fantastic, useful and entertaining this series has been. Your delivery is absolutely on point. Thank you for putting out all this invaluable content!

  • @marabunta1980
    @marabunta1980 7 месяцев назад

    Hello Alex, I have about 15 years of software engineering experience in java ecosystem.
    Been a hard-core programmer throughout my career.
    Lately been thinking of adding any worthy skill set to boost my career.
    Do you think something like a data analyst would be apt for me?

  • @jorgechavarriaga395
    @jorgechavarriaga395 3 месяца назад +1

    My solution for the exercise:
    SELECT ed.first_name, ed.last_name, pd.department_name, es.salary,
    CASE
    WHEN es.salary < 50000 THEN (es.salary * 1.05)
    WHEN es.salary > 50000 THEN (es.salary * 1.07)
    END as new_salary,
    CASE
    WHEN pd.department_name like 'finance' THEN (es.salary * .1)
    ELSE 0
    END as bonus
    FROM employee_demographics ed
    left join employee_salary es on ed.employee_id = es.employee_id
    left join parks_departments pd on es.dept_id = pd.department_id
    ORDER BY new_salary DESC;
    And one more, a little more complex, to continue learning new concepts:
    SET @LowSalaryIncrease = 1.05;
    SET @HighSalaryIncrease = 1.07;
    SET @SalaryThreshold = 50000;
    SET @FinanceBonusRate = 0.1;
    SELECT
    ed.first_name,
    ed.last_name,
    pd.department_name,
    es.salary,
    CASE
    WHEN es.salary < @SalaryThreshold THEN (es.salary * @LowSalaryIncrease)
    WHEN es.salary >= @SalaryThreshold THEN (es.salary * @HighSalaryIncrease)
    END as new_salary,
    CASE
    WHEN pd.department_name = 'finance' THEN (es.salary * @FinanceBonusRate)
    ELSE 0
    END as bonus
    FROM
    employee_demographics ed
    LEFT JOIN employee_salary es ON ed.employee_id = es.employee_id
    LEFT JOIN parks_departments pd ON es.dept_id = pd.department_id
    ORDER BY
    new_salary DESC;

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

      by the way...I fell into the range of 'On death's door' 🤣

    • @alihanemretunc7789
      @alihanemretunc7789 Месяц назад +1

      Thank you. if wanna get rid of NULLs and decimals, look at this as well:
      SELECT ed.first_name, ed.last_name, pd.department_name, es.salary,
      CASE
      WHEN es.salary < 50000 THEN ROUND(es.salary * 1.05)
      WHEN es.salary > 50000 THEN ROUND(es.salary * 1.07)
      ELSE es.salary
      END AS new_salary,
      CASE
      WHEN pd.department_name like 'finance' THEN ROUND(es.salary * .1)
      ELSE 0
      END AS bonus
      FROM employee_demographics ed
      INNER JOIN employee_salary es on ed.employee_id = es.employee_id
      INNER JOIN parks_departments pd on es.dept_id = pd.department_id
      ORDER BY new_salary DESC;

  • @anassalkabbani6192
    @anassalkabbani6192 11 дней назад

    quick question, you pulled the dept_id column from a different table without identifying the table how is that possible ?

    • @amosem_
      @amosem_ 6 дней назад +1

      I think it's because each dept_id is unique to each department and can also be found in the parks_department table as department_id, and we know from the said table that 6 is unique to the finance department.

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

    quick question -- shouldn't it be bonus of new salary i.e 10% of 74900

  • @sachin-b8c4m
    @sachin-b8c4m 7 месяцев назад

    thank you

  • @MinatoJunior-hl8tb
    @MinatoJunior-hl8tb 7 месяцев назад

    Hello can you do a video into how to download a csv file faster into mysql. I was able to prep the csv file and create table and the datatypes for it but i ran into the problem of error code 1265

  • @TobiDeolu
    @TobiDeolu 7 месяцев назад

    Hi Alex, this is so interesting and pretty fascinating.
    I would like to ask, which do you think is pretty simple not to get confused with when writing the "New_Salary" equation? Is it writing the full equation as "Salary + (Salary * 0.05) for 5% increase or writing it as "Salary * 1.05"

    • @el-prof1700
      @el-prof1700 2 месяца назад

      The second solution
      salary*1.05
      because the first is longer and awful
      except if you explain it to one who didn't know anything about math

    • @WilnerSumagingsing
      @WilnerSumagingsing 22 дня назад

      2nd one of course but since this is a tutorial and expect that not all viewers are good at numbers it is good to use the first one to make beginners easily catch up

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

    Wouldn't 3rd CASE statement be >50 since second one includes age 50 already?

  • @sachin-b8c4m
    @sachin-b8c4m 7 месяцев назад

    may I know how to download these tables?

  • @DivisivelyIndivisible
    @DivisivelyIndivisible 7 месяцев назад

    What do you think about rapidly increasing adoption of Databricks?

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

    Having trouble with the maths and percentages lol

  • @asgard5522
    @asgard5522 4 месяца назад +1

    On death's door lol

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

    This is similar to if Statement in Python.

  • @garry6882
    @garry6882 12 дней назад

    31 - 50 is old :(

  • @WilnerSumagingsing
    @WilnerSumagingsing 22 дня назад

    Poor 50,000 salary people no increase HAHAHA

  • @aizuddinbinshaalimasri7181
    @aizuddinbinshaalimasri7181 18 дней назад

    unfair increase rate. especially for tom and jerry. plus the imbalance increase rate resulting larger salary gap. boohoo

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

    on death's door

  • @tantei1496
    @tantei1496 12 дней назад

    excuse me i'm still not understand with salary * 1.05 and salary * .10 why use 1? and in 10% for bonus is why use .10 and not 1.10?

  • @iyshsd
    @iyshsd 10 часов назад

    WHEN age >= 50 'good night'

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

    Between 31 and 50 old??
    So, am 31, and you really dissappointed me :(

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

    poor Tom and Jerry, earning 50k doesnt grant them an increase 😂😂

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

    thank you thank you thank you

  • @WilnerSumagingsing
    @WilnerSumagingsing 22 дня назад

    On death's door 💀

  • @ryanstef
    @ryanstef 4 месяца назад

    Hi Alex, thank you for these videos.
    How can i use the case statement as an input data?
    example:
    Case end as Salary_increase,
    salary + salary_increase as New_salary
    SQL is not recognizing salary_increase as a new column that i can use.

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

    What was your loss if you also uploaded numeric functions in this series?

  • @wherezavigoes
    @wherezavigoes 4 месяца назад

    I understand everything he studied us but can't practice because I don't have data

  • @DataAnalyst-f6l
    @DataAnalyst-f6l Месяц назад

    Man just cannot believe finance did an outstanding job

  • @rahulpattnaik4118
    @rahulpattnaik4118 7 месяцев назад +4

    Hey Alex, your MySQL lessons are fantastic! Could you please upload them a bit faster? I have an upcoming interview and I'd love to practice more before then. Thanks so much!

    • @AlexTheAnalyst
      @AlexTheAnalyst  7 месяцев назад +3

      I post only one video per week because otherwise I would post way too much and have to constantly be creating more videos. I do have a full MySQL course and a platform to practice MySQL on AnalystBuilder.com - hope that helps!

    • @AliAli-li4ys
      @AliAli-li4ys 7 месяцев назад

      @@AlexTheAnalystCan you please provide a discount code? I would really appreciate it. Any suggestions/recommendations of what course to begin with (on your website) for a complete beginner.
      Thank You

  • @LibyaMicro
    @LibyaMicro 7 месяцев назад

    Question: What distinguishes MySQL from Firebird, and does it have strengths over other databases?

    • @hadiamalik9570
      @hadiamalik9570 2 месяца назад +1

      MySQL is a highly popular and widely used database, especially for web applications, due to its large community, ease of use, and excellent integration with various programming languages and platforms. Firebird, on the other hand, is known for its performance, efficiency, and lightweight nature, making it suitable for smaller systems and applications requiring high concurrency and low resource usage. The choice between the two depends on the specific needs of the project, with MySQL being ideal for broader applications and web development, and Firebird excelling in environments needing efficient resource management and high user concurrency.

  • @rahullshharma3800
    @rahullshharma3800 5 месяцев назад

    Where can I find this dataset?