Delete duplicate lines postgresql

0

My code automatically inserts data into a database, causing the DB to become too large, and sometimes with repeated information. For this, I want to use the Slowly Changing Dimension (SCD) method so that: - A record with a given id will be added to the database, and the insertion date will be saved in the field data_inicial

  • As long as this record is the same, the program will only update to data_final
  • When you change something in this record, the data_final of the record will be updated to the date the change happened, and another record will be created with the information that has changed and data_inicial updated. As represented below:
  

id | city | initial_date | data_final

     

123 | About Us | 01/10/2016 | 12/3/2016

     

123 | Privacy Policy | 12/04/2016 | 01/20/2017

     

123 | Fortaleza | 01/21/2017 | 01/01/2999

Note: the table will have data of several id's, and more than one die with the same id.

obs2 .: I use a C # code to insert into the database

    
asked by anonymous 15.03.2017 / 15:01

0 answers