0% found this document useful (0 votes)
10 views6 pages

Queries

The document contains a series of database management system (DBMS) home assignment tasks focused on retrieving and analyzing employee and sailor data. It includes queries for employee details, project involvement, salary statistics, and sailor reservations. The tasks aim to practice SQL skills by manipulating and querying relational databases.

Uploaded by

mvbvijay935
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views6 pages

Queries

The document contains a series of database management system (DBMS) home assignment tasks focused on retrieving and analyzing employee and sailor data. It includes queries for employee details, project involvement, salary statistics, and sailor reservations. The tasks aim to practice SQL skills by manipulating and querying relational databases.

Uploaded by

mvbvijay935
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

DBMS:: HOME ASSIGNMENT

1. Retrieve the birth date and address of the employee(s) whose name is ‘John B. Smith’.
2. Retrieve the name and address of all employees who work for the ‘Research’ department.
3. 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.
4. For each employee, retrieve the employee’s first and last name and the first and last name of his
or her immediate supervisor.
5. Retrieve the salary of every employee
6. Display all distinct salary values.
7. Make a list of all project numbers for projects that involve an employee whose last name is
‘Smith’, either as a worker or as a manager of the department that controls the project.
8. Retrieve all employees whose address is in Houston, Texas.
9. Find all employees who were born during the 1950s.
10. Show the resulting salaries if every employee working on the ‘ProductX’ project is given a 10%
raise.
11. Retrieve all employees in department 5 whose salary is between $30,000 and $40,000.
12. Retrieve a list of employees and the projects they are working on, ordered by department and,
within each department, ordered alphabetically by last name, then first name.
13. Retrieve the names of all employees who do not have supervisors.
14. Retrieve the name of each employee who has a dependent with the same first name and is the
same sex as the employee.
15. Retrieve the names of employees who have no dependents.
16. List the names of managers who have at least one dependent.
17. Retrieve the Social Security numbers of all employees who work on project numbers 1, 2, or 3
18. Find the sum of the salaries of all employees, the maximum salary, the minimum salary, and the
average salary.
19. Find the sum of the salaries of all employees of the ‘Research’ department, as well as the
maximum salary, the minimum salary, and the average salary in this department.
20. Retrieve the total number of employees in the company
21. Retrieve the number of employees in the ‘Research’ department
22. Count the number of distinct salary values in the database.
23. For each department, retrieve the department number, the number of employees in the
department, and their average salary.
24. For each project, retrieve the project number, the project name, and the number of employees
who work on that project.
25. For each project on which more than two employees work, retrieve the project number, the
project name, and the number of employees who work on the project.
26. For each project, retrieve the project number, the project name, and the number of employees
from department 5 who work on the project
27. For each department that has more than five employees, retrieve the department number and
the number of its employees who are making more than $40,000.
Home assignment

Creating all the tables based on given format ::


1. Find the names and ages of all sailors.
2. Find all sailors with a rating above 7.
3. Find the names of sailors who have reserved boat number 103.
4. Find the sids of sailors who have reserved a red boat.
5. Find the names of sailors who have reserved a red boat.
6. Find the colors of boats reserved by Lubber.
7. Find the names of sailors who have reserved at least one boat.
8. Compute increments for the ratings of persons who have sailed two different boats on the
same day.
9. Find the ages of sailors whose name begins and ends with B and has at least three characters.
10. Find the names of sailors who have reserved a red or a green boat.
11. Find the names of sailors who have reserved both a red and a green boat.
12. Find the sids of all sailors who have reserved red boats but not green boats.
13. Find all sids of sailors who have a rating of 10 or have reserved boat 104.
14. Find the names of sailors who have reserved boat 103.
15. Find the names of sailors who have reserved a red boat.
16. Find the names of sailors who have not reserved a red boat.
17. Find the names of sailors who have reserved boat number 103.
18. Find sailors whose rating is better than some sailor called Horatio.
19. Find sailors whose rating is better than every sailor called Horatio.
20. Find the sailors with the highest rating.
21. Find the names of sailors who have reserved both a red and a green boat.
22. Find the names of sailors who have reserved all boats.
23. Find the average age of all sailors.
24. Find the average age of sailors with a rating of 10
25. Find the name and age of the oldest sailor.
26. Count the number of sailors.
27. Count the number of different sailor names.
28. Find the names of sailors who are older than the oldest sailor with a rating of 10.
29. Find the age of the youngest sailor for each rating level.
30. Find the age of the youngest sailor who is eligible to vote (i.e., is at least 18 years old) for each
rating level with at least two such sailors.
31. For each red boat, find the number of reservations for this boat.
32. Find the average age of sailors for each rating level that has at least two sailors.
33. Find the average age of sailors who are of voting age (i.e., at least 18 years old) for each rating
level that has at least two sailors.
34. Find the average age of sailors who are of voting age (i.e., at least 18 years old) for each rating
level that has at least two such sailors.
35. Find those ratings for which the average age of sailors is the minimum overall ratings.

You might also like