foreign keys - MySQL Inserting data and setting FK's? -
i have table in database
http://i.stack.imgur.com/bsos9.png
i have pk,fk relationships setup , im ready start inserting data.
however not know start.
do insert tables primary keys first.
but how give foreign keys values of primary key in linking tables?
i thought starting with:
-patient -department -procedure -staff -events -supplies
any reference material appreciated, tried googling question not luck. perhaps eloquote more accurately.
you thought correctly, start foremost "parent" table, , work way down. inserting foreign keys can done either nested queries or getting key, storing it, , reusing it.
personally i'd go nested queries.
Comments
Post a Comment