ScholarQuill logoScholarQuillUniversity Notes
My Semester
Explore Notes
Past Papers12 New
Video CoursesNew
Search
Settings
Study Tools
GPA/CGPA Calculator
Schedule & To-Do
Student Portal
Contact
Contact
ScholarQuill logo
My Semester
Explore Notes
Past Papers12 New
Video CoursesNew
Search
Settings
GPA/CGPA Calculator
Schedule & To-Do
Student Portal
Contact
ScholarQuill logoScholarQuillUniversity Notes
Study PortalCOMP3146Database Administratio…
Ctrl + K
Login
Explore
Search
Semester
Papers
CGPA
    COMP3146

    Advance Database Management Systems

    Progress0 / 18 done
    Topics18
    1Introduction to advance data models such as object relational, object oriented2File organizations concepts3Transactional processing4Concurrency control techniques5Recovery techniques6Query processing and optimization7Database Programming (PL/SQL)8Database Programming (T-SQL)9Database Programming (similar technology)10Integrity and security11Database Administration (Role management)12Database Administration (managing database access)13Database Administration (views)14Physical database design and tuning15Distributed database systems16Emerging research trends in database systems17MONGO DB18NO SQL (or similar technologies)
    3 min read
    Topic 13 of 18
    Topic Study Note Illustration
    13

    Database Administration (views)

    A View is a virtual table based on the result set of a SQL query. It presents data from one or more tables without storing the data...

    🛠️ Database Administration: Views


    1. What is a View?

    A View is a virtual table based on the result set of a SQL query. It presents data from one or more tables without storing the data physically.

    • Acts as a stored SELECT query.
    • Provides abstraction and simplified data access.
    • Can restrict access to sensitive data.
    • Can combine data from multiple tables.

    2. Why Use Views?

    • Simplify complex queries by encapsulating them.
    • Provide data security by showing only specific columns or rows.
    • Support data abstraction hiding the underlying table structure.
    • Facilitate data consistency by reusing common queries.
    • Can be used as read-only or updatable views (depending on DBMS and query).

    3. Creating a View

    CREATE VIEW employee_details AS
    SELECT employee_id, first_name, last_name, department, salary
    FROM employees
    WHERE status = 'ACTIVE';
    
    • The view employee_details now acts like a table for querying active employees.

    4. Using Views

    • Query a view just like a table:
    SELECT * FROM employee_details WHERE department = 'Sales';
    
    • Views can be joined with other tables or views.

    5. Types of Views

    Type Description
    Simple View Based on a single table without functions or groups. Often updatable.
    Complex View Based on multiple tables, includes joins, aggregates, group by, etc. Usually read-only.
    Materialized View Stores the result physically for faster access, needs refreshing.

    6. Updating Data Through Views

    • Updatable Views allow INSERT, UPDATE, DELETE through the view if:

      • The view is based on a single table.
      • Does not contain aggregates, DISTINCT, GROUP BY, or joins.
      • Includes all NOT NULL columns required.
    • Otherwise, views are read-only.

    Example of updating through view:

    UPDATE employee_details SET salary = salary * 1.1 WHERE employee_id = 101;
    

    7. Advantages of Views

    • Security: Restrict user access to only required data.
    • Simplicity: Hide complexity of underlying joins or calculations.
    • Consistency: Centralize business logic or calculations.
    • Reusability: Share complex queries without rewriting them.

    8. Managing Views

    • Modify view:
    CREATE OR REPLACE VIEW employee_details AS
    SELECT employee_id, first_name, last_name, department, salary
    FROM employees
    WHERE status = 'ACTIVE' AND department IS NOT NULL;
    
    • Drop view:
    DROP VIEW employee_details;
    

    9. Limitations of Views

    • Performance can be slower than direct table queries (especially with complex views).
    • Updatability is restricted based on the view definition.
    • Materialized views require maintenance to keep data fresh.

    10. Summary Table

    Feature Description Example
    Create View Defines a virtual table CREATE VIEW v AS SELECT...
    Query View Access data through the view SELECT * FROM v;
    Updatable View Allows DML operations if conditions met UPDATE v SET salary =...;
    Materialized View Stores data physically, requires refresh CREATE MATERIALIZED VIEW mv AS...
    Drop View Removes the view definition DROP VIEW v;

    ← Previous topic 12
    Database Administration (managing database access)
    Next topic 14 →
    Physical database design and tuning

    Past Papers

    Open this section to view and download past papers

    Click on Show Past Papers to load available exam papers.

    Reading Progress
    0%
    3mremaining
    440words
    Beginnerlevel
    On This Page

    No headings found

    Study Toolkit

    Subject Portal

    Advance Database Management Systems