Author
 Joe Celko
RSS
E-Mail

Profile of Joe Celko

News & Commentary Posts: 19
Articles by Joe Celko

Celko SQL Puzzle: Calculating Commissions

9/2/2008
How many ways can you come up with to keep track of commission amounts?... One way of spotting a design problem is when you have to use a VIEW or CTE over and over to answer basic questions. This implies that the schema has spread information over many tables that should be in one table or that it has aggregated data in one row that should be split out into multiple rows.

Post a Comment

Celko's Theater-Seat-Assignment SQL Puzzle

11/5/2007
In many situations, auxiliary tables are faster and more appropriate than SQL with computations. To illustrate, consider a classic problem. You have a theater and a bunch of seats you wish to sell for a performance (or think of seats for an airline flight). The seats have a sequential serial number from 1 to (n) for inventory. But in the theater building and on the tickets, the seats are arranged in rows of (k) seats and referenced by the pair (row_nbr, seat_within_row_nbr).

Post a Comment

Celko on SQL: Auxiliary Tables vs. Declarative Coding

11/5/2007
Auxiliary tables are not only portable across SQL environments and adaptable to external software, they're often a faster, better choice than SQL with computations. And as chips and hardware get faster and cheaper, the auxiliary table approach will make even more sense.

Post a Comment

And the 'Email Validation' SQL Puzzle Winner Is...

9/27/2007
The winner of last week's 'Email Address Validation' SQL puzzle is "Guest" (see comments), because he/she bothered to do the research and come up with an answer that is generic enough to port to any SQL dialect with a SIMILAR TO or a regexp() function. So, "Guest" please email me with your snail mail address (and some attempt to validate your SQL mastery/identity) and I'll send you one of my books. Here's my answer to last week's puzzle...

Post a Comment

Celko's Email-Address-Validation SQL Puzzle

9/17/2007
You've probably noticed that many Web sites use the customer's email addresses as an identifier. We have all received messages something like this: "Thanks for signing up for 'The Leech Farmer's Monthly' email newsletter! We are sending you a confirmation at your email address with your temporary password." How many ways can you write CHECK() column constraint to validate an email address?

Post a Comment

Celko's 'Can't Be Your Own Supervisor' SQL Puzzle

8/20/2007
A small database has the following business rules: 1) Every person in the database is uniquely defined by a single key, their user_id; 2) Everyone is assigned a job category, call them 'A', 'B' and 'X'; 3) Everyone in job category 'X' has a supervisor who must be in either job category 'A' or job category 'B'; 4) Nobody can be their own supervisor. One proposal was to divide job category 'X' into two, call them 'XA' and 'XB' respectively. All the 'XA' people would have 'A' supervisors, and all

Post a Comment

Cooking an old puzzle

4/25/2005
I just got an email about Puzzle #11 in my old book SQL PUZZLES & ANSWER from Rainer Gemulla at TU Dresden, Fak. Informatik, Institut SyA, in Dresden, Germany. It is a very nice cook and it is embarassing to see how needlessly complex the other answers were:

Post a Comment

More on streaming databases

4/16/2005
There is a good article on streaming databases with lots of product names and stuff suitable for googling inthe current issue of INTELLIGENT ENTERPRISE.

Post a Comment

An Old Celko Puzzle

3/25/2005
If you go over to http://www.dbdebunk.com/page/page/666711.htm, you will find a letter to the editor from someone named PV about an old column of mine. Here is the jist of it: Back in June of 1996, Jack Wells submitted this SQL problem to my SQL FOR SMARTIES column.

Post a Comment

Hello everyone!

3/15/2005
INTELLIGENT ENTERPRISE once more changed format at the end of last year and my long-time column went away. However CMP asked me if I would like to do a blog on SQL, databases and the other things that interests me.

Post a Comment
The Business of Going Digital
The Business of Going Digital
Digital business isn't about changing code; it's about changing what legacy sales, distribution, customer service, and product groups do in the new digital age. It's about bringing big data analytics, mobile, social, marketing automation, cloud computing, and the app economy together to launch new products and services. We're seeing new titles in this digital revolution, new responsibilities, new business models, and major shifts in technology spending.
Register for InformationWeek Newsletters
White Papers
Current Issue
InformationWeek Tech Digest - August 27, 2014
Who wins in cloud price wars? Short answer: not IT. Enterprises don't want bare-bones IaaS. Providers must focus on support, not undercutting rivals.
Flash Poll
Video
Slideshows
Twitter Feed
InformationWeek Radio
Sponsored Live Streaming Video
Everything You've Been Told About Mobility Is Wrong
Attend this video symposium with Sean Wisdom, Global Director of Mobility Solutions, and learn about how you can harness powerful new products to mobilize your business potential.