add information to the database

0

I wanted to know if it is possible to have a list in database, as in java List<> as in the image below, a comida table that may have one or more ingredientes . How can I do this in the database?

For example, add one ingredient in lasagna, and another 2 in pasta.

    
asked by anonymous 23.03.2017 / 23:39

1 answer

0

You can add the ingredients using UPDATE , for example:

UPDATE SUA_TABELA
SET INGREDIENTES = INGREDIENTES + ', novoIngrediente'

Let's suppose you want to add cheese to your Lasagna dish:

UPDATE SUA_TABELA
SET INGREDIENTES = INGREDIENTES + ', queijo' // Aqui você vai concatenar o(s) ingrediente(s) que já tem com o novo
WHERE código_prato = 1

The result would be:

|  1   | lasanha | massa, queijo |
    
27.03.2017 / 14:36