How to set up last access (timestamptz) in table 1( basic info table) when working with many other tables having foreign key from table 1?
1
vote
2
answers
216
views
Let's say the database have 5 tables for sake of simplicity (there're many more in reality). Table 1 has the basic information of a user which is not changed so often. However, the other tables are accessed very often. All these other tables have the user-id as the foreign key. I need to make a column
lastAccess
in table 1 such that whenever the user works with any of the table, user's lastAccess in table 1 is updated.
I'm working with [python-socketio] (https://github.com/miguelgrinberg/python-socketio) server connected to PostgreSQL database using [python-psycopg2](http://initd.org/psycopg/) connector.
It seems like a task which every person working with databases should know. I am new to working with RDBMS and exactly find a way to do it.
A general direction, if a solution is not possible, will also be really appreciated.
Asked by Tushar Jain
(113 rep)
Dec 23, 2016, 07:05 PM
Last activity: Dec 24, 2016, 04:54 AM
Last activity: Dec 24, 2016, 04:54 AM