l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
April 21: Google Glass
Next Installfest:
TBD
Latest News:
Mar. 18: Google Glass at LUGOD's April meeting
Page last updated:
2004 Jul 21 00:00

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] SQL help - unions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] SQL help - unions



On Tue, Jul 20, 2004 at 06:20:06PM -0700, Jeff Newmiller wrote:
> 
> The existence of separate tables with identical structures and disjoint
> data in your schema is a red flag to me.
> 
> I highly recommend putting all the data into one table with a "Season"
> column to distinguish the rows... it simplifies these kinds of queries and
> makes the data much more useful for mining.

To be proper about it, you would normalize this by putting the season
and year in respective separate tables, and place foreign keys to these
in the SSN table.  But it doesn't sound like this schema needs to be
overly complex.  Separate tables does simplify archiving etc., and
whatever works.

> As the other respondents suggested, different SQL engines have different
> levels of support for the language.
> 
>     SELECT SSN from [Fall 2003] WHERE race == 1
>     UNION
>     SELECT SSN from [Spring 2004] WHERE race == 1

The comparison operator for equal is '=' not '=='.

> gets you a little bit closer, but there are a couple of problems with 
> this... it isn't really obtaining a headcount,

Yes it is.  As is Michael Wenk's version.

> and unions don't eliminate duplicates.

Yes they do.

-David
_______________________________________________
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech



LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
O'Reilly and Associates
For numerous book donations.