You are on page 1of 1

Databases LAB SQL II – tasks B (v1)

1. For each student give the number of subjects in which he or she got grades.

2. (a) Give the ids and the names of projects which are undertaken by at most three employees.
(b) Give the names of projects which are undertaken by the least number of employees.

3. (a) Give the ids and the names of male students, who are older than at least one employee from
SOFTWARE team.
(b) Give the ids and the names of COMPUTER SCIENCE students, who got grades higher than
every ROBOTICS student in DATABASES subject.
(c) Check if each value of foreign key manager id from PROJECTS table matches to record from
ALLOCATIONS table.

4. (a) Give the ids and the names of students who haven’t got any grade yet.
(b) Give the names of employees who haven’t been assigned to any projects but received pay-
ment(s).

5. Give the ids, names of projects and the number of employees who are assigned to these projects.
Include also projects with no employees and pay attention to the possibility of getting money more
than once for the same project by employee.

6. (a) Create the view with the ids, names of projects and the total income from these projects. Give
the reason why you can (or can’t) update the data in this view. On successful completion of
this task, remove created view.
(b) For each team give an average, minimum and maximum of employees’ earnings. Do it in two
steps:
• Create the view in the following form:

team id team name employee id employee name employee sum of earnings

Take employees with no earnings into account.


• Use above view to perform this task.

7. For each team give the names of the youngest employees.

8. Give the ids and the names of employees who aren’t assinged to any project which is managed by
employee INDEPENDENT.

9. Give the names of employees who were undertaking all projects with ids in range (. . .).

You might also like