J
J
Jan2012-05-21 20:36:39
Database
Jan, 2012-05-21 20:36:39

DB - comparison of previous versions of tables with the current one

I would like to invent a bicycle that will be a database that saves changes or states for each day in one way or another and be able to compare with the current state of the table.
There is information (let it be, about orders) that is planned to be added “manually” (csv or xlsx, for example) to the database every day. Changes occur in several fields at the same time, and in almost every line, incl. field logging doesn't seem like the best option.
I would like to see (automatically and interactively, ha) the changes that have occurred and be able to compare table versions on different days and find the delta between them.

Tell me, please, how best to implement this miracle.
So far there have been 2 options: a separate table for each day (at least a month) and, for example, subtract one from the other. Or update triggers, which are quite an option, but how to restore the state of the entire table to the past date?

I am very interested in both general architecture tips and specific technologies that are best used.
Thank you.

Answer the question

In order to leave comments, you need to log in

5 answer(s)
A
Alex Bunin, 2012-05-22
@azxc

I usually store such things in one table, I just add one more field with the version number.

S
strib, 2012-05-22
@strib

Versioning should be normal.
There are several ways to organize. For example, for each object, specify the lifetime.
Well, or buy Oracle, 11 has built-in versioning.
There is something like an introductory part, not everything is perfect, but more or less habrahabr.ru/post/101544/
And the network is full of information on data versioning.

E
egorinsk, 2012-05-21
@egorinsk

> Tell me, please, how best to implement this miracle.
Of course, write yourself. For storage, you can use, for example, a revision system (as in Wikipedia) (1 table stores the current values, another, archive, all previous revisions of the records).

U
Ura78, 2012-05-24
@Ura78

I advise you to use the Database Comparer VCL library

K
kuzemchik, 2012-05-26
@kuzemchik

If the load is not large, create a copy + smart view as a trigger.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question