Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 181641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T14:47:58+00:00 2026-05-11T14:47:58+00:00

I’ve read a few questions on SO (such as this one ) in regards

  • 0

I’ve read a few questions on SO (such as this one) in regards to versioning your data within a database.

I liked some of the suggestions that were mentioned. I have for the longest time wanted (needed) to revision many of my tables but never got around to it. Being a programmer with only simple database work under my belt I was wondering how one would actually go about doing this.

I’m not asking for the actual solution in SQL syntax. I can eventually figure that out for myself (or post SO when the time comes). I’m just asking for people to comment as how they would go about doing it and any potential performance problems there might be if I was to ‘revision’ hundreds of million of records. Or any other suggestions as long as it is based on the example below.

Given a simple example:

Person ------------------------------------------------ ID                UINT NOT NULL, PersonID          UINT NOT NULL, Name              VARCHAR(200) NOT NULL, DOB               DATE NOT NULL, Email             VARCHAR(100) NOT NULL  Audit ------------------------------------------------ ID                UINT NOT NULL, UserID            UINT NOT NULL,               -- Who TableName         VARCHAR(50) NOT NULL,        -- What OldRecID          UINT NOT NULL,               -- Where NewRecID          UINT NOT NULL, AffectedOn        DATE NOT NULL,               -- When Comment           VARCHAR(500) NOT NULL        -- Why 

I’m not sure how one would link the Audit table to any other tables (such as Person) if the TableName is a string?

Also, assuming that I have three GUI’s to populate:

  1. A full record for a specific person id
  2. A table view listing all persons (by id)
  3. A view showing each person with their revision info below each entry (# of revisions per person, dates of revisions, revision comments, etc), ordered by the most recent revisions.

To accomplish 1 and 2, would it be better to query the Person table or the Audit table?

To accomplish 3, would a so called database expert simply get all records and pass it on to the software for processing, or group by PersonID and Affected date? Is this usually handled in one query or many?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T14:47:59+00:00Added an answer on May 11, 2026 at 2:47 pm

    I have done various audit schemes over the years and I am currently going to implement something like this:

    Person ------------------------------------------------ ID                UINT NOT NULL, PersonID          UINT NOT NULL, Name              VARCHAR(200) NOT NULL, DOB               DATE NOT NULL, Email             VARCHAR(100) NOT NULL   Person_History ------------------------------------------------ ID                UINT NOT NULL, PersonID          UINT NOT NULL, Name              VARCHAR(200) NOT NULL, DOB               DATE NOT NULL, Email             VARCHAR(100) NOT NULL AuditID           UINT NOT NULL   Audit ------------------------------------------------ ID                UINT NOT NULL, UserID            UINT NOT NULL,               -- Who AffectedOn        DATE NOT NULL,               -- When Comment           VARCHAR(500) NOT NULL        -- Why 

    The current records are always in the Person table. If there is a change an audit record is created and the old record is copied into the Person_History table (note the ID does not change and there can be multiple versions)

    The Audit ID is in the *_History tables so you can link multiple record changes to one audit record if you like.

    EDIT:
    If you don’t have a separate history table for each base table and want to use the same table to hold old and ‘deleted’ records then you have to mark the records with a status flag. The problem with that it’s a real pain when querying for current records – trust me I’ve done that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 123k
  • Answers 123k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Try this subquery: (SELECT IF(COUNT(*) > 0, 6, 4)) -… May 12, 2026 at 1:06 am
  • Editorial Team
    Editorial Team added an answer Actually the WebBrowser is a GUI control used in case… May 12, 2026 at 1:06 am
  • Editorial Team
    Editorial Team added an answer This could be because you need to set the form… May 12, 2026 at 1:06 am

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am currently running into a problem where an element is coming back from
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.