DBMS SQL View - Javatpoint
DBMS SQL View - Javatpoint
AACSB-accredited MBA
Home DBMS SQL PL/SQL SQLite MongoDB Cassandra MySQL Oracle CouchDB Neo4j DB2 C Java Projects Interview Q
⇧ SCROLL TO TOP
Views in SQL
Views in SQL are considered as a virtual table. A view also contains rows and
columns.
To create the view, we can select the fields from one or more tables present in the
database.
A view can either have specific rows based on certain condition or all the rows of a
table.
Sample table:
Student_Detail
1 Stephan Delhi
2 Kathrin Noida
3 David Ghaziabad
4 Alina Gurugram
Student_Marks
ADVERTISEMENT
ADVERTISEMENT
1 Stephan 97 19
2 Kathrin 86 21
3 David 74 18
4 Alina 90 20
5 John 96 18
1. Creating view
A view can be created using the CREATE VIEW statement. We can create a view from
a single table or multiple tables.
Syntax:
Earn $2.5
per answer
Make money from answering
simple questions. We pay you
in cash. Simple and fun.
MetroOpinion
In this example, we create a View named DetailsView from the table Student_Detail.
Query:
Just like table query, we can query the view to view the data.
Output:
NAME ADDRESS
Stephan Delhi
Kathrin Noida
David Ghaziabad
In the given example, a view is created named MarksView from two tables
Student_Detail and Student_Marks.
Query:
Stephan Delhi 97
Kathrin Noida 86
David Ghaziabad 74
Alina Gurugram 90
4. Deleting View
Syntax
Example:
← Prev Next →
Feedback
Preparation
Trending Technologies
Machine DevOps
Learning Tutorial
Tutorial
DevOps
Machine
Learning
B.Tech / MCA