I have a table called groups in my postgres production server, they have a column called manager_id. What I'm trying to do is to create simulated look up tables base off the ids of the manager. For example, if I have the following rows for table groups:
| id |manager_id| ... |
| 1 | 1 | .
| 2 | 3 | .
| 4 | 1 |
| 5 | 2 |
| 7 | 2 |
I would like to access make believe tables like group-1
| id |manager_id| ... |
| 1 | 1 | .
| 4 | 1 | .
Or group-2
| id |manager_id| ... |
| 5 | 2 | .
| 7 | 2 | .
I am not sure if this is possible, and yes I'm aware I could query for it, but for the purpose of the question (and my very specific needs, which I am having trouble finding a workaround), can I do something like that? If yes, can I do it without duplicating data, just picking up references from the original one?