0% found this document useful (0 votes)
38 views1 page

Experiment Observations: Views

Views allow querying of data from underlying tables without needing a primary key in the view definition. Stored procedures store queries for repeated use and improve performance by caching queries on the server. Transactions allow running multiple statements atomically by starting a transaction, running statements, and committing or rolling back the transaction. Database administrators grant and revoke privileges on database objects to control access at both the system and object level. Triggers automatically run code when events like insert or update occur, and are used for derived attributes, auditing, and other automated responses.

Uploaded by

Rounak Baral
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views1 page

Experiment Observations: Views

Views allow querying of data from underlying tables without needing a primary key in the view definition. Stored procedures store queries for repeated use and improve performance by caching queries on the server. Transactions allow running multiple statements atomically by starting a transaction, running statements, and committing or rolling back the transaction. Database administrators grant and revoke privileges on database objects to control access at both the system and object level. Triggers automatically run code when events like insert or update occur, and are used for derived attributes, auditing, and other automated responses.

Uploaded by

Rounak Baral
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Experiment Observations

• Views:
1) No need to have a PRIMARY KEY in the original table to create a view.
2) Inserting a value in a view inserts a corrosponding value in the original table with
NULL in the fields not included in the view.
3) Cannot insert in a view if the original table has as a PRIMARY KEY but the view
does not have that field.
4) Fields can have NULL values in the rows.
5) A view is by default updatable if the original table does not have a PRIMARY
KEY.
Example of an updatable view: table:temp(primary key(rollno))

view:

• Stored Procedures
1. way to store a query to use it again.
2. Comes handy when a particular query is fired very frequently.
3. Faster as they are cached in the server

*delimiter $$ used to run compound statements


4. provides security as query is made using procedure name only.
• Transactions
SELECT, UPDATE etc are in itself transactions and either affect the table or
not, now suppose we want to run multiple such statements so we need to use SET
TRANSACTION to begin transection and COMMIT to end a transaction.
Rollback is also done if transaction is not done completely.
• Grant/Revoke Privileges
1. Only Database Administrator can provide/remove privileges on a database object.
2. System privileges - This allows the user to CREATE, ALTER, or DROP database
objects.
3. Object privileges - This allows the user to EXECUTE, SELECT, INSERT,
UPDATE data from database objects to which the
privileges apply.
• Triggers
1. Triggers are called automatically when an event occurs.
2. Help in generation of some derived attribute of an entity. For ex return date is
automatically calculated as issue date is filled.
3. Serves purpose as an auditor.

You might also like