473,320 Members | 2,110 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Two tables and two relations problem

There are two tables, Pupils and Class:

Pupils
Pupil_Id (primary)
Class_Id (foreign) - Id of a class a pupil belongs to (many pupils
may belong to a class).
...

Class
Class_Id (primary)
Pupil_Id (foreign) - Id of a pupil (a kind of a class-chief, this
is one-to-one relation).
...

So two tables are related in two ways: one-to-many and one-to-one. Is
it OK? What problems may occur? What database purists say?

Thank you in advance.
Regards

Marek Kotowski
Warsaw
Jul 20 '05 #1
3 1384
"Marek Kotowski" <Ma************@wsip.com.pl> wrote in message
There are two tables, Pupils and Class:

Pupils
Pupil_Id (primary)
Class_Id (foreign) - Id of a class a pupil belongs to (many pupils
may belong to a class).
...

Class
Class_Id (primary)
Pupil_Id (foreign) - Id of a pupil (a kind of a class-chief, this
is one-to-one relation).
...

So two tables are related in two ways: one-to-many and one-to-one. Is
it OK? What problems may occur? What database purists say?


Your design is fine. Specific problems may occur depending on what you want
to do with your tables, but in general I don't see any problems. Only
suggestion I have is to rename Class.Pupil_Id to Class.Primary_Pupil_Id or
Class.Main_Pupil_Id or something like.

Now there is one question. Can't pupils take multiple classes? Your design
only allows one pupil to take one class.
Jul 20 '05 #2
"Siemel Naran" <Si*********@REMOVE.att.net> wrote in message news:<Ec********************@bgtnsc05-news.ops.worldnet.att.net>...

Now there is one question. Can't pupils take multiple classes? Your design
only allows one pupil to take one class.


Thank you for your opinion.
One pupil belong to one class. This is a school model,
not - for example - courses model where one student may
take many courses in the same time.

Regards

Marek Kotowski
Warsaw
Jul 20 '05 #3
"Marek Kotowski" <Ma************@wsip.com.pl> wrote in message
"Siemel Naran" <Si*********@REMOVE.att.net> wrote in message

news:<Ec0vc.18256
Now there is one question. Can't pupils take multiple classes? Your design only allows one pupil to take one class.


Thank you for your opinion.
One pupil belong to one class. This is a school model,
not - for example - courses model where one student may
take many courses in the same time.


OK, got it. Like in kindergarten and elementary school, just one class.
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Swaq | last post by:
Or, at least, I find it complicated :-) Hopefully it is not that hard but here goes: I have two tables: Persons and Relations Persons contain personal data such as person_ID, name, adresse,...
0
by: Raed Sawalha | last post by:
I have the following code where Build the relation on DataSet Schema I got the error that Child Has Multiple Tables DataTable LoData = new DataTable("LearningOutcomesDT"); DataTable LoDocData...
5
by: Krechting | last post by:
Hi All, I have a db with three tables which have a relationship. The problem is that when I add a record to the ForAction table it will automatically add a record to the Originator table but not...
4
by: Joe Van Meer | last post by:
Hi, Is the datalist meant for one table or can I use it to display information from 2 different tables? Or should I be looking at a datagrid instead? I began my code and kinda ran into a snag...
8
by: Jason L James | last post by:
Hi all, does anyone know if I can create a dataview from multiple datatables. My dataset is constructed from four separate tables and then the relationships are added that link the tables...
3
by: Bob | last post by:
I have a dataset with two tables. To make it simple, assume they are: Table_1 with EmployeeID, Name, and ReportsTo fields Table_2 with ManagerID and Name fields A data relation is set up...
2
by: yuanh23 | last post by:
Hi, I have 3 talbes "customers","orders","details". i wanna to use 3 datagrids to show those tables. and when the selected row in parent talbe changes, the selected row in child table changes...
2
by: Henrik | last post by:
Hi, I'm really stuck with this one. I have a dataset with two tables. One table is company data, and the other is contacts. I populate these by using a SP in SQL Server which returns the two...
5
by: Ron | last post by:
Hi All, Development stage of setting up a new solution here. I CONSTANTLY have to unhook the relationships I've built via the Relationships tab on Tools, then change the Required element of a...
11
by: shriil | last post by:
Hi I have this database that calculates and stores the incentive amount earned by employees of a particular department. Each record is entered by entering the Date, Shift (morn, eve, or night)...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.