3 ms·
Can't you summarise all of that simply: "a database schema should be able to represent only valid data". e.g. employee, department, location is not good becaus
by jules 12y ago
Can't you summarise all of that simply: "a database schema should be able to represent only valid data".
e.g. employee, department, location is not good because that schema can represent invalid data: a single department can't be in 2 locations but the schema can represent that.
The same rule of thumb applies to types in programming: a data type should be able to represent only valid values. This is why sum types are superior to error codes: a function can return a result AND an error code, when what we usually want is that the function returns a result OR an error code. When invalid values are unrepresentable that makes a lot of errors impossible. Though sometimes your type system can't deal with all the constraints that you have, e.g. an array should be sorted (an unsorted array is representable but not valid => bad).
- bcoates 12y agoThe various normal forms are named for the kinds of invalid data they reject, so they can be used as a design process to ensure the higher level goal (that "a database schema should be able to represent only valid data")