Last answered:

25 Apr 2023

Posted on:

21 Apr 2023

0

Numbers don't match, am I missing something?

In the table salaries the count of current salaries (whose to_date is>sysday()) is 81635.

However, in the table dept_emp the amount of employees whose to_date is >sysday() = 240024

If we run the  query below, we can see that there are 158489 employees whose salary  = 0

Is it supposed to be this way? Seems counterintuitive.


select de.emp_no, count(s.to_date)
from dept_emp de
left join salaries s on (s.emp_no = de.emp_no) and (s.to_date>sysdate())
where de.to_date > sysdate()
group by de.emp_no
having count(s.to_date) = 0;



2 answers ( 0 marked as helpful)
Posted on:

24 Apr 2023

0

Hi Eugenia!
Thanks for reaching out.


Could you please explain your question with more words and provide additional examples? Thank you.


Looking forward to your answer.
Best,
Tsvetelin

Posted on:

25 Apr 2023

0

What I am trying to say is that the amount of current employees is more than the amount of current salaries. (The query that I gave proves it). It seems counter intuitive to me, because, as far as I am concerned, every employee should have a salary. The reason I am pointing it out is because it confused me when I was trying to make sence of numbers regarding this database. 


Submit an answer