d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Normalization Question
Add Reply New Topic New Poll
Member
Posts: 10,715
Joined: Sep 1 2007
Gold: 11,037.49
Oct 21 2016 01:50pm
Date Time Stylist Customer Phone Email Service Booked Price
10/7/2016 10:00 AM Jill Murphy Sue Jones 5408317238 12323@.com Color 75 mins 86
10/7/2016 10:00 AM Rita Hazan Mary Martin 9198631038 m333n86@l.com Highlights 90 mins 125
10/7/2016 11:30 AM Jill Murphy Sarah Connor 4047501212 sarahcon@.edu Wash & Dry 20 mins 48
10/7/2016 11:50 AM Jill Murphy Sarah Connor 4047501212 sa3con@edu Cut & Style 30 mins 29
10/7/2016 12:15 PM Rita Hazan Mary Martin 5406768801 bmsm@gmail.com Extensions 45 mins 91
10/7/2016 12:30 PM Jill Murphy Mary Martin 9198631038 mman86@gmail.com Cut & Style 30 mins 29
10/8/2016 10:00 AM Rita Hazan Vickie Smith 5407500844 viith@.edu Cut & Style 30 mins 29

I'm taking this data set and normalizing it.


I know what tables I will need to break down the data, but I'm having trouble deciding on how to link each table with the right key... any thoughts on how to approach this?

This post was edited by Zom8 on Oct 21 2016 01:51pm
Member
Posts: 3,386
Joined: May 4 2013
Gold: 1,780.00
Oct 21 2016 02:49pm
stylists
id | name

customers
id | name | phone | email

orders
id | stylist_id | customer_id | date | booked | service | price

stylist_id and customer_id are obviously foreign keys referencing other 2 tables (orders.stylist_id => stylists.id) .

Or you can just literally make a table like you have in post, without any extras. This still works and there is nothing wrong with it. Unless you make user accounts, registration and start processing millions of them ...

This post was edited by nuvo on Oct 21 2016 02:50pm
Member
Posts: 10,715
Joined: Sep 1 2007
Gold: 11,037.49
Oct 21 2016 05:32pm
Quote (nuvo @ Oct 21 2016 03:49pm)
stylists
id | name

customers
id | name | phone | email

orders
id | stylist_id | customer_id | date | booked | service | price

stylist_id and customer_id are obviously foreign keys referencing other 2 tables (orders.stylist_id => stylists.id) .

Or you can just literally make a table like you have in post, without any extras. This still works and there is nothing wrong with it. Unless you make user accounts, registration and start processing millions of them ...



Thanks. The point of this ex cerise was to learn how to fix normal form violations. Without adding the ID what could I use as foreign keys? He said not to add or delete any data. So I assumed I couldn't create IDs
Member
Posts: 3,386
Joined: May 4 2013
Gold: 1,780.00
Oct 22 2016 06:17am
You need unique identifier, and id type serial would be best.
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll