4 ms·
What web framework are you using? It's possible to model inheritance/abstraction within database design but it's not always optimal. You can 'extend' an existi
by kellros 14y ago
What web framework are you using?
It's possible to model inheritance/abstraction within database design but it's not always optimal. You can 'extend' an existing table by specifying the child identifier as a primary and foreign key referencing the parent table (this is called 1 to 1 mapping).
Most of the time when you see 1 to 1 mapping you won't see it, because in relational databases you add those columns to the same table. There are some scenarios where it makes sense to split the table into two tables, such as a User and an Account table (AccountId = UserId), so you can better model the relationships.
Most people would advise against it and tell you to denormalize those tables (put everything on the user table), but if you use an orm that does class-per-table mapping it really reduces friction (ex. anything referencing an Account is accessable from an account, everything referencing a User specifically won't be directly accessable via the Account).
There's also a difference between key-value stores and object-oriented-databases (both being NOSQL). The reason why using NOSQL is 'closer' to your actual objects is because you would be storing actual objects (they get serialized into a graphs and stored).
I'd also suggest you check out Brewer's CAP Theorem: http://www.julianbrowne.com/article/viewer/brewers-cap-theorem http://www.julianbrowne.com/article/viewer/brewers-cap-theor...