365 Days of Daily Coding: Day 93
Lately, I have been thinking a lot about the purpose of my life. Perhaps, as I reach near my thirties, I am being given a chance to reassess my life. Perhaps, this self-awareness is asking me to rethink my chase for material and superficial possessions. As a Buddhist, I believe that life in itself is suffering and to want anything is to add to your suffering. Maybe my suffering will help me answer.
It’s rare that I let my thoughts run bare openly in my blog. It’s because there’s hardly anyone reading except my one friend. LoL!
WITH temp AS (
Select 'Alpha' AS Workflow, '6/1/2018' AS ExecutionDate FROM Dual Union All
Select 'Alpha' AS Workflow, '6/14/2018' AS ExecutionDate FROM Dual Union All
Select 'Alpha' AS Workflow, '6/15/2018' AS ExecutionDate FROM Dual Union All
Select 'Bravo' AS Workflow, '6/1/2018' AS ExecutionDate FROM Dual Union All
Select 'Bravo' AS Workflow, '6/2/2018' AS ExecutionDate FROM Dual Union All
Select 'Bravo' AS Workflow, '6/19/2018' AS ExecutionDate FROM Dual Union All
Select 'Charlie' AS Workflow, '6/1/2018' AS ExecutionDate FROM Dual Union All
Select 'Charlie' AS Workflow, '6/15/2018' AS ExecutionDate FROM Dual Union All
Select 'Charlie' AS Workflow, '6/30/2018' AS ExecutionDate FROM Dual
)
SELECT DISTINCT Workflow, FLOOR(AVG(Diff) OVER (PARTITION BY Workflow)) AS "Average Days"
FROM(
SELECT Workflow, ExecutionDate - LAG(ExecutionDate) OVER (PARTITION BY Workflow ORDER BY ExecutionDate) AS Diff
FROM (
SELECT Workflow, TO_DATE(ExecutionDate, 'MM/DD/YYYY') AS ExecutionDate
FROM temp))
ORDER BY Workflow

Leave a reply to Karma Cancel reply