Re: Avoiding duplications in tables - Mailing list pgsql-general
From | shreedhar |
---|---|
Subject | Re: Avoiding duplications in tables |
Date | |
Msg-id | 012001c2f1d6$5a9e3bd0$1201a8c0@a4005 Whole thread Raw |
In response to | Avoiding duplications in tables (Deepa K <kdeepa@midascomm.com>) |
List | pgsql-general |
Hi Deepa, Let me know that 1) Is tables ApplicationNumber and ApplicationManager are same ? 2) Why do you have more than one referential key between two tables, Which will makes process very slow. If answer to the first question as 'yes' and answer to the second question as 'I can change it to single referential key' You can look the following design which will wipe out redundancy. (1) tablename : versions versionnumber - string (2) tablename : applications applicationnumber - integer other details (3) tablename : applicationnumber -- CHANGED ApplicaitonNumberId Integer versionnumber - string applicationnumber - integer (4) tablename : profilemanager -- CHANGED ApplicationNumberId - Integer ProfileId - Integer other details (5) tablename : profiles -- CHANGED ProfileId - Integer versionnumber - string profilename - string Primary key : --------------- (1) versions : versionnumber (2) applicationmanager ( ApplicationNumber) : ApplicationNumberId -- CHANGED (3) applications : applicationnumber (4) profilemanager : ProfileId, ApplicationNumberId -- CHANGED (5) profiles : ProfileId -- CHANGED Relations : ----------- (1) versionnumber of 'applicationmanager/ApplicationNumber' referes to versionnumber of 'versions' table. (2) applicationnumber of 'applicationmanager/ApplicationNumber' referes to applicationnumber of 'applications' table. (3) ApplicationNumberId of 'profilemanager' referes to ApplicationNumberId of 'applicationmanager'. -- CHANGED (4) ProfileId of 'profilemanager' referes to ProfileId of 'profiles'. -- CHANGED (5) versionnumber of 'profiles' referes to versionnumber of 'versions'. I Think this design will serve your purpose (which will move redundancy). Sreedhar Baskararaju ---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives? http://archives.postgresql.org ----- Original Message ----- From: "Deepa K" <kdeepa@midascomm.com> To: <pgsql-general@postgresql.org> Sent: Monday, March 24, 2003 12:33 PM Subject: [GENERAL] Avoiding duplications in tables > Hi All, > I have the following tables. > > (1) tablename : versions > > versionnumber - string > > (2) tablename : applications > > applicationnumber - integer > other details > > (3) tablename : applicationnumber > > versionnumber - string > applicationnumber - integer > > (4) tablename : profilemanager > > versionnumber - string > profilename - string > applicationnumber - integer > other details > > (5) tablename : profiles > > versionnumber - string > profilename - string > > Primary key : > --------------- > > (1) versions : versionnumber > (2) applicationmanager : versionnumber, applicationnumber > (3) applications : applicationnumber > (4) profilemanager : veriosnnumber, profilename, applicationnumber > (5) profiles : versionnumber, profilename > > Relations : > ----------- > > (1) versionnumber of 'applicationmanager' referes to versionnumber of > > 'versions' table. > (2) applicationnumber of 'applicationmanager' referes to > applicationnumber of 'applications' table. > (3) versionnumber and applicationnumber of 'profilemanager' referes > to versionnumber and applicationnumber of > 'applicationmanager'. > (4) versionnumber and profilename of 'profilemanager' referes ot > versionnumber and profilename of 'profiles'. > (5) versionnumber of 'profiles' referes to versionnumber of > 'versions'. > > In the above design I can able to see duplication of data in all the > tables. If I take out a id out of all these tables to make reference, is > > that problem will solve. Is that is > a correct approach. > > Can any one help me. > > regards, > Deepa K > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org
pgsql-general by date: