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

  • Home
  • SEARCH
  • 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 7979247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:43:39+00:00 2026-06-04T09:43:39+00:00

I want to implement a temporal database using mysql. I have found out that

  • 0

I want to implement a temporal database using mysql. I have found out that BerekelyDB Engine is not supporting for current MySQL versions. I want to store data and query the history. (Don’t want to delete any data). For example let say table stundet.

Student_ID      Student_Name   Class   Added_Date               Deleted_Date 
1004            ABC             19   2011-02-03:18-24         2011-04-03:20-24
1004            ABC_D           19   2011-04-03:20-24         null

here is an example table I want. when I change some detail there will be a deleted_datetime stamp added and a whole new record will be added. When deleting a record it will only add a Deleted_Date

So do I have to write a whole library, or is there any particular library or database implementation to support my problem?..

By the way I found this http://www.cs.arizona.edu/projects/tau/tbdb/ but seems like it works only for older versions.

  • 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. Editorial Team
    Editorial Team
    2026-06-04T09:43:40+00:00Added an answer on June 4, 2026 at 9:43 am

    When you upgrade your non temporal table to a temporal table you can achieve compatibility to older applications be creating a non temporal view for the temporal table. The view reduces the temporal data to the currently valid data. For such a view you can create so called instead of triggers which perform the correct action on the temporal table.

    Unfortunately this does not work with MySQL, because the functionality of MySQL is way to limited. This means that you have two possible solutions:

    • Migrate your data into a more functional database.
    • Modify the application.

    The following example shows a possible solution for the first alternative. I have tested the example with Oracle 10gR2.

    Create a table for the temporal data. The current value is the
    value, for which the ending is NULL. The unique constraint
    prevents that the table contains more than one current value. The
    table does not have a primary key because the id is not unique in
    the temporal table but only in the legacy view.

    CREATE TABLE temporal (
      id         NUMBER NOT NULL,
      starting   TIMESTAMP NOT NULL,
      ending     TIMESTAMP,
      attribute  CHAR(20),
      UNIQUE (id, ending));
    

    Create a view for the legacy application.

    CREATE VIEW legacy (id, attribute) AS
      SELECT id, attribute FROM temporal WHERE ending IS NULL;
    

    Create an “instead of” trigger for the legacy table which performs
    the correct insert into the temporal table. An insert into the
    legacy table is also an insert into the temporal table.

    CREATE TRIGGER legacy_insert
    INSTEAD OF INSERT ON legacy
    FOR EACH ROW
    BEGIN
      INSERT INTO temporal (id, starting, ending, attribute)
      VALUES (:NEW.id, CURRENT_TIMESTAMP, NULL, :NEW.attribute);
    END;
    

    Create an “instead of” trigger for the update of the legacy table.
    An update of the legacy table is an update and an insert of the
    temporal table. The current value gets updated and for the new
    value a new row gets inserted.

    CREATE TRIGGER legacy_update
    INSTEAD OF UPDATE ON legacy
    FOR EACH ROW
    BEGIN
      UPDATE temporal SET ending = CURRENT_TIMESTAMP WHERE id = :NEW.id;
      INSERT INTO temporal (id, starting, ending, attribute)
      VALUES (:NEW.id, CURRENT_TIMESTAMP, NULL, :NEW.attribute);
    END;
    

    Create an “instead of” trigger for the deletion of an attribute in
    the legacy table. A delete of the legacy table is an update of the
    temporal table.

    CREATE TRIGGER legacy_delete
    INSTEAD OF DELETE ON legacy
    FOR EACH ROW
    BEGIN
      UPDATE temporal SET ending = CURRENT_TIMESTAMP 
      WHERE id = :OLD.id AND ending IS NULL;
    END;
    

    Try to insert.

    INSERT INTO legacy (id, attribute) VALUES (1, 'a');
    SELECT * FROM legacy;
    SELECT * FROM temporal;
    

    Try to update.

    UPDATE legacy SET attribute = 'A' WHERE id = 1;
    SELECT * FROM legacy;
    SELECT * FROM temporal;
    

    Try to delete.

    DELETE FROM legacy WHERE id = 1;
    SELECT * FROM legacy;
    SELECT * FROM temporal;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to implement file upload in RESTful way using openrasta but not able
I want to implement SQLite database for iPhone using PhoneGap. I know some basics
I want to implement a picker that will have only 2 part. consider the
Microsoft has announce that WindowsLiveID become a OpenID provider . I want implement it
I want to implement a basic search/replace translation table in C; that is, it
We want to implement a sitemap.xml feature in out CMS system. There is some
I'm studying the best data structures to implement a simple open-source object temporal database,
i have question for example i want to implement binary tree with array i
I want to implement the replication and fault tolerance in CORBA using Java. I
I want implement forward geocoding in my app. But I am not able to

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.