In an interview for the NoCOUG Journal, Steven Feuerstein was asked: “SQL is a set-oriented non-procedural language; i.e., it works on sets and does not specify access paths. PL/SQL on the other hand is a record-oriented procedural language, as is very clear from the name. What is the place of a record-oriented procedural language in the relational world?”

Steven replied:  “Its place is proven: SQL is not a complete language. Some people can perform seeming miracles with straight SQL, but the statements can end up looking like pretzels created by someone who is experimenting with hallucinogens. We need more than SQL to build our applications, whether it is the implementation of business rules or application logic. PL/SQL remains the fastest and easiest way to access and manipulate data in an Oracle RDBMS, and I am certain it is going to stay that way for decades.”

To prove Steven correct, NoCOUG has held four international SQL challenges.

First International NoCOUG SQL challenge (2009)

An ancient 20-sided die was discovered in the secret chamber of mystery at Hogwash School of Es-Cue-El. A mysterious symbol was inscribed on each face of the die. The great Wizard of Odds discovered that each symbol represents a number. The great wizard discovered that the die was biased: that is, it was more probable that certain numbers would be displayed than others if the die were used in a game of chance. The great wizard recorded this information in tabular fashion as described below.

Name

Null?

Type

FACE_ID

NOT NULL

INT

FACE_VALUE

NOT NULL

INT

PROBABILITY

NOT NULL

REAL

The great wizard then invited all practitioners of the ancient arts of Es-Cue-El to create an Es-Cue-El spell to display the probabilities of obtaining various sums when the die was thrown “N” times in succession in a game of chance.

The contest was a great success; nine solutions were found by participants in seven countries and three continents but the winner, Alberto Dell’Era from Italy, rose above the competition by implementing Discrete Fourier Transforms and becoming the first knight of the August Order of the Wooden Pretzel. You can read an explanation of his wonderful solution here. Alberto also implemented Fast Fourier Transforms but we won’t even go there.

Second International NoCOUG SQL Challenge (2011)

An ancient manuscript titled “Love Your Data” was discovered in the secret chamber of mystery at Hogwash School of Es-Cue-El. The manuscript was covered with mysterious words and the great Wizard of Odds implored contestants to create an Es-Cue-El spell that revealed the secret message. Here is a short excerpt from the ancient manuscript.

 

A

 

COMPREHENSION

ABILITY

OLD

 

ABOUT

 

 

ALWAYS

 

SCIENCE

AND

PHYSICS

 

ANY

 

 

AS

 

SO

ASK

ABILITY

Andre Araujo (Australia), Rob van Wijk (Netherlands), and Ilya Chuhnakov (Russia) submitted solutions and became the second, third, and fourth knights of the August Order of the Wooden Pretzel. Ilya submitted two solutions: one using the MODEL clause and one using recursive common table expressions. You can read their wonderful solutions here.

Third International NoCOUG SQL Challenge (2012)

The Wicked Witch of the West had invited six friends to the Third Annual Witching & Wizarding Ball at Pythian Academy of Es-Cue-El & No-Es-Cue-El. Burdock Muldoon and Carlotta Pinkstone both said they would come if Albus Dumbledore came. Daisy Dodderidge said she would come if Albus Dumbledore and Burdock Muldoon both came. And so on and so forth. The Wicked Witch of the West needed an Es-Cue-El or No-Es-Cue-El spell to determine whom she needed to persuade to attend the wizarding ball in order to ensure that all her invitees attend.

Master sorcerer Lukasz Plata of Poland not only solved the problem with a single SQL statement but provided a proof that his solution was correct. He became the fifth knight of the August Order of the Wooden Pretzel. You can read his wonderful solution here.

Fourth International NoCOUG SQL Challenge (2015)

Albert and Bernard just became friends with Cheryl, and they want to know when her birthday is. Cheryl gives them a list of 10 possible dates:

May

 

15

16

 

 

19

June

 

 

 

17

18

 

July

14

 

16

 

 

 

August

14

15

 

17

 

 

Cheryl then tells Albert and Bernard separately the month and the day of her birthday respectively.

  • Albert: I don’t know when Cheryl’s birthday is, but I know that Bernard doesn’t know too.
  • Bernard: At first I don’t [sic] know when Cheryl’s birthday is, but I know now.
  • Albert: Then I also know when Cheryl's birthday is.

So when is Cheryl’s birthday?

Chris Goerg elegantly solved this challenge with the MODEL clause and became the sixth knight of the August Order of the Wooden Pretzel. You can read his wonderful solution here.