How to make a query in sql to get a field by entering several parameters in the where

0

I'm doing a sql database on foods. The tables I have are meals from the sierra jungle coast and ingredients. And its intermediate tables. What I want to do is a query that allows me to obtain a meal by entering several ingredients in the where. I do not know if my database allows this query.

    
asked by Jean Pierre Acosta Tomaylla 28.10.2018 в 02:28
source

2 answers

0

Try making inner join to the tables involved as follows:

select ingredientes.nombre_ingrediente AS ingredientes from ingredientes 
    inner join comidacosta_ingrediente on ingredientes.id_ingrediente = comidacosta_ingrediente.id_ingrediente
    inner join comidas_de_la_costa on comidacosta_ingrediente.id_costa = comidas_de_la_costa.id_costa  
        WHERE ingredientes.nombre_ingrediente = "cebolla"
        AND ingredientes.nombre_ingrediente = "jitomate"
        AND ingredientes.nombre_ingrediente = "chiles"

Esepro serve you, luck!

    
answered by 28.10.2018 в 16:08
0

if you can but, from my point of view, I think you have to re-formulate the DESIGN: a table is considered when it has more than 3 attributes; in the case of the coast because that belongs to tabla region that has id

select from ingredientes 
inner join comidaselva_ingredientes on ingredientes.id_ingredientes=comidaselva_ingredientes.id_ingredientes 
inner join comidas_de_la_selva on comidaselva_ingredientes.id_selva=comidas_de_la_selva.id_selva
inner join comidacosta_ingredientes on ingredientes.id_ingredientes where ingredientes.nombre_ingrediente = "cebolla"

falteras make a inner join wings other tables of the sierra and the coast

    
answered by 28.10.2018 в 14:22