
Originally Posted by
IBazz
Does that make sense?
yes!! 
oh, yes, yes, yes 
perhaps i am in a small minority but when numeric surrogate keys (of dubious merit in the first place) are absent in an example, it allows the concept more easily to shine through
so, yes 
ScallioXTX's example is exactly the same, but you have to shift your eyes from the many-to-many table back to the referring tables in order to interpret the relationships (you're performing a "virtual join" in your brain)
in instances where i need to do this, i avoid confusion by giving different keys a different range of values, like this --Events (not "tblEvents")
id name
201 Pizza Night
209 Dance Night
237 Italian Dinner Gala
Tags (not "tblTags")
id name
1 dance
2 food
EventTags (not "tblEventTags")
event_id tag_id
201 2
209 1
237 1
237 2
note: i don't actually assign different ranges in my database, i meant for the purposes of giving an example)
in practice i would never use an event name as a primary/foreign key, but i definitely would use the tag itself
so it would end up like this --EventTags
event_id tag_id
201 dance
209 food
237 food
237 dance
saves an extra join in the sql, too
Bookmarks