【问题标题】:Using the Where statement in SQL在 SQL 中使用 Where 语句
【发布时间】:2013-03-26 16:09:21
【问题描述】:

如果 ingrDesc 是“cumin”,我如何选择 idR 和 recipeTitle 这就是我所拥有的:

  • 食谱 =(idR、recipeTitle、prepText、美食类型、餐食类型)
  • 成分 = (idI, ingrDesc)
  • RecipIngr = (idR*, idI*)

    SELECT idR, recipeTitle 
    FROM Recipe
    JOIN Ingredient
    WHERE ingrDesc='cumin'
    

【问题讨论】:

    标签: select join where


    【解决方案1】:

    在不知道您的表结构的情况下,任何猜测都会有些随机。这是一个随机的猜测。我猜成分有一个与食谱相关的外键。我将把那个键称为RecipeId。

    SELECT idR, recipeTitle 
    FROM Recipe r
    INNER JOIN Ingredient i
    ON r.idR = i.RecipeId
    WHERE ingrDesc='cumin'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-10-16
      • 2017-01-27
      • 1970-01-01
      • 2018-07-23
      • 1970-01-01
      • 2021-11-12
      • 1970-01-01
      相关资源
      最近更新 更多