TechnoLearnAcademy

TECHNOLEARN

SQL ALTER VIEW

A VIEW is a virtual table based on the result of a SQL SELECT query.
Let’s understand the alter view with an example. For demonstration purposes, we will be using the table emp.
         Table EMP
         Table Project
Alter View

Example:

   Objective: In this example, we will modify the existing view to add a condition where the department is IT. 
                      ALTER VIEW VW_Texas_Records AS                                                                                                                                                              SELECT * FROM Tbl_EMP                                                                                                                                                                             WHERE Location = ‘Texas’ and Department = ‘IT’;
   View Query:
                      SELECT * FROM VW_Texas_Records
   Output:
Scroll to Top