DB Qlda
DB Qlda
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.
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