View Single Post

   
  #1 (permalink)  
Old 02-29-2008, 06:16 PM
ibiza
 
Posts: n/a
Default Performance and data structure question

Hi SQL gurus,


I have a table structure question. I will have a table 'Models' that
has one to many 'incomes' and one to many 'costs'. These 2 entities
have exactly the same structure, which is 7 smallmoney and a name. Is
it better to create a table 'Incomes' and a table 'Costs', with both
the same number of fields like this :


Incomes
-------------
in_idmodel
in_1
in_2
in_3
in_4
in_5
in_6
in_7
in_name


Costs
-------------
c_idmodel
c_1
c_2
c_3
c_4
c_5
c_6
c_7
c_name


or is it better to create one single table that will contain both
entities like that :


Incomes_Costs
-------------
ic_idmodel
ic_1
ic_2
ic_3
ic_4
ic_5
ic_6
ic_7
ic_name
ic_isIncome


which only differs from the 2 above by the isIncome field to know which

row is an income and which row is a cost.


I'd like to know which method is the best in terms of performance and
general structure and would greatly appreciate if you explain a little
the reasons that drove you to suggest me a method over the other.


Thanks all for your time!


ibiza

Reply With Quote