How would you create a table where a number of the columns have default values that come from another table?
F开发者_Python百科or example, I have a table that holds some data, and then another table that holds the foreign key for the previous table and columns that can hold similar data to the first table. I want to be able to create a 'snapshot' of rows from the first table where all the date is input be default.
Thanks.
A concrete example may help. Consider a data model with one FAMILY entity and a child FAMILY_MEMBER entity. Some attributes, such as date of birth, would be specific to the child entity. Others, such as FAMILY_NAME, could be considered for storage against either the parent or child entity.
In some cases you may decide to store one FAMILY_NAME on the FAMILY entity but allow for a 'overrride' on the FAMILY_MEMBER entity. In this case, I would leave the value on the FAMILY_MEMBER as NULL. I might then have a view that joins the two entities and has an NVL(fm.FAMILY_NAME, f.FAMILY_NAME) derived value.
精彩评论