> In the example I provide (entity), specifically for web2py and
> relational databases, does it actually make sense to separate 'entity'
> to its own table and use 1:1 relationships from tables A/B/C, or is it
> recommended to just embed the 'entity' fields into tables A/B/C
> (without any references)?.
>
> What are the pros and cons of such alternatives?.
>
> The pro I see about using an independent 'entity' table is
> maintenance, but the con might be the access / manipulation of this
> extra reference ...?

For general info on relational database you can google for database
normalization.

On the practical side sometimes 1:1 relations are useful. For example
if we want to store 'dressed person' object which contains
person_name, current_jacket. Its convenient to store in 2 tables
db.define_table('jackets', Field('jacket', 'string'))
db.define_table('dressed_person', Field('person_name','string'),
                                        Field(current_jacket', db.jackets.id)

So when a person changes a jacket we don't loose info on the jacket
he was wearing in case he wants to put old jacket on again.

On web2py side its much easier to design your app with  1 table= 1
page approach.

Reply via email to