RDBMS: Proper way to store data - comma separated variables or in different fields or tables?
1
vote
2
answers
3583
views
Fundamental question that I cannot seem to find an answer on. I have a database that stores line items from receipts along with the username and receipt number.
Right now the
lineItem
column is just a long string of data separated by commas (original file appears to have been just an Excel file). This information is parsed in a PHP script for viewing on the front end.
The table looks like this:
|----------|----------|----------|
|lineItem |receiptID |customerID|
|----------|----------|----------|
|CD, DVD, |001 |User01 |
|----------|----------|----------|
|CD, CD, |002 |User02 |
|DVD, usb, | | |
|----------|----------|----------|
Ultimately, **is this bad practice**? Should the lineItem
values be linked to related values in another table instead maybe?
Asked by Bunny
(113 rep)
Jun 9, 2020, 07:32 PM
Last activity: Jan 5, 2022, 09:44 AM
Last activity: Jan 5, 2022, 09:44 AM