I am working on redesigning a table to normalize and increase performance.Imagine the current table as such:CustID State CarType CarManufacture CarLocation------ ----- -------- -------------- ------------abc 1,2,3 100,50,40 101,201,203 505,605,705
Currently the application (Cold Fusion) would lookup a CustID and then use the comma separated list from the columns above to lookup the data in a list that was stored in memory in Cold Fusion (read very poor performance) and not very flexible. I have proposed a table design that would be suchCustStateTableCustID StateCode------- ---------abc 1abc 2abc 3 CustCarTypeCustID CarType------ --------abc 100abc 50abc 40etc....etc..... for the other columsand then the translation tablesStateTranslationStateID State------- -----1 New Yotk2 Vermont3 TexasCarTypeTranslationTypeID Type------ ------100 Ford50 Chevy40 Dodgeetc....etc..... for the other lookups
It does seem to work but I am trying to keep this as simple as possible for obvious reasons.One major issue that we are having is what was a once a simple query has turned into a huge query with a huge amount of joins. Creates a lot of overhead to create a single query and is really a mess. It also seems overly complicated for something this simple.Another hurdle I am having is getting the output onto one row, such as :CustID State1 State2 State3 CarType1 CarType2 CarType3 etc..------ ------ ------ ------ -------- ------- --------abc New York Vermont Texas Ford Chevy Dodge
So what are the thoughts on the simplest way to do this? Main goals are to keep the queries as simple as possible and to get the output onto one row as simple as possible.Thanks in advance,Chris