gaps-in-data

hibernate oracle sequence produces large gap

荒凉一梦 提交于 2019-12-17 02:31:55
问题 I am using hibernate 3 , oracle 10g. I have a table: subject. The definition is here CREATE TABLE SUBJECT ( SUBJECT_ID NUMBER (10), FNAME VARCHAR2(30) not null, LNAME VARCHAR2(30) not null, EMAILADR VARCHAR2 (40), BIRTHDT DATE not null, constraint pk_sub primary key(subject_id) USING INDEX TABLESPACE data_index ) ; when insert a new subject, sub_seq is used to create an subject id, the definition is here create sequence sub_seq MINVALUE 1 MAXVALUE 999999999999999999999999999 START WITH 1

How generate gap rows between dates in postgresql

浪子不回头ぞ 提交于 2019-12-12 02:19:03
问题 I have a table that store payments. I need to merge the days a payment was made and when not. So I will have something like: DeudaId Date Value 1 2016-01-01 $100 <- This come from a table 1 2016-01-02 $0 <- This was calculated 1 2016-01-03 $0 <- This was calculated 1 2016-01-04 $100 <- This come from a table I have this imperative solution, but is too slow for my case: CREATE OR REPLACE FUNCTION build_dates2() RETURNS TABLE (id INTEGER, cobrador_id INTEGER, fecha DATE) LANGUAGE plpgsql

How to pivot two date columns and fill in the gaps with multiple overlapping date periods

有些话、适合烂在心里 提交于 2019-12-11 19:42:19
问题 I have a table with employee absence entries. The rows contain employee number, first and last day of absence and a whole lot of more data like absence type, approved, etc. absencecalendarline: EMPLOYEENUMBER | FIRSTDAYOFABSENCE | LASTDAYOFABSENCE | ABSENCETYPE | APPROVED ---------------+-------------------+------------------+-------------+---------- 1 | 2013-01-01 | 2013-01-04 | VACATION | TRUE 2 | 2013-01-01 | 2013-01-02 | VACATION | TRUE 3 | 2013-02-05 | 2013-02-08 | VACATION | TRUE 2 |

Fill the table with data for missing date (postgresql, redshift)

我只是一个虾纸丫 提交于 2019-12-10 22:46:10
问题 I'm trying to fill daily data for missing dates and can not find an answer, please help. My daily_table example: url | timestamp_gmt | visitors | hits | other.. -------------------+---------------+----------+-------+------- www.domain.com/1 | 2016-04-12 | 1231 | 23423 | www.domain.com/1 | 2016-04-13 | 1374 | 26482 | www.domain.com/1 | 2016-04-17 | 1262 | 21493 | www.domain.com/2 | 2016-05-09 | 2345 | 35471 | Expected result: I wand to fill this table with data for every domain and every day