Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9117469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:54:11+00:00 2026-06-17T04:54:11+00:00

Is it possible to combine 2 primary keys from 2 different table into 1

  • 0

Is it possible to combine 2 primary keys from 2 different table into 1 foreign key in another table? I have a table named product_food with food_id as primary key and product_drinks with drink_id as primary key and then I want to combine food_id and drink_id as a foreign key in my orders table as product_ID? Is that possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T04:54:12+00:00Added an answer on June 17, 2026 at 4:54 am

    There’s many ways you can solve it, from the top of my head:

    1. You get foods and drinks in the same table, using the same id, they may use different fields.
    2. You make a table products with unique ids and make foods and drinks have a product id.
    3. Make nullable foreign keys food_id, drink_id on the orders table and possibly add another field indicating which one are you gonna use.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Combine Multiple child rows into one row MYSQL I have following table,
Possible Duplicate: Combine two Arrays into Hash I have an model which stores key
Possible Duplicate: Combine two Images into one new Image I have a c# code
Possible Duplicate: Combine multiple Collections into a single logical Collection? I have a lot
Is it possible to combine two wav files into one as if they've been
Is it possible to combine registers in vim? For example, if I have registers
Also is it possible to combine this with removing periods from within the string?
Is it possible to combine Underscore's filter and map? I currently have two separate
I'm using SQLite. I have two tables: Log: pid INTEGER PRIMARY KEY AUTOINCREMENT action
Is it possible to combine this whole definition into one declaration instead of breaking

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.