Subject Re: [IBO] info on database design
Author Artur Anjos
I will try to help the best I could (I'm not an FB specialist (yet-hehehe))

> 1. I need to make a program which allows to make appointments
> automatically, but certain dates have to be avoided. I thought on
> storing these dates in a table. Now, what is the best primary key for
> such a table? I thought to use a date key for this, but it looks like
> people don't find this such a good idea, why? A date key in this case
> is always unique. If I would use an autoincrement, then this value
> will at a certain time get it's maximum. Yes I know... it will take a
> long time and perhaps never reaches it's maximum, but with a date as
> key this will never happen. So why is using a date key not a good
> approach?

People always use generators por primary keys because the "primary key main function is getting a way to identify the "row" you are getting from the table. So, this should be unique and fast: that's the main reason to avoid to use Date Fields for that. Resume: the main reason it's keeping the 'ID' out from the data. That way you can change ID's with no problem with your data relation. In your case, I suggest to use a primary key with a generator and keep an index on your "Date" column. Don't worry about your "Integer generator" coming to an end: at that time YOU will not be here... [Do you really think that people will use your application in the next 5 years? I never think about software for more then 5 years, and at time I will consider my appl "a very, very, very obsolet appl'].

2. What is the best, using a TIBOTable or a TIBOQuery (with select *
form table). Speed?

If you are going to select * use TIBOTable. (Do you really need to select *? Think Client-Server: what data should be available for your user at the moment? Monitor area is limited, so I think you don't have so many columns on your table. If you do, choose the columns that really are available at that time to the user, and get all the others when you really need to].

> 3. What is best in speed, using a storedprocedure to update a table
> or a query?

Ops, don't have any help to you on this. It depends. But "to update" I will use the same TIBOQuery or TIBOTable, no need to have another way.

> 4. I need to iterate through a table, but not visual, how can I do
> this best, concerning speed?

Use DisableControls and the usual: Locate, Goto, Filter... Don't know what you really need to do.

I hope it helped!

Artur Anjos

[Non-text portions of this message have been removed]