Questions tagged [array]
An array is an ordered linear data structure consisting of a collection of elements (values, variables, or references), each identified by one or more indexes. When asking about specific variants of arrays, use related tags as well. When using this tag, in a question that is specific to a database, tag the question with the database being used.
323 questions
1 vote
1 answer
141 views
SELECT with array values on WHERE using postgres
I'm using an query to update a object array inside a jsonb column. Example data: [ { "_id": "68696e0a3aab2f9ff9c40679", "altura": 1, "comprimento":...
2 votes
1 answer
137 views
Cardinality of a multirange? How many ranges or gaps are there in a multirange?
How do I obtain the cardinality of a multirange? I'm using range_agg() to aggregate ranges, which merges ranges if they are continuous, or returns what looks like an array of ranges if the ranges are ...
0 votes
2 answers
59 views
Is there a way to "rearrange" arrays when selecting?
I have a table post_likes with one column being a post ID (uint), and another column being an array of IDs (uint[]) of users who liked the post. If I'm selecting info from multiple tables on multiple ...
0 votes
0 answers
116 views
What are downsides of using composite types and array type columns in TimescaleDB hypertable?
I'm considering to use a composite type, array of standard type and array of composite type columns in TimescaleDB hypertable. I'm curious whether using such columns has any downsides like less ...
1 vote
1 answer
129 views
MySQL Trigger updating second table based on History and computed values
The Goal: Update an secondary table called Lottery_Cycle when an INSERT occours on table Lottery_History with some computed values and checking previous data. Let's say a lottery with 25 numbers of ...
-1 votes
1 answer
517 views
Replacing substrings in array elements
I have a table with an array of URLs in column urls. Now there's a need to update some URLs changing the hostname. E.g.: {https://storage.host1.com/file.jpg, https://storage.host1.com/file2.jpg} ...
0 votes
1 answer
46 views
How can I get a linear forecast in BigQuery?
BigQuery has no native support for linear forecasting outside of machine learning, but it does support user-defined functions, and these can accept arrays as inputs. However, (as of 2023/10 anyway), ...
0 votes
1 answer
90 views
How to calculate quantity based on a boolean field and retrieve values from a JSON field in MySQL
I'm working with a table called price_options that has the following fields: id, slots, list_slots, and quantity. Issue Description My objective is to calculate the quantity for each price option ...