Last active
April 4, 2020 20:38
-
-
Save dperrera/eeca5173fb14e0a4df61d5760609c9b5 to your computer and use it in GitHub Desktop.
Query JSONB column in Postgres
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Selects all from recipe table where the ingredients of a recipe | |
-- has a name that includes potato (case insensitive) | |
SELECT * | |
FROM recipe, jsonb_array_elements(recipe.ingredients) ingredient | |
WHERE ingredient->>'name' ILIKE 'PoTaTo' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment