Skip to content
Advertisement

Tag: postgresql

Postgresql:Update text column with value from another column

I’m new to postgresql and need help with an update script where I can insert the corresponding ID between path2 and the filename if there is none.This will be done on multiple records. After update only IDs 111 and 333 will be affected and the expected is /path1/path2/111/file1.png /path1/path2/333/file3.png I am using this select to get the records that need

Why PSQL create table returns [42P01] ERROR: relation does not exist

I’m new to SQL. I was trying to run sql schema, here is a part of code It returns[2020-07-03 15:28:19] [42P01] ERROR: relation “people” does not exist In fact all foreign key reference table reference not exist. When i remove the reference, the table can be created, can someone please help me ? Answer The script is run sequentially. So

Postgresql – create table with disjoint subclasses

I’m unsure how one can create a table on postgresql with disjoint subclasses. I have represented (a very simplified version of) my problem below in an ER diagram, showing the two subclasses and the attributes of each subclass. For the columns common to all rows (id, common1, common2), it’s clearly very simple (as shown in the code below). However I’m

How to use triple INNER JOIN with one empty table?

Given is the following table: A project can be either owned by a user (user_id), OR by an organization (org_id) So either field is 0. So I do an INNER JOIN on projects, users, and organizations, but if the project is owned by a user (and currently no organization does exist at all), the result is empty. Does NOT work

How do I do this without a subquery?

I need to make the same query, but without a subquery! I need to get the count of rows in which genre_id is equal to the :deletedGenreId and the org_type_id value of this line in this table is not unique Answer There is nothing wrong with sub-query. Sub-query actually can help boost performance and increase code readability if you do

Advertisement