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


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

Posted on 2009-06-29
Medium Priority
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
Question by:F-J-K
  • 2
  • 2
LVL 57

Accepted Solution

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.

Author Comment

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

Assisted Solution

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.
LVL 57

Expert Comment

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

Author Closing Comment

ID: 31597877

Featured Post


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