New answers tagged eav
Search on the tag [eav] -- there are a lot of discussions of the evils of it. One insidious evil comes when you need to sort numbers that are stored in a VARCHAR.
If you are trying to create a flexible application where users can create their own "forms"/"screens"/"pages", I would recommend you create different "modules" with specific meaningfully table name for the module and specific meaningfull labeled columns for each fields rather than a table to store fields which can be anything and everything. With your ...
To add just a bit to the correct answer from Vérace (+1), you should go further than separating different types into different columns, you should also define what your columns are and use them appropriately. This is called design and it is a necessary step for an understandable, scalable, good performing system. Just to hit on the understandable angle, ...
This question (in various guises) crops up regularly. This type of "solution" is known as EAV (Entity-Attribute-Value) and is not a good idea. Take a look here or here for tips (or links to tips) on the problems it can cause and how to properly leverage the data types that your RDBMS offers. Not using the correct data type is a sure fire way to confuse the ...
It depends what do you want to do with "Value". if you need for example sum(...) it may be best to have a decimal column and use "case when fieldtype='N' then sum(cDecimal) When ..".
Top 50 recent answers are included