   [web] Using XML or MSSQL DB for variable number of fields
  HiI am currently trying to implement my own recipe database and I have a little trouble figuring out what the best approach would be. The problem is that I have an ingredients list which hold a variable number of ingredients, which is easy to do in an XML file, but I dont know how searching this will compare to the speed of a relational DB.So can the variable list be done reasonably in the DB or is an XML file to be considered the best choice? I could probably do it with a string, that would hold all the IDs of the ingredients, and then parse it each time I wanted to use it, but I don't know if that is a good choice.And for informations sake, I am developing a web application with ASP.NET.What do you think?[Edited by - thallish on September 10, 2007 3:55:06 AM]
  In a database, you'd have three tables:RecipeTable: ID, Name, etcIngredientTable: ID, Name, etcRecipeIngredientTable: ID, RecipeID, IngredientID, Amount, etcwhere ID is the unique identifier of the row in the table. The third table is used to link each ingredient to a recipe. You can then set up a SQL query to scan the RecipeIngredientTable for rows where the RecipeID is the recipe your interested in and us a JOIN to merge the RecipeIngredientTable and IngredientTable tables into the search result table. Something like:SELECT * FROM RecipeIngredientTable INNER JOIN IngredientTable ON RecipeIngredientTable.IngredientID = IngredientTable.ID WHERE RecipeID = <the recipe>or something like that.Skizz   ;  Of course. I had not even thought about that relation! Thank you for the input.