entity-attribute-value

How to represent many similar attributes of an entity in a database?

流过昼夜 提交于 2020-01-06 07:00:16
问题 Let's say I'm building a website about cars. The car entity has a lot of enum-like attributes: transmission (manual/automatic) fuel (gasoline/diesel/bioethanol/electric) body style (coupe/sedan/convertible/...) air conditioning (none/simple/dual-zone) exterior color (black/white/gray/blue/green/...) interior color (black/white/gray/blue/green/...) etc. The list of these attributes is likely to change in the future. What is the optimal way to model them in the database? I can think of the

Mysql EAV match row as field or entity's property value

元气小坏坏 提交于 2020-01-04 10:59:17
问题 My Mysql database has objects which are defined by an object type which is then joined to set it's properties. And it is based on the Entity Attribute Value model as pointed out by Spencer. The database is a little more complicated then below but this should make my question a little more clear. I have a mysql table objects which contains some basic information about an object say create_date , title , author and of course an id . I also have a table object_properties which contains some more

DB Design to allow user to define products, product specs and let themself insert orders

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-04 04:38:46
问题 I'm designing a db because I need to develop such a CRM, where the users are able to specify new products, products specs and pricing and then let themself to insert orders for that products specified in a previous step. Of course the data inserted needs to be evaluated according to what they specified in the db. I may be more clear with an example: user1 creates a product "apple", specifies then "color" and "weight" as attribute specs for that product. Then user1 says that the apple pricing

select from mysql db with 300 tables using a default prefix

人走茶凉 提交于 2020-01-04 02:50:46
问题 I have a program that selects from about 200 tables with prefix. eg PBN_products, PBN_address, PBN_others. Instead of appending the prefix on each table for the select statement, is there a way of defining the prefix as default value and do the selection? $prefix=GET['prefix']; mysql_connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD); mysql_select_db(DB_DATABASE); $sql = 'SELECT price, description, title, cost'. 'FROM products, address, others'; How can I define the prefix not to

EAV Database Scheme

微笑、不失礼 提交于 2020-01-01 06:07:38
问题 I have a db with more that 100K records. A lot of categories and many items (with different properties per category) Everything is stored in a EAV. If I try to break this scheme and create for any category a unique table is something that will I have to avoid? Yes, I know that probably I'll have a lot of tables and I'll need to ALTER them if I want to add an extra field, BUT is this so wrong? I have also read that as many tables I have, the db will be populate with more files and this isn't

EAV Database Scheme

只愿长相守 提交于 2020-01-01 06:07:07
问题 I have a db with more that 100K records. A lot of categories and many items (with different properties per category) Everything is stored in a EAV. If I try to break this scheme and create for any category a unique table is something that will I have to avoid? Yes, I know that probably I'll have a lot of tables and I'll need to ALTER them if I want to add an extra field, BUT is this so wrong? I have also read that as many tables I have, the db will be populate with more files and this isn't

How to store the properties of the goods in mysql? [closed]

牧云@^-^@ 提交于 2019-12-30 13:39:49
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 4 years ago . Now I'm planning the structure of the database products. There was a question of storage options / parameters of the goods. For example, if it were the size of the goods - it would be enough to create three fields to the width / height / depth, but what if dozens of parameters? It is assumed that

Entity-Attribute-Value Table Design

若如初见. 提交于 2019-12-27 11:42:59
问题 I am currently designing a database structure for the products section of an ecommerce platform. It needs to be designed in such a way that makes it possible to sell an infinite number of different types of products with an infinite number of different attributes. E.g. The attributes of a laptop would be RAM, Screen Size, Weight, etc. The attributes of a book would be Author, ISBN, Publisher, etc. It seems like an EAV structure would be most suitable. Select a product Product belongs to

EAV - in an ecommerce case, is it really an anti-pattern?

点点圈 提交于 2019-12-25 13:18:00
问题 I'm in the process of building a new system which will require an extendable data model. It's quite complex, but the part of the system which requires this structure is very relatable to the product part of an ecommerce system, so I'll use that as a case. Imagine a set of companies. Each company has a range of products, which has some basic attributes such as name , sku , description , price etc. Alongside these basic attributes, the company should be able to create n custom product

Is it possible to name SQL result columns from rows in another table? (Postgres)

纵饮孤独 提交于 2019-12-25 07:01:47
问题 Basically I have users with a dynamic attributes table. Simplified: SELECT * FROM users; id | email -----+------------------------------------------ 1 | example@example.com SELECT * FROM user_attributes; id | name ----+---------------- 1 | Salutation 2 | Given Name 3 | Surname 4 | Alias 5 | Address 6 | Address 2 7 | Address 3 8 | City 9 | Region .... SELECT * FROM user_attribute_values; client_id | attribute_id | value -----------+--------------+------- What I'm looking to do is a SELECT that