gettingstarted
[Top] [All Lists]

Re: What is a database record?

To: Getting Started <gettingstarted at lists dot realsoftware dot com>
Subject: Re: What is a database record?
From: Wayne Dreier <realbasicnovice at MacDialUp dot com>
Date: Tue, 28 Dec 2004 19:48:41 -0500
Delivered-to: gettingstarted at lists dot realsoftware dot com
References: <8CCA3D6A-5902-11D9-977D-003065D91F8C at MacDialUp dot com> <4659CB0D-5910-11D9-8A9B-000393101B4A at mobleybros dot com>
Here is an actual set of data taken from the 1850 U. S. Federal census - the first field is Dwelling number, the second is Family number, the third is name. (There are additional fields such as age, sex, occupation, etc.)

Row 1 - 124, 124, Monohan, James
Row 2 - , , Ammanda
Row 3 - , , Dean, Harley

Notice first of all that only the first row contains a family number and a dwelling number. The second row contains only a first name. The third row contains a last name but it is different than the last name in row 1.

Here is my dilemma - If the key is for family or dwelling number, only the first row would be retrieved. If the key is on last name and I search for Dean, I'd get only row 3. If I search for Monohan I'd get only row 1.

Any suggestions?

Wayne Dreier
Using OS X 10.3.7
Using RB 5.5.4

On Dec 28, 2004, at 3:37 PM, Phil Mobley wrote:

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>

_______________________________________________
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>

<Prev in Thread] Current Thread [Next in Thread>