Database System - Basic SQL
Database System - Basic SQL
View
A view is either a partial reference (i.e., not the whole table) to or a read-only view upon some table.
Updatable view and read-only view
If a view satisfy the following conditions, it’s updatable:
- Every row in the view can be uniquely mapped to a row in one table.
- Columns in the view should not be expression. (e.g.
SELECT a.id + 1 FROM a;)
Create a view
1
2
3
4
CREATE VIEW <VIEW> [(<COLUMN1> <COLUMN2> ... <COLUMNn>)]
AS
<SELECT_QUERY>
[WITH CHECK OPTION]
WITH CHECK OPTIONensures the view updates when its contents are updated by other queries.
See also CMU 15-445 (2025 Fall) Model SQL.
This post is licensed under
CC BY 4.0
by the author.