How to pull a string value using the int in related tables?

There is a table users:
id_user: 1
username(var): root
password(var): root
role(int): 1
department(int): 1

Table role:
id_role: 1
role: admin

Table department:
id_department: 1
department: all


How to receive a string value from a related table?
On request:
select role from users where username="root" and password = "root";

I get id like to no id, and the right value?
role = session.createQuery("Some query here to bet?").toString();
July 8th 19 at 12:01
1 answer
July 8th 19 at 12:03
Solution
LEFT JOIN
SELECT role.role FROM users LEFT JOIN role ON users.role=role.id WHERE users.username="root" AND users.password = "root";
Should work.
SELECT role.role FROM users LEFT JOIN role ON users.role=role.id_role WHERE users.username="root" AND users.password = "root";

Slightly tweaked, and it works! - Millie_Bechtel commented on July 8th 19 at 12:06

Find more questions by tags HibernateSQL ServerMySQLSQL