If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Have I created This databse Correctly

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-24-08, 04:03
SquirrelJ SquirrelJ is offline
Registered User
 
Join Date: Jan 2008
Posts: 1
Have I created This databse Correctly

I have only recently learnt about Normalisation (and I am still unsure about it).

I have had a go at the attached bmp picture.

I was hoping that someone could have a quick look and maybe suggest areas to improve the database and where I have gone wrong so far.

The blue entries indicate what I think are the Primary Keys

Cheers
Attached Images
File Type: bmp untitled.bmp (1.11 MB, 56 views)
Reply With Quote
  #2 (permalink)  
Old 01-24-08, 06:11
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
Company table...
What happens when we reach 2010, are you going to add another column?

No, of course not! You want to move the orders into a separate table! Remember; pretty much anything you can calculate (e.g. sales for a year) should not be stored; it should be calculated when needed.

same goes for logincount -> create a login history table or something to save instances of logins.
__________________
George
Twitter | Blog
Reply With Quote
  #3 (permalink)  
Old 01-24-08, 06:33
Diabolic Diabolic is offline
Registered User
 
Join Date: Jul 2007
Posts: 96
Why use int(100000) for id's and varchar(200) for orders? Any particular reason that I might be missing?

Also keep in mind that one of the purposes of normalization is to avoid data duplication, which in your case is still happening for the currency field (just to give an example).

I strongly suggest that you take a couple of hours to search for normalization articles as well as normal forms, particulary 1NF, 2NF 3NF.

EDIT: I've noticed that your password field is varchar(200). Since a hashed password has a fixed size I supposed that your are not hashing them? Furthermore, you should hash your passwords with a salt value. Please search about how to store passwords.

Last edited by Diabolic; 01-24-08 at 06:43.
Reply With Quote
  #4 (permalink)  
Old 01-24-08, 06:45
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
INT(100000) means show 100000 digit positions

fortunately, only if you're using ZEROFILL

many people think this number in parentheses indicates the range of numbers which the column can hold

but INT(100000) and INT(937) and INT(2) and INTEGER can all hold exactly the same range of numbers
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On