Oracle compute time format average


to_char((to_date(‘2019-07-01’, ‘yyyy-mm-dd’) + numtodsinterval(avg(begin_time_second), ‘second’)),’hh24:mi:ss’) avg_begin_time,
to_char((to_date(‘2019-07-01’, ‘yyyy-mm-dd’) + numtodsinterval(avg(end_time_second), ‘second’)),’hh24:mi:ss’) avg_end_time
–2019-07-01 00:00:00 + numtodsinterval (average, ‘seconds’) is converted to date format and then to time character format
— convert working hours to seconds
  to_char(a.actontime, ‘hh24’) * 3600 +
  to_char(a.actontime, ‘mi’) * 60 +
  to_char(a.actontime, ‘ss’) as begin_time_second,
— convert off hours to seconds
  to_char(a.actofftime, ‘hh24’) * 3600 +
  to_char(a.actofftime, ‘mi’) * 60 +
  to_char(a.actofftime, ‘ss’) as end_time_second
  from empworkdate a

Recommended Today

Redis design and implementation 4: Dictionary Dict

In redis, the dictionary is the infrastructure. Redis database data, expiration time and hash type all take the dictionary as the underlying structure. Structure of dictionary Hashtable The implementation code of hash table is as follows:dict.h/dictht The dictionary of redis is implemented in the form of hash table. typedef struct dictht { //Hash table array, […]