How add node as an update in postgres table column

Viewed 18

Here is what is the JSON value in my table

  {
 "quiz":{
  "sport":{
     "q1":{
        "question":"Which one is correct team name in NBA?",
        "options":[
           "New York Bulls",
           "Los Angeles Kings",
           "Golden State Warriros",
           "Huston Rocket"
        ],
        "answer":"Huston Rocket"
     }
    }
  }
}

I want to add "hint":" HR" at the label of options i saw something like

UPDATE test SET data = jsonb_set(data, '{answer}', '"New York Bulls"');

but this is to update existing key but i want to have to add it.

0 Answers
Related