0% found this document useful (0 votes)
25 views2 pages

DB Qlda

DBI202 material

Uploaded by

Huu hien Nguyen
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)
25 views2 pages

DB Qlda

DBI202 material

Uploaded by

Huu hien Nguyen
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/ 2

PRACTICAL

Subject code: DBI202


Duration : 85 minutes

Requirements:
+ Download the file DB.sql and execute it to create the database and the tables that
are already in the file.
+ Students should complete their exams in the file named DB.sql and submit this
file.
+ Submit the exam consisting of 2 files: DB.sql and file containing the ERD for
question 1.

1. (2 points) wo entities extracted from the ERD of the project management


information system, as shown in the diagram. Add the following business
requirements to the diagram:
Each employee can participate in multiple projects, and each project can have
multiple employees participating. Each employee participating in a project needs to
record the number of hours spent on the project. A project needs to have a project
code and a project name.
A department can be responsible for multiple projects. (Add this to the existing
diagram) (Add to the existing diagram in the exam).
Use the diagram below to complete question 1 (you can draw it in MS Word).

2. (2 points) From the diagram in question 1, write SQL statements to create tables
corresponding to the entities added to the diagram. The statements should reflect
maximum data constraints on the table fields. Enter 3 rows of data suitable for the
tables just created (Other tables are already available).
3. (2 points) Write a procedure to perform the addition of a new employees.
Requirement: Error notification procedure if the data addition operation is not
successful.
4. (2 points) Write a trigger that, when assigning a project to an employee, ensures
that each project has a maximum of 5 employees working on it. If the number of
employees working on the project reaches 5, perform a rollback of the transaction
and display an error message.
5. (1 points) Write a query to display employees with the highest working hours for
each project, including information such as Employee ID, full name, project name,
and the number of hours worked.
6. (1 points) Write a query to display a list of departments with the number of
employees working greater than or equal to 3.

End

You might also like