Skip to content
Advertisement

Tag: arrays

Is there a algorithm to resolve credit rating?

I need to implement a logic in either Java OR SQL for the following. There are credit ratings from numbers 1 to 11. And corresponding to each rating say x, I have 3 grades, effectively :x+, x and x-. Difference between each grade is termed as a step. For example, 2 and 2- is single(1) step,2+ and 2- is double(2)

SQL Insert JSON into table column

while searching for a way to insert array into single db columns, I found an article about inserting JSON string. However it wasn’t explained how. I tried to search and find the way with no success. I have the following table: What i want to do is insert a Json arry in the address column. like: I thought about inserting

Update partial jsonb field in Postgres 13

can anyone help please optimize SQL request Postgres 13 (jsonb). Need to update the “percent” values inside the Jsonb field with the specified ID This example is working, but it works for a very long time on a large database. https://dbfiddle.uk/?rdbms=postgres_13&fiddle=a521fee551f2cdf8b189ef0c0191b730 Answer I would phrase this as: The logic is quite the same as in your original code, but this

Using left join to query and match JSON field in MySQL

Table A,field : pay_type_fk,type:json, Examples Data: [1,2,4] Table B,field : id type : bigint Examples Data: primary key SQL I use: Only pay can be found_ For the first record in the type table, I think we can query all of them with group_ CONCAT Answer If I follow you correctly, you can join on JSON_CONTAINS(): That said, a better

Mysql comma seperated to json-array

I have some fields in the database that are comma selerated, something like: a,b,c,d,e and I want to convert them into: I know how to do it in nodejs / any other language, but I need to do it directly on the mysql Possible? Thanks Answer The simplest approach probably is to use string functions only: Basically this turns a

Advertisement