I need to store of 100-200 data in mysql, the data which would be separated by pipes..
any idea how to store it on mysql? should I use a single column or should I make many multiple columns? I don’t know exactly how many data users will input.
I made a form, it halted at the part where multiple data needs to be stored.
Anyone know how to store multiple data in single column or is there any alternative way?
please help me..
thank you very much
You should implement your table with an ID for the source of the data. This ID will be used to group all those pieces of similar data so you don’t need to know how many you have beforehand.
Your table columns and data could be set up like this:
When you query the database, you can just pull in all of the data with the same sourceID. With the data above, the following query would return two pieces of data.
If you have multiple tables, you’ll need to associate them with each other using
JOINsyntax. Say you have a main table with user data and you want to associate all of this input data with each user.If you want to join data from this table (userTable) with data from the dataTable, use a query like this:
This query will give you all of the data for the user with an ID of 1. This assumes that the sourceID in your data table is using the userID from the user table to keep track of who the extra data belongs to.
Note that this is not the only JOIN syntax in SQL. You can learn about other types of joins here.