EXPERIMENT5
EXPERIMENT5
AIM: To study the commands for views and execute insertion, selection and deletion queries
on it.
NOTE: EXECUTE THE COMMANDS AND PASTE THE OUTPUTS OF THE QUERIES PERFORMED ON
VIEWS
Theory:
Views in SQL are virtual tables that are based on the result set of a SELECT query. They provide a
way to present data from one or more tables in a structured manner, allowing users to query and
manipulate the data without directly accessing the underlying tables. Views can simplify complex
queries, enhance security by restricting access to certain columns, and provide a consistent
interface to users.
Implementation:
a.) Simple View: Create a simple view to display basic book information.
CREATE OR REPLACE VIEW simple_book_view AS
SELECT BookID, Title, year_published
FROM books;
b.) Complex View: Create a complex view to show book details along with author
information.
--Query 4: Update the year of publishing of book to 2006 where BookID is 103
Update complex_book_view set year_published=2006 where BookID=103;