I found a very interesting SQL question on Twitter recently: Hi @sfonplsql we have some scenario, Let us 01Jan Mkt Value 100, 02Jan 120, next entry available 25th Jan 125, from 3rd Jan 24 Jan, our value should be 120. How to arrive ? Thanks @oraclebase — Vikki (@vikkiarul) April 23, 2019 Rephrasing the question: … Continue reading Using IGNORE…
#last value
3 posts
24 Apr 2019
20 Sept 2018
SQL is a verbose language, and one of the most verbose features are window functions. In a stack overflow question that I’ve encountered recently, someone asked to calculate the difference between the first and the last value in a time series for any given day: Input volume tstamp --------------------------- 29011 2012-12-28 09:00:00 28701 2012-12-28 10:00:00 … Continue reading How to…
12 May 2015
Whenever you feel that itch… Can’t I calculate this with SQL? The answer is: Yes you can! And you should! Let’s see how… Calculating time differences between rows Let’s consider the following database containing timestamps (e.g. in a log database). We’re using PostgreSQL syntax for this: Obviously, you’ll be adding constraints and indexes, etc. Now, … Continue reading Use this…