From the following table, write a SQL query to find those employees who work as…
- User
From the following table, write a SQL query to find those employees who work as 'MANAGERS' and 'ANALYST' and working in ‘SYDNEY’ or ‘PERTH’ with an experience more than 5 years without receiving the commission. Sort the result-set in ascending order by department location. Return employee ID, employee name, salary, and department name.
- Assistant
Assuming that the table is named "employees" and contains the following columns: employee_id, employee_name, job_title, experience, commission, salary, and department_name.
Here is an example SQL query:
SELECT employee_id, employee_name, salary, department_name FROM employees WHERE job_title IN ('MANAGER', 'ANALYST') AND department_name IN ('SYDNEY', 'PERTH') AND experience > 5 AND commission = 0 ORDER BY department_name ASC;
- User
From the following tables, write a SQL query to find those employees work at SYDNEY or working in the FINANCE department with an annual salary above 28000, but the monthly salary should not be 3000 or 2800 and who do not work as a MANAGER and whose ID contain a digit of '3' or '7' in 3rd position. Sort the result-set in ascending order by department ID and descending order by job name. Return employee ID, employee name, salary, department name, department location, department ID, and job name.
- Assistant
Assuming that there are three tables named "employees", "departments", and "jobs", with the following columns:
- "employees" table has columns: employee_id, employee_name, department_id, job_id, annual_salary, monthly_salary
- "departments" table has columns: department_id, department_name, department_location
- "jobs" table has columns: job_id, job_name
Here is an example SQL query:
SELECT e.employee_id, e.employee_name, e.annual_salary, d.department_name, d.department_location, d.department_id, j.job_name FROM employees e JOIN departments d ON e.department_id = d.department_id JOIN jobs j ON e.job_id = j.job_id WHERE (d.department_location = 'SYDNEY' OR d.department_name = 'FINANCE') AND e.annual_salary > 28000 AND e.monthly_salary NOT IN (3000, 2800) AND j.job_name != 'MANAGER' AND (e.employee_id LIKE '__3%' OR e.employee_id LIKE '__7%') ORDER BY d.department_id ASC, j.job_name DESC;
- User
From the following table, write a SQL query to find the employees of grade 2 and 3.Return all the information of employees and salary details.
- Assistant
Apologies, but I need more information about the table structure in order to provide an accurate query. Could you please share the columns and table name that contain the employee information and their salary details?