add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
select version();
version()
8.0.36
create table superheroes (
name varchar(32),
attributes JSON
);
insert into superheroes
values ('Batman', '{"dead": "false", "orphan": true, "billionaire": "true", "goodboy" : "true"}');
insert into superheroes
values ('Batman', '{"dead": "false", "orphan": "false", "billionaire": "true", "goodboy" : "true"}');
SELECT JSON_SEARCH((CASE WHEN JSON_CONTAINS(attributes, 'true', '$.orphan') =1 then JSON_REPLACE(attributes,'$.orphan',"true") else attributes end), 'all', 'true') as myJSON
FROM superheroes
WHERE name = 'Batman';

myJSON
["$.orphan", "$.goodboy", "$.billionaire"]
["$.goodboy", "$.billionaire"]