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

Show all comments

Showing thread 29 of 52

iblaine1 reply#
> What are good schema examples?

Anything that doesn't break the first normal form("1NF")[1].
> And what are some poor examples?
Anything that breaks 1NF.
You break 1NF when...
* a column cannot be described by the key, ex. user.id describes user.name but not user.items_purchased.
* values in a column are repeated, ex. a user table that stores multiple addresses for the same user should be split into an addresses table.
Treat tables as classes and you'll be fine. Just like a method may not belong in a class, a column may not belong in a table.
[1](https://en.wikipedia.org/wiki/First_normal_form)

iblaine#
s/1NF/3NF/g ...point here is that data good design comes from objects in 3NF...1NF is a good start, 3NF would be better...