What are design patterns to support custom fields in an application?

I do agree with posters below that Options 3, 4, or 5 are most likely to be appropriate. However, each of your suggested implementations has its benefits and costs. I’d suggest choosing one by matching it to your specific requirements. For example: Option 1 pros: Fast to implement. Allows DB actions on custom fields (searching, … Read more

MongoDB Schema Design – Many small documents or fewer large documents?

You’ll definitely need to optimize for the queries you’re doing. Here’s my best guess based on your description. You’ll probably want to know all Credit Cards for each Customer, so keep an array of those within the Customer Object. You’ll also probably want to have a Customer reference for each Payment. This will keep the … Read more

What is Normalisation (or Normalization)? [closed]

Normalization is basically to design a database schema such that duplicate and redundant data is avoided. If the same information is repeated in multiple places in the database, there is the risk that it is updated in one place but not the other, leading to data corruption. There is a number of normalization levels from … Read more

Why use multiple columns as primary keys (composite primary key)

Your understanding is correct. You would do this in many cases. One example is in a relationship like OrderHeader and OrderDetail. The PK in OrderHeader might be OrderNumber. The PK in OrderDetail might be OrderNumber AND LineNumber. If it was either of those two, it would not be unique, but the combination of the two … Read more

How to design a product table for many kinds of product where each product has many parameters

You have at least these five options for modeling the type hierarchy you describe: Single Table Inheritance: one table for all Product types, with enough columns to store all attributes of all types. This means a lot of columns, most of which are NULL on any given row. Class Table Inheritance: one table for Products, … Read more

How to Store Historical Data [closed]

Supporting historical data directly within an operational system will make your application much more complex than it would otherwise be. Generally, I would not recommend doing it unless you have a hard requirement to manipulate historical versions of a record within the system. If you look closely, most requirements for historical data fall into one … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)