Last answered:

02 Sept 2022

Posted on:

24 Jun 2022

0

Need clarification on why using e.emp_no < 10011 in the WHERE clause

I can't make sense of the condition you have suggested in the query at all, the prompt asks us for the first 10 employees, so I think we should use a condition like emp_no BETWEEN 110022 AND 110032. Below is the code I had run:

SELECT
    e.*, d.*
FROM
    employees e
        CROSS JOIN
    departments d
WHERE
    emp_no BETWEEN 110022 AND 110032
ORDER BY e.emp_no;

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

25 Jun 2022

0

Hi Saeed!
Thanks for reaching out.

Yes, you can use the BETWEEN operator. However, the first employee starts with number 10001. So, please use the following code:

SELECT
    e.*, d.*
FROM
    employees e
        CROSS JOIN
    departments d
WHERE
    emp_no BETWEEN 10001 AND 10010
ORDER BY e.emp_no;

Hope this helps.
Best,
Tsvetelin

Posted on:

26 Jul 2022

0

Also I had to add "GROUP BY e.emp_no" just before "ORDER BY e.emp_no;" as it was giving me 90 rows instead of 10. In case it helps.

Posted on:

02 Sept 2022

1

It really should result into 90 rows, since we are assigning each of the 10 employees with 9 possible departments.

Submit an answer