I have the following database, the first table users is a table containing my users, userid is a primary key.

The next is my results table, now for each user, there can be a result with an id and it can be against an exam. Is it ok in this scenario to use “id” as a primary key and “userid” as a foreign key? Is there a better way I could model this scenario?

These then link to the corresponding exams…

I would probably not have
useridas avarchar. I would have that as anintas well.So the user table is like this:
And then the forenkey in the results table table would be an
int. Like this:Becuase if you are plaing on
JOINing the tables together thenJOINing on avarcharis not as fast asJOINing on aINTEDIT
That depend on how much data you are planing to store. Beause you know that there is a minimum chans that
GUIDs are not unique. Simple proof that GUID is not unique. I think if I would design this database I would go with an int. Becuase it feels a little bit overkill to use aGUIDas a userid