The data in the array looks like XXXX:”False”. I used element_at(array_name,’Field’) and contains(map_keys(array_name),’Field’). They only check if the element is present in the array. But if the ‘Field’ has a value of ‘true’, How do i check that value? Answer Assuming that you have a map at hand, and that you want to check the value of of a given
Tag: arrays
How to convert data into this form in SQL :
Input: I have to Convert data from input to output. where we trying if for id freq is n then create n rows of that id. Output: Answer In Presto, one option uses sequence() and a lateral join to generate the rows:
Get array size in oracle sql
I have a table in oracle with this definition Document is stored in a json format. How can i extract size for array parameters in sql? I need extract array size for each table record, and after sum all this values. ex: 1 step: 2 step: Can someone please give me an idea how to do that ? Answer Provided
Website language translation in PHP (SQL)
i want to implement in my website a language translation. For this is created a table “translations” in my database: id | de | en | other languages 1 | Hallo | Hello | … Based …
Count json tags in sql
I have this json strings And know i want the following output I wanted to do this with a sql query. If you know how to do this, thanks in advance! Answer If you’re not using MySQL 8, this is a bit more complicated. First you have to find a path to a name element that has the value phone
Postgres get multiple rows into a single json object
I have a users table with columns like id, name, email, etc. I want to retrieve information of some users in the following format in a single json object: Wherein the users unique id is the key and a json containing his information is its corresponding value. I am able to get this information in two separate rows using json_build_object
SQL request to Clickhouse: select if value exist in JSON array
I’ve got a following table: How can I do ‘select Status where Name XXX represented at least in one Array[i].Name’? Answer
How to declare the elements of an array non-nullable?
In the following simple table It’s possible to insert null as an element of things: But I’d like to not allow this. Changing the definition to the following, however, Only prevents this which is not what I want. (I still want to allow that.) So how can I declare not the column, but the elements of the array column to
Removing backslashes when using Oracle’s JSON_ARRAY function?
How do you get rid of the back slashes, but still keep the double quotes when using json_array? TABLE A: Wrong code: Wrong output: Desired output: And yes, I know you can just concatenate like so “select ‘[‘|| etc. without using the json_array, but I need to have that in the code. Is there a way to use regexp_replace somehow,
Select Unique value from a JSON Array – PostgreSQL JSON column
I have the following JSON document stored in a PostgreSQL JSON column: I am trying to retrieve the price for specific customer_ID I am using this query to get the price for Customer_ID=1 The problem is that i am getting the same results for Customer_ID=1 and for Customer_ID=10 I am basically getting both elements of the array instead of just