[PLUG] MSQL Cross-Table Query

Randal L. Schwartz merlyn at stonehenge.com
Wed Mar 3 15:12:45 UTC 2010


>>>>> "D" == D Cooper Stevenson <cooper at cooper.stevenson.name> writes:

D> I have three tables entitled, "msft," "goog," "aapl," and "intc." Each
D> of these tables are in the same database entitled, "minute."

Tables with the same structure with different names are an indication that
you're confusing data with structure.  In this case, "goog" is really a data
item, not a structure item, so it should be a column in the table, not the
name of the table.

However, if you *needed* these tables separate (for datawarehousing for
example), and you were using Postgresql (which I recommend wholeheartedly over
MySQL except when compatibility is a must), you could partition your tables as
an inherited structure, so that querying "stocks" would essentially be a union
of all stock-derived tables.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion




More information about the PLUG mailing list