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 7181999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:40:32+00:00 2026-05-28T17:40:32+00:00

Some background I have a set of data that represents the alchemy ingredients and

  • 0

Some background I have a set of data that represents the alchemy ingredients and their effects from Skyrim. If you’re unfamiliar with this you can combine 2-4 ingredients to make a potion. Each ingredient has 4 effects. If any effects between ingredients are the same it will make that type of potion. I’ve identified this as a many-to-many relationship and I set up my tables like so:

ingredients: ing_id (key), ing_name, (other supplemental info)

effects: eff_id (key), eff_name

ing_eff_xref: eff_id, ing_id

I would like to input 2 or more available ingredients and return possible combinations without knowing what the effects are. My sql experience is pretty much limited to phpmyadmin and simple select queries. I guess my questions are: is this the right way to structure the tables for this type of relationship, do I need to set foreign keys if I don’t plan on updating the tables, and is there a query that can take a set of ing_names and return only eff_names that intersect?

Here is the mysqldump of the db if anyone is interested: http://dl.dropbox.com/u/59699040/alchemy_db.sql

  • 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-05-28T17:40:33+00:00Added an answer on May 28, 2026 at 5:40 pm

    is this the right way to structure the tables for this type of relationship?

    Yes, but then you don’t need to have effect1 through effect4 on the ingredient table.

    do I need to set foreign keys if I don’t plan on updating the tables?

    Yes. The only way for you to get the data that you’re after is by JOINing three tables together. Without foreign keys (or more specifically, appropriate indexes), that may not perform well on queries. Of course you do have a small number of rows overall, but using foreign keys is a good practice to follow in this type of scenario.

    is there a query that can take a set of ing_names and return only
    eff_names that intersect?

    I think you’re after something like this:

    SELECT e.eff_name
    FROM ingredients i
    INNER JOIN ing_eff_xref ie ON ie.ing_id = i.ing_id
    INNER JOIN effects e ON e.eff_id = ie.eff_id
    WHERE i.ing_name = 'Abecean Longfin ';
    

    If you need to see effects for multiple ingredients, you could adjust your WHERE clause, like this:

    WHERE i.ing_name IN ('Abecean Longfin ','Eye of Sabre Cat ','Bear Claws ');
    

    You’ll probably not want duplicate effects, so you could do a SELECT DISTINCT to eliminate those.

    Can potion effects stack in Skyrim? If they in can stack, then you can do a GROUP BY query with a COUNT to get the stacked value of each effect:

    SELECT e.eff_name, count(*) as value
    FROM ingredients i
    INNER JOIN ing_eff_xref ie ON ie.ing_id = i.ing_id
    INNER JOIN effects e ON e.eff_id = ie.eff_id
    WHERE i.ing_name IN ('Eye of Sabre Cat ','Bear Claws ')
    GROUP BY e.eff_name;
    

    This query will list 6 effects with a value of 1, and “Restore Stamina” will have a value of 2. Not sure if Skyrim potions work this way or not, but it was just an extra thought.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a form set up that passes some data to a php
I have one AlertDialog which is working fine.I have set some background images to
I have a page where the background colour can be set dynamically. In some
Some background: we have a windows application (c#) that locate in the system try.
I have a modeled a set of objects that correspond with some real world
I'm working on a .NET component that gets a set of data from the
in my android application i have created Background thread to load data from the
Background Information I have a distributed processing application that does data analysis. It is
I have a rake task that populates some initial data in my rails app.
I have a WPF data trigger that is set to fire when a value

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.