List:General Discussion« Previous MessageNext Message »
From:Jim Faucette Date:May 8 1999 5:27pm
Subject:Re: Building a database
View as plain text  
Boaz Yahav wrote:
> 
> 1. Why should I prefer to use char(X) when I can simply use VARCHAR(255) for
> all text fields (or maybe I shouldn't).

If all a table's fields can be fixed length numerics and char, then
retrival is faster. Of course it's a trade off ... disk space for speed. 

> 2. Is there a reason to prefer VARCHAR(50) over VARCHAR(255) when I really
> need no 50 but maybe I will need more in the future?

Alot of programmers use the database length to set limits in the GUI for
each field's input limit. 

> 2. Is there a reason why I should prefer to use int(7) instead of int(11)
> when I guess I will really need int(7) but thinking to the future...
>     maybe I will need int(11)...

It depends on the range you will allow for user input. If you allow them
to enter a value that's out-of-range ... a 0 will be inserted in the
field.

> 3. Should I try to avoid using text fields as much as possible?

Unless absolutely needed ... and then try to isolate text or blob fields
as much as normalization will allow.

These are general suggestions. Mileage will vary depending on the
specific application.

  jim...
Thread
Building a databaseBoaz Yahav8 May
  • Re: Building a databaseJim Faucette8 May
    • Re: Building a databasePaul DuBois8 May