让我们创建一个表并设置一个JSON类型的列值
mysql> create table DemoTable1832 ( ListOfNames JSON );
使用插入命令在表中插入一些记录-
mysql> insert into DemoTable1832(ListOfNames) values('["Sam", "Mike", "Carol"]'); mysql> insert into DemoTable1832(ListOfNames) values('["David", "Bob"]'); mysql> insert into DemoTable1832(ListOfNames) values('["Adam", "John","Sam"]');
使用select语句显示表中的所有记录-
mysql> select * from DemoTable1832;
这将产生以下输出-
+--------------------------+ | ListOfNames | +--------------------------+ | ["Sam", "Mike", "Carol"] | | ["David", "Bob"] | | ["Adam", "John", "Sam"] | +--------------------------+ 3 rows in set (0.00 sec)