Read a JSONB property

Take your time, follow the code and check your understanding.

The codePostgreSQL queries
SELECT metadata->>'color' AS color
FROM products WHERE id = 1;
Your answer4 min · no timer
What will the code print?

Show solution and explanation

The ->> operator extracts a JSON property as text. The -> operator retains a JSON value.

A text value such as green.