2
kudos
spam Kudos Remove

Celko's Summer SQL Stumpers: Prime numbers

published 1026 days, 4 hours, 47 minutes ago posted by sasa 1026 days, 20 hours, 29 minutes ago
Tuesday, July 28, 2009 12:05:09 PM GMT Monday, July 27, 2009 8:23:07 PM GMT

I was teaching SQL classes for YAPC-10 (“Yet Another PERL Conference” #10) at Carnegie Mellon University at the end of June 2009. For the record, I have never used PERL and had to Google up an overview before I went; it is a very different creature from SQL.

One of my students asked if you could write an SQL statement to generate the prime numbers less than 1000 (or any other limit) that scales well. He was bothered by the lack of loops in SQL and a Prime Number sieve is a common PERL programming exercise. You can Google it and see an animation at Eratosthenes' sieve and some PERL code at Sieve of Eratosthenes with closures...

category: Query | clicked: 0 | | source: www.sqlservercentral.com | show counter code
tags: Puzzle

No comments yet, be the first one to post comment.

To post your comment please login or signup