This is the perfect example of what you'd use a join for. See the example below on how to use the join syntax. The query below will yield the same result as your query but is a more conventional syntax. The advantages is that you can separate your joining logic and your filtering (WHERE clause) logic. If you needed to filter the results of the join, it would be a simple WHERE clause, rather than having both your join logic and filtering logic in the WHERE clause.
SELECT employees.emp_no,
employees.first_name,
employees.last_name,
dept_emp.from_date,
dept_emp.to_date,
departments.dept_name
FROM employees e
INNER JOIN dept_emp de
ON e.emp_no = de.emp_no
INNER JOIN departments d
ON de.dept_no = d.dept_no
We start off by selecting from the employees table, joining to the dept_emp table. The on clause specifies fields need to match to join the two tables. Same with dept_emp to departments.
In this example I've used INNER JOIN which will only return matching rows. For a full list of joins and how they work you can find tons of resources explaining. Here is a good resource:
https://blog.codinghorror.com/a-visual-explanation-of-sql-joins/
EDIT: In response to the other part of your question:
I got the result but if an employer has more depts the table gives me
more row for the same employer.
I want to know if this is normal or if is there any other way to query
that. I saw some examples with join but i don't know how to use it
with three tables. This is all new for me.
Yes this is normal, if there are multiple departments per employee, each department will be a row with the same emp_no.