aspose file tools
The moose likes JDBC and the fly likes Database Design issue Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "Database Design issue" Watch "Database Design issue" New topic
Author

Database Design issue

ryan sukale
Ranch Hand

Joined: Aug 11, 2007
Posts: 53
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.


SCJP 5.0, SCWCD 5.0, SCBCD 5.0
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 26173
    
  66

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Pradeep Arun
Greenhorn

Joined: Dec 28, 2007
Posts: 19
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
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Database Design issue
 
Similar Threads
OneToMany Unidirectional strange behavior ?
EJB Using the Oracle Database
J2EE Design Question -- Am I On The Right Track?
Multiple Tables In the Database -- Use Multiple Entity Beans?
can i use one entity bean to access more than one tables