Hi amazing list,

what would be the best way to answer these, given `CREATE TABLE foo(id
TEXT, json JSON);` and json is always a json object:

   - all rows with a given key bar
      - SELECT * FROM foo WHERE json_extract(json, '$.bar') IS NOT NULL;
   - all rows where there are only any of the given keys a,b in the object
      - SELECT * FROM foo WHERE json_remove(json,'$.a','$.b') ='{}';
   - all rows where there are all the given keys a,b and no others in the
   object
      - SELECT * FROM foo WHERE json_remove(json,'$.a','$.b') ='{}' and
      json_extract(json, '$.a') IS NOT NULL and json_extract(json,
'$.b') IS NOT
      NULL;

these queries seem pretty onerous to me, I hope there are better ways…

Wout.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to