How to create a column with the value of the previous row in another column?
Here's an example, I have the time column and I want to create the column time_lag
:
Tabela inicial:
id | title | time | domain
32 title1 12:30 domain1
33 title1 13:30 domain2
34 title2 14:20 domain1
35 title2 14:50 domain2
36 title3 15:30 domain5
Expected result:
id | title | time | domain |time_lag
32 title1 12:30 domain1
33 title1 13:30 domain2 12:30
34 title2 14:20 domain1 13:30
35 title2 14:50 domain2 14:20
36 title3 15:30 domain5 14:50