Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Simple Question about One-To-Many Relationship between Student and Country Tables - RDBMS SQL

Posted on 2009-06-29
5
Medium Priority
?
562 Views
Last Modified: 2013-12-19
I got Student table and Country table

Student {StudentID, Name, CountryID}
Country {CountryID, CountryName}

1. This means every student can have several countries while every country can not have several students! I do not get it. Does the above structure mean no two students can have same country name?

Student {StudentID, Name}
Country {CountryID, CountryName, StudentID}

Every country name can have several students a student can not have several countries. Can you explain please...

It's funny that it sounds simple but my mind does not seem having the sense of getting it...weird
0
Comment
Question by:F-J-K
  • 2
  • 2
5 Comments
 
LVL 57

Accepted Solution

by:
Raja Jegan R earned 1920 total points
ID: 24735519
In your example 1, A Student / StudentID can be assigned to a single CountryID.
So a single Country / CountryID can have several students.

In your Example 2, A Country / CountryID can have A single studentID alone.
And A student / StudentID can have several Countries.

And I believe Example 1 is the correct scenario wherein Many students can belong to a single Country.
Hope this helps and revert if I need to explain more.
0
 
LVL 1

Author Comment

by:F-J-K
ID: 24735553
Ok i got a good picture of it. I will leave the question open for a while then close it....Thanks! A+
0
 
LVL 17

Assisted Solution

by:pssandhu
pssandhu earned 80 total points
ID: 24735570
I agree:
I think every country could have multiple students but a student cannot be affiliated with more than one country. Now, the only thing that comes to mind are immgirants who hold dual citizenship. In that case still I think it will be county of their current fulltime residentship.
Also, the first structure you posted looks much better with COUNTRYID as foreign key to the Country table. If you go with the second strucure you will have to update your Country table every time a new student is registered. In wihch case you are going to have the same country's entry logged in more than once and I am assuming CountryID is a primary Key so it won't allow duplicates.
Hope this helps.
P.
0
 
LVL 57

Expert Comment

by:Raja Jegan R
ID: 24735579
Thanks and glad to have helped.
   
0
 
LVL 1

Author Closing Comment

by:F-J-K
ID: 31597877
Thanks
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question