I am using mysql 5.7.x
I can create a mysql json table
CREATE TABLE t1 (jdoc JSON);
I can insert rows.
INSERT INTO t1 VALUES('{"key1": "value1", "key2": "value2"}');
INSERT INTO t1 VALUES('{"key1": "value11", "key2": "value22"}');
I can also get all rows:
SELECT * from t1;
How do I use a where clause?
select * from t1 where "key1" = "value1"
You can try:
SELECT *
FROM t1
WHERE json_extract(jdoc, '$.key1')='value1'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With