Database Reference
In-Depth Information
TASK 3: MODIFYING DATA IN VIEW
To see how the data being modiied in a view will impact the underlying table, let us work on
the following task. In this activity, we irst create a new view STUDENT_GRADE_VIEW
based on a single table STUDENT_CLASS. We then perform insert, update, and delete
activities on the view. We will check to see if the changes are also made to the underlying
table. Next, we will modify the view STUDENT_ADVISOR_VIEW, which has a calcu-
lated column and see if the change can be made to this kind of view.
1. Assume that the Windows Azure SQL Database portal is still open. Enter the follow-
ing SQL statement to create the view Student_GRADE_VIEW:
CREATE VIEW STUDENT_GRADE_VIEW
AS
SELECT *
FROM STUDENT_CLASS
2. Highlight the code and click Run . As shown in Figure 8.8, the view STUDENT_
GRADE_VIEW is successfully created.
3. Now, we will perform several modiications. We irst insert a row with the following
SQL statement:
INSERT INTO STUDENT_GRADE_VIEW
VALUES(11, 1005, 'B')
4. Highlight the code and click Run . To see what has happened in the view STUDENT_
GRADE_VIEW, enter the following query statement. As shown in Figure 8.9, the
new role is added to the view. (In Figure 8.9, the GO keyword is to separate the two
statements so that they can be executed together.)
SELECT * FROM STUDENT_GRADE_VIEW
Figure 8.8
Create view based on single table.
Search WWH ::




Custom Search