SELECT 
    d.*,
    l.name AS location_name,
    CONCAT(e.last_name, ' ', e.first_name, ' ', e.patronymic) AS employee_full_name,
    e.fk_id_department AS department_id,
	dep.name AS department_name
FROM 
    device d
JOIN 
    location l ON d.fk_id_location = l.id  
JOIN 
    employee e ON d.fk_id_employee = e.id  
JOIN 
    department dep ON e.fk_id_department = dep.id;  
