This week's book giveaway is in the Programmer Certification forum.
We're giving away four copies of OCP Oracle Certified Professional Java SE 21 Developer Study Guide: Exam 1Z0-830 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Database Design issue

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ranchers,

I have a database system that has 4 tables. 3 of these tables have a primary key.
The fourth table has four columns, three of which are foreign keys for the other three tables. The fourth column has data.

My question is that is this a proper design to have data in a join table(my fourth table).
Or should i create a primary key for the fourth table and make another table that uses this new primary key as a foreign key and then store the data in that table.

Kindly help.

Thanks in advance.
 
author & internet detective
Posts: 42027
916
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ryan,
There's no right or wrong to this. I think it depends on what the data is. If it is a large file, I would put it elsewhere. If it regular data (varchar, number, etc), I would leave it in the join table.
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ryan,

As you know that any software, application evolve over a period of time and i am sure your application would be no way different. I would suggest to have a primary key (a sequence) in the fourth table as well. But you need not access it based on the primary key for the current requirement but it would be helpful in the future. So my suggestion would be to have PK as well.


Thanks,
Pradeep
 
Politics is a circus designed to distract you from what is really going on. So is this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic