Re: Mysql Rows

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Barry:

I realize that relational dB's are out if one does this -- and -- I fully understand why.

That's the reason when I started this thread I made it clear that I was NOT talking about a relational dB but rather a simple flat file.

What I find interesting in all of this exchange -- however -- is that everyone agree's renumbering the "id" of a dB is something you don't do, but no one can come up with a concrete (other than relational) reason why.

I haven't finished reading this thread but here's why.

It's because those id's could be used as foreign keys.

I'll set up an example:

create table author (authorid int, authorname varchar(200));
insert into author(authorid, authorname) values(1, 'Chris 1');
insert into author(authorid, authorname) values(2, 'Chris 2');

create table news(newsid int, newstitle varchar(200), authorid int);

insert into news(newsid, newstitle, authorid) values (1, 'News by first author', 1); insert into news(newsid, newstitle, authorid) values (1, 'News by second author', 2);


If you delete author '1' and then renumber, you have to go through every other table in the database to see if anything relates to authorid '1' and update it.


Extremely time consuming and extremely error prone.

--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux