Edit Sorry for being unclear in the first post. If the item appears only once, it should also be included. Please, check updated sample table… I have a table of record of sales of each item per day….
Tag: gaps-and-islands
Find the longest streak of perfect scores per player
I have a the following result from a SELECT query with ORDER BY player_id ASC, time ASC in PostgreSQL database: I’m trying to find each player’s longest streak where points = 100, with the tiebreaker being whichever streak began most recently. I also need to determine the time at which that player’s longest streak began. The expected result would be:
Gaps And Islands: Splitting Islands Based On External Table
My scenario started off similar to a Island and Gaps problem, where I needed to find consecutive days of work. My current SQL query answers “ProductA was produced at LocationA from DateA through DateB,…
Oracle: Analytical functions Sub totals after each change in value
I have the following data (order of records as in the example): A B 1 10 1 20 1 30 1 40 2 50 2 65 2 75 1 89 1 100 from SQL: with x as ( select A, B from ( select 1 as A, …
Find unmatched rows between two tables
Given this setup: CREATE TABLE table1 (column1 text, column2 text); CREATE TABLE table2 (column1 text, column2 text); INSERT INTO table1 VALUES (‘A’, ‘A’) , (‘B’, ‘N’) , (‘C’, ‘C’) , (‘B’, ‘A’)…
How to check any missing number from a series of numbers?
I am doing a project creating an admission system for a college; the technologies are Java and Oracle. In one of the tables, pre-generated serial numbers are stored. Later, against those serial numbers, the applicant’s form data will be entered. My requirement is that when the entry process is completed I will have to generate a Lot wise report. If