[net.database] Re.: Replace query in relational dbms

mohan@ihuxf.UUCP (Mohan Palat) (09/30/86)

> From: vacca@burdvax.UUCP (Dave Vacca)
> 
> replace t1 ( value = t2.total ) where t1.UKEY = t2.KEY
> 
> The join is one-to-many (t1-to-t2).  Thus, there may be 3 rows in t2
> which have the same key value as just 1 row in t1.  There will never
> be 2 or more rows in t1 which have the same key value as 1 row in t2.
> 
> Do I have to normalize t2?


	It is not clear as to what exactly you want this query to do -
	if, for example, there are 3 tuples in t2 that satisfy your
	qualification, which one of these three do you want to be 
	selected in the replace operation? In other words, the variable
	"value" could take on 3 possible values corresponding 
	to the "total" column of each of the 3 selected tuples and it
	is not clear as to which of these 3 values you want the variable
	"value" to contain. 
	One way to make the selection more restrictive might be to add another 
	qualifier to the query:
		replace() where t1.UKEY=t2.KEY and ...

	Mohan Palat
	AT&T Network Systems
	Lisle, IL