Home > Database > Mysql Tutorial > body text

MariaDB 10.0.X中,动态列支持 JSON 格式来获取数据

WBOY
Release: 2016-06-07 14:54:04
Original
2357 people have browsed it

MariaDB 10.0.X中,动态列(Dynamic Columns),可以支持 JSON 格式来获取数据。 为了兼容传统SQL语法,MariaDB 10和MySQL5.7支持

mysql> UPDATE assets SET dynamic_cols=COLUMN_ADD(dynamic_cols, 'warranty', '3 years')

    -> WHERE item_name='Thinkpad Laptop';

Query OK, 1 row affected (0.01 sec)

Rows matched: 1  Changed: 1  Warnings: 0

 

mysql> SELECT item_name, COLUMN_JSON(dynamic_cols) FROM assets;                           

+-----------------+----------------------------------------+

| item_name       | COLUMN_JSON(dynamic_cols)              |

+-----------------+----------------------------------------+

| MariaDB T-shirt | {"size":"XL","color":"blue"}           |

| Thinkpad Laptop | {"color":"black","warranty":"3 years"} |

+-----------------+----------------------------------------+

2 rows in set (0.00 sec)

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!