Skip to content
Advertisement

Tag: postgresql

update average/count from another table

I’ve been provided the below schema for this problem and I’m trying to do two things: Update the ACCOUNT table’s average_eval row with the average of the evaluation row from the POST_EVAL table per account_id. Update the ACCOUNT table with a count of the number of posts per account_id, with default value 0 if the account_id has no post_id associated

Need help understanding Postgresql query execution

I have a generated query from an ORM that selects data from a nested join on a junction table. When executing it looks like it performs a full table scan on a table with >55 million records resulting in a slow execution time. My expectation was that it would perform the filtering first then lookup by index for the join.

Counting organizations which user has not contacted

I am new at PostgreSQL. I have the following tables created in my schema: User table: Organization table: And finally Organization_rating table: With this schema, an organization has a business type in which gives support to the user that also have that business type. After giving this support, the user can rate this organization with organization_rating. Following this logic, I

Add a new column from compare result

I need add a new column (status) on my main table (Table 1) on my bd Postgres, to do this , I need to compare two columns from table 1 on table 2 , if the two columns exist , I need to copy the status from table 2 to the new column on table 1 , if not exist

Advertisement