![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Is it best practise to: 1) Store users in a User table, with a numeric UserID as primary key, and reference these users in other tables using that UserID as a foreign key? Also, this would require an additional username field. or 2) Store users in a User table, with a text Username as primary key, and reference these users in other tables using the Username as a foreign key? TIA. |
#3
| ||||||
| ||||||
|
|
Dave wrote: Is it best practise to: 1) Store users in a User table, with a numeric UserID as primary key, and reference these users in other tables using that UserID as a foreign key? Also, this would require an additional username field. or 2) Store users in a User table, with a text Username as primary key, and reference these users in other tables using the Username as a foreign key? TIA. It is best practice to state the version of the database and the business rules. |
|
Is each individual user logging in with the same userid and password or does each one have their own? |
|
Do users have a unique surrogate key such as an employee id number or are you talking about creating a new purely arbitrary numbering system? |
|
How do other applications in the organization identify users such that you can exchange data between systems. Where do user names come from? |
|
Could their be two Bob Joneses? How are names to be maintained? |
|
The simple answer is that there is no "right" way. |
#4
| |||
| |||
|
|
It is best practice to state the version of the database and the business rules. PostgreSQL and .... |
#5
| |||
| |||
|
|
Dave wrote: Is it best practise to: 1) Store users in a User table, with a numeric UserID as primary key, and reference these users in other tables using that UserID as a foreign key? Also, this would require an additional username field. or 2) Store users in a User table, with a text Username as primary key, and reference these users in other tables using the Username as a foreign key? |
|
PostgreSQL and I'm developing a financial application, which will involve reports which return results on a per-user basis. Some of the tables will contain 100,000+ rows. Is each individual user logging in with the same userid and password or does each one have their own? Each have their own. Do users have a unique surrogate key such as an employee id number or are you talking about creating a new purely arbitrary numbering system? Arbitrary. How do other applications in the organization identify users such that you can exchange data between systems. Where do user names come from? Traditionally first letter of forename plus surname e.g. "bjones", these are assigned by system admins. |
![]() |
| Thread Tools | |
| Display Modes | |
| |