Storing and querying JSON from a database

后端 未结 6 1397
日久生厌
日久生厌 2021-01-30 10:25

I\'ve heard about MongoDB, but I\'m not sure I fully understand the concept.

If I have multiple JSON objects stored in MongoDB:

[{\"id\": \"peter\",
  \         


        
6条回答
  •  有刺的猬
    2021-01-30 11:23

    Starting from 5.7, MySQL now has native JSON datatype. Assuming your table is called students and the JSON column is called student, in MySQL 5.7 your select can be written as

    SELECT * FROM students WHERE JSON_EXTRACT(student, '$.age') = 12;
    

提交回复
热议问题