Sunday, August 26, 2012

What is VIEW?

  • ·         view is a specific look on data from one or more tables.
  • ·         It is a dynamic, virtual table computed or collated from data in the database.
  • ·         A view is a pseudo table. It is a stored query which looks like a table. And it can be referenced like a table.
  • ·         It can arrange data in some specific order highlight or hide some data.
  • ·         The fields in a view are fields from one or more real tables in the database.
  • ·         A view contains rows and columns, just like a real table. 

  • Syntax:
    CREATE VIEW view_name AS
    SELECT column_name(s)
    FROM table_name
    WHERE condition

    Example:





    A view is a database object than can be queried. 



    A view is deleted with the DROP VIEW syntax.





    Finding Views





    mysql> SELECT TABLE_NAME,TABLE_TYPE FROM information_schema.TABLES;

    Creating a view with a UNION


No comments:

Post a Comment