On Dec 28, 2004, at 10:59 AM, Wayne Dreier wrote:
As I understand database structure, a record consists of a single row
of fields (columns). If this statement is correct, then how do I deal
with a record that needs to consist of multiple rows of those fields?
Stated another way, in my app which keeps track of research, I will
search and need to record data about family units from certain
sources. How would I go about retrieving multiple rows of data as a
single record?
What you do is have two different tables.
Here is an example:
You need to keep track of your product serial numbers. Well a single
person can own more than one license or even multiple products. You
don't want to have all of the contact information for the person in the
registered products table, because (a) what if the contact info
changes, and (b) it takes up too much space (duplication of data).
You have a single table called 'Person' table contains a unique
identifier for each person (if you are using the RB DB, you can use the
'_rowid' column). Then in the 'Serials' table, have a column
'person_id' which is the same unique identifier used in the 'Person'
table.
Then to get all of the serial numbers registered to anyone who's last
name is 'Smith', here is the SQL (I am pretty sure this syntax is
correct and Will can correct me if I am wrong):
SELECT a.snumber FROM Serials A, Person P WHERE a.person_id=p._rowid
AND p.last_name='Smith'
This is called a Join where you take conditions from two tables to
generate the search results.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>
|