Click here to Skip to main content
15,897,704 members
Home / Discussions / Database
   

Database

 
Questionattach two varbinary Pin
reza assar30-Jan-11 1:37
reza assar30-Jan-11 1:37 
AnswerRe: attach two varbinary Pin
jschell30-Jan-11 9:59
jschell30-Jan-11 9:59 
QuestionLooking For… Top Money To Be Earned-high Volume (SZ-1462) Pin
sohaib zubair29-Jan-11 23:50
sohaib zubair29-Jan-11 23:50 
Questioncan't connect to database sdf (visual studio 2010) Pin
siaswar29-Jan-11 9:26
siaswar29-Jan-11 9:26 
AnswerRe: can't connect to database sdf (visual studio 2010) Pin
dan!sh 29-Jan-11 9:31
professional dan!sh 29-Jan-11 9:31 
AnswerRe: can't connect to database sdf (visual studio 2010) Pin
Eddy Vluggen30-Jan-11 0:39
professionalEddy Vluggen30-Jan-11 0:39 
Questionfilling a M:N table foreign keys Pin
siaswar29-Jan-11 9:07
siaswar29-Jan-11 9:07 
AnswerRe: filling a M:N table foreign keys Pin
jschell29-Jan-11 10:51
jschell29-Jan-11 10:51 
siaswar wrote:
should I fill it (just foreign keys) when filling student table?


Your data model isn't clear.

I will presume that any one book can only be used by one class. Thus one book is associated with only one class. So your tables and fields would look like the following.

class: class_id, class_name
book: book_id, book_name, class_id
student: student_id, student_name

Students takes classes so there must be a way for a student to be associated to a class. So that gives another table.

student_class_link: student_id, class_id

For this table you would populate it as follows.
1. Create classes - fill class table.
2. Assign books to classes - fill in book table and include appropriate class id.
3. Create students - fill student table
4. Assign students to class - fill in student_class_link table. (It is NOT 'automatic' you must add the values.)

If I want to find what books are associated with which student I do NOT need another table. That is because I can use the following relationship to get the books.

student -> student_class_link -> class -> book
GeneralRe: filling a M:N table foreign keys Pin
siaswar29-Jan-11 15:20
siaswar29-Jan-11 15:20 
GeneralRe: filling a M:N table foreign keys Pin
jschell30-Jan-11 9:45
jschell30-Jan-11 9:45 
QuestionData migration from Oracle to SQL server 2005 Pin
vanikanc28-Jan-11 10:36
vanikanc28-Jan-11 10:36 
AnswerRe: Data migration from Oracle to SQL server 2005 Pin
dan!sh 29-Jan-11 9:34
professional dan!sh 29-Jan-11 9:34 
AnswerRe: Data migration from Oracle to SQL server 2005 Pin
jschell29-Jan-11 11:01
jschell29-Jan-11 11:01 
AnswerRe: Data migration from Oracle to SQL server 2005 Pin
scottgp29-Jan-11 12:23
professionalscottgp29-Jan-11 12:23 
GeneralRe: Data migration from Oracle to SQL server 2005 Pin
EralperYilmaz30-Jan-11 3:12
EralperYilmaz30-Jan-11 3:12 
QuestionCan't connect to database file ( mdf ) Pin
Yanshof27-Jan-11 12:14
Yanshof27-Jan-11 12:14 
QuestionMigrating From SQl 2005 to 2008 Pin
#realJSOP27-Jan-11 4:59
professional#realJSOP27-Jan-11 4:59 
AnswerRe: Migrating From SQl 2005 to 2008 PinPopular
leckey27-Jan-11 5:30
leckey27-Jan-11 5:30 
GeneralRe: Migrating From SQl 2005 to 2008 Pin
Corporal Agarn27-Jan-11 6:48
professionalCorporal Agarn27-Jan-11 6:48 
AnswerRe: Migrating From SQl 2005 to 2008 Pin
R. Giskard Reventlov27-Jan-11 9:22
R. Giskard Reventlov27-Jan-11 9:22 
AnswerRe: Migrating From SQl 2005 to 2008 Pin
Mycroft Holmes27-Jan-11 11:47
professionalMycroft Holmes27-Jan-11 11:47 
GeneralRe: Migrating From SQl 2005 to 2008 Pin
EralperYilmaz30-Jan-11 3:09
EralperYilmaz30-Jan-11 3:09 
QuestionRepRbld.exe SQL Server 7 Pin
Sean Cundiff25-Jan-11 9:11
Sean Cundiff25-Jan-11 9:11 
QuestionGetting records from excel into Access??? is it that annoyinnnnnngggg Pin
scorp_scorp24-Jan-11 19:13
scorp_scorp24-Jan-11 19:13 
AnswerRe: Getting records from excel into Access??? is it that annoyinnnnnngggg Pin
Mycroft Holmes24-Jan-11 19:16
professionalMycroft Holmes24-Jan-11 19:16 

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.