Forum Stats

  • 3,759,176 Users
  • 2,251,510 Discussions
  • 7,870,526 Comments

Discussions

History table in SQL (Oracle 19c)

User_3ZQRH
User_3ZQRH Member Posts: 70 Red Ribbon

Hi,

Hope this query is not irrelevant to this group.

I am building a live table ( and its' corresponding history table which will hold any changes made to the live table) in SQL (Oracle DB - 19 c)


As such the history table is not used by the application (except is rare scenario) for audit purpose/tracing back a data quality issue.


There is unique constraint (business validation) built on the Live table. Do I need to replicate the same constraint on the history table as well ? Is that the practice ? or I should not be creating any constraint on history table because it will only be populated via Live table ( and there is already an constraint implemented on the live table)

Answers

  • JambukaM
    JambukaM Member Posts: 3 Red Ribbon

    Hi @User_3ZQRH ,

    In my practice there is no need to create all constraints on history table, cuz they are already exists on your live table; The only need for history table is primary key, and, maybe, you will create some indexes, if your history table will be used for some reports using Oracle BI or some other tool;