I have a Postgres table users (E_8_User) which contains User_id as a primary key, Boss as a foreign key to the same table (it is not nullable, if some user doesn’t have boss, its Boss attribute = …
Tag: postgresql
Not return row from table when use the case when condition
I have a basic question. I want to return data from my table when the condition is true but when it is not I got the null row, but I don’t want that. This is my example: select case when coalesce(…
Select part from the values in SQL
I have such problem/question. I am trying to extract data from database, but only part. The real example is: { “email”:”bla@gmail.com”, “addinfo”:{ “invoice_id”:”1F5FspmpyfQ” }, “…
I need a query in postgres that returns the length of arrays but without taking empty values into consideration
so given the table: id | names =============== 1 {John, , Wayne} 2 {Luke, Harold, } 3 {Bill} 4 {Will, , } They don’t have a standard and some values may come empty ( …
How to delete unnecessary records from postgresql database table
I have a table that includes versions of my table. version_id transaction entity_id date ————————————————————– 1 insert 1 …
Creating Postgres View getting ERROR: column “id” specified more than once
SCENARIO: I have this select statement that JOINs a bunch of tables together: I’d like to create a Postgres View. So wrote it out like this: I keep getting this error: ERROR: column “id” specified more than once QUESTIONS: How do I fix this error? I would like to create a view called “…
Default Value in a column when insert a new row
I have the table Photographies with the columns: Name, Author, Date, Updated date. I would like to set Update date as default current_date when a new record is inserted or when a record is updated. …
Fraction formatting as halves or one third or quarters in PostgreSQL
I have some double-precision values in a column in PostgreSQL as following: I want to round these values to their nearest quarter value at the decimal place. That is: I saw this kind of feature in MS Excel. It can be found at: How can I do the same in PostgreSQL? Thanks in advance for your help. Answer You ca…
single or multiple search with a single query based on condition
For example i have this table component_information with these atrribute I will pass the group_code,category_code,compnent_code from the frontend for searching.Now i want to do single or multiple search based on this. Like on first condition if it gets only group_code value from frontend it will do search onl…
Java + Postgresql : How to store Parent and List of all children in a HashMap>
I have an sql table Children : | ParentName | ChildrenName | ——————————————————————————— | parent 1 | child 1 | | parent 1 | child 2 | | parent 2 | child 3 | | parent 1 | …