Recently, I'm practicing code exercises in Codility. Here you can find the problem, it is in the Exercises 6 - SQL section. Just start a test to see t ...
Recently, I'm practicing code exercises in Codility. Here you can find the problem, it is in the Exercises 6 - SQL section. Just start a test to see t ...
I've been learning Window Functions (e.g., OVER, RANK, PARTITION BY clauses) in PostgreSQL but am still confused when and how to use them and what wou ...
I have a table (line) of individuals who measure in at different weights and take turns to enter a lift. I am trying to work out how to select the nam ...
I struggle to see what I'm doing wrong. I have noticed that some syntax doesn't work (I've had this issue with the keywords "WITH" and now with "OVER" ...
I do not fully understand the query results listed for the below: Executing the above, I get the following result set: From my understanding of ...
I have a table with the following structure. I have a query to return, on a specific date, whether or not previous (inclusive) aNumbers sum is > ...
I am using OVER, and Partition by to get the mindate and max date of dataset. I am using this query And I am getting this result As we see da ...
I'm calculating customers retention and want to segment my customers according to behavior in first, second, third and so-on purchases. For example: ...
Is there a way to compute the duration between consequent dates that are not the same, using SQL Server 2017's OVER clause and without joins or subque ...
I would like to select the minimum ID of a partition. Kind of like how dense_rank works I'd like a unique number associated with each paritition, but ...
i have a table with a list of items and qty to be sold by a certain due date. I am trying to calculate a running total column that would show how many ...
I have a table in SQL Server in which I need to select the data, sorted based on a value. For example, If the sort value is 1, then I need to sort ...
I want to Aggregate a column over timestamps. Here an example: Table contains columns like col1, col2, ..., col_ts (timestamp column). Now i want ...
I would like to use a variable for the number of rows used in an 'OVER clause' statement. Up to now I only get it working by creation of the sql state ...
I really need to take what I have as a result of a CTE, and calculate the cummulative value of groups of data. The dataset is: What I want is an a ...
I am trying to use the OVER Clause to return one row. My code is as follow: I want to return: Instead what returns is: How do I get just the ...
I am facing a problem where I have a table called Group and a table called Entry. The Group table has a primary key Id. The Entry table has a primary ...
My query is designed to add an additional field named "WeightFactor" to the end of a table. My SQL code is below. When I attempt to run I receive the ...
I am trying to use the over function to count the number of events which start between the start and end date of the current row for all rows. I.e. a ...
I get an execution error in following SQL script: Error message Incorrect syntax near 'order' Can anyone tell me what's wrong with my syntax ...