Search Postgresql Archives

Re: Trying to Understand Table Inheritance

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



--- Jeff > You can create a table called order_item with columns that exist for all
> items (the shared columns). Create a table called merchandise with
> columns that exist only for merchandise and not other items (without any
> of the shared columns).
> 
> When you insert new merchandise, put the common values into the
> order_item table, and the merchandise-specific attributes into the
> merchandise table with a foreign key to the order_item record. When you
> want all the items, select from order_item. When you want only the
> merchandise, join the order_item and merchandise tables, and of course
> the join will eliminate all non-merchandise records. And you can do the
> same for memberships and subscriptions.

Then if you wanted, you could add one additional layer to for convienence.  you can create
multiple updateable views, one view for each of your extenction tables such as mechandise in this
example  that are joined back to your primary table.

This way you can handle each relation seperately.

Regards,

Richard Broersma.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux