CS22b2021 - LAB6
CS22b2021 - LAB6
Q0) Retrieve the birthdate and address of employee(s) whose name is John B.smith
Q1)retrieve the name and address of all employess who work for the research department
Q2)for every project located in ‘Stafford’, list the project number, the controlling department
number, and the department manager’s last name, address, and birth date.
Q9 10)select all employee ssn (Q9) and all combinations of emplyee ssn ann department dname
(Q10)in the database
Q)
--Q1C D 10A ) asterisk
Q5 13 15 17 19
13)show the resulting salaries if every employee working on the ‘ProductX’ is given a 10 percent
raise
15)
retrieve alist of employees and the projects \they are working on, ordered by department and within
each department ordered alphabetaically by last name, first name
17)
retrieve the social security numbers of all employees who work on porject number 1,2 or 3
Q1)
Write an SQL query that returns the project number and name for projects with
a budget greater than $100,000.
q2)
Write an SQL query that returns the total budget allocated to each department.
Q3)
Write an SQL query that returns the employee numbers and names of those
employees who do not work on any project.
Q4)
Write an SQL query that returns all works on records where hours worked is
less than 10 and the responsibility is 'Manager'.
Q5)
Write an SQL query that returns the employee numbers and names of
employees who earn more than the average salary across all departments.
Q6)
Write an SQL query that returns the department names and the total number of
hours worked by all employees in each department.
Q7. Write an SQL query that returns the employees (number and name only) who
have a title of 'EE' or 'SA' and make more than $35,000.
Q8. Write an SQL query that returns the employees (name only) in department 'D1'
ordered by decreasing salary.
Q9. Write an SQL query that returns the departments (all fields) ordered by
ascending department name.
10.Write an SQL query that returns the employee name, department name, and
employee title.
11. Write an SQL query that returns the department name and the number of
employees working in each department.
12. Write an SQL query that returns the employee numbers, names, and their
respective project names for employees who work on multiple projects.
14. Write an SQL query that returns the project name, department name, and
budget for all projects with a budget < $50,000.
15. Write an SQL query that returns the employee numbers and salaries of all
employees in the 'Consulting' department ordered by descending salary.
16. Write an SQL query that returns the employee name, project name, employee
title, and hours for all works on records
17. Write an SQL query that returns the average number of hours worked by
employees on each project.
18. Write an SQL query that returns the project names and their respective budgets
for projects where the budget exceeds the average budget of all projects.
19. Write an SQL query that returns the employee numbers and names of
employees who are managers (mgreno) in their respective departments.
20. Write an SQL query that returns the project names and the total number of
hours worked on each project.
21. Write an SQL query that returns the department names and the total budget
allocated to each department, sorted in descending order of budget.
22. Write an SQL query that returns the employee numbers and names of
employees who earn the highest salary in each department.
23. Write an SQL query that returns the employee numbers and names of
employees who work on projects managed by themselves (i.e., their employee
number matches the manager's employee number for the project).
24. Write an SQL query that returns the project names and the total number of
hours worked by all employees on each project, sorted in descending order of
total hours worked.
25. Write an SQL query that returns the employee numbers and names of
employees who work on projects with a budget higher than the average budget
of all projects.