Hi, I've been teaching myself how to normalize. I know I still have some things to do (tables for phones), but I'm just wondering if I'm on the right track? Thanks.
How does my 1NF database look so far? I welcome any suggestions. Thank you.
PK Person ID
Person First Name
Person Last Name
Person Street
Person City
Person State
Person Zip Code
Person Country
Person SSN
Person Marital Status
Person DOB
FK Person ID
Phone Numbers
Type
FK Person ID
PK Spouse ID
Spouse First Name
Spouse Last Name
Spouse Street
Spouse City
Spouse State
Spouse Zip Code
Spouse Country
Spouse SSN
Spouse DOB
Spouse Marital Status
PK Person ID
PK Spouse ID
Child ID
Child First Name
Child Last Name
Child Street
Child City
Child State
Child Zip Code
Child Country
Child SSN
Child DOB
Child Marital Status
FK Person ID
Vehicle Make
Vehicle Model
Vehicle Year
Vehicle Color
Vehicle Mileage
Vehicle Body Type
PK Vehicle ID
PK Vehicle ID
Vehicle Repair Date
Vehicle Repair Description
Vehicle Repair Cost
PK Vehicle Repair ID
PK Vehicle Repair ID
Vehicle Repair Shop Name
Vehicle Repair Shop Street
Vehicle Repair Shop City
Vehicle Repair Shop State
Vehicle Repair Shop Zip Code
Vehicle Repair Shop Country
FK Repair Shop ID
PK Repair Shop ID
Repair Shop Phone Numbers
Repair Shop Owner First Name
Repair Shop Owner Last Name
Repair Shop Owner Street
Repair Shop Owner City
Repair Shop Owner State
Repair Shop Owner Zip Code
Repair Shop Owner Country
Repair Shop Owner Phone Numbers
Without wishing to be rude you asked how it looks - horrible - I jest.
I good guide to normalisation is to see how often the same piece of data is going to appear. So for example addresses are going to be duplicated, triplicated etc. depending on the size of the family.
A second point is that a table should roughly contain information of a similar type, so with with your persons table, names, age, sex, hair colour, marital status all apply to a person. These items are "locked" to that person. Their address changes when they move home.
So a simple example: In the case of your families, I'm guessing that many of the children live at the same address as the parents, so the address only needs to be entered once.
Now do we need a complete address? How often does the same City appear in the addresses? Once you have defined a City, you know what State it is in.
The remarks about addresses apply equally to the repair shops.
So to give you a start:
TblStates
StateID PK
State No duplicates
TblCities
CityID PK
City
StateID FK
TblAddress
AddressID PK
AddressLine1
AddressLine2
AddressLine3
CityID FK
So at this point, once you have entered the city, the state comes up automatically.
TblStatus
StatusID PK
Status (No duplicates) - Head, Spouse, Son, Daughter, Granny etc.
TblPerson
PersonID PK
PersonFirstName
PersonLastName
PersonMaritalStatus
PersonDOB
StatusID Fk
PersonHeadID FK
AddressID FK
So here's the critical bit. If you set PersonHeadID = PersonID, then that is equivalent to your Person Table. Let's be terribly politically incorrect and call this person the "Head of House"
Your Spouse and Children tables just set the PersonHeadID = PersonID (of the Head of House). The StatusID defines what relationship that person has to the "Head of House"
One further point. I strongly advise you not to have spaces in field names. If you do, you will always have to put square brackets[] round them, as Access has no way of knowing when a field name ends. so [Person First Name]
Alternatives are
Person_First_Name
or PersonFirstName.
I personally prefer the latter.
Hopes this gets you stated
Phil
5 967
Without wishing to be rude you asked how it looks - horrible - I jest.
I good guide to normalisation is to see how often the same piece of data is going to appear. So for example addresses are going to be duplicated, triplicated etc. depending on the size of the family.
A second point is that a table should roughly contain information of a similar type, so with with your persons table, names, age, sex, hair colour, marital status all apply to a person. These items are "locked" to that person. Their address changes when they move home.
So a simple example: In the case of your families, I'm guessing that many of the children live at the same address as the parents, so the address only needs to be entered once.
Now do we need a complete address? How often does the same City appear in the addresses? Once you have defined a City, you know what State it is in.
The remarks about addresses apply equally to the repair shops.
So to give you a start:
TblStates
StateID PK
State No duplicates
TblCities
CityID PK
City
StateID FK
TblAddress
AddressID PK
AddressLine1
AddressLine2
AddressLine3
CityID FK
So at this point, once you have entered the city, the state comes up automatically.
TblStatus
StatusID PK
Status (No duplicates) - Head, Spouse, Son, Daughter, Granny etc.
TblPerson
PersonID PK
PersonFirstName
PersonLastName
PersonMaritalStatus
PersonDOB
StatusID Fk
PersonHeadID FK
AddressID FK
So here's the critical bit. If you set PersonHeadID = PersonID, then that is equivalent to your Person Table. Let's be terribly politically incorrect and call this person the "Head of House"
Your Spouse and Children tables just set the PersonHeadID = PersonID (of the Head of House). The StatusID defines what relationship that person has to the "Head of House"
One further point. I strongly advise you not to have spaces in field names. If you do, you will always have to put square brackets[] round them, as Access has no way of knowing when a field name ends. so [Person First Name]
Alternatives are
Person_First_Name
or PersonFirstName.
I personally prefer the latter.
Hopes this gets you stated
Phil
As Phil and zmbd have metioned, it's much easier to write code without spaces in the field names than with spaces in the field names.
I would merge Person and Spouse tables into the same table and add a Foreign key for Spouse that links back to the same table. Depending on your needs you may need to add a Type field to determine if it is a Spouse or not.
Personally, I would not have a separate PhoneNumber Table. I would create three PhoneNumbers fields in the Person table along with three PhoneType fields and default the PhoneTypes to Cell. This will make entering, displaying, and reporting data much easier as you won't have to Link to an additional table.
Lastly, unless I'm misunderstanding what it is that you are doing, I think the Vehicle, VehicleRepair and RepairShop tables are messed up a bit. I think you will want something like this, where there's a Vehicle Table and a RepairShop Table and then a VehicleRepair Table that links the two tables together: - Vehicle
-
VehicleID (PK)
-
Make
-
Model
-
Year
- RepairShop
-
RepairShopID (PK)
-
ShopName
-
Address1
-
Address2
-
City
-
State
-
ZipCode
- VehicleRepair
-
VehicleRepairID (PK)
-
VehicleID (FK)
-
RepairShopID (FK)
-
RepairDate
-
Description
-
Cost
Sorry to disagree with you, jforbes.
Firstly I think (as indicated) that Person, Spouse & Child table should all be one table. The only difference between the three groups is their status (Head, Spouse, Son, Daughter Grandmother, etc) and who is the head of that group.
Secondly I see no reason for the RepairShop table. It's just an address. You may want a table of -
AddressTypes
-
AddressTypeID
-
AddressType (Main Home, Holiday Home, Repair shop etc)
-
and obviously a suitable FK AddressTypeID in the address table.
This would then give carlpoppa the option to hold multiple addresses for each person using a join table.
Phil
Thanks to everyone for the information. You all have definitely helped me understand this a lot better now.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Steve Bishop |
last post by:
I have an application that uses data access that runs slow the first
time. My first page reads data from an ODBC source and the second page
hits a MSDE database. After each page opens the first...
|
by: TB |
last post by:
Hi all:
If you think that the following comments are absolute amateurish, then
please bear with me, or simply skip this thread.
A couple of months back I made the decision to initiate a...
|
by: bwhite |
last post by:
I have an access database application that is used to calculate landed
costs for foreign goods imported into vartious countries. I am trying
to determine an approach so that a user will be...
|
by: Massimiliano Campagnoli |
last post by:
I am trying to backup sample database to network drive J:\ which maps
to a SAMBA share.
The first time the backup is successfull but the the next time fails.
I've to delete J:\sample.0 if I want...
|
by: majestic12 |
last post by:
This is the first time I've tried to use mysql/phpmyadmin and I'm having trouble. I'm using a geocites pro account and I got both installed and it set up a database call mysql and the user yroot. ...
|
by: phpmel |
last post by:
Hi again,
I tried this Ajax database thing for the first time and it is not working.
Here is the code
this is testAjax.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
|
by: mrutyunjaya |
last post by:
when i used this code when i running second time from xml file it shows that testdbo.xml used by another user
//StreamWriter xmlDoc = new StreamWriter(Server.MapPath("~/Testdo.xml"), false);
...
|
by: ArizonaJohn |
last post by:
Hello,
On my site, a user enters a value into a form, and if that value is not in my database, the code below is meant to give the user the message "The topic "value" has not been added. Add the...
|
by: KishorDhembare |
last post by:
Hi Everybady
I Want To Create New Database When My Application Starts First Time My Application Developed In Vb.net
I Get The Error When I Run Command which I Have Command Is Like.
Dim...
|
by: dougancil |
last post by:
I'm creating a datatable for the first time and I'm having some difficulties. I have the following code:
Protected Function Dataparse(ByVal Save As String) As String
Dim DataSet ds =...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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...
|
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |