I am new to designing database. Maybe its a stupid question so please pardon me for that. So the thing is I am designing the database for users. After user fills registration information he gets the unique receipt number. So my question is since receipt no. is unique can I use it as a primary key in Users table or should I stick with standard method of assigning userID to each row in table and use userID as primary key?
Share
If your receipt no. is complicated enough – built using numbers and characters, or 20 digits in length – better use the surrogate UserId
If receipt No can be simple integer and may be generated from DB – better use UserId and assign its value to ReceiptNo
If ReceiptNo is simple integer and its identifies the user AND the only user – use it as PKey.