InterviewSolution
Saved Bookmarks
| 1. |
Write the steps to create, update and drop a view in SQL. |
|
Answer» In SQL, a view is a single table that contains data from other tables. As a result, a view features rows and columns that are IDENTICAL to those of a real table, as well as fields from one or more tables. In ORDER to create a view: CREATE VIEW View_Name ASSELECT Column1, Column2, Column3, ..., ColumnNFROM Table_NameWHERE Condition;For updating a view: CREATE VIEW OR REPLACE View_Name ASSELECT Column1, Column2, Column3, ..., ColumnNFROM Table_NameWHERE Condition;For dropping a view: DROP VIEW View_Name;In the above queries, Column1, Column2, .. ColumnN denotes the name of the columns to be ADDED or updated. View_Name denotes the name of the view created and Table_name denotes the name of the current table. |
|