AgerNic.com
WEB DEVELOPER SITE, HTML, CSS, PHP, SQL

SQL CREATE VIEW


<< Previous Page
SQL tutorial
Next Page >>
SQL tutorial

SQL Tutorial » SQL CREATE VIEW

How do I create a SQL view in SQL Server?

A view statement in SQL is a virtual table based on the result-set of an SQL statement.

A view in SQL contains rows and columns, as a real table. This fields in a view SQL are fields from one or more real tables in the database.

A view is created with CREATE VIEW statement.

Syntax:

CREATE VIEW my_view_name AS
SELECT column_1, column_2, ..., column_N
FROM my_table_name
WHERE condition;
Note: A view always shows up-to-date data!

 

SQL CREATE VIEW Examples

The following SQL creates a view that will display all customers from France:

CREATE VIEW [France Customers] AS
SELECT Customer_Name, Contact_Name
FROM Customers
WHERE Country = 'France';

We can query the view above as follows:

SELECT * FROM [Brazil Customers];

Related subjects:
How to create database phpmyadmin? SQL create table PHP select / view data SQL primary key SQL alter table

Tags: sql create view: with parameters, from multiple tables, with new column, create or replace view, deop view sql
Can you create views in SQL?
How do I create a SQL view in SQL Server?
Why do we CREATE VIEW in SQL?
How do you create a simple view in SQL?

 

SQL Updating a View

Using CREATE OR REPLACE VIEW statement we make updat for SQL view.

SQL CREATE OR REPLACE VIEW Syntax

CREATE OR REPLACE VIEW my_view_name AS
SELECT column_1, column_2, ...
FROM my_table_name
WHERE condition;

The following SQL adds the "Address" column to the "France Customers" view:

CREATE OR REPLACE VIEW [France Customers] AS
SELECT Customer_Name, Contact_Name, Address
FROM Customers
WHERE Country = 'France';

 

SQL Dropping a View

A view is deleted with the DROP VIEW statement.

The following SQL drops the "France Customers" view:

DROP VIEW [France Customers];

 



sql create view: with parameters, from multiple tables, with new column, create or replace view, deop view sql Can you create views in SQL?
How do I create a SQL view in SQL Server?
Why do we CREATE VIEW in SQL?
How do you create a simple view in SQL?
SQL CREATE VIEW - sql tutorial

Online Editor
ONLINE EDITOR

news templates


COLOR PICKER

news templates
This tool makes it easy to create, adjust, and experiment with custom colors for the web.


HTML Templates
news templates
Magnews2 is a modern and creative free magazine and news website template that will help you kick off your online project in style.


CSS HTML Layout
news templates
Find here examples of creative and unique website layouts.


Free CSS HTML Menu
news templates
Find here examples of creative and unique website CSS HTML menu.


Home - Database
SQL - Database
SQL Syntax
SQL Select Data
SQL Insert Data
SQL Update
SQL Delete Row
PHP mysqli_query()
SQL order
SQL Create Database
SQL Display Data
SQL Count()
SQL mysqli_connect
SQL create table
SQL Where And & Or
SQL like Syntax
SQL Between Operator
SQL IN Operator
Online Editor
ONLINE EDITOR

news templates


COLOR PICKER

news templates
This tool makes it easy to create, adjust, and experiment with custom colors for the web.


HTML Templates
news templates
Magnews2 is a modern and creative free magazine and news website template that will help you kick off your online project in style.


CSS HTML Layout
news templates
Find here examples of creative and unique website layouts.


Free CSS HTML Menu
news templates
Find here examples of creative and unique website CSS HTML menu.


Error: Unable to connect to MySQL. Debugging errno: 1045 Debugging error: Access denied for user 'u142985959_ager'@'localhost' (using password: YES)