Skip to content

Tag: postgresql

SQL query for EXCEPT or NOT IN

I’m new to SQL and I am trying to write a query on PostgreSQL to find the cust_ID and customer name of each customer at the bank who only has a loan at the bank, and no account. The database schema is: The results should have only these 3 customers: My two attempts for this query are: 1) Where my

Pivot by Country Name and Flag in Postgresql

and I am trying to cross tab it like this: Here is my SQL query, I am not able to do it since I do not have permissions to create extensions (tablefunc) Is there an alternate way? Can you please help? Thank you. Answer As you ave only 2 values, you can make the classical approach to pivot country |

change the type of column in postgres not working

I have a column of type object, and i need to make it from another object type, (the table is empty ) i tried to do : ERROR: function pg_catalog.btrim(invoice_item) does not exist LINE 1: …ory ALTER COLUMN invoice_info TYPE invoice USING (trim(invoi… ^ HINT: No function matches the given name and …