Last answered:

29 May 2024

Posted on:

02 May 2023

0

Resolved: why this code not valid

SELECT
 m.emp_no, e.first_name,e.last_name,e.hire_date,t.title,t.from_date, d.dept_name
 from 
 dept_number d
 join
 dept_manager m on d.dept_no = m.dept_no
 join
 employees e on m.emp_no = e.emp_no
 join
 titles t on e.emp_no = t.emp_no;
   


the error >> 

Error Code: 1146. Table 'employees.dept_number' doesn't exist

6 answers ( 1 marked as helpful)
Instructor
Posted on:

03 May 2023

0

Hi Abdelrahman!
Thanks for reaching out.


There is not such a table dept_number. Please, use the departments table. The code is:

SELECT 
    m.emp_no,
    e.first_name,
    e.last_name,
    e.hire_date,
    t.title,
    t.from_date,
    d.dept_name
FROM
    departments d
        JOIN
    dept_manager m ON d.dept_no = m.dept_no
        JOIN
    employees e ON m.emp_no = e.emp_no
        JOIN
    titles t ON e.emp_no = t.emp_no;


Hope this helps.
Best,
Tsvetelin

Posted on:

03 May 2023

0

Thank you for your concern

Instructor
Posted on:

10 May 2023

0

Hi Abdelrahman!
You are very welcome!
Best,
Tsvetelin

Posted on:

07 Jul 2023

0

why this code is not working 

select
e.first_name, 
e.last_name, 
e.hire_date, 
m.form_date, 
d.dept_name
from
employees e 
join 
dept_manager m on e.emp_no = m.emp_no
join 
departments d on m.dept_no = d.dept_no;

Super learner
This user is a Super Learner. To become a Super Learner, you need to reach Level 8.
Posted on:

26 Jan 2024

0

In the SELECT fields' names it is "m.from_date" , then it would work just fine.

Instructor
Posted on:

29 May 2024

0

Hi Abdullah and Mohamed!
Thanks for reaching out.


@: Mohamed
Thanks for sharing this piece of information with the Community!


@: Abdullah 

As Mohamed explained you should use m.from_date instead of m.form_date. This will resolve the issue.



Hope this helps.
Best,
Tsvetelin

Submit an answer