|
Posted by Jerry Stuckle on 06/30/05 18:12
Jeff North wrote:
> On Wed, 29 Jun 2005 17:36:21 -0500, in comp.lang.php Jerry Stuckle
> <jstucklex@attglobal.net> wrote:
>
>
>>| madsgormlarsen@gmail.com wrote:
>>| > Is what you are suggesting something along these lines?
>>| >
>>| > or do you agree with Jeff?
>>| >
>>| > CREATE TABLE `usr_languages` (
>>| > `pageName` varchar(25) default '',
>>| > `id` int(11) default '0',
>>| > `language` char(2),
>>| > `Actual_info` text,
>>| > )
>>| >
>>|
>>| No, I do not agree with Jeff. His design, while it works, makes the code very
>>| difficult to modify should he ever want to add a new language. To do so would
>>| require changing the database - and an examination of all the code which
>>| accesses the database. No, all the code would not HAVE to be modified - but all
>>| would have to be inspected.
>
>
> Each method has it's pros and cons. Neither is better than the other.
Then why is normalization so important? A properly normalized database is
almost without exception better than an unnormalized one.
>
>
>>| Normalizing the database helps with these effects. You don't need to change
>>| column names in your queries, for instance. It means if you have a bad language
>>| value (i.e. no sw(ahili) column), you get no data back instead of a MySQL query
>>| error.
>>|
>>| The method you quoted is much clearer - except you really don't need an "id"
>>| column. Rather, the primary key should be "pageName, language".
>
>
> If you have 20 fields on a webpage, how would you work out what text
> goes where?
> NB: where I use this is on forms where there are lots of prompts,
> tooltips and other textual information.
How do you do it with your page?
In his case, he just wants to store the entire page in a table. This works fine
for it.
If you have several fields, normalization is even more important. You could add
a third column to pagename and language - that being "field". Each row would be
identified by a pagename, a language and a field. It now becomes quite easy to
add or delete languages, fields and rows.
>
>
>>| I don't have any tutorials in mind - but if you do a google search on "database
>>| normalization" you should find several.
>
>
> ---------------------------------------------------------------
> jnorthau@yourpantsyahoo.com.au : Remove your pants to reply
> ---------------------------------------------------------------
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|