How To Use SQL To Query A Lotto Combination File

How To Use SQL To Query A Lotto Combination File

Latest Casino News 07 Apr , 2017 0

Reducing unlikely lotto combinations is the main objective for many lottery players. This article explains how to use Structured Query Language, or SQL, to identify specific numeric patterns.

What Does SQL Have To Do With Lotto Calculations?

SQL is a popular language for querying a database. Let's find out how it can help with lotto selections.

As an example, I'm using the popular Prime lotto system for my combination file. In each line of 6 numbers there are:

  • 3 even numbers
  • 1 non-prime odd
  • 2 primes

There are 575,586 lines altogether, but some of the combinations might look like this:

1 2 3 8 12 32

5 11 12 18 21 32

3 4 10 12 13 33

Some players think consecutive balls like "1,2,3" are unlikely to occur so seek to remove them from selections. You can use SQL to query the file; initially to count the lines with your criteria and then to generate a new series with or without your specified parameters.

You will need to import the file into a database. For researching SQL queries you can use a simple desktop application like MS Access which I'm found is good for up to around 100,000 combinations. We won't be looking at how to use these applications and will instead focus on using the SQL coding.

I'm using MS Access for this example and my table holds the first 20,000 lotto lines of the Prime system.

Examples Of Using SQL On A Lotto Combinations File

Let's jump into some simple examples; we can start with a combination count using various parameters.

The database structure is just a single table comprising 6 numbers.

Lines containing "1,2,3":

select count(n1) AS Count

from PrimeLottoSystem20k

where n1<>1 and n2<>2 and n3<>3;

If you consider the query in terms of everyday language, it's quite simple.

"Please count how many lines there are where the first three numbers are not 1,2, or 3."

When I ran that query in Access, it returned a count of 17,093. That means there are over 17,000 combinations that contain neither "1,2,3" in the first 20,000 lines

Here's a query to determine how many lines contain only numbers greater that 10.

select Count(n1) as count

from PrimeLottoSystem20k

where n1>10 and n2>10 and n3>10 and n4>10 and n5>10 and n6>10

In my database table, the count was zero as the sample data wasn't large enough to meet the parameters.

You can probably see that a database application like MS Access isn't powerful enough to carry out meaningful research but is a starting point for learning about SQL.

Summary

This article has introduced the concept of using SQL to research lotto numbers. The innovations possible are limited only by your imagination and willingness to learn a new skill.

[ad_2]

Source by A. Lewis Gibson

LEAVE A REPLY

Your email address will not be published.

*

Currently you have JavaScript disabled. In order to post comments, please make sure JavaScript and Cookies are enabled, and reload the page. Click here for instructions on how to enable JavaScript in your browser.

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close