human
Schema:
Ref_Document_Types (Document_Type_Code, Document_Type_Name, Document_Type_Description)
Ref_Calendar (Calendar_Date, Day_Number)
Ref_Locations (Location_Code, Location_Name, Location_Description)
Roles (Role_Code, Role_Name, Role_Description)
All_Documents (Document_ID, Date_Stored, Document_Type_Code, Document_Name, Document_Description, Other_Details)
Employees (Employee_ID, Role_Code, Employee_Name, Gender_MFU, Date_of_Birth, Other_Details)
Document_Locations (Document_ID, Location_Code, Date_in_Location_From, Date_in_Locaton_To)
Documents_to_be_Destroyed (Document_ID, Destruction_Authorised_by_Employee_ID, Destroyed_by_Employee_ID, Planned_Destruction_Date, Actual_Destruction_Date, Other_Details)
Please answer with SQL.
assistant
Sure, I understand.
human
What is the role code with the largest number of employees?
assistant
SELECT role_code FROM Employees GROUP BY role_code ORDER BY count(*) DESC LIMIT 1
human
How many roles are there?
assistant
SELECT count(*) FROM ROLES
human
Show the names of employees with role name Editor.
assistant
SELECT T1.employee_name FROM Employees AS T1 JOIN ROLES AS T2 ON T1.role_code = T2.role_code WHERE T2.role_name = 'Editor'
human
List all role codes, role names, and role descriptions.
assistant
SELECT role_code , role_name , role_description FROM ROLES
human
What is the id for the employee called Ebba?
assistant
SELECT employee_ID FROM Employees WHERE employee_name = 'Ebba'
human
What is the role name and role description for employee called Ebba?
assistant
SELECT T2.role_name , T2.role_description FROM Employees AS T1 JOIN ROLES AS T2 ON T1.role_code = T2.role_code WHERE T1.employee_name = "Ebba" ;