Hello, I need to store like 200 various values, from boolean to random size texts, this means what each value will have its own format. So which way will be quicker/less memory using: to create 200 fields for each value and one row with values, or to create 2 fields (name and value) and 200 rows? I will need to select all values every time, so if i use second way i will also need to perform while loop to create array with values from all fields. Thanks.
I would do so reading on database normalization. You probably don't have 200 fields that are related to one specific key so if you normalize your database you'll find it easier to retrieve the data for each specific purpose. Normalization isn't that hard to do and it will save you a lot of headaches in the future.
Given the amount of rows I would call this premature optimisation, Google tells me that is the cause of lots of bad things. Just store everything as varchar and cast if and when needed, you could combine this with a type column to know how to cast it back in your source datatype.
200 is not a big number probably you have something like a configuration database with 2 columns name and value. you should make with 200 ros. my opinion
If the 200 fields will stay pretty static, then I'd go with the 200 individual columns, especially if you'll be doing a lot of data mining off of the data. It makes it easier then to get aggregate views of the data, such as in the case of survey responses. If you dont anticipate aggregating the data heavily, or anticipate the values you have to collect changing frequently, then go with the table containing name/value pairs.
you should to check table care fully. If possible then try to reduce the number of field by normalization or break the table in more the one table And finally i suggest you should to go with 200 rows ..that will be a better and logical way.......
however if this is a configuration database i would suggest to create a condiguration file and put that values in an array. i think it's must faster because you don't have to make a select from database every time someone visits a page. but it all depends what do you intend to do