Maastonakki
Explore posts from serversDTDrizzle Team
•Created by Maastonakki on 10/12/2024 in #help
Calculating average of joined table column
I'm trying to achieve select/query, where DB would automatically calculate average rating for my contractor. Here are my two attempts, but both have some issues, when I'm also trying to fetch relations for contractor.
Another try with select:
I believe there should be some kind of
json_agg
, or json_create_array
methods?3 replies
DTDrizzle Team
•Created by Maastonakki on 6/18/2024 in #help
How to make all relations be deleted when user is removed?
Hello! I'm trying to get my head around for table relations, and just can't seem to get this figured out. I've table for users, and user sessions. When I'm trying to delete a user, postgres throws error, that delete violates foreign key constraint on sessions.
What might be proper way to define this relations? Below is my schema.
1 replies