Might be out of scope, but on my last job I was issued to create the similar table structure to keep there the contact information. The demand was in order to keep the different contact schemas in the same table.
I've gone with the other approach (it was not too easy to get the boss' agreement :-))
Instead of the single table with contact information I've implemented the structure of 2 tables: the contact and contact_details. The contact_details has 3 columns: contact_id, value and value_type_id.
That all allowed me to avoid such problems as sorting. And has used the storage more efficient way.
Depending on the number of nullable "columns", I agree that's one way to use storage more efficiently. I don't understand how using such an EAV table would allow you to avoid sorting problems, though. In fact it would seem to exacerbate the problem a bit. For example, if the EAV contained a FirstName, LastName, and PhoneNumber, how would you sort based on LastName and FirstName?
is pronounced ree-bar and is a Modenism for R
First step towards the paradigm shift of writing Set Based code: Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair
How to post code problemsHow to post performance problemsForum FAQs