O'Reilly logo

Joe Celko's SQL for Smarties, 4th Edition by Joe Celko

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

38

Temporal Queries

Temporal data is the hardest type of data for people to handle conceptually. Perhaps time is difficult because it is dynamic and all other data types are static or perhaps because time allows multiple parallel events. This is an old puzzle that still catches people.

If a hen and a half lays an egg and a half in a day and a half, how many eggs will five hens lay in six days? Do not look at the rest of the page—try to answer the question in your head.

Suppose two hens lay four eggs in three days. That means that each hen laid two eggs during those three days, so each hen lays 2/3 of an egg per day. Now if you had five hens and six days, they would lay five times as many eggs per day, totaling 10/3 per day; multiply that by 6 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required