Scenario: a restaurant's PostgreSQL DB.
If I have a column called stock (in a table called ingredients) and I have another column called inStock (boolean column in a table called dish) and a dish is only in stock if all the ingredients that are associated with the dish are in stock. To check this I can perform a query.
Would it be possible to do the following: If the result of all the rows returned from the query is != 0 then set the dish's inStock to true else set it to false.
How would I do this?