← Back to Blog

SQL for Lottery Analysis, Part 3: Jackpot Rollover Streaks

December 2, 2026  ·  10 min read  ·  Education

SQL for Lottery Analysis series

  1. Part 1: Count how often each number is drawn
  2. Part 2: Find "overdue" numbers with window functions
  3. Part 3: Measure jackpot rollover streaks (you are here)
  4. Part 4: Same number, same day, different states
  5. Part 5: Test it all: why none of it predicts a draw

Free practice data: SQLite database · Powerball CSV · Pick 3/Pick 4 CSV

When nobody wins the Powerball jackpot, it rolls over and grows. When someone wins, it resets to the starting amount. A stretch of draws between two wins is a jackpot run, and finding runs in a table is a classic SQL puzzle known as "gaps and islands." This part solves it with the jackpot column in the sample database, then checks the answer against official records, which turns up a lesson about trusting data. For how rollovers work, see how jackpot rollovers work.

Step 1: Compare each draw with the one before

LAG(jackpot), the window function from Part 2, puts the previous draw's jackpot next to the current one. Here are the draws around Christmas 2025:

SELECT draw_date,
       jackpot,
       LAG(jackpot) OVER (ORDER BY draw_date) AS previous_jackpot
FROM powerball_draws
WHERE draw_date BETWEEN '2025-12-17' AND '2025-12-31';

Result:

draw_datejackpotprevious_jackpot
2025-12-171266700000NULL
2025-12-2014346000001266700000
2025-12-2215866000001434600000
2025-12-2418168000001586600000
2025-12-27211000001816800000
2025-12-293430000021100000
2025-12-315340000034300000

The jackpot climbed to $1,816,800,000 on December 24, then the next draw's jackpot was $21 million (Powerball.com). That drop is the signature of a win. Powerball confirms a single ticket sold in Arkansas won a $1.817 billion jackpot in the December 24, 2025 drawing (Powerball.com). The first row shows NULL because LAG only looks inside the rows the query returns, and the window starts there.

Step 2: List the wins

If the jackpot is lower than the draw before, the draw before was won. That rule finds the wins. Here it is for 2026, up to Powerball's November 5 announcement of the New Jersey win:

WITH flagged AS (
  SELECT draw_date,
         jackpot,
         LAG(draw_date) OVER (ORDER BY draw_date) AS previous_draw,
         LAG(jackpot) OVER (ORDER BY draw_date) AS previous_jackpot
  FROM powerball_draws
)
SELECT previous_draw AS draw_won,
       previous_jackpot AS jackpot_won,
       draw_date AS next_draw,
       jackpot AS new_jackpot
FROM flagged
WHERE jackpot < previous_jackpot
  AND draw_date BETWEEN '2026-01-01' AND '2026-11-07'
ORDER BY draw_date;

Result:

draw_wonjackpot_wonnext_drawnew_jackpot
2026-01-212093000002026-01-2420000000
2026-03-022508000002026-03-0420000000
2026-04-062310000002026-04-0820000000
2026-04-291430000002026-05-0220000000
2026-08-1210400000002026-08-1520000000
2026-11-048470000002026-11-0720000000

Powerball's own list of 2026 jackpot wins in that announcement is January 21, March 2, April 6, April 29, May 2, August 12 and November 4 (Powerball.com). The query found six of the seven. The one it missed is a useful lesson.

On April 29, 2026, tickets in Indiana and Kansas won $143 million. Then on May 2, the very next drawing, tickets in Florida and Texas split the $20 million starting jackpot (Powerball.com). The jackpot went from $20 million to $20 million, so it never dropped, and the "lower than before" rule couldn't see the second win. Every query rests on an assumption, and the way to find where it breaks is to check the results against an outside source.

The amounts match Powerball's announcements too: $1.040 billion in Illinois on August 12 (Powerball.com) and $847 million in New Jersey on November 4 (Powerball.com). For won draws, this table holds the amount the lottery announced, which can be higher than the estimate advertised before the draw.

Step 3: Number the runs

Here's the gaps-and-islands trick in two steps.

  1. Mark each draw where a new run starts: 1 when the jackpot dropped, 0 otherwise.
  2. Take a running total of those marks with SUM(...) OVER (ORDER BY draw_date). The total goes up by one at the start of each run and stays the same inside it, so it works as a run number.

Then GROUP BY the run number, the same way Part 1 grouped by ball:

WITH flagged AS (
  SELECT draw_date,
         jackpot,
         CASE WHEN jackpot < LAG(jackpot) OVER (ORDER BY draw_date)
              THEN 1 ELSE 0 END AS new_run
  FROM powerball_draws
),
runs AS (
  SELECT draw_date,
         jackpot,
         SUM(new_run) OVER (ORDER BY draw_date) AS run_id
  FROM flagged
)
SELECT MIN(draw_date) AS run_started,
       MAX(draw_date) AS last_draw,
       COUNT(*) AS draws_in_run,
       MAX(jackpot) AS top_jackpot
FROM runs
GROUP BY run_id
ORDER BY draws_in_run DESC, run_started
LIMIT 10;

Result:

run_startedlast_drawdraws_in_runtop_jackpot
2025-09-082025-12-24471816800000
2026-05-022026-08-12451040000000
2025-06-022025-09-06421787400000
2021-06-092021-10-0441699800000
2022-08-062022-11-07412040100000
2024-01-032024-04-06411325900000
2021-10-062022-01-0540632600000
2023-04-222023-07-19391079800000
2020-09-192021-01-2036731000000
2023-07-222023-10-11361764900000

Step 4: Check the answer against official records

Two more caveats apply to any table like this. The first run starts before the table does, so its length is cut short, and the last run is still going, so it isn't finished.

Step 5: How long do runs usually last?

A CASE expression sorts values into labeled buckets, a handy way to build a histogram in SQL:

WITH flagged AS (
  SELECT draw_date,
         jackpot,
         CASE WHEN jackpot < LAG(jackpot) OVER (ORDER BY draw_date)
              THEN 1 ELSE 0 END AS new_run
  FROM powerball_draws
),
runs AS (
  SELECT draw_date,
         jackpot,
         SUM(new_run) OVER (ORDER BY draw_date) AS run_id
  FROM flagged
),
run_lengths AS (
  SELECT run_id, COUNT(*) AS draws_in_run
  FROM runs
  GROUP BY run_id
)
SELECT CASE WHEN draws_in_run < 10 THEN '1-9'
            WHEN draws_in_run < 20 THEN '10-19'
            WHEN draws_in_run < 30 THEN '20-29'
            WHEN draws_in_run < 40 THEN '30-39'
            ELSE '40+' END AS run_length,
       COUNT(*) AS runs
FROM run_lengths
GROUP BY run_length
ORDER BY MIN(draws_in_run);

Result:

run_lengthruns
1-917
10-1932
20-2914
30-398
40+7

Most runs end within 30 draws. Runs of 40 or more, the ones that produce billion-dollar headlines, are rare. The Step 1 rows show how fast a jackpot climbs late in a long run: more than $150 million a draw in the last week of the 2025 run. Our Powerball jackpot history covers the biggest ones.

Try it yourself

About the practice data

The sample files come from the DrawAnalytics results database, the same records behind our Powerball pages and state results pages. They're free to use; if you publish something made with them, please credit DrawAnalytics with a link.

Two things are worth knowing. The jackpot column is the jackpot advertised for each draw; for a draw where the jackpot was won, it's the amount the lottery announced, which can be a little higher than the estimate before the draw. And a few individual draws in our database have been wrong before, so for anything that matters, such as checking a ticket, use the lottery's official results. Powerball's are at powerball.com. Developers who want more data can use our free results API.

Next: Part 4: Same number, same day, different states

Sources

DrawAnalytics is an informational service. We do not sell predictions or guarantee outcomes. Lottery drawings are random — past results do not predict future drawings. Play responsibly. 1-800-GAMBLER.

Need to talk to someone about gambling?

Free, confidential help is available 24/7. Call or text 1-800-GAMBLER (1-800-426-2537) or visit ncpgambling.org.

DrawAnalytics is an informational and entertainment service. We provide historical lottery data analysis and pattern exploration tools. We do not sell predictions, we do not guarantee any outcome, and we make no representation that any tool on this site improves a user's probability of winning any lottery game. Lottery drawings are random. Past results do not predict future drawings. DrawAnalytics is independent and is not affiliated with or endorsed by any state lottery, the Multi-State Lottery Association, Powerball or Mega Millions. Game names are trademarks of their respective owners. Results are collected from public sources and may contain errors; official lottery results prevail. You must be 18 or older (21+ in some states) to play state lottery games. If you or someone you know has a gambling problem, call 1-800-GAMBLER or visit ncpgambling.org.