The 365 Data Science team is proud to invite you to our own community forum. A very well built system to support your queries, questions and give the chance to show your knowledge and help others in their path of becoming Data Science specialists.
Ask
Anybody can ask a question
Answer
Anybody can answer
Vote
The best answers are voted up and moderated by our team

case statement section in SQL course

case statement section in SQL course

0
Votes
3
Answer

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

please clarify your question,add screenshot or coding you have performed,its not clear what you wanted to ask..

5 months
3 Answers

365 Team
0
Votes

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

0
Votes

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 

365 Team
0
Votes

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

×
LAST CHANCE
Ready to Learn Data Science?
50% OFF