Xojo Conferences
MBSOct2019CologneDE

Primary Keys (Real Studio network user group Mailinglist archive)

Back to the thread list
Previous thread: Re: transparent spritesurface?
Next thread: significant digits?


Serializable ... kind of   -   Jan Erik Moström <
  Primary Keys   -   Todd Geist
   Re: Primary Keys   -   Norman Palardy
   Re: Primary Keys   -   Mr. Weasel Willits

Primary Keys
Date: 06.05.02 05:05 (Sun, 05 May 2002 22:05:09 -0600)
From: Todd Geist
Hello,

What is the best way to maintain a Primary Key in a RealBasic Database? Is
there a standard for this sort of thing? Do you query the database with
some kind of Max function every time or do you maintain a property some
where.

I have been looking for documentation for this sort of thing but can't find
any.

Thanks

Todd

Re: Primary Keys
Date: 06.05.02 06:02 (Sun, 5 May 2002 23:02:24 -0600)
From: Norman Palardy
there is none because the RIGHT answer depends on your database

Max makes no sense if you keys are alphanumeric in nature (like a
product ID code might be) since Max is a numeric operator (mostly)

Some primary keys will automatically jump right out at you based on the
data
For instance, I'm sure there are thousands of databases that use social
insurance # as a primary key somewhere in them

your best bet is to find a reference on database design, and this will
give you the answers you need

designing the database is VERY important and doing the design well is
crucial

On Sunday, May 5, 2002, at 10:05 PM, Todd Geist wrote:

> Hello,
>
> What is the best way to maintain a Primary Key in a RealBasic
> Database? Is
> there a standard for this sort of thing? Do you query the database with
> some kind of Max function every time or do you maintain a property some
> where.
>
> I have been looking for documentation for this sort of thing but can't
> find
> any.
>
> Thanks
>
> Todd
>
> --
>
> Todd Geist
> __________________________________________
>
> ---
> Subscribe to the digest:
> <mailto:<email address removed>>
> Unsubscribe:
> <mailto:<email address removed>>

---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>

Re: Primary Keys
Date: 06.05.02 06:53 (Sun, 05 May 2002 22:53:49 -0700)
From: Mr. Weasel Willits
On 12/31/69 7:09 PM, the NSA intercepted the following message from "Harlan
Ribnik" <<email address removed>>:

>> What is the best way to maintain a Primary Key in a RealBasic
>> Database? Is
>> there a standard for this sort of thing? Do you query the database with
>> some kind of Max function every time or do you maintain a property some
>> where.

Well you could do it everytime, but that means that over time two record can
have the same primary key. For example you can have a record with pkey 1000
and then delete it. Later when you have 999 records, if you were to add
another record it would be assigned pkey 1000. Make sense?

To get around that, I simply created another table in the database called
DatabaseInformation and stored the max value there and add 1 to it everytime
a record is added to the database. Make sense?

-------------------Seth Willits-------------------
An answer to a panhandler's plea for spare change:
"Change comes from within, man."
_______ http://freaksoftware.tripod.com/ ________


---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>