473,473 Members | 1,642 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Relational database design

Hi all,

This is a very stupid question, but it has been years since i've
touched databases so any help will be very appreciated.

I am designing a school registration database which also serves as an
analysis application for an LEA or something.

Im trying to get my head round the design and it really annoying me!!
lol

Let us say we have an LEA Employee table with a foreign key LEA_id that
links to the LEA table, which has a foreign key itself of school_id
from a school table.

If I want to have a LEA form with employee's subform so I can fill
employee details based on the LEA they are allocated to, how would I do
this? It is saying that I need to fill in the School_id, which is
correct, but I dont want it to yet.

Many thanks for helping a idiot out!

Feb 21 '06 #1
7 1698
If I want to have a LEA form with employee's subform so I can fill
employee details based on the LEA they are allocated to, how would I do
this? It is saying that I need to fill in the School_id, which is
correct, but I dont want it to yet.


If the employee is the child record of school and this is declared as a
foreign key relationship then the school_ID MUST exist in each employee
record. This is probably the error message that you are getting.

You can solve this problem quite nicely by creating a 'pseudo entry' in
the school table, maybe called 'not yet allocated'. Normally I use the
ID of '1'. Then you can set the default in the school_ID field in
employee table to '1' and then each new employee will happily be
allocated to this pseudo entry. Then in the school navigation screen
you can go to the school 'not yet allocated' and assign your employees
to schools.

Give it a try :-)

Cheers,
Alan.
Feb 21 '06 #2
Hi.

Thanks for you post.

Sorry I didnt explain it well. I have people that will be related to a
specific school, such as adminstrators, teachers and student. However
LEA Employees will not be related to a school, they should only be
related to an LEA, for which a number of schools is managed by.

Regards
Shaz

Feb 21 '06 #3
Hi Shaz,
Sorry I didnt explain it well. I have people that will be related to a
specific school, such as adminstrators, teachers and student. However
LEA Employees will not be related to a school, they should only be
related to an LEA, for which a number of schools is managed by.


This makes it a bit more tricky. I would, however, still recommend
staying with the 'pseudo entry' idea:

You could maybe have one 'pseudo-school' for each LEA with each pseudo
school being entitled 'Direct link to LEA xyz'. Then the pseudo-school
would have the same foreign key structure as normal schools thereby
linking it to a specific LEA.

In this way, you can set up full, stable relational integrity
constraints and create one set of reporting. Indeed, in the reporting,
the titles given to the 'pseudo-schools' would appear when reporting
employees linked directly to LEAs, which, in turn, would appear
alongside staff working for specific schools. This could save you a lot
of headaches!

What do you think of this idea?

I wish you well with your development and am sure it will work out.

Cheers,
Alan.
Feb 21 '06 #4
Hi Alan,

If I understand you correctly you are refering to the 'default value'
attribute when designing the table in access.

This idea sounds good, but I think for a test environment only.

As I said, I havent touched DB's in years - Im actually going to
(hopefully) implement it in Oracle but as I wanted to get back into
DB's thought at having a go in access first and if possible migrating
it over.

Feb 21 '06 #5
Hi Shaz,
If I understand you correctly you are refering to the 'default value'
attribute when designing the table in access.
No, not in this case. Here you would select a pseudo-school (i.e. a
link to the LEA) for every employee not directly allocated to a school.
These pseudo-entries would then complete the heirarchy for all staff,
even if they aren't allocated to a school. If you don't do it this way,
then you will need a lot of exception handling, at least two different
sets of reports and setting referential integrity could be tricky (or
impossible).
This idea sounds good, but I think for a test environment only.
:-/ Only test what you are planning to implement: There's no reason to
test anything which is to be thrown away.
As I said, I havent touched DB's in years - Im actually going to
(hopefully) implement it in Oracle but as I wanted to get back into
DB's thought at having a go in access first and if possible migrating
it over.


It makes no difference: A relational structure is a relational
structure. In Access, Oracle or anywhere else. Indeed, Access is the
perfect environment for testing a structure which will later be migrated
to a 'bigger' database.

But I still think you don't understand my suggestion. Here are examples
of the tables ...

LEA
ID LEA
1 LEA1
2 LEA2
3 LEA3

SCHOOL/ESTABLISHMENT
ID SCHOOL LEA (foreign key)
1 SCHOOL1 2
2 SCHOOL2 1
3 SCHOOL3 2
4 LEA1 1 (link to LEA1)
5 LEA2 2 (link to LEA2)
6 LEA3 3 (link to LEA3)

STAFF
ID STAFFMEMBER SCHOOL (foreign key)
1 TEACHER1 2
2 TEACHER2 1
3 EMPLOYEE 5 (this employee is linked to SCHOOL_ID 5 which is
really a link to LEA2)

Do you see what I mean?

If you are not comfortable with this structure, you could try putting
both Schools and LEAs in one table, giving them ESTABLISHMENT_TYPE
categories and then, where required, linking them back on each-other.
That's another way to do it.

Anyway, I wish you all the best with this.

Cheers,
Alan.
Feb 21 '06 #6
Alan

Got it to work!

Yes underatand you at first but I had a think and its done.

Thank you for your helpfulness.

Best Regards,
Shaz

Feb 21 '06 #7
Alan

Got it to work!

Yes I understand you at first but I had a think and its done.

Thank you for your helpfulness.

Best Regards,
Shaz

Feb 21 '06 #8

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

Similar topics

34
by: yensao | last post by:
Hi, I have a hard time to understand difference and similarities between Relational database model and the Object-Oriented model. Can somebody help me with this? Thank you in advance. ...
4
by: S. Cole | last post by:
Hi! I need help with creating a relational database and normalizing it. I've been studying the process of creating a relational database, however I am unsure if I am doing it correctly. Below...
18
by: comcast | last post by:
Hello all, I am developing an interface system for an application I was written. This interface will connect to other system to share information. I would like to use xml and xsl to generically...
49
by: Mike MacSween | last post by:
I frequently hear that there isn't a commercially available dbms that fully implements the relational model. Why not? And which product comes closest. Mike MacSween
3
by: cassandra.flowers | last post by:
I'm designing a database because I have to do it for the preperation work for my A-Level ICT exam. The database is for a building company. It has to store information on building projects...
1
by: Tim Fierro | last post by:
Hello, I have had many years using flat file databases (File Express from way back) but am now at a company where a relational database is needed and would carry us into the future. Since I...
17
by: deko | last post by:
Is there a Pattern or best Practice for getting relational data out of a database and into an object? The object in question has public properties that look like this: _stringName _ArrayList...
5
by: sh | last post by:
I am working on a database project, and I'm trying to think "objectively". Are there any tools that will map my "objects" to relational tables? I'd prefer a freebie, or something faily low-cost to...
7
by: Pradeep | last post by:
Hello, I need to take a set of input tables and create an XML output file. The format of the XML output must be user-definable and must be intuitive enough for non-techies to use. input...
13
by: sulyokpeti | last post by:
I have made a simple python module to handle SQL databases: https://fedorahosted.org/pySQLFace/wiki Its goal to separate relational database stuff (SQL) from algorythmic code (python). A SQLFace...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.