I’ll wait for those who want to go to take your leave… Go ahead… It's okay, I won't take it personally.
Okay, for those of you who are left, let’s say that you have a business selling Pizza Baking Pans, and therefore you have a table with a Description, the Diameter (in inches), and the Height (in inches) of the pan:
create table #PizzaBakingPansAnd let’s say your customers want to know the volume (in cubic inches) of these assorted pans.
ID int identity(1,1) primary key
select 'Traditional Personal', 8.0,0.5
union all select 'Traditional Small' ,10.0,0.5
union all select 'Traditional Medium' ,14.0,0.5
union all select 'Traditional Large' ,18.0,0.5
union all select 'Deep-Dish Small' ,10.0,3.5
union all select 'Deep-Dish Medium' ,14.0,3.5
union all select 'Deep-Dish Large' ,18.0,3.5
Well, you may recall from your high school geometry class that the volume of a cylindrical object is defined as V = πr²h. So, with that in mind, you create the following SQL query:
select DescriptionSee? I told you I was going to be frivolous and tongue-in-cheek. Don’t say I didn’t warn you.
cross apply (select Z=Diameter/2
Even though it’s a key ingredient of pi*z*z*a, please refrain from throwing tomatoes at your screen. It's not my fault anyway. You can blame it on my daughter… she's the one who e-mailed me this joke.
Next time I promise I’ll have the usual challenging and mind-blowing content.