Skip to content

Tag: sql

PostgresSQL custom sequence

I have a problem with nextval function, I have a custom sequence in my DB called InternalCodes and when i want to make a insert like this: insert into “Membership” (“Name”, “…

Symmetric Pair in SQL with JOIN

I am trying to find the name of students where a symmetric pair exists. There are 3 tables: Edit from your comment: A student is called as being a part of a symmetric pair if the marks obtained by that student in science is equal to the marks obtained by some other student in mathematics and the marks obtaine…

Merge the table based on date and condition

I have following table: In this table type will be 1,2,3,4.. here date and type both are composite key. I need to merge the row based if same date exist to single row and merge based on only below condition and grp col is based on running count of date. Answer Try GROUP BY FIDDLE DEMO Output