Purpose of Datestamp Column in Database Table - mysql

I'm working on building a webapp and received a partial database schema. Some of the tables have datestamp columns to keep track of when the record was last updated.
My question is twofold: what is/are the purpose(s) or benefit(s) of tracking when a record was updated, and when should it be done?
Thanks

You would want an "updated_at" column if a user wants to sort or filter by when a row was last updated.
Look at Google Drive's main listing window. There is a column "Last Modified" that you can sort on, to look at documents that you most recently modified. You would need a database column with the last modified date to be able to sort by that value.
Another example is an API where API users only want to download new information, so they could filter (using a WHERE clause) for records that had changed only since their last download.

Related

Read the last line of a CSV file and extract one value in Knime

I am working in a workflow on Knime, and I have an excel writer node as a final node of my workflow. I need to read this file and get and store the last value of one specific column (time). And with this data, I need to input in another time node, to update my API link to get a new request.
To summarize I need to extract specific information from the last line of my excel file in knime.
My question is: How can I read this file and get this value from my sheet? And then, how can update a time loop to refresh the data for inserting the current day in my API link?
UDDATE-> My question is how can I Filter always the last 90 days in my concatenate database. I have two columns in this file with dates. And I need to maintain just the last 90 days since the current day.
To read an Excel file, use the Excel Reader node.
The simplest way to get the last row of a table (assuming your date column has a value for every row of this table?) is probably to use a Rule-based Row Filter with the expression
$$ROWINDEX$$ = $$ROWCOUNT$$ => TRUE
Now you have a one-row table with the values from the last line of the Excel sheet. To help further we need to understand what you mean by update a time loop to refresh the date for inserting the current day in my API link. Can you update your question with a screenshot of your current KNIME code?

Making updates to google forms

At present this is a hypothetical question and I haven't begun writing the code for this, mainly because I'm not sure if it is possible to achieve what I need to in Google Forms.
We have a employee contact form that is completed when they join the organisation, obviously people go through changes in life and either get a new mobile or change address, when this happens they change their contact details via a Google form, this adds a new row of data to the responses spreadsheet meaning that we have a duplicate entry for the same employee.
What I want to be able to do, is have the sheet look for duplicate data and overwrite the fields that have changed. I am fairly confident that this is possible, however, I am struggling with the logic.
If it is possible? Could you provide a hint as to how this might work.
It is possible to look for duplicates in a spreadsheet and delete them, however if you do it in the destination spreadsheet of a Google Form - the deleted duplicates will come back at every update.
So you need a workaround:
Create a new spreadsheet (slave) that will be synchronized with the destination spreadsheet (master) on every form submit
The form data from each form submit will be checked for duplicates before being written into the slave
You need a unique identifier, e.g. employee number
You can check either an entry with this identifier already exists in the slave, e.g. with indexOf()
If the identifier does not exist yet - append the new data to the last row of the slave
If the identifier exists already - find the row containing it and overwrite it with new data

Is it possible to edit and save a form as a new record, while also keeping the old entry as a separate record in MS Access?

For example, I have a form for info associated with version 4.1. What I want to do is edit that info and save it as version 4.2, but also keep the previous version. Obviously I could do this by creating a new record, but a lot of the info remains the same which is why I want to avoid that. Right now if I edit the info on the form it just overwrites the old info.
Keep it simple. Use the function here as basis to duplicate the record.
Add a field to the table named, say, Archived, and perhaps also a date field for the archive date. Then, before updating, copy the record and update Archived and the date field in the source record.

Does the Socrata SODA API support getting a list of dates on which the dataset was modified?

Does the Socrata SODA API support a method to query out all the dates a dataset has been updated? Basically a changelog for the dataset that has an object for every modification/update to a dataset.
There is an existing question that asks for the last modified date (you can get it through the "/data.json API available on all Socrata-powered sites".
There is also a method to get the modified dates of individual rows using System Fields and the :update_at field. But this is incomplete, a data provider might update every row each time. This means there is no guarantee that we are really getting back a history of modifications, just the top layer of modification on each row.
I'm looking for the complete list of modification dates, at least. We are trying to get a sense of activity on datasets and we need to know how often they are being updated.
Unfortunately, Max, we don't offer what you're looking for. We've got the last time the dataset and metadata were modified, but not a changelog of every single time that there was a change.
A surprisingly large number of datasets change very frequently, as often as every 5 minutes.

Detect time of last change on a Microsoft Access database table

Does anyone know of a way to detect when the last time a Microsoft Access table has been changed (inserted into or updated)? We used OLEDB via ADO COM to communicate with an access database programmatically and were looking for a way of detecting changes to specific tables. We don't need to know what those changes are, just that changes were made.
The only way to detect if data in the table has changed is to perform a query against the table.
You must add a column of type DATETIME to the table e.g. named LastUpdatedDate that indicates the last updated date/time of each row. Make it NOT NULL so that you will have to write an updated DATETIME value to that column for each INSERT or UPDATE. Also, set the column to have a default of DATE() for the current date stamp or NOW() for the current date/time stamp. Then add a Validation Rule or CHECK constraint e.g. CHECK (LastUpdatedDate = NOW()) to ensure the column is actually updated on each UPDATE and INSERT.
Finally, run a MAX(LastUpdatedDate) query and you will get what you need.
There isn't a way without "manually" writing to a column each time you access the table.
As others have indicated there is no way to track changes without coding it yourself.
There's a simple example at
ACC2000: How to Create an Audit Trail of Record Changes in a Form
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q197592
Audit Trail - Log changes at the record level at:
http://allenbrowne.com/AppAudit.html
The article addresses edits, inserts, and deletes for a form and subform.
Modules: Maintain a history of changes
http://www.mvps.org/access/modules/mdl0021.htm
The History Table routine is designed to write history records that track the changes made to fields in one or more tables.
You will need to implement a timestamp column in your table, and update the value during your data changes.