Last answered:

03 May 2020

Posted on:

25 Apr 2020

0

case statement section in SQL course

Hi,
In the exercise 1 I am not getting the desired result even if i use your solution.
with my coding I am only getting 24 rows of managers only in the fourth column and with your code I am getting 200035 rows of employees only
i am confused with is null and is not null.
please help

3 answers ( 0 marked as helpful)
Instructor
Posted on:

26 Apr 2020

0
Hi Aimen and Prafful! Thanks for reaching out. Indeed, can you please support your question with more information, Aimen? Much as Prafful requested. Looking forward to your answer.
Best,
Martin
Posted on:

28 Apr 2020

0
My apologies for being so vague. I just completed by course on SQL and really happy with the results. My question is for the last section of 'case statement' there is exercise 1 with coding pasted below SELECT e.emp_no, e.first_name, e.last_name, CASE WHEN dm.emp_no IS NOT NULL THEN 'Manager' ELSE 'Employee' END AS is_manager FROM employees e LEFT JOIN dept_manager dm ON dm.emp_no = e.emp_no WHERE e.emp_no > 109990; When I type the same coding above in my workbench I get employees only in last column whether I use IS NOT NULL or NOT NULL  the result is same. I hope I am able to explain my question now 
Instructor
Posted on:

03 May 2020

0
Hi Aimen! Thanks for the kind words and reaching out. Although the number of rows obtained is the same, the output as a whole is not identical at all. If you use IS NOT NULL, you obtain only "Employee" in column is_manager. If you use IS NULL (I think that's what you meant, as opposed to NOT NULL which leads to an error message), then you will obtain only "Manager" in column is_manager. Hope this helps.
Best,
Martin

Submit an answer