Last update Mysql table

Asked

Viewed 623 times

1

good morning.

I have a trial that runs daily deleting data from a table with daily data from my system’s customers and for data availability reasons, sometimes this trial runs sooner or later.

I wonder if there is a query that visualizes the date of the last update of a table so I can use it in PHP to show users the last update performed within the system (table).

It is possible?

Thank you!


I did the test and it returns me a value null.

It is worth noting that this table does not accumulate data, it is deleted and receives data from the day in question.

Maybe I didn’t put the question right.

It is possible?

2 answers

1

Thus:

SELECT
    UPDATE_TIME as ultima_atualizacao
FROM
    information_schema.tables
WHERE
    TABLE_NAME = 'nome_da_tabela'
AND
    TABLE_SCHEMA = 'nome_do_banco';
  • Review the terms you used when setting the values in TABLE_NAME and TABLE_SCHEMA. To query that @Jasarorion passed will bring you a listing, run it and see what it brings to check the parameters.

0

all changes are saved in mysql information_schema so use something similar to this query

SELECT UPDATE_TIME, TABLE_SCHEMA, TABLE_NAME
FROM information_schema.tables
ORDER BY UPDATE_TIME DESC, TABLE_SCHEMA, TABLE_NAME

on top of it you edit for what you need

Browser other questions tagged

You are not signed in. Login or sign up in order to post.