How to effectively implement data query based on existing table structure

Hello, everyone. At present, there is a database query design problem:

action table:

user_id, action_detail
1        "action_click"
2        "action_drag"

user info tablle

user_id, full_name, email
1        "User One" "userone@user.com"
1        "User Two" "usertwo@user2.com"

company info table

company_name,      company_domain
"User Company"     "user.com"
"User2 Company"    "user2.com"

the queries that need to be implemented currently include:

  1. find out the action records (action_detail) of all users of a company
  2. find out the action records (action_detail) of all users of a company, but exclude certain specified users
  3. find the action records (action_detail) of all users of multiple companies, but exclude certain specified users

based on the above three tables, how to effectively implement these three queries? thank you!

Mar.28,2021
Menu