You are here: Re: "you should define a primary key for this table" - why? « PHP Programming Language « IT news, forums, messages
Re: "you should define a primary key for this table" - why?

Posted by Gordon Burditt on 09/25/05 01:34

>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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация