SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jun 2002
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Database design question

    Hi everyone,

    I've made the effort to read thru some of the threads so that I don't duplicate them but I can't find anything, so here goes.

    I'm kinda new at this, so be gentle .

    I'm building a database driven site using ASP (no lectures from MS haters, cos I'm trying to learn other stuff too) and I'm using Access.

    OK, I'm trying to build a database with information of companies from different countries. Each company profile would consist of the basics. Name, address & contact no. Then there's other stuff about them. I was thinking of creating seperate tables for them as there would be too many fields/colums if I dumped everything in a single table.

    Now my question is, do I create these tables for EVERY country in one db (too many tables in one db). Or is it better to create A db for each country (too many dbs).

    I hope my question is clear & someone's able to give me an appopriate answer. Remember I'm not a pro like most of you guys (& gals). So take it easy. Thanks in advance.

  2. #2
    SitePoint Zealot akohl's Avatar
    Join Date
    Jun 2001
    Location
    Israel
    Posts
    184
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I think you should create two tables:

    companies
    ---------
    companyID -primary key
    countryID -foreign key
    name
    address
    website
    lots of other relevant fields....

    countries
    --------
    countryID -primary key
    president
    yearly rainfall
    military might
    sales tax -yes/no
    lots of other relevant fields

    I'm no expert. So wait for other answers.

  3. #3
    SitePoint Wizard Goof's Avatar
    Join Date
    Feb 2001
    Location
    Pittsburgh, PA
    Posts
    1,154
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Akohl is right. Since each company in the same country will have some common data (data about the country and not about the company), it would probably be best to put the country data in one table, then the company data in another table. Simply assign a country id to each company and you can keep track of the country data that goes along with that company record.

    I can't really think of any good reason to put each company or country in it's own table (unless the information you wanted to store for each one was that different - which kinda defeats the purpose of using a database). Sounds like you've got a winner!

    Hope that helps,
    Goof
    Nathan Rutman
    A slightly offbeat creative.


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
  •