Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email firstname.lastname@example.org
From: Martijn Tonies (m.toniesupscene.com)
Date: Thu Aug 06 2009 - 03:36:51 CDT
>Hi, I'm a novel developer of MySql and now I am trying to create a mysql
>query to detect table updates.
>I query a database table every X seconds, and i want to get only the
>different rows in the table. The result that I want to have is simply
>TABLE (t = now) - TABLE (t = X second ago)
>Every time that i query the database I store the table situation in another
>table, called TABLE_TEMP, so the operation of difference >detection is
>TABLE_DIFERENCE = TABLE - TABLE_TEMP.
>How can I do this query? The problem that I have is that I don't know the
>structure of the table and I want to create a program with can be >used for
>all types of data and tables.
Although in relational theory, a "relation" means the table or view and you
should be able to modify one relation to another, in SQL databases, it
doesn't work that way.
In SQL databases, a "table" doesn't get modified, you modify rows. A
table is nothing but a description of a certain structure. So in order to
if any row in a table has been modified, you either need to have some kind
of timestamp in each row or keep a copy of the table since it's last
Instead of querying the table, I guess you could write a trigger that
a "metatable" that says a row has been added/deleted/modified for a
Download Database Workbench for Oracle, MS SQL Server, Sybase SQL
Anywhere, MySQL, InterBase, NexusDB and Firebird!
Database questions? Check the forum:
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql