Skip to content

Tag: sql

How to get the minimum value for a given time-period

I have a table with equipment failure and resolved date. Until the failure is resolved, entries for each day will show as failed. Once the issue is resolved data will start from the next failure date. Below is an example I want an output which will give me the first failure time for each resolved timestamp li…

SQL Query, list from BOTH values?

Pretty sure this can be answered quite quickly but I just can’t seem to find a solution online. Might I add also (if you haven’t already figured out) that I’m a complete beginner. The following query lists all movies starring Johnny Depp and all movies starring Helena Bonham Carter. How do I…

How to use refer to multiple id’s when using JOINs in SQL

I try to display the number of reviews which an employee provided and the number of reviews which he received. I try to do something like this, but in my output table (3) I receive incorrect data. I believe that this happens due to the wrong reference: however, if I reference it like this: then nr_of_reviews_…

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…