1,680 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
-4
votes
1
answer
64
views
How to precompute nested date ranges efficiently to optimize range filtering and pagination? [closed]
📝 Body
I have a Mongo collection CollectionA where each top-level object contains a nested array of meetings now each meetings have start and end times, for example:
CollectionA = [
{
&...
1
vote
1
answer
75
views
Postgresql with daterange on the same day
I'm trying to create a virtual column called period created by 2 other columns starting_date (time) and ending_date (time).
The aim is to avoid overlapping of periods for the same user.
Here is my ...
0
votes
1
answer
68
views
PostgreSQL alter column type from tstzrange to daterange
Similar to this SO question, how to convert a tstzrange value to daterange (ignoring the time part) ?
alter table x alter column y type daterange using y::daterange;
Ouput:
ERROR: cannot cast type ...
1
vote
3
answers
172
views
How does the Postgres daterange() function work?
This SQL:
select daterange(current_date, current_date);
Results in:
daterange
-----------
empty
(1 row)
But the daterange() function does not seem to be documented. I've looked here and there. ...
3
votes
3
answers
153
views
Find dates common in different rows
I have a table which has 3 columns:
task_name -- data type is varchar(50)
start_date -- data type is date
end_date -- data type is date
I want to list the dates which fall within the range (between ...
-1
votes
1
answer
98
views
Matching holidays between two dates (SAS TO SQL)
I have two tables one with request dates and SLA and the other with the list of dates of US holidays.
I want to write query that checks if any of the holidays fall between the request dates and the ...
0
votes
1
answer
72
views
Summing event durations in SQL with input time range, accounting for splitting event times, and incomplete events for OEE
I need to calculate OEE (Overall Equipment Effectiveness) for a set of production data given a start and end timestamp.
The value I'm stuck on is Availability %, which is (time running/time requested) ...
1
vote
2
answers
93
views
SQL join 2 table with date, filtered and grouped by a week number
I have 3 tables in SQL:
Agency, booking and checkin (and rooms)
I need to compute a % of checkin / booking, by week number (of begin), by agency
Here somes tables for example
Agency :
id
name
1
first
...
2
votes
2
answers
105
views
How to represent ranges of time in a pandas index
I have a collection of user data as follows:
user
start
end
John Doe
2025年03月21日 11:30:35
2025年03月21日 13:05:26
...
...
...
Jane Doe
2023年12月31日 01:02:03
2024年01月02日 03:04:05
Each user has a start and end ...
1
vote
5
answers
191
views
How can I write iterative query on Oracle SQL?
I have the columns party_id and data_date. I want to sort the data_dates in ascending order for each party_id. I will always take the first data_date. After that, the data_date I select must be at ...
1
vote
2
answers
85
views
SQL Query to combine overlapping times from same table to make decisions
I have a set of database tables in Microsoft SQL Server "in the example flattened to keep this example easy" that is a bunch of time clock records for employees that looks like this.
Call ...
-1
votes
1
answer
72
views
Day with the highest number of active users in the last 4 months in a Delinea report?
I'm working on a Delinea report and need to generate an SQL query to find the day with the highest number of active users simultaneously over the last 4 months. My database has columns like UserId, ...
2
votes
2
answers
78
views
Identify duplicates within a period of time using Redshift SQL
In a table, I have plan details of customers with their customer_id and enroll_date.
Now, I want to identify duplicate and valid enrollments from the overall data.
Duplicate: If a customer enrolls a ...
4
votes
6
answers
135
views
Counting dates in a range of dates
I have a pandas dataframe that contains two date columns, a start date and an end date that defines a range. I'd like to be able to collect a total count for all dates across all rows in the dataframe,...
-2
votes
2
answers
81
views
count how many event between dates sql in different rows
I am trying to count number of overlapping events between dates in SQL. Let’s assume some dates for room reservations in a hotel. Like this:
start
end
14.01.2024
17.01.2024
15.01.2024
17.01.2024
17.01....