Thursday, June 18, 2020

Answer for Sometimes I would like to validate my results. How can I do this in this example (Exists-Not Exists)

https://365datascience.com/dwqa-answer/answer-for-sometimes-i-would-like-to-validate-my-results-how-can-i-do-this-in-this-example-exists-not-exists/ -

Hi Mike!

Thanks for reaching out.

Please accept my apologies for the delayed response.

We can’t add a condition when designating the columns we are joining our tables on. Moreover, we have already designated the title of interest in the subquery. 

That said, I guess that the following query will solve the task you are referring to.


SELECT 
e.first_name, e.last_name, t.title
FROM
employees e
JOIN
titles t ON e.emp_no = t.emp_no
WHERE
EXISTS( SELECT
*
FROM
titles t
WHERE
t.emp_no = e.emp_no
AND title = 'Assistant Engineer');

Hope this helps.
Best,
Martin




#365datascience #DataScience #data #science #365datascience #BigData #tutorial #infographic #career #salary #education #howto #scientist #engineer #course #engineer #MachineLearning #machine #learning #certificate #udemy

No comments:

Post a Comment