mysql - SQL One to One relation (Additional entity attributes in the second table) advantages -


quite few times saw models 1 (1 or 0) relations. e.g.:

create table accounts(login varchar primary key, password varchar); create table people(login varchar primary key, name varchar, inn varchar, age integer...); 

sometimes people has foreign key set on login column too, doesnt.

so question advantages , disadvantages of such model , tables normalised here? (as far know are, still strange way)

ps. have homework assignment on databases , need design complex enough model. technique students use in order make more tables.

one practical reason doing one-to-one relationship workaround row size limits of mysql storage engine, without implementing lob type storage columns (moving them off row storage).

innodb has practical limit of on 8000 bytes maximum row size. couple of varchar(4000) columns throw on limit.

another reason separate entities. here, i'm using term "entity" it's commonly used in entity relationship modeling techniques, (roughly) defined as "person, place, thing, concept or event can uniquely identified need store information about". if 2 separate entities, want have them implemented separate tables. "1-to-1"-ness of relationship not usual relationship find (requirements discovery-wise) between 2 entities. more find 1-to-many or many-to-many relationship between entities.

another reason implement 1-to-1 (or 1-to-0or1) contents of each table being "stewarded" different process. example, 1 process responsible adding/updating rows in "person" table, perhaps there's overnight job loads table external source. , there's process responsible adding/updating accounts table, maybe that's online web form application. find preferable each table "stewarded" single process.

those 3 big reasons have. otherwise, i'd go 1 table entity.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -