Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!lll-tis!ames!oliveb!sun!urth!rfm From: rfm%urth@Sun.COM (Richard McAllister) Newsgroups: comp.databases Subject: Re: SQL question Message-ID: <43005@sun.uucp> Date: 24 Feb 88 16:51:14 GMT References: <34358UH2@PSUVM> Sender: news@sun.uucp Reply-To: rfm@sun.UUCP (Richard McAllister) Organization: Sun Microsystems, Mountain View Lines: 17 Keywords: SQL UNION Summary: SELECT ... UNION SELECT ... In article <34358UH2@PSUVM> UH2@PSUVM.BITNET (Lee Sailer) writes: >This morning I am wondering, how do you do a simple relational UNION in SQL? >That is, given two relations, R1 and R2, how do you create R3 that contains >those tuples that are in either R1, R2, or both, assuming that R1 and R2 >have the same attributes? You write SELECT * FROM R1 UNION SELECT * FROM R2 to get the rows of R3. If you want to create a new "virtual" relation R3 (SQL calls this a VIEW) you're pretty much out of luck as few implementations of SQL allow basing a VIEW on a UNION. Rich