correct approach to store in database
Posted
by
John
on Stack Overflow
See other posts from Stack Overflow
or by John
Published on 2012-03-29T17:21:55Z
Indexed on
2012/03/29
17:29 UTC
Read the original article
Hit count: 271
database
|database-design
I'm developing an online website (using Django and Mysql). I have a Tests table and User table.
I have 50 tests within the table and each user completes them at their own pace. How do I store the status of the tests in my DB?
One idea that came to my mind is to create an additional column in User table. That column containing testid's separated by comma or any other delimiter.
userid | username | testscompleted 1 john 1, 5, 34 2 tom 1, 10, 23, 25
Another idea was to create a seperate table to store userid and testid. So, I'll have only 2 columns but thousands of rows (no of tests * no of users) and they will always continue to increase.
userid | testid 1 1 1 5 2 1 1 34 2 10
© Stack Overflow or respective owner