Re: Web dev, DB and "proper db design".

[email protected] ("Tony Marston")
Newsgroups php.general
Message-ID <[email protected]>
"Richard Quadling"  wrote in message 
news:CAKUjMCWJ4wiUO904OvYkS53Fsg4PPXa=qbOKcVHWFEmCpKpMMQ@mail.gmail.com...
>
>Hi.
>
>I've just had a conversation regarding DB, foreign keys and their benefits.
>
>I was told "I've never worked on a web application where foreign keys were
>used in the database".
>
>As someone who has spent 25 years working on accounting/epos systems on MS
>SQL Server (yep, windows) and now in a web environment and hearing the
>above, ... well, ... slightly concerned.
>
>So, in the biggest broadest terms, what do you lot do?
>
>DBs with no foreign keys (constrainted or not).
>ORM builders with manual definition of relationships between the tables.
>Inline SQL where you have to just remember all the relationships.
>Views for simple lookups? How do you handle updatable views (does mysql
>support them?)
>etc.
>
>Is there a difference in those in 'startups' and web only situations, or
>those doing more traditional development (split that as you like - I'm just
>trying to get an understanding and not go off on one!).
>
>No definitive answers, and I hope I get some wide experiences here.
>
>Thanks for looking.
>
>Richard.

There is a difference between having a field which is used as a foreign key 
and having a foreign key constraint defined in the database. Remember that 
foreign keys can be used in SELECT statements without there being a FK 
constraint. Constraints are only used in INSERT/UPDATE/DELETE operations, 
and never used for SELECTs

You cannot have relationships in a database without foreign keys, but you 
can have foreign keys with constraints.

-- 
Tony Marston

http://www.tonymarston.net
http://www.radicore.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.