Hi Everyone,
In relational theory, a join is the projection and restriction of the
roduct.
The product, or Cartesian product, is the set of all possible combinations of
the rows from the two tables.
The system first examines all possible combinations of the rows from two
tables, then eliminates all the rows that do not meet the conditions of the
projection (columns) and restriction (selection of rows). The actual
procedure that FoxPro follows is a bit more sophisticated, and varies from
implementation to implementation.
With join queries, more so than with other types of SQL queries, you should
test your queries on a sample of your data to make sure that you're getting
the results you really want. An insufficiently restricted join query can
return results that need a good pruning before you can be sure that they are
correct, or useful. Also, you can bring down your LAN with the amount of
.TMP file space and the large projection created! I've done it, lads.
What makes a good join column? Ideally, a join column is a key column for
its table, either a primary key or a foreign key. A primary key requires
uniqueness of its data column or columns. When a key is a composite, you
must join on all the columns of the key.
Since the primary key logically connects to related foreign key columns in
other tables, key columns are usually ideal candidate columns on which to
construct a join. Such a join is likely to be useful and logically
appropriate, because you planned ahead for it. Primary key-foreign key joins
are based on the expectation that foreign keys will be kept consistent with
their primary keys, in order to preserve the referential integrity of the
entire database.
In FoxPro and VFP, columns being joined need not have the same name, though
mine usually do. I still like easy SET RELATION TO and UPDATE ON
xpressions.
Although they need not be identical datatypes, the datatypes of join columns
must be compatible -- types that Fox can convert from one type to another.
For example, Fox can easily convert among any of the numeric type columns --
such as integer, decimal, currency, or float. Datype-compatible join columns
are, generally speaking, both character types, or both numeric types.
When you join tables, Fox compares the data in the specified fields and
displays the results of the comparison as a table of the qualifying rows.
The results show a row for each successful join. Data from any of the tables
is duplicated as needed.
Join query results replicate data from qualifying rows as needed in order to
regularize the table display. As with any query, the results of a join query
display as a table without altering the database tables in any way. The join
operation simply permits the system to manipulate data from multiple tables
as if it were contained in a single table.
* ---- I'm out of time. More next time. I'm leading to something here, so
stay tuned.
David in Dallas.
--- Maximus/2 3.01
---------------
* Origin: * MacSavvy OS/2 BBS * Dallas, Texas * 972-250-4479 * (1:124/1208)
|