Click here to Skip to main content
15,888,521 members
Home / Discussions / Database
   

Database

 
GeneralUrgent Pin
kalikoi4-Apr-05 0:46
kalikoi4-Apr-05 0:46 
GeneralRe: Urgent Pin
WoutL4-Apr-05 0:54
WoutL4-Apr-05 0:54 
Generalconnecting database over internet Pin
Member 4472173-Apr-05 21:02
Member 4472173-Apr-05 21:02 
GeneralRe: connecting database over internet Pin
Colin Angus Mackay3-Apr-05 23:30
Colin Angus Mackay3-Apr-05 23:30 
GeneralMultiple columns Pin
Jaydeanster1-Apr-05 8:00
Jaydeanster1-Apr-05 8:00 
GeneralRe: Multiple columns Pin
Colin Angus Mackay1-Apr-05 8:17
Colin Angus Mackay1-Apr-05 8:17 
GeneralRe: Multiple columns Pin
Jaydeanster1-Apr-05 8:39
Jaydeanster1-Apr-05 8:39 
GeneralRe: Multiple columns Pin
Colin Angus Mackay1-Apr-05 10:06
Colin Angus Mackay1-Apr-05 10:06 
The Trainer table is somewhat denormalised (it partially meets the 3rd normal form criteria) and it would be better if there was a many-to-many join between the Trainer table and the Languages table, and also between the Trainer table and the Products table.

To implement a many-to-many join you add an intermediate table with a compound primary key and two foreign joins. This is actually a lot simpler than it sounds. Simply put the intermediate table contains the primary key from each side of the join, for example the primary key from Trainer (one of the foreign keys) and the primary key from Languages (the other foreign key). All those columns together make up the primary key of the intermediate table so that the only columns in the intermediate table make up the compound primary key.

So, you create two new tables like this
/----------------------\     /---------------------\
| TrainerLanguage      |     | TrainerProduct      |
|----------------------|     |---------------------|
| PK, FK1 | TrainerID  |     | PK, FK1 | TrainerID |
| PK, FK2 | LanguageID |     | PK, FK2 | ProductID |
\----------------------/     \---------------------/
and populate them with the values that were in the Language and Product columns in the Trainer table.

Once you have that set up then your queries can be much simpler and you don't have to worry about nulls and the schema will be much more flexible than it is at the moment.

I don't know your level with databases so I hope that this is not too overwhelming.


My: Blog | Photos | Next SQL Presentation
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More


GeneralWriting data to a dataset Pin
Delo1-Apr-05 7:27
Delo1-Apr-05 7:27 
GeneralRe: Writing data to a dataset Pin
numbrel5-Apr-05 11:01
numbrel5-Apr-05 11:01 
GeneralSelect statments problems Pin
Member 17338781-Apr-05 0:09
Member 17338781-Apr-05 0:09 
GeneralRe: Select statments problems Pin
Colin Angus Mackay1-Apr-05 0:22
Colin Angus Mackay1-Apr-05 0:22 
GeneralRe: Select statments problems Pin
Michael Potter1-Apr-05 4:34
Michael Potter1-Apr-05 4:34 
GeneralRe: Select statments problems Pin
Yulianto.1-Apr-05 17:17
Yulianto.1-Apr-05 17:17 
QuestionAm I missing a header file? Pin
IlanTal31-Mar-05 23:31
IlanTal31-Mar-05 23:31 
AnswerRe: Am I missing a header file? Pin
Colin Angus Mackay1-Apr-05 7:37
Colin Angus Mackay1-Apr-05 7:37 
QuestionHow do I COMMIT an oracle temp table thru ado.net Pin
phil.short31-Mar-05 10:50
phil.short31-Mar-05 10:50 
GeneralSQL challenge Pin
Chris Losinger31-Mar-05 4:04
professionalChris Losinger31-Mar-05 4:04 
GeneralRe: SQL challenge Pin
Colin Angus Mackay31-Mar-05 4:18
Colin Angus Mackay31-Mar-05 4:18 
GeneralRe: SQL challenge Pin
Chris Losinger31-Mar-05 5:15
professionalChris Losinger31-Mar-05 5:15 
Questionparameterized queries? Pin
IlanTal31-Mar-05 3:31
IlanTal31-Mar-05 3:31 
AnswerRe: parameterized queries? Pin
IlanTal31-Mar-05 18:38
IlanTal31-Mar-05 18:38 
GeneralReading BLOB data from database Pin
Member 165844231-Mar-05 1:37
Member 165844231-Mar-05 1:37 
GeneralRe: Reading BLOB data from database Pin
Member 165844211-Apr-05 2:57
Member 165844211-Apr-05 2:57 
QuestionReporting Service - bug with drilldown? Pin
devvvy30-Mar-05 23:56
devvvy30-Mar-05 23:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.