Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #7454
| From | "Tony Marston" <TonyMarston@hotmail.com> |
|---|---|
| Newsgroups | comp.lang.php |
| References | <cnKks.137076$Tf3.11521@fx12.am4> <vq6fm9-97b.ln1@luuk.invalid.lan> |
| Subject | Re: Bad database design can cause unnecessary coding |
| Message-ID | <Btrls.182463$g62.111973@fx06.am4> (permalink) |
| Date | 2012-11-04 10:30 +0000 |
"Luuk" wrote in message news:vq6fm9-97b.ln1@luuk.invalid.lan... > >On 02-11-2012 08:12, Tony Marston wrote: >> When you design your database for your PHP application are you aware >> that some of your design decisions can have a detrimental effect when it >> comes to writing the code to access that database? I have been designing >> databases, and building the applications which use them, for several >> decades, and I have learned over the years that there are some design >> decisions which help the developer while others do nothing more than >> hinder. I have produced a document which lists 14 of these “hindrances” >> which can be read at >> http://www.tonymarston.net/php-mysql/database-design-ru-novice-ninja-or-nincompoop.html >> >> >> Do you agree with my opinions? Can you think of any more questionable >> design decisions which can be added to this list? >> >> Tony Marston >> >> http://www.tonymarston.net >> http://www.radicore.org > >Basic Database Rules > >2.The primary key can be of almost any data type, but should not exceed the >size limit for the database (which is usually 255 characters). The primary >key can also span more than one column, and need not be the first column(s) >to be defined for the table. > >- This is not a 'basic database rule'. It's more a techinal-note on how the >world (might, because i did not verify) look like. The "size limit for the >database" is for sure something techical, which should not be a 'BASIC' >rule... It needs to be identified as a rule in order to stop some newbie from using a large TEXT or BINARY column as a primary key. If you don't state it as a rule then how is a newbie to know that he's breaking it? >- Some say you should only use 1 column for your primary key. > >7.All database, table and column names should use the standard character >set, which is comprised of letters, numbers and underscores. Attempting to >use symbols may seem "cool" at first, but eventually you will feel the >pain. >9.All databases, both past and present, are case INsensitive when it comes >to names. This means that names such as "foo_bar", "FOO_BAR" and "Foo_Bar" >will all resolve to the same column. > >- I would not use underscores in my table or column names. I would, for the simple reason that I started my career using operating systems which only had a single case, so using mixed case, as in "FooBar" was out of the question, and underscore was the standard separator, thus giving "foo_bar". If you choose to be different then that is your choice. >- a 'basic database rule' should be that consistency in naming should be >used. If you use 'CarsSold' in one table, thant you should not have another >field named like 'cars_wrecked'. >The consistency in naming you tables (and columns) is more important than >the case INsentiviity of it. Case sensitive software causes more problems than it solves, which I why I take steps to avoid potential problems by keeping all my database, table and column names in lower case with the underscore separator. -- Tony Marston http://www.tonymarston.net http://www.radicore.org
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Bad database design can cause unnecessary coding "Tony Marston" <TonyMarston@hotmail.com> - 2012-11-02 07:12 +0000
Re: Bad database design can cause unnecessary coding "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-11-02 09:53 +0100
Re: Bad database design can cause unnecessary coding "Tony Marston" <TonyMarston@hotmail.com> - 2012-11-03 09:14 +0000
Re: Bad database design can cause unnecessary coding "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-11-03 18:01 +0100
Re: Bad database design can cause unnecessary coding Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-03 15:03 -0400
Re: Bad database design can cause unnecessary coding "Tony Marston" <TonyMarston@hotmail.com> - 2012-11-04 10:11 +0000
Re: Bad database design can cause unnecessary coding "Peter H. Coffin" <hellsop@ninehells.com> - 2012-11-04 14:37 -0600
Re: Bad database design can cause unnecessary coding "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-11-03 19:00 +0100
Re: Bad database design can cause unnecessary coding "Tony Marston" <TonyMarston@hotmail.com> - 2012-11-04 10:18 +0000
Re: Bad database design can cause unnecessary coding Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-04 07:29 -0500
Re: Bad database design can cause unnecessary coding Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-02 06:48 -0400
Re: Bad database design can cause unnecessary coding Goran <goran@nospam.com> - 2012-11-02 12:34 +0100
Re: Bad database design can cause unnecessary coding Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-02 07:48 -0400
Re: Bad database design can cause unnecessary coding "Tony Marston" <TonyMarston@hotmail.com> - 2012-11-03 09:28 +0000
Re: Bad database design can cause unnecessary coding "J.O. Aho" <user@example.net> - 2012-11-03 10:56 +0100
Re: Bad database design can cause unnecessary coding "Tony Marston" <TonyMarston@hotmail.com> - 2012-11-04 10:09 +0000
Re: Bad database design can cause unnecessary coding Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-04 07:32 -0500
Re: Bad database design can cause unnecessary coding "J.O. Aho" <user@example.net> - 2012-11-04 16:45 +0100
Re: Bad database design can cause unnecessary coding Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-03 10:52 -0400
Re: Bad database design can cause unnecessary coding The Natural Philosopher <tnp@invalid.invalid> - 2012-11-02 11:56 +0000
Re: Bad database design can cause unnecessary coding "Tony Marston" <TonyMarston@hotmail.com> - 2012-11-03 09:17 +0000
Re: Bad database design can cause unnecessary coding Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-03 10:54 -0400
Re: Bad database design can cause unnecessary coding Luuk <luuk@invalid.lan> - 2012-11-03 16:06 +0100
Re: Bad database design can cause unnecessary coding Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-03 11:25 -0400
Re: Bad database design can cause unnecessary coding Denis McMahon <denismfmcmahon@gmail.com> - 2012-11-02 11:13 +0000
Re: Bad database design can cause unnecessary coding "Tony Marston" <TonyMarston@hotmail.com> - 2012-11-03 09:31 +0000
Re: Bad database design can cause unnecessary coding Denis McMahon <denismfmcmahon@gmail.com> - 2012-11-03 13:08 +0000
Re: Bad database design can cause unnecessary coding Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-03 10:55 -0400
Re: Bad database design can cause unnecessary coding "Tony Marston" <TonyMarston@hotmail.com> - 2012-11-04 10:04 +0000
Re: Bad database design can cause unnecessary coding Luuk <luuk@invalid.lan> - 2012-11-03 11:04 +0100
Re: Bad database design can cause unnecessary coding "Tony Marston" <TonyMarston@hotmail.com> - 2012-11-04 10:30 +0000
Re: Bad database design can cause unnecessary coding Erwin Moller <erwinmollerusenet@xs4all.nl> - 2012-11-15 15:49 +0100
Re: Bad database design can cause unnecessary coding "Peter H. Coffin" <hellsop@ninehells.com> - 2012-11-15 12:03 -0600
csiph-web