Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

mysql json query

+----+--------+-------+-------+---------------------------------+
| id | name   | price | stock | attr                            |
+----+--------+-------+-------+---------------------------------+
|  2 | Shirt  | 10.50 |    78 | {"size": 42, "colour": "white"} |
|  3 | Blouse | 17.00 |    15 | {"colour": "white"}             |
+----+--------+-------+-------+---------------------------------+
  
SELECT name FROM clothes WHERE JSON_EXTRACT(attr, '$.size') = 42;
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #mysql #json #query
ADD COMMENT
Topic
Name
9+4 =