Relational Data Model for Double-Entry Accounting

A. Preliminary Your Approach First and foremost, I must commend your attitude. It is rare to find someone who not only thinks and works from a solid grounding, and who wishes to understand and implement a Double-Entry Accounting system, instead of: either not implementing DEA, thus suffering multiple re-writes, and pain at each increment, each … Read more

When to use MongoDB [closed]

You would use MongoDB when you have a use case that matches its strengths. Do you need a schema-less document store? Nope, you have a stable schema. Do you need automatic sharding? Nope, you don’t have extraordinary data needs or budget for horizontally scaling hardware. Do you need map/reduce data processing? Not for something like … Read more

What are the known ways to store a tree structure in a relational DB? [closed]

As always: there is no best solution. Each solution makes different things easier or harder. The right solution for you depends on which operation you will do most. Naive Approach with parent-id: Pros: Easy to implement Easy to move a big subtree to another parent Insert is cheap Needed Fields directly accessible in SQL Cons: … Read more

Database design: 3 types of users, separate or one table? [closed]

What you need to consider when designing tables is not necessarily what they’ll have access to and how that is similar/dissimilar, but rather how the user levels themselves are similar/dissimilar. For example, if the user types will have the same attributes (name, email, birthdate, etc), then they belong in one table together with a column … Read more

Database design for user settings

Other answers have ably outlined the pros and cons of your various options. I believe that your Option 1 (property bag) is the best overall design for most applications, especially if you build in some protections against the weaknesses of propety bags. See the following ERD: In the above ERD, the USER_SETTING table is very … Read more

Setting up table relations what do “Cascade”, “Set Null” and “Restrict” do?

CASCADE will propagate the change when the parent changes. (If you delete a row, rows in constrained tables that reference that row will also be deleted, etc.) SET NULL sets the column value to NULL when a parent row goes away. RESTRICT causes the attempted DELETE of a parent row to fail. EDIT: You didn’t … Read more

How should international geographical addresses be stored in a relational database?

I will summarize my thoughts from my blog post – A lesson in address storage (on archive.org). On my current project [I work for a logistics company] we’re storing international addresses. I’ve done research on addresses all over the world in the design of this portion of the database. There’s a lot of different formats. … Read more

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