Insert into object_Attributes values( 2, 2, 'John' ) Insert into object_Attributes values( 2, 1, '2' ) Insert into objects values ( 2, 'PERSON' ) Insert into object_Attributes values( 1, 3, 'Kyte' ) Insert into object_Attributes values( 1, 2, 'Thomas' ) Insert into object_Attributes values( 1, 1, '1' ) Insert into objects values ( 1, 'PERSON' ) Insert into attributes values ( 3, 'LAST_NAME', 'STRING' ) Īnd now I'm ready to create a PERSON record: Insert into attributes values ( 2, 'FIRST_NAME', 'STRING' ) Insert into attributes values ( 1, 'DATE_OF_BIRTH', 'DATE' ) That's it - no more CREATE TABLE for me! I can fill the attributes table up with rows like this: ( oid int, attrId int, value varchar2(4000), ( attrId int primary key, attrName varchar2(255), Many times - these are one in the same thing! For example, it is well known you can represent any object in a database using just four tables:Ĭreate table objects ( oid int primary key, name varchar2(255) ) Here is a excerpt from my forthcoming book where I talk about this (and show you how ugly, hard and inefficient queries against your very flexible model will be)įrequently I see applications built on a generic data model for "maximum flexibility" or applications built in ways that prohibit performance. Is this a wrong design ? or Just we don´t know how to build a query ? and product b could have color,style,group, and length (4 or more. We don't know how many features a product will have, product A could have color,size,material We use that structure because the attributes are dynamic, * All the product with Color "RED" and style "CLASIC" ?Įvery condition of the questions is a row in the struture, so we don't Know how to build a * All the products with Category "BED ROOM" and Color "RED" and Material "IRON" ? * All the products with Category "BED ROOM" and Color "RED" ? Then, we want to solve users questions using a query : PROD_ID PROD_DES PROD_COST PROD_LEVEL PROD_STATUS PROD_CLASIF And there is another table with the attributes of each product like thisĪnd exist another table with all the valid values for the attributes
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |