Professional Documents
Culture Documents
Lab5 SQL Questions
Lab5 SQL Questions
Lab 5
Advance SQL Statements
Triggers
1. Create a trigger named ins_branch that capitalise the city name upon each new
branch record.
2. Create a trigger named free_points that set the points to 100 for each new owner.
3. Enough spaces are needed to ensure that animals can roam freely when being
boarded. Create a trigger named spare_capacity that minus 10 from the total
capacity for all existing branch.
Note: As we don’t update IDs and we are triggering the capacity. You can do updates
on the city name perhaps.
4. Using BEGIN … END to define a trigger that executes multiple statements. Use
DELIMETER to separate the statements.
Create a trigger named bonus_points that give extra points to each existing owner.
The extra points is as follow:
Views can be said as virtual table. It eases time re-running the same queries again and again.
1. Create a view named likas_people to display all owners from Likas. Sample query
output is as below.
2. Create a view named likas_boarding to display all boarding made for the Likas
branch. Sample query output is as below.
4. Create a view name pet_boardings that display all pets, and any boardings they
might have. Sample query output is as below.