![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Aug 2005
Location: Leeds - UK
Posts: 69
Rep Power: 4
![]() |
help with normalisation of schemas
HI ppl!
I have the schemas below. Any help with normalisation?? Schemas User (userID, fName, sName, access, department) Password( userID, password) Customer (customerID, fName, sName, address) Product (productID, prodDesc, prodName, cost, supplier) User (userID, fName, sName, access, department) Do these make sense???? Thanks in advance |
|
|
|
|
|
#2 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
We don't know what your ultimate goal is, or how that data's related. If you're knew to this sort of thing, you might want to check out entity-relationship diagrams. For sure, I wouldn't have "User" there twice.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#3 |
|
Programmer
Join Date: Aug 2005
Location: Leeds - UK
Posts: 69
Rep Power: 4
![]() |
I've mapped these using entity relationship diagrams. It is possible to normalise data without entity relationship diagrams.
I have normalised the data, but just wanted to check. User shouldnt be there twice. If anyone can look at these schemas and check whether the data is normalised, id be very grateful. |
|
|
|
|
|
#4 | |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Quote:
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
|
#5 |
|
Programmer
Join Date: Aug 2005
Location: Leeds - UK
Posts: 69
Rep Power: 4
![]() |
Hopefully this puts the schemas into context.
Schemas User (userID, fName, sName, access, department, userID, password) Customer (customerID, fName, sName, address) Product (productID, prodDesc, prodName, cost, supplier) Well, the user and the customer are separate. I am developing an online business appliccation. A user is a member of staff for example. He has a department, password, userID etc. One user must create 1..* customers, while a customer must be created by a user. The customer also has customerID, fName etc. The customer then must purchase n products. The products have a unique product ID, product description etc. A product may be purchased by 1..* customers. Thanks in advance |
|
|
|
|
|
#6 |
|
Professional Programmer
|
User (userID, fName, sName, access, department, userID, password)
That's not good .. your copy paste was wrong The addres in customer should be devided in more fields like state, city, street ... etc Should have a table : Purchased (id_purchase, productID, customerID, quantity) Suplier(id_suplier, suplier_name) should be another name Product (productID, prodDesc, prodName, cost, id_suplier) Also : Department( department_id , department_name) and : User (userID, fName, sName, access, department_id ) that's all for now , i think
__________________
Don't take life too seriously, it's not permanent ! |
|
|
|
|
|
#7 | |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Quote:
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
|
#8 |
|
Programmer
Join Date: Aug 2005
Location: Leeds - UK
Posts: 69
Rep Power: 4
![]() |
thanks Xavier, thats really helpful, and my cut and paste did go wrong.
Il give it another go and show my results. Thanks again |
|
|
|
|
|
#9 |
|
Programmer
Join Date: Aug 2005
Location: Leeds - UK
Posts: 69
Rep Power: 4
![]() |
I am new to this.
So help me out? |
|
|
|
|
|
#10 |
|
Programmer
Join Date: Aug 2005
Location: Leeds - UK
Posts: 69
Rep Power: 4
![]() |
Is this any better??
User (userID, fName, sName, access, department) Customer (customerID, fName, sName, address) Product (productID, prodDesc, prodName, cost, supplierID) CustomerAddress (CustomerID, addressLn1, addressLn2, addressLn3, city, county, postcode) Purchase (purchaseID, productID, customerID) productID and customerID are foreign keys. Supplier (supplierID, supName) |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|