sql >> Base de Datos >  >> RDS >> PostgreSQL

Ejecutar Consulta basada en el JSON que se almacenó dentro de la columna

Use ->> operador :

-- Example data
create table test (id int, js jsonb);
insert into test values 
(1, '{"a":"1","b":"2","c":"3"}'),
(2, '{"a":"1","b":"2","c":"4"}');

--query
select * 
from test
where js->>'c' = '3';

 id |               js               
----+--------------------------------
  1 | {"a": "1", "b": "2", "c": "3"}
(1 row)