Based on an example database from your workplace or an appli

Based on an example database from your workplace, or an application that interests you, describe how views, stored procedures, and triggers could be utilized.

Solution

1) View is a virtual table that is a result of an SQL Query.

The View is dependent on the base table.

That does not exist Physically.

Let us consider a situation of an employee table where are fields can be accessible by everyone about Employees.

If we want to restrict that others should not retrieve the salary of any employee then we will create a view on that table Employees by leaving the salary field. Hence everyone can view all fields except the salary field.

2) Stored Procedures are set of SQL Statements that will store those functions in compiled form so that whenever the input changes from the user it will directly give the result.

Let us consider Employee table and we have written a query that will update the salary of all employees whose experience is more than 10 years and promote them. The same criteria applies across all levels then we have to write various procedures. Using Stored Procedures we can implement the same by simply changing the values and the changes will be reflected in all tables.

3) Triggers are database operations that are automatically perforemed when some event occurs. The event could be insert,delete or update or any other operations that changes the state of database.

Consider an Employee table then we can perform any sort of operations on it. Whenever any operation is performed then we can immediately raise an event to the user about the changes that are made

Based on an example database from your workplace, or an application that interests you, describe how views, stored procedures, and triggers could be utilized.So

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site