SELECT
id, client_id, service_id,
json_extract(service_values, '$.quota') AS quota,
json_extract(service_values, '$.free_quota') AS free_quota,
json_extract(service_values, '$.total_accounts') AS total_accounts,
json_extract(service_values, '$.data_transfer') AS data_transfer
FROM client_services;
+----+--------+-------+-------+---------------------------------+
| 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;
SELECT json_clmn->'$.property' FROM table
SELECT
ID, CITY,
json_extract(POPULATION_JSON_DATA, '$.male') AS POPL_MALE,
json_extract(POPULATION_JSON_DATA, '$.female') AS POPL_FEMALE,
json_extract(POPULATION_JSON_DATA, '$.other') AS POPL_OTHER
FROM TBL_JSON;
SELECT
o_id,
CONCAT(
'{',
GROUP_CONCAT(
CONCAT(
'"',
`attribute`,
'":"',
`value`,
'"'
)
),
'}'
) json
FROM t3
GROUP BY o_id
Code Example |
---|
Sql :: change mariadb to mysql xampp |
Sql :: sql all |
Sql :: create user mariadb |
Sql :: adding generated time in row mysql workbench |
Sql :: download sql server 2016 |
Sql :: sql escape quote |
Sql :: sql if empty then |
Sql :: avg sql |
Sql :: primary key multiple colums |
Sql :: spring boot working with sql database connection |
Sql :: mysql remove first and last character from string |
Sql :: sql inner join with where clause |
Sql :: MySQL get all previous date record |
Sql :: how to get date in sql |
Sql :: partition by sql server |
Sql :: mysql delete rows |
Sql :: sql parent child tree query |
Sql :: mysql datetime with timezone offset |
Sql :: get count of null in column sql |
Sql :: mysql min value row |
Sql :: oracle nvl |
Sql :: view table sql |
Sql :: datepart sql server |
Sql :: sql display max value |
Sql :: to_char sql |
Sql :: oracle select row max date |
Sql :: t-sql random number for each row |
Sql :: sql string function update replace |
Sql :: SQL Updating a View |
Sql :: table structure in sql |