Sql view - sql - sql tutorial - learn sql

Definition of view

  • In SQL, a view is a virtual table based on the result-set of an SQL statement.
  • A view contains rows and columns, just like a real table. The fields in a view are fields from one or more real tables in the database.
 sql view
  • In database theory, a View is the result set of a stored query on the data, which the database users can query just as they would in a persistent database collection object.
  • This pre-established query command is kept in the database dictionary.
  • As a result set, it is a virtual table computed or collated dynamically from data in the database when access to that view is requested.
  • A view is a virtual table and it consists of rows and columns just like a table. The difference between a view and a table is that views are definitions built on top of other tables (or views), and do not hold data themselves.
  • If data is changing in the underlying table, the same change is reflected in the view.

The Syntax to create a sql view is:

CREATE VIEW view_name AS
SELECT column1, column2, ...
FROM table_name
WHERE condition;
  • view_name is the name of the VIEW.
  • The SELECT statement is used to define the columns and rows that you want to display in the view.
sql tutorial , pl sql tutorial , mysql tutorial , oracle tutorial , learn sql , sql server tutorial

For Example: to create a view on the product table the sql query would be like

CREATE VIEW [Current Product List] AS
SELECT ProductID, ProductName
FROM Products
WHERE Discontinued = No;

Views offer the following advantages:

  • Ease of use: A view hides the complexity of the database tables from end users. Essentially we can think of views as a layer of abstraction on top of the database tables.
  • Space savings: Views takes very little space to store, since they do not store actual data.
  • Additional data security: Views can include only certain columns in the table so that only the non-sensitive columns are included and exposed to the end user. In addition, some databases allow views to have different security settings, thus hiding sensitive data from prying eyes.

This tutorial provides more the basic needs and informations on sql tutorial , pl sql tutorial , mysql tutorial , sql server , sqlcode , sql queries , sql , sql formatter , sql join , w3schools sql , oracle tutorial , mysql , pl sql , learn sql , sql tutorial for beginners , sql server tutorial , sql query tutorial , oracle sql tutorial , t sql tutorial , ms sql tutorial , database tutorial , sql tutorial point , oracle pl sql tutorial , oracle database tutorial , oracle tutorial for beginners , ms sql server tutorial , sql tutorial pdf

Related Searches to Sql view