Can You Find 5 Errors in This SQL Query? | SQL Debugging

Поділитися
Вставка
  • Опубліковано 29 лис 2024

КОМЕНТАРІ • 11

  • @LearnatKnowstar
    @LearnatKnowstar  2 місяці тому +1

    Can you find the 5th error in this SQL Query? Please let us know in comments below!

  • @kristyowens2284
    @kristyowens2284 2 місяці тому +1

    amazing - still looking for the 5th error :D

  • @whitecrowuk575
    @whitecrowuk575 2 місяці тому +1

    1. salary/12.0 - or convert both to decimal/float - otherwise it will discard decimal places
    2. Total rate - need to cast as numerical type like decimal or integer first otherwise you’re concatenating strings
    3. Case - second check needs to come first otherwise first will return true on first one meaning second condition would never happen.
    4. DeptID condition needs to be with left join as we return dept name only if it’s 1-3 not filter out all records when this happens
    5.Manager_ID 5 not 3 also null handling would be nice since we can see it occurs there and if we want to treat it as 5 then something like isnull(Manager_id,0) 5 would do the job (just mind you lose sargability that is index on that column would not be used leading to possibly poorer query performance).
    Ps realized this is not quiz and you provide the answers- good morning 😅

  • @crickmoments3732
    @crickmoments3732 2 місяці тому

    Great video really liked it, please make more videos like this.

  • @dchvswamy7537
    @dchvswamy7537 2 місяці тому