Skip to content

Tag: postgresql

UPDATE VALUES OF COLUMN IN POSTGRESQL

I have 4 tables: what i want is to update table1 with the salary values from matchsal table with conditions in the others tables, i tried this query: and i got this error: ERROR: more than one row returned by a subquery used as an expression SQL state: 21000 Answer I found the answer ^^” It is simple th…

Case statement in multiple conditions?

I want to check the column mr.name, if mr.name is null then i have to replace mr.name as mr.ticket_no. How? Can use if else or case? When i use like this it will throw an error if mr.name = null means i have to replace mr.name = mr.ticket_no. I want to check the column mr.name, if mr.name is null then

Using NEW and COPY in a Postgres Trigger

I’m trying to copy the last inserted row from a table into a csv file using a trigger. I’ve tried this in various incarnations, with or without EXECUTE but I’m still getting the error. Just cannot get it to access the NEW data. Where am I going wrong ? Answer Adrian’s answer inspired m…

User Defined Column name in select statement in Hivesql

I need to create user defined column name like below Postgresql query into HiveSql. Could you please help me on this. Answer Use backticks: But it is not possible to preserve case due to Hive limitation. Resulted column name will be in lower case: total customers See this answer: https://stackoverflow.com/a/5…