SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    ********* Genius Mike's Avatar
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    5,458
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    MySQL Table layout

    I am new to designing databases, so I need help with some tables.

    OK, for my new site, which will be a type of directory, I am collecting the following info:

    Company Name, URL, Description, Contact Name, Contact EMail, Catagory, Price, Username, Password, Expire Date, and their Logo (which is uploaded)

    My original idea for tables is this:

    |------------------------------------------------|
    | Hosts
    |------------------------------------------------|
    |ID|CName|URL|Description|Price|Logo|Expire|ConID|
    |------------------------------------------------|

    |-----------------|
    | ConInfo
    |-----------------|
    |ID|Name|Email|PID|
    |-----------------|

    |-----------|
    | Relate
    |-----------|
    |HID | CatID|
    |-----------|

    |-----------|
    |Catagories|
    |-----------|
    | ID | Name |
    |-----------|


    |-----------------|
    | Users
    |-----------------|
    |ID|Username|Pword|
    |-----------------|


    So is there anything I should change? Any tables which could be combined?

    I can give you more info about each colom if you need it. Thanks.
    Mike
    It's not who I am underneath, but what I do that defines me.

  2. #2
    SitePoint Wizard samsm's Avatar
    Join Date
    Nov 2001
    Location
    Atlanta, GA, USA
    Posts
    5,011
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm no database expert but...

    I think everything looks good and nothing nessesarily needs or should be combined.

    However... if you are only going to have one contact for each host (and one host for each contact) then you could combine hosts and contacts.

    If you were to allow for more than one contact for each host, then you'd need a separate contact-host lookup table. (which would also mean that you might want to rename your "relate" table so that it has a more meaningful name).

    Just some thoughts .
    Using your unpaid time to add free content to SitePoint Pty Ltd's portfolio?

  3. #3
    ********* Genius Mike's Avatar
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    5,458
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    ok, I think I'll combine the hosts and contact table. Thanks!
    Mike
    It's not who I am underneath, but what I do that defines me.

  4. #4
    What? Maelstrom's Avatar
    Join Date
    Oct 2001
    Location
    Whistler BC originally from Guelph Ontario
    Posts
    2,175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would tend to agree. Although for extensiblities sake I would leave them seperate. That way if it ever comes up where you need multiple contacts

    1 - billing
    2 - support
    3 - your best friend

    Having the extra table already built in removes the need to hack at it later
    Maelstrom Personal - Apparition Visions
    Development - PhP || Mysql || Zend || Devshed
    Unix - FreeBSD || FreeBsdForums || Man Pages
    They made me a sitepoint Mentor - Feel free to PM me or Email me and I will see if I can help.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •