JSON_REMOVE
Applies to ✅ Open Source Edition ✅ Express Edition ✅ Professional Edition ✅ Enterprise Edition
The MySQL style JSON_REMOVE
function is a function that removes a value from a JSON document, given a JSON path.
SELECT JSON_REMOVE('{"a":1}', '$.a'), JSON_REMOVE('{"a":1}', '$.b')
create.select( jsonRemove(val(json("{\"a\":1}")), "$.a"), jsonRemove(val(json("{\"a\":1}")), "$.b")).fetch();
The result would look like this:
+-------------+-------------+ | json_remove | json_remove | +-------------+-------------+ | {} | {"a":1} | +-------------+-------------+
Dialect support
This example using jOOQ:
jsonRemove(val(json("{\"a\":1}")), "$.a")
Translates to the following dialect specific expressions:
BigQuery, MariaDB, MySQL, SQLite
json_remove('{"a":1}', '$.a')
Oracle
json_transform('{"a":1}', REMOVE '$.a')
SQLServer
json_modify('{"a":1}', '$.a', NULL)
ASE, Access, Aurora MySQL, Aurora Postgres, ClickHouse, CockroachDB, DB2, Derby, DuckDB, Exasol, Firebird, H2, HSQLDB, Hana, Informix, MemSQL, Postgres, Redshift, SQLDataWarehouse, Snowflake, Sybase, Teradata, Trino, Vertica, YugabyteDB
/* UNSUPPORTED */
Generated with jOOQ 3.20. Translate your own SQL on our website
Feedback
Do you have any feedback about this page? We'd love to hear it!