add information to the database

Asked

Viewed 124 times

0

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

for example, add mai an ingredient in lasagna, and 2 more in macaroni.

1 answer

0


You can Add the ingredients using the UPDATE, for example:

UPDATE SUA_TABELA
SET INGREDIENTES = INGREDIENTES + ', novoIngrediente'

Suppose you want to add cheese to the lasagna plate:

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 |

Browser other questions tagged

You are not signed in. Login or sign up in order to post.