Welcome to Dream.In.Code
Become an Expert!

Join 150,138 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,249 people online right now. Registration is fast and FREE... Join Now!




Updateable Views

 
Reply to this topicStart new topic

Updateable Views

birdofprey
24 Jul, 2008 - 08:42 AM
Post #1

New D.I.C Head
*

Joined: 24 Jul, 2008
Posts: 3

Hello Coders,

I've been reading this database book for my upcoming class this Fall and I've gotten up to Views.

I know that Views can be made updatable, always, by using triggers.

In the book they state that for Views to be updatable without using triggers are when:

1) The WHERE clause must not involve Relation R (Table) in the subquery.

- Does this mean that the view can't contain something like this
Select * From R WHERE (Select a FROM R Where id=1)?


2)The FROM clause only consist of one occurrence of R and no other relation.

- don't understand what this mean. Anyone could explain?
User is offlineProfile CardPM
+Quote Post

AdaHacker
RE: Updateable Views
28 Jul, 2008 - 02:34 PM
Post #2

D.I.C Head
**

Joined: 17 Jun, 2008
Posts: 194



Thanked: 33 times
My Contributions
QUOTE(birdofprey @ 24 Jul, 2008 - 11:42 AM) *

1) The WHERE clause must not involve Relation R (Table) in the subquery.

- Does this mean that the view can't contain something like this
Select * From R WHERE (Select a FROM R Where id=1)?

That sounds about right to me.

QUOTE(birdofprey @ 24 Jul, 2008 - 11:42 AM) *

2)The FROM clause only consist of one occurrence of R and no other relation.

- don't understand what this mean. Anyone could explain?

Basically, it means "no joins in the FROM clause." The general principle is that for a view to be updatable, you must be able to directly map each row of the view to a row of the base table. If you your view is built from more than one table, it can introduce ambiguity into which rows of which table should be updated.
User is offlineProfile CardPM
+Quote Post

birdofprey
RE: Updateable Views
29 Jul, 2008 - 03:19 PM
Post #3

New D.I.C Head
*

Joined: 24 Jul, 2008
Posts: 3

thanks, how do i rep on this forum because you deserve one.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 02:03AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month