sql - Can you tell me a better approach in designing a table for banned users than this? -
i designing web application , need give administrators , moderators right allow , deny other users access application. thinking of having table following columns:
- operationtype (ban / access regained).
- banneduser
- user (admin/mod gave access or banned user)
- eventdate
- reason (optional)
i can have table, storing banned users, want keep track of happening in app , make sure administrators , moderators not misbehaving well.
so, if table doesn't include operationtype column, list of banned users retrieved simple writing following query:
select banneduser userban; but if leave table operationtype column, shown above, simple select query become this:
select o3.banneduser ( select o1.banneduser, max(o1.eventdate) eventdate userban o1 group o1.banneduser ) o2, userban o3 o3.eventdate = o2.eventdate , o3.banneduser = o2.banneduser , o3.operationtype = 1 assume operationtype = 1 ban.
so, can give me better solution case? :)
Comments
Post a Comment