Here are the tables that store information about website users, mainly customers, their accounts, login keys, group affiliations, discounts, primary addresses and shipping addresses.
One thing I wasn't sure about was whether or not to store discount information in the users table in addition to the customerGroups table as I have done here. An individual user may have his own discount details. Lets say we want to compensate him
for a late delivery by giving him a 15% discount for one month. Or should I make another table, "discounts" where I define properties of discounts which can be used for individuals or groups.
As I write this question the issues are already becoming a bit more clear to me. But I culd still use some input.
Suggestions welcome!
users
--------------
userID pk
userNameFirst
userNameMiddle
userNameLast
userEmail
userPassword
usePhoneAreaCode
userPhone
userPhoneCell
administrator
userDiscountPCT
userDiscountStartDate
userDiscountExpireDate
customerGroupID fk
accounts
--------------
accountID pk
userID fk
CCType
CCNumber
CCDateExpires
accountDateEntered
valid
addresses
--------------
addressID pk
recipientFullName where null, listing represents a primary address, the one given
along with credit card account information. For this Address,
the name was written to the name fields in the related users field.
pob
street
city
state
zip
country
userID fk
customerGroups
--------------
customerGroupID pk
customerGroupName
customerGroupDescription
CGDiscountPCT
CGDiscountStartDate
CGDiscountExpireDate
customerGroupSponserID fk from userID
books/cutomerGroups
--------------
bookID
customerGroupID
books
--------------
bookID pk
bookTitle
bookSubtitle
bookDescription
bookImagefile
publisherId fk
publishDate
pageVisits
----------
pageVisitID
bookID
userID
IP
browser
visitDateEntered
One thing I wasn't sure about was whether or not to store discount information in the users table in addition to the customerGroups table as I have done here. An individual user may have his own discount details. Lets say we want to compensate him
for a late delivery by giving him a 15% discount for one month. Or should I make another table, "discounts" where I define properties of discounts which can be used for individuals or groups.
As I write this question the issues are already becoming a bit more clear to me. But I culd still use some input.
Suggestions welcome!
users
--------------
userID pk
userNameFirst
userNameMiddle
userNameLast
userEmail
userPassword
usePhoneAreaCode
userPhone
userPhoneCell
administrator
userDiscountPCT
userDiscountStartDate
userDiscountExpireDate
customerGroupID fk
accounts
--------------
accountID pk
userID fk
CCType
CCNumber
CCDateExpires
accountDateEntered
valid
addresses
--------------
addressID pk
recipientFullName where null, listing represents a primary address, the one given
along with credit card account information. For this Address,
the name was written to the name fields in the related users field.
pob
street
city
state
zip
country
userID fk
customerGroups
--------------
customerGroupID pk
customerGroupName
customerGroupDescription
CGDiscountPCT
CGDiscountStartDate
CGDiscountExpireDate
customerGroupSponserID fk from userID
books/cutomerGroups
--------------
bookID
customerGroupID
books
--------------
bookID pk
bookTitle
bookSubtitle
bookDescription
bookImagefile
publisherId fk
publishDate
pageVisits
----------
pageVisitID
bookID
userID
IP
browser
visitDateEntered