Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL database
I have two tables; Table1 with 15 fields Table2 with 6 fields. Among these 6 fields 5 fields will share same data as in Table1. Which means If Table1 is updated I have to update Table2 as well, apart from this Table2 will have its own data as well.
 
My question is should I get rid of Table2 & add one extra field to Table1, in this case the remaining 9 fields will have null values for the data that was going into Table2 before.
 
Or I keep Table2; but in that case I will have to programmatically maintain both tables, which will cause data duplication. It is very important that the data of these two tables always match as it is the heart of the program.
 
Thanks in Advance.
Posted 16-Sep-12 1:53am
Edited 16-Sep-12 2:01am
v3

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

I recommend third solution. Create third table which will be contain 5 fields common to previous table and some Id field. In this case you will kept in table1 and table2 only reference by id to needed data.
 
Share data always should be kept in one place.
  Permalink  
Comments
divyang_dv at 16-Sep-12 12:26pm
   
Thanks grzelix25, I am feeling so dumb now as I didn't thought of this solution... :) I'll start accordingly.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web01 | 2.8.140827.1 | Last Updated 16 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100