Saturday, August 20, 2011

Re: Database design question

My gut instinct is screaming that you should not be creating multiple
tables as that goes against database normalisation and results in
duplicate tables, models, controllers and views.

Why would a small add not have a value for size, location and
user_id?
- I would expect by the very fact you're calling them small ads then
they have a size of small.
- All adverts must appear somwehere, so have a location, if not the
value would be null
- All adverts must have been added, or belong to someone, if not the
value would again be null

HTH, Paul.

On Aug 19, 10:40 pm, cronet <cro...@gmx.de> wrote:
> Hey,
>
> I've got a question concerning my database design. I would like to
> rewrite my website for small ads.
>
> There are two possible ways of creating my database:
>
> 1) Put all in one big table
>
> simplified example:
>
> id (1)
> name (2)
> address (3)
> zip (4)
> city (5)
> request_type (6)
> description (7)
> size (8)
> location (9)
> style (10)
> instrument (11)
> user_id (12)
>
> For some small ads i need fields 1,2,3,4,5,6,7,10,11
> for another ones i need fields 1,2,3,4,5,6,7,8,9,12
>
> Each row would be saved in one table with some fields empty.
>
> 2) Different model/tabel for each category
>
> instruments
>     id
>     name
>     address
>     zip
>     city
>     request_type
>     description
>     style
>     instrument
>
> common
>     id
>     name
>     address
>     zip
>     city
>     request_type
>     description
>     size
>     location
>     user_id
>
> I think I need about 6 or 7 categories...
>
> The big question:
> Should I create a extra model and database table for each small ad
> category (version 2), or should I pack all categories in one table
> (version 1)?
>
> Regards,
> Cronet

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: