Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2012
    Posts
    2

    Unanswered: help with creating table in sql

    I am having trouble creating my last table for a project.

    I have a table named "Payment".
    I have a composite key (ebay_ID & Cellphone_ID).

    Would eBay_ID & cellphone_id also be foreign keys since they are the PK of their own table?

    I also have an entity called "CC#" and "payment_amt".
    For example there is a buyer who purchased 3 diff items, so the ebay_id would be the same and so would the cc#.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by hbsluna8 View Post
    Would eBay_ID & cellphone_id also be foreign keys since they are the PK of their own table?
    yes

    Quote Originally Posted by hbsluna8 View Post
    I also have an entity called "CC#" and "payment_amt".
    For example there is a buyer who purchased 3 diff items, so the ebay_id would be the same and so would the cc#.
    this makes no sense, sorry

    why would you have an entity for a credit card number?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Apr 2012
    Posts
    2
    theres a customer table(pk is ebay_id) and a cellphone table (pk cellphone_id). there is also a payment table.

    so the payment table records the customer who purchases a phone(ebay_id) and the cellphone_id, the cc# they used and the amount of the purchase.

    i want the primary key to be composite because the buyer might buy more than one phone, so it needs the cellphone_Id to be unique. and i have the cc# on there just to have more data when i run queries.

    does that make sense?

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    it does now... when credit card number is an attribute, not an entity like you said earlier
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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