I have a problem adding values to my exercise table. I want to update within the name column the values that are with en-US by adding values with es-ES and pt-BR, in this case, I already have this json with the translations and now I need to insert it into my database. but I’m wondering how to make a SQL script to do this automatically instead of me updating each column within the name line
I created this script inside my dbeaver:
UPDATE exercise
SET name = name || '{"en-US": "alternate heel touchers", "pt-BR": "toques alternados de calcanhar", "es-ES": "toques alternos de talón"}'::jsonb
WHERE name->>'en-US' = 'alternate heel touchers';
But I realized that I’m going to have to change this part here
WHERE name->>'en-US' = 'alternate heel touchers';
for each en-US that already has the previous value and I want to change it
Lxrd is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2