extract data from an array of json objects
Hi,
DB : mysql8
server : debian 10
php 7.4
question 1: is it better to have 10000 rows which contains a Json field (3 levels) or 100,000 rows without json field? what is the fastest?
Question 2 : for my understanding
I would like to know what SQL query to perform to extract data from a json object array
For example, extract data where style = Hard
I tried :
SELECT *
FROM myTable
WHERE disc->>"$.Style" = "Hard"
how to get to the lower level ?
MyTable :
id = int
productor = string
disc = json
Here is the structure of my object "disc"
[
{
"Artist": "AC/DC",
"Year" : 2010,
"Album": [
"AlbumName": "Puissance",
"Style" : "Hard"
]
}, {
"Artist": "U2",
"Year" : 2011,
"Album": [
"AlbumName": "Fake",
"Style" : "Pop"
]
}, {
"Artist": "IRON",
"Year" : 2014,
"Album": [
"AlbumName": "New",
"Style" : "Hard"
]
}
]
Thanks for your feedback
Subject
Views
Written By
Posted
extract data from an array of json objects
530
November 06, 2022 04:02PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.