Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
AJ217
Starting Member
3 Posts |
Posted - 2014-05-05 : 13:25:27
|
Hi, why do we need a junction table in a many to many relationship? Why can't everything be in just 2 tables? |
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2014-05-05 : 13:40:14
|
How would you model a many-to-many with two tables? |
 |
|
AJ217
Starting Member
3 Posts |
Posted - 2014-05-05 : 13:53:07
|
if i was describing lets say classes and students where each student can be in more than one class and each class can have multiple students. Or how about just using Table A by itself. I'm sorry, I'm new to SQL.Table AID Student Class 1 Bob math2 Tim math3 Linda english4 Linda scienceTable BID Class10 math11 science12 english |
 |
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2014-05-05 : 14:10:08
|
You can certainly model a one to many with one table, but I wouldn't do it for a number of reasons. The point is that, in general, normalization is a good thing. If you don't use a junction table, then your leaving you data less normalized. If you are not familiar with normalization, then you should look it up! That is one of the fundamental foundations of relational theory. :) |
 |
|
AJ217
Starting Member
3 Posts |
Posted - 2014-05-05 : 15:16:52
|
Ok yeah I'll have to look up normalization with respect to relational theory. Thank you so much. |
 |
|
|
|
|