On 6-Jun-2005,
el*************@yahoo.com wrote:
1) When creating a table why do I need to define the type of data and
length so strictly, i,e int , varchar etc?
it improves calculation, data storage and indexing for mysql to know what
data type is contained in a column.
Can I make a flexible table
with data of any type and length?
check out the blob data types.
2) When creating a record I am using autoincrement ID. This works
great except when I delete a record it leaves a "hole" in the table.
How can I set it up to work like a flatfile where all records shift
"up" when one is deleted?
There is no 'hole' in the table, only a missing number in the sequence. If
you really need to you can resequence a table but it's better to stop
thinking in terms of flat files and take advantage of the features of tables
and relations. For example you can retrieve the records from a table in
sequence by the auto-increment field, then count them as you retrieve them.
If all you want is the count, you can do that with a "select count()..."
The only way to close up a hole in a flat file is to rewrite all the records
from the hold forward, that's not practical in the case of a large number of
records. With a database, the 'cost' of deleting a row is usually minimal
because the records do not need to be stored sequentially.
--
Tom Thackrey
www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to
ja*********@willglen.net (it's reserved for spammers)