K
K
Kai2021-12-01 18:41:04
Python
Kai, 2021-12-01 18:41:04

How to split date period by seconds?

61a795fd04df1374706563.png

Hello everyone Tell me

, pliz, there is such data consisting of two columns. Time from and time to.
It is required to break the line into periods by seconds.
That is, the first line:
from 10/01/2021 00:00:05 to 10/01/2021 00:00:09
and you need to create new lines below that will go by seconds 06, 07, 08. Can this be done when uploading data in SQL? or already during processing, for example, in Power BI or using Pandas.

I will be grateful for any help.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
galaxy, 2021-12-02
@Tr3ShKirill

Of course it is possible. Here is one possible option directly in Postgresql:

select generate_series(start_time, end_time, interval '1 second'), t.*
  from t

https://www.db-fiddle.com/f/mKkdMbcpYx7goX6UiNM4LH/0

A
Andy_U, 2021-12-02
@Andy_U

Can.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question