Skip to content

Tag: postgresql

SQL write a query, question from interview problem

At the beginning I need to mention that I am not very good at SQL so I would like to ask you. Here is a tables relation: tables What I need to do with them is “Show name, surname and number of movies those directors (Reżyser means director), who made more movies that the average number is for all direct…

Add a number for duplicate values in posgresql

I’ve a query in MySQL and I’m looking for a query which can perform below operation using Posgres MySQL Query : Output: Email Row Number Aamir 1 Aamir 2 Aamir 3 Suresh 1 Suresh 2 Hafiz 1 Answer https://www.db-fiddle.com/f/3RqNHRGFjkU74v33upyfhi/0

Full Outer Join failing to return all records from both tables

I have a pair of tables I need to join, I want to return any record that’s in tableA, tableB or both. I think I need a FULL OUTER JOIN This query return 1164 records And this one return 3339 records And this one returns 3369 records (so there must be 30 records in tableA that aren’t in tableB) I

PSQL: How to compare record to previous record (2 tables)?

I have two tables: 01_System_Log Records I need to create a view, where the records of the last request id (3) are compared with the previous (2). So far I made a view, where the most actual records are shown. I am not sure how to proceed, while in all compare examples, which I have found, only one table was