With a comma separated list column in the db with the role id’s available for that section? Then on each page load check that the user’s role list is contained in the page list?
OR
Is it easier to only allow a person into one category and then still assign the number list to each category? So for instance, there’s a ‘dealer’ and there’s a ‘distributor’, but in certain cases someone can be a dealer/distributor…*which with this method there would be three roles and with the other there would only be two.
Are either of these the right path? Thanks for any insight.
Yeah, that’s probably true. Though unless you’re inserting thousands of records at one time, it’s probably not noticeable. At least it hasn’t been w/our db. Granted there’s no point using an extra ID column if you don’t really need one …
Yep, on a relationship table. We did use the AK in some cases. Though I admit, we weren’t terribly obsessed with space constraints for basic ints.
Not every db requires an auto number to be the table’s primary key. Though IIRC, mySQL does. But in either case you have a covering index, so how much of an issue is this with a small table table storing ints …?
Some of the tables were pretty large. But again it’s only 3 int columns. If it were 3 blob/clob columns I might feel differently…
and degraded performance?
Degraded how if you’ve got a covering index? I’m not being argumentative here, I’m genuinely curious as we’ve never had any big performance bogs using this structure. Though we’re using sql server not mysql.
in a ~relationship~ table? that would only be if the relationship table has child tables of its own! (which is exceedingly rare, and i would likely propagate the natural keys in that case anyway)
having an id for a relationship table is also wrong, just make the two FKs a composite PK
It’s a matter of preference. I’ve worked with db’s that used an id column as an AK and it often came in handy in many cases. As long as any unique constraints are enforced having an id doesn’t harm anything.