Chapter 7 WORKING WITH VIEWS 419 John , Mathew ,

Chapter 7 WORKING WITH VIEWS 419 John , Mathew , 10) 4. To display the view with the updated record, enter and run the following: SELECT * FROM EmployeeView WHERE emp_id = AEE21349M 5. To see that the record has been added to the base table, Employee, run the following. The results of both of these SELECT statements are shown in Figure 7.12: SELECT * FROM Employee WHERE emp_id = AEE21349M Now that you have seen how to put data into a table through a view, you should also know how to get the data back out of the database through a view. FIGURE 7.12 Inserting data through a view. Deleting Rows Through Views In the same way data can be retrieved and inserted through a view, it can also be removed. Rows can be removed through a view in almost the same fashion that they can be inserted. In fact, deleting rows from a view is as easy as knowing how to DELETE rows from a regular table. The biggest rule that can never be broken when you DELETE a row through a view is that the affected row can reference only one table. In other words, the view can be based on only one table. If the view referred to or was based on more than one table, then every row would reference more than one table and could not be deleted. If you attempt to DELETE a row that is based on more than one table, then you receive an error message. Here is an attempted deletion and subsequent error message:

If you looking for unlimited one inclusive web hosting plan please check cheap web hosting website.

Comments are closed.