Re: "you should define a primary key for this table" - why?
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.php archive

Re: "you should define a primary key for this table" - why?

From: Gordon Burditt <gordonb.0gd0a@burditt.org>
Date: Sun Sep 25 2005 - 00:34:38 CEST

>JN wrote:
>> >| Should one place all the text in one big table, or is i better to place
>> >| it in several tabels. Should one make 4 colums one for each language,
>> >| or 4 rows one for each language?
>>
>> I use:
>> CREATE TABLE `usr_languages` (
>> `pageName` varchar(25) default '',
>> `itemNo` int(11) default '0',
>> `en` text,
>> `fr` text,
>> `it` text
>> ) TYPE=MyISAM COMMENT='different languages';
>>
>
>which I used, and it works just fine, except that I just discovered
>that if I place just a litle more than a few line of text - in the TEXT
>fields then i get an "error" in phpmyadmin. There is a small question

I doubt it is an ERROR. It is a suggestion to improve your database,
much like a grade of A is a suggestion that you didn't do well enough
to deserve an A+.

>mark were thre is normally a pen and a cross - and when I move the
>cursur above the question mark i get this. "you should define a primary
>key for this table" .

Conventional wisdom says you should have a primary key for every
table. Among other things, this gives you the ability to delete
one specific record without possibly getting others in the process.
An index also speeds lookup.

Sometimes your primary key is an "artificial" one, maintained
by the database, such as:
        id int not null auto_increment

>Do you have any suggestions as to what the problem might be?

Bad style.

                                        Gordon L. Burditt
Received on Tue Oct 18 02:27:42 2005