SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Guru
    Join Date
    Sep 2008
    Posts
    977
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    db structure question.

    Hi,

    I have a plan for several separate databases. Was thinking that keeping them separate, might be good for if/when someone may want to buy one (but not all). However, for each database, there is one table that would be/is common, in terms of its structure and content. It is called customers.

    what way would you structure such a series of db's?

    1. put them all into one big db
    2. keep them separate and put the customers table into its own space where all dbs can relate to it
    3. a third way

    If you recommend putting them all into one huge db, can you point me to some search terms or tutorials on, for example, 'partitioning databases' or partitioning tables or other potential search terms.

    bazz

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Are these databases for separate sites?

    Will the *data* in the customers table be the same in each database?

    Almost every site with a database has a users table, but we don't have one megadatabase that everyone in the world connects to... need some more details as to why you're asking

  3. #3
    SitePoint Guru
    Join Date
    Sep 2008
    Posts
    977
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's a series of dbs for multiple purposes.

    The users/customer data is common to each db.

    bazz

  4. #4
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,016
    Mentioned
    53 Post(s)
    Tagged
    2 Thread(s)
    i would put the users table wherever convenient

    if customer 1 buys your application X and it requires a users table, and customer 2 buys your application Y and it also requires a users table, the difference in what you give them as far as the SQL is concerned is basically the same

    yes, the queries might have to be tweaked as to whether the users table is in the same database or a separate database, but that's really trivial -- the basic queries will be the same
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  5. #5
    SitePoint Guru
    Join Date
    Sep 2008
    Posts
    977
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the response.

    To make sure I understand:

    If customer A were to buy a book from website 1 and customer B were to buy a shirt from website 2, it's OK to have a 'customer' table outside of both dbs? That would mean 3 dbs.

    Would it be better to have the 3 dbs on the same server or, at least, to have them within the same datacentre?

    bazz


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
  •