Questions tagged [aggregates]

Aggregate functions, typically found in SQL, derive summary values from multiple rows in a single column.

An aggregate, more commonly known as an aggregate function, is a means to examine the values found in multiple rows from a single column. These are grouped together as input on certain criteria to form a single value of more significant meaning or measurement, such as a set, a bag or a list. Aggregates are usually found in SQL.

179 questions
4
votes
2 answers

Collapse and intersect data frames

I have two data.frames which have a 3 columns: 1. id - a unique key target - semicolon separated unique values source - similar for each of the data frames but different for the two data.frames. Here's simulated data: set.seed(1) df.1 <-…
dan
  • 6,048
  • 10
  • 57
  • 125
4
votes
1 answer

django filtering on datetime = None

I have a table with metadata on fieldmeasurement in which a fields 'startDate' is of type datetime. The value can be empty, when no info is available. I would like to run some statistics on this field, and get min and max value (i.e. the oldest…
Bart P.
  • 849
  • 1
  • 8
  • 11
4
votes
2 answers

Mapping a data warehouse star schema to HBASE

Suppose, hypothetically that I have a star schema in a data warehouse setting. There is one VERY, VERY long fact table (think billions to trillions of rows) and several low cardinality dimension tables (think 100 dimension tables). Each fact table…
user78706
3
votes
2 answers

GROUP BY Works with Select columns not in GROUP BY

why is this GROUP BY still working when the SELECTed columns are neither in the GROUP BY clause, nor aggregate function. DATABASE SCHEMA HERE SELECT FirstName, LastName, City, Email, COUNT(I.CustomerId) AS Invoices FROM Customers C…
3
votes
2 answers

VHDL logic vector to record assignment

Suppose I have defined a record with fields of std_ulogic_vector to represent a larger std_ulogic_vector. It's straightforward to convert this record to the large vector using a concatenation (without knowledge of the size for each field). How do I…
3
votes
3 answers

Query for missing elements

I have a table with the following structure: timestamp | name | value 0 | john | 5 1 | NULL | 3 8 | NULL | 12 12 | john | 3 33 | NULL | 4 54 | pete | 1 180 | NULL | 4 400 | john | 3 401 …
Martijn
  • 11,964
  • 12
  • 50
  • 96
3
votes
1 answer

How to Use Aggregate Case Statements Instead of PIVOT When You Don't Know the Upper Bound?

Solution: I wasn't able to solve this without going beyond a simple query, so I've resorted to hard-coding the case statements up to the limit of my table's numeric identifier. I'm looking for help in writing a query to represent an unknown number…
3
votes
0 answers

How to query for aggregate of two dimensional sparse matrix in PostgreSQl?

Is there an efficient way to query for array_agg on sparse data as follows? Rows with sparse elements need to get aggregated even if some are overlapped only partially. Input ID | tags ----|------------- a1 | {b1, b2} a2 | {b1, b3, b4} a3 |…
SG. Nihonbashi
  • 471
  • 1
  • 4
  • 7
3
votes
1 answer

Using FireDac Aggregates

I am using XE6 with FireDac. I have a FDMemTable with ItemVals as a ftfloat field. I would like to use the aggregates function of SUM(ItemVals) but I would like only ItemVals with a value >0 to be added in. ItemVals is a ftfloat but as far as I can…
3
votes
1 answer

Using aggregate functions with Inner Joins

I'm having an issue understanding the Group By when using aggregate functions. I understood it fine without using inner joins, but now I'm not understanding what to group by. Here is my code. SELECT ProductName, Products.ProductNumber, …
user2891712
  • 41
  • 1
  • 4
3
votes
1 answer

Getting daily aggregates/sum sorted by day in Laravel

So getting a sum()/count() is really easy in Laravel... but how would I look at the past month, and get the sum of rows every day? EG...grouped by day that they were created at. So I want to return a count such as 3, 2, 4, 5 Meaning 3 rows were…
Kylie
  • 11,421
  • 11
  • 47
  • 78
3
votes
1 answer

Domain driven design and aggregate references

I am designing the domain model, but there is something that doesn't seem to be ok. I start with a main aggregate. It has references to other aggregates and those other aggregates reference more aggregates too. I can travel the hole domain model…
2
votes
1 answer

DDD: Maintaining Constraints Across Aggregates

Still reading and learning about DDD and trying to apply it to a project I am working on. I am still trying to get by head around Aggregates and came across an interesting question. Assume I have 2 Aggregates, 1 having an Account Entity for a root…
9ee1
  • 1,078
  • 1
  • 10
  • 25
2
votes
0 answers

Kafka Streams. How to emit the final result in an aggregation window with suppressor

With my huge surprise I realized that the "suppress" operator does not emit the last event at window close but only when another event is published on the partition the streams' tasks belong to. So, how to emit the final aggregate result without…
2
votes
1 answer

MySQL: JSON column values aggregate into the single JSON object groupped by property

I have a table variants with properties column type JSON and some data: id product_id properties(JSON) 1 1 [{"name": "Color", "value": "Black"}, {"name": "Size", "value": "Xl"}] 2 1 [{"name": "Color", "value": "Red"}, {"name": "Size",…
1
2
3
11 12