Database Lab
Database Lab
Q1:
CREATE TABLE employees (
first_name VARCHAR(50),
last_name VARCHAR(50),
department_id INT,
manager_id INT
);
VALUES
Q1:
1. list the last name and salary of employees who earn between $5,000 and $12,000, and are
in department 20 or 50. Label the columns Employee and Monthly Salary, respectively.
FROM employees
FROM employees
Q3: Display the maximin, minimum and average salary given to the employees in our
organization.
SELECT
FROM employees;
Q4: Display the name of the employee along with their total annual salary (Salary+commision).
The name of the employee earning highest annual salary should appear first.
SELECT last_name, (salary + COALESCE(commission_pct, 0) * salary) AS "Total Annual Salary"
FROM employees
Q5: Write a query to display first name, last name, department name for all employees working
in department 80 or 40.
Manager Table:
Q6: Write a query in SQL to display the department name, city, and state province for each
department.
Q7: Write a query in SQL to display the first name, last name, and department number for those
employees who works in the same department as the employee who holds the last name as
Taylor.
8Q: Write a query in SQL to display the first name of all employees and the first name of their
manager including those who does not working under any manager.