Welcome to Dream.In.Code
Getting Help is Easy!

Join 107,162 Programmers for FREE! Ask your question and get quick answers from experts. There are 1,371 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



Updateable Views

 
Reply to this topicStart new topic

Updateable Views

birdofprey
post 24 Jul, 2008 - 09: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

Go to the top of the page


AdaHacker
post 28 Jul, 2008 - 03:34 PM
Post #2


D.I.C Head

**
Joined: 17 Jun, 2008
Posts: 68



Thanked 7 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

Go to the top of the page

birdofprey
post 29 Jul, 2008 - 04: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

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 8/27/08 09:30PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month