Tutorials Hut

  • SQL Testing




  • SQL View | Types ,Benefits and Example

    Sql view represents subsets of data from one or more tables.

    Sql View
    A view can contain all rows of a table or select rows from a table.
    • A view is a virtual table based on the result-set of an SQL statement
    • With the help of view,  We can get virtual view of selected data without affecting data of real table
    • It  contains rows and columns  just like a real table
    • It store data dynamically.
    • It also prevents to access real table.

    Create A VIEW

    CREATE VIEW view_name  AS  SELECT column_name(s)  FROM table_name  where [condition]

    Modify a View

    Alter VIEW view_name  AS  SELECT column_name(s) FROM table_name where [condition]

    Types of SQL View:

    1) Simple views

          • Derives data from only one table
          • Can perform DML operations

    2) Complex views

          • Derives data  from one or more tables.
          • Cannot perform DML operations as data is derived from one or more tables.

    Why use views ?

          • To Restrict data access.
          • To make complex queries easy.
          • Views can be used to hide and reuse complex queries.
          • This allows the DBA to give users only the data they need, while protecting other data in the same table.

    Referencehttps://docs.oracle.com/cd/B28359_01/server.111/b28310/views001.htm#ADMIN11774

    Recommended Articles:




  • SQL Testing


















  • Leave a Reply

    Your email address will not be published. Required fields are marked *