Lurker News
I've seen many examples of database schemas but don't always recognise a good design over a mediocre or poor design.

This is what I mean by schema (is this a good design?)
https://www.drupal.org/node/1785994
When I read about database schemas with thousands of tables I wonder what kind of problem could possibly require so many tables.
What are good schema examples? And what are some poor examples?

Comments (175) 52 threads

Earlier comments
arethuza#
"what kind of problem could possibly require so many tables"

CRMs often have hundreds of tables and ERPs have thousands or tens of thousands or more.

petercooper#
Vertabelo has a blog which is almost entirely devoted to modelling schemas for various contrived scenarios: https://www.vertabelo.com/blog/ .. I take umbrage with some of the decisions made but broadly they are interesting and well thought out.
the-dude1 reply#
Northwind Traders
dwd#
That made me laugh.

My 2 cents after doing this long enough to recognise it
- Aim for 3NF but not religiously. Still, if you need a flat table try a view.
- Any ternary relationship can be modeled as a pair of binary relations (you'll never regret keeping it simpler)
- You don't need EAV (Magento is a good example of why you shouldn't)
- On the other hand don't serialize data (looking at you WordPress)
- XML and JSON data types though are perfectly fine when you need to store an object
- Every table should have a primary key (preferably an integer)
- If you really want a string for your primary key make it a candidate key (why, because someone will insist on changing it)
- E/R diagrams are your friend
- So are Venn diagrams for visualizing a complex select

Load more comments