About 949,000 results
Open links in new tab
  1. sql - Database Design for Revisions? - Stack Overflow

    The best way I found for this is to use the employee_id as your revision_id. This means you will have duplicate revision ids for different types of entities but this …

    • Reviews: 5

      Code sample

      AS
      , FirstName, , DepartmentId
      SELECT EmployeeId, RevisionXML.value('(/employee/FirstName)[1]', 'varchar(50)') AS FirstName,
        RevisionXML.value('(/employee/LastName)[1]', 'varchar(100)') AS LastName,
        RevisionXML.value('(/employee/DepartmentId)[1]', 'integer') AS DepartmentId,...
    • Design a Table to Keep Historical Changes in Database

      I DON'Tlike this approach but I've seen people practicing it, struggling with it but still insisting to do it. Hence, I would like to demonstrate why it's a bad approach doing so. The idea is to have EffectiveFrom and EffectiveTofields inside of the tables, which looks like this: The EffectiveFrom and EffectiveTo fields are for vali…
      See more on dev.to
      • Field: varchar (50)
      • OldValue: varchar (255)
      • NewValue: varchar (255)
      • Table: varchar (50)
    • design - Ways to have a history of changes of database entries ...

      Jul 10, 2012 · There are basically two approaches: an audit table, with all previous values stored in it, or include a start/end date as part of the table, and all updates create a new record while closing out the old one.

      • Reviews: 3
      • Patterns for Versioning Relational Data in a MySQL database?

        Feb 28, 2012 · Another approach is to have a version_id column in your table and a 'current' flag which specifies which row is the current one. Each time you need an update, you can insert a new row and set the existing version 'current' flag to 0 / false and the newly added row to 1.

      • sql server - How to design SQL schema that treats historical data …

        Sep 13, 2015 · I'm currently designing a SQL Server database schema for an application that consists of highly structured "tree" data. So, a table might look like this: id parentId (references id in same table) ...

      • sql - Understanding Database Revisions: Methods, Examples, and …

        Feb 18, 2025 · revision_id INT PRIMARY KEY AUTO_INCREMENT: A unique identifier for each revision in the history. AUTO_INCREMENT automatically generates a new unique ID for each inserted row. product_id INT : A foreign key referencing the product_id in the main products table.

      • Use your database! (part 3) - Creating a revision system

        Dec 22, 2017 · Use database triggers and functions to create a revision system. Tagged with relational, database, trigger, postgres.

      • sql - database schema for document revision - Stack Overflow

        Jan 10, 2014 · Ideally I'd like to get rid of the component_number in both the component_lot and component_supplier tables, as well as the component_revision in the component_lot table, and just use component_id.

      • How to Version SQL Server Database Schema - codinghelmet.com

        We will then provide reusable implementation in T-SQL, followed by a fully functional demonstration. Solution is designed around a single table which tracks schema version changes. A couple of stored procedures are provided to back up required scenarios. The following …

      • Tips and tricks for SQL Server database (table) design?

        May 15, 2020 · Here are eight key database design rules, which are aimed to make your life easier. As it turns out, we often forget about painfully obvious things, so being prudent and wise stands above all rules. #1: Figure out the nature of the application: OLTP or OLAP.

      Refresh