![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
#3
| |||
| |||
|
|
Hi, I am trying to design a db schema (or rather extend existing db schema). My goal is to extend the database table so that every time a new column is needed, we dont go about adding the new columns by altering the table. Here is some background. Business requirement: We usually have a need to extend the existing table structure to add new columns to incorporate information related to the new customer requirements. Example: Consider an existing table "Organization" in our db. I have a new project from another customer which requires some new information. To achieve this, I will need to add new columns to existing "Organization" table. In the future, there is another project from a new customer which requires adding some more new columns to the "Organization" table. My goal is not to add new columns every time a requirement comes to the existing table structure. So I thought about creating some Metadata table to solve this. Add a new table called "MetaData". It will have the following columns column_id (int) table_id (int) - holds the table object_id for which the new column is being added column_name (varchar) - name of the new column needed column_data_type (varchar) - data type for the new column needed I will add a new table called "OrganizationAttributes". It will have the following columns org_id (int) - foriegn key to Organization table column_id (int) - foreign key to MetaData table. column_value (varbinarymax) - the value for the new column for the org_id record I will need to create a function called GetOrganizationAttributes(table_id, column_name, *org_id) that would convert the value in column_value column to appropriate data type. Is this a good design to implement?. Did any of you use this type of design in your db schema ? Are there any other better ideas that you guys think are good. I appreciate any help regarding this. Thanks, -Raj |
#4
| |||
| |||
|
|
Are you familiar with the predicate view of data? *Basically, instead of entity tables, you make predicate tables - tables which describe facts about one or more entities. *It's an important point of view from relational theory and object-relational modeling, and has additional advantages, such as mostly eliminating the need for nulls and turning queries into logical deduction. It requires you to create new tables when you need new attributes, which requires some getting used too. *Relational databases can be much more dynamic and powerful than commonly used.- Hide quoted text - - Show quoted text - |
#5
| |||
| |||
|
|
Could you post some links to articles that go into more detail on this concept? Thanks, Bill Are you familiar with the predicate view of data? *Basically, instead of entity tables, you make predicate tables - tables which describe facts about one or more entities. *It's an important point of view from relational theory and object-relational modeling, and has additional advantages, such as mostly eliminating the need for nulls and turning queries into logical deduction. It requires you to create new tables when you need new attributes, which requires some getting used too. *Relational databases can be much more dynamic and powerful than commonly used.- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text - |
![]() |
| Thread Tools | |
| Display Modes | |
| |