Chap 13
Chap 13
Views
A View is a window into the database, or a view into the database. It can seem
like it is a table, but it is not, it is a view that pulls data from the real tables.
Views are created so users can use the view instead of a table to pull data from.
The best Example I can think of from our Registration database is: wouldn’t it be
nice if we had a Sections table with the instructor’s name and the CourseName
in the Sections table. Well we can do that with a View. We can create a
SectionsView that contains these columns. Then when the user uses this view, it
seems like the columns are already there.
The data for a view remains in the actual tables, but from the users stand point,
it seems like the data is in the View.
SELECT *
FROM SectionsView
WHERE crn = 30115;
The User does not have to do the Join. It was already done when we created the
View.
One limitation of a view is that they are only used for Select. You cannot Insert,
Update or Delete from a view. You need to do these 3 functions with the actual
tables.
Transactions
Security
o Users and Groups
Almost all databases have Users and Groups. Users need to login to the
database to get access to the entities that they have access to. A database
Administrator usually gives out the access. They are the ones that usually
execute the following command. Programmers do not usually execute these
commands, programmers act as users at this point.
The 2 commands for giving and taking away database access are GRANT and
REVOKE.
o Grant
GRANT Examples:
o Revoke
REVOKE Examples:
Triggers
https://docs.oracle.com/cd/A57673_01/DOC/server/doc/SCN73/ch15.htm
https://www.essentialsql.com/what-is-a-database-trigger/
Stored Procedures
https://www.w3schools.com/sql/sql_stored_procedures.asp
Summary
Other Resources
Click on the link below to get more help with “SQL Views”.
https://www.w3schools.com/sql/sql_view.asp
http://beginner-sql-tutorial.com/sql-views.htm
Click on the link below to get more help with “GRANT & REVOKE”.
http://beginner-sql-tutorial.com/sql-grant-revoke-privileges-roles.htm