97 remember that I need to make a webshop for school? And that we ended up going to sell magic cards instead of fruit?
Well.... I may be in trouble. Let me explain:
Every card has a cost, consisting of symbols. So, I decided to make a table called Symbols containing the name, the picture and the text representation. So far, so good.
After that, I decided to create a table called Costs. This was so cards could reference this table to say what their cost is. That way its easy to get cards that have a certain cost.
However, as their is no limit of symbols inside a cost, I also created a SymbolsInCosts table. This contains the values CostId and SymbolId and is used to determain which symbols are in a cost.
So, lets say every card that has a manacost of{3}{w}{u}.
The first step is easy. Just look at each symbol inside the symbols table and get their id. Lets say the result is {3} = 1, {w} = 2 and {u} = 3.
Then, I need to look into SymbolsInCosts and get every row where SymbolId is either 1,2 or 3.
Then, I need to look at the costIds returned and filter every row out where not ALL 3 symbols are referenced.
Then, I need to filter every costId out which also has MORE than those 3 symbols.
This.... is a pain to do in SQL, which is kind of what I want to use....
Well.... I may be in trouble. Let me explain:
Every card has a cost, consisting of symbols. So, I decided to make a table called Symbols containing the name, the picture and the text representation. So far, so good.
After that, I decided to create a table called Costs. This was so cards could reference this table to say what their cost is. That way its easy to get cards that have a certain cost.
However, as their is no limit of symbols inside a cost, I also created a SymbolsInCosts table. This contains the values CostId and SymbolId and is used to determain which symbols are in a cost.
So, lets say every card that has a manacost of{3}{w}{u}.
The first step is easy. Just look at each symbol inside the symbols table and get their id. Lets say the result is {3} = 1, {w} = 2 and {u} = 3.
Then, I need to look into SymbolsInCosts and get every row where SymbolId is either 1,2 or 3.
Then, I need to look at the costIds returned and filter every row out where not ALL 3 symbols are referenced.
Then, I need to filter every costId out which also has MORE than those 3 symbols.
This.... is a pain to do in SQL, which is kind of what I want to use....