It's always nice to have the last of some user. For example, last seen would be the USERS' most recently created SESSION_ACTIVITIES record. This could be a column derived in a VIEW and could easily be rendered as a relationship to a USERS record.
CREATE VIEW users_last_activities AS
SELECT users.id,
(
SELECT MAX(sa.created_at)
FROM session_activities sa INNER JOIN sessions s
ON sa.session_id=s.id
WHERE s.user_id=users.id
),
...
FROM users
It's always nice to have the last of some user. For example, last seen would be the
USERS
' most recently createdSESSION_ACTIVITIES
record. This could be a column derived in aVIEW
and could easily be rendered as a relationship to aUSERS
record.Other last ideas from projects I've worked on: