Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2009
    Location
    San Francisco
    Posts
    1

    Unanswered: Help with a new table design

    Hello friends,

    This is my first post in this forum.
    I am trying to design a table which is intended to hold data related to vendors.
    Every vendor can receive one or more orders. The table should hold vendors along with orders received

    For example:
    Vendor A received 1 order, vendor B received 2 orders and vendor C received 5 orders

    A-->ord1
    B-->ord1, ord2
    C-->ord1, ord2, ord3, ord4, ord5

    What is the best way to design such a table?

    Thanks a bunch in advance
    Yamini

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    The best way is to create two tables: Vendors and Orders:
    Code:
    create table vendors (vendor_id {datatype} primary key, ...);
    
    create table orders
     (order_id {datatype} primary key,
      vendor_id references vendors, 
      ...);

  3. #3
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Talking DB Schema Tutorial

    If you intend to actually learn something and "expand" from your simplistic two-table schema to an actual database model, check out this tutorial.
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

Posting Permissions

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