CASE EXPRESSIONS

CASE expressions allow SQL users to implement conditional logic similar to the ubiquitous IF…THEN…ELSE form found in other programming languages such as python, java, and c+ among others. SQL’s CASE expressions come in two forms, simple and searched. The focus of this page is to explore each of these forms through real-world problems.

Before reading further, consider reviewing the Example Data section below to familiarize yourself with the data being used throughout the examples on this page. If you are already familiar with the data, then skip to the Simple CASE Expressions section

Example Data
The schemas, corresponding tables, and data used in the example problems can be found at livesql.oracle.com. To more easily follow the examples covered on this page, consider first reading the table descriptions below and reviewing each table’s contents. To review the data maintained in each table, click on the icon next to the table name. To hide the data, click the icon again.

oe.customers
Contains information related to each customer. A customer may or may not have placed an order. Therefore, it’s possible for a customer to exist and not be represented in the orders table. There is one row per customer.
customer_idcust_first_namecust_last_namenls_territorycredit_limitcust_emailaccount_mgr_iddate_of_birthmarital_statusgenderincome_level
144SivajiLandisAMERICA500Sivaji.Landis@GOLDENEYE.EXAMPLE.COM1459-Feb-70marriedMF: 110,000 – 129,999
145MammuttiPacinoAMERICA500Mammutti.Pacino@GREBE.EXAMPLE.COM14519-Feb-46singleMF: 110,000 – 129,999
146EliaFawcettAMERICA500Elia.Fawcett@JACANA.EXAMPLE.COM14512-Mar-63marriedFL: 300,000 and above
147IshwaryaRobertsAMERICA600Ishwarya.Roberts@LAPWING.EXAMPLE.COM14521-Mar-44singleFG: 130,000 – 149,999
148GustavSteenburgenAMERICA600Gustav.Steenburgen@PINTAIL.EXAMPLE.COM14510-Apr-50marriedMF: 110,000 – 129,999
149MarkusRamplingAMERICA600Markus.Rampling@PUFFIN.EXAMPLE.COM14520-Apr-41singleMD: 70,000 – 89,999
150GoldieSlaterAMERICA700Goldie.Slater@PYRRHULOXIA.EXAMPLE.COM14511-May-51marriedMD: 70,000 – 89,999
151DivineAykroydAMERICA700Divine.Aykroyd@REDSTART.EXAMPLE.COM14520-May-76singleMF: 110,000 – 129,999
152DieterMatthauAMERICA700Dieter.Matthau@VERDIN.EXAMPLE.COM1459-Jun-22marriedMA: Below 30,000
153DivineSheenAMERICA700Divine.Sheen@COWBIRD.EXAMPLE.COM14520-Jun-67singleMI: 170,000 – 189,999
154FredericGrodinAMERICA700Frederic.Grodin@CREEPER.EXAMPLE.COM14529-Jun-65singleFL: 300,000 and above
155FredericoRomeroAMERICA700Frederico.Romero@CURLEW.EXAMPLE.COM1459-Jul-42marriedME: 90,000 – 109,999
156GoldieMontandAMERICA700Goldie.Montand@DIPPER.EXAMPLE.COM1459-Aug-55marriedFF: 110,000 – 129,999
157SidneyCapshawAMERICA700Sidney.Capshaw@DUNLIN.EXAMPLE.COM14518-Aug-69singleMG: 130,000 – 149,999
158FredericoLyonAMERICA700Frederico.Lyon@FLICKER.EXAMPLE.COM1457-Sep-70marriedMJ: 190,000 – 249,999
159EddieBoyerAMERICA700Eddie.Boyer@GALLINULE.EXAMPLE.COM1457-Oct-53marriedMG: 130,000 – 149,999
160EddieSternAMERICA700Eddie.Stern@GODWIT.EXAMPLE.COM1456-Nov-50marriedMG: 130,000 – 149,999
161ErnestWeaverAMERICA900Ernest.Weaver@GROSBEAK.EXAMPLE.COM14516-Nov-42singleMB: 30,000 – 49,999
162ErnestGeorgeAMERICA900Ernest.George@LAPWING.EXAMPLE.COM1457-Dec-75marriedMD: 70,000 – 89,999
164CharlotteKazanAMERICA1200Charlotte.Kazan@MERGANSER.EXAMPLE.COM1455-Jan-54marriedMI: 170,000 – 189,999
165CharlotteFondaAMERICA1200Charlotte.Fonda@MOORHEN.EXAMPLE.COM1455-Feb-56marriedMJ: 190,000 – 249,999
166DheerajAlexanderAMERICA1200Dheeraj.Alexander@NUTHATCH.EXAMPLE.COM14514-Feb-50singleFG: 130,000 – 149,999
167GerardHersheyAMERICA1200Gerard.Hershey@PARULA.EXAMPLE.COM1456-Mar-48marriedMD: 70,000 – 89,999
169DheerajDavisAMERICA1200Dheeraj.Davis@PIPIT.EXAMPLE.COM1455-Apr-81marriedFF: 110,000 – 129,999
170Harry DeanFondaAMERICA1200HarryDean.Fonda@PLOVER.EXAMPLE.COM14515-Apr-88singleMG: 130,000 – 149,999
171HemaPowellAMERICA1200Hema.Powell@SANDERLING.EXAMPLE.COM1455-May-53marriedMD: 70,000 – 89,999
172Harry MeanPeckinpahAMERICA1200HarryMean.Peckinpah@VERDIN.EXAMPLE.COM14515-May-59singleMI: 170,000 – 189,999
174BlakeSeignierAMERICA1200Blake.Seignier@GALLINULE.EXAMPLE.COM14914-Jun-88singleMH: 150,000 – 169,999
175ClaudePowellAMERICA1200Claude.Powell@GODWIT.EXAMPLE.COM1494-Jul-46marriedMF: 110,000 – 129,999
176FayeGlennAMERICA1200Faye.Glenn@GREBE.EXAMPLE.COM14914-Jul-47singleFB: 30,000 – 49,999
177GerhardSeignierAMERICA1200Gerhard.Seignier@JACANA.EXAMPLE.COM1493-Aug-78marriedME: 90,000 – 109,999
179Harry deanForrestAMERICA1200Harrydean.Forrest@KISKADEE.EXAMPLE.COM14912-Sep-74singleMG: 130,000 – 149,999
180Harry deanCageAMERICA1200Harrydean.Cage@LAPWING.EXAMPLE.COM1492-Oct-75marriedFF: 110,000 – 129,999
181LaurenHersheyAMERICA1200Lauren.Hershey@LIMPKIN.EXAMPLE.COM14912-Oct-65singleFH: 150,000 – 169,999
183LaurenAltmanAMERICA1200Lauren.Altman@MERGANSER.EXAMPLE.COM1491-Nov-68marriedFC: 50,000 – 69,999
184Mary BethRobertsAMERICA1200MaryBeth.Roberts@NUTHATCH.EXAMPLE.COM14911-Nov-27singleMA: Below 30,000
262FredReynoldsAMERICA3600Fred.Reynolds@WATERTHRUSH.EXAMPLE.COM14913-Jul-58marriedMF: 110,000 – 129,999
263FredLithgowAMERICA3600Fred.Lithgow@WHIMBREL.EXAMPLE.COM14923-Jul-79singleMD: 70,000 – 89,999
265IreneLaughtonAMERICA3600Irene.Laughton@ANHINGA.EXAMPLE.COM14922-Aug-73singleFJ: 190,000 – 249,999
266PremCardinaleAMERICA3700Prem.Cardinale@BITTERN.EXAMPLE.COM1491-Sep-70singleML: 300,000 and above
267PremWalkenAMERICA3700Prem.Walken@BRANT.EXAMPLE.COM14511-Sep-53marriedFG: 130,000 – 149,999
268KyleSchneiderAMERICA3700Kyle.Schneider@DUNLIN.EXAMPLE.COM14521-Sep-52singleFG: 130,000 – 149,999
270MegDerekAMERICA3700Meg.Derek@FLICKER.EXAMPLE.COM14510-Nov-71marriedMF: 110,000 – 129,999
271ShelleyPeckinpahAMERICA3700Shelley.Peckinpah@GODWIT.EXAMPLE.COM14520-Nov-87singleFD: 70,000 – 89,999
272PremGarciaAMERICA3700Prem.Garcia@JACANA.EXAMPLE.COM14510-Dec-60marriedMI: 170,000 – 189,999
274BobMcCarthyAMERICA5000Bob.McCarthy@ANI.EXAMPLE.COM14919-Jan-46singleMA: Below 30,000
275DomMcQueenAMERICA5000Dom.McQueen@AUKLET.EXAMPLE.COM1498-Feb-84marriedFG: 130,000 – 149,999
276DomHoskinsAMERICA5000Dom.Hoskins@AVOCET.EXAMPLE.COM14910-Mar-51marriedME: 90,000 – 109,999
101ConstantinWellesAMERICA100Constantin.Welles@ANHINGA.EXAMPLE.COM14520-Feb-72marriedMB: 30,000 – 49,999
102HarrisonPacinoAMERICA100Harrison.Pacino@ANI.EXAMPLE.COM1452-Mar-53singleMI: 170,000 – 189,999
103ManishaTaylorAMERICA100Manisha.Taylor@AUKLET.EXAMPLE.COM14522-Mar-83marriedFH: 150,000 – 169,999
104HarrisonSutherlandAMERICA100Harrison.Sutherland@GODWIT.EXAMPLE.COM14531-Mar-72singleFH: 150,000 – 169,999
105MatthiasMacGrawAMERICA100Matthias.MacGraw@GOLDENEYE.EXAMPLE.COM14521-Apr-69marriedFC: 50,000 – 69,999
106MatthiasHannahAMERICA100Matthias.Hannah@GREBE.EXAMPLE.COM14530-Apr-60singleMF: 110,000 – 129,999
107MatthiasCruiseAMERICA100Matthias.Cruise@GROSBEAK.EXAMPLE.COM14521-May-69marriedFG: 130,000 – 149,999
108MeenakshiMasonAMERICA100Meenakshi.Mason@JACANA.EXAMPLE.COM14520-Jun-57marriedMH: 150,000 – 169,999
109ChristianCageAMERICA100Christian.Cage@KINGLET.EXAMPLE.COM14530-Jun-38singleMF: 110,000 – 129,999
110CharlieSutherlandAMERICA200Charlie.Sutherland@LIMPKIN.EXAMPLE.COM14520-Jul-51marriedMG: 130,000 – 149,999
111CharliePacinoAMERICA200Charlie.Pacino@LONGSPUR.EXAMPLE.COM14529-Jul-48singleMG: 130,000 – 149,999
112GuillaumeJacksonAMERICA200Guillaume.Jackson@MOORHEN.EXAMPLE.COM14519-Aug-54marriedMI: 170,000 – 189,999
113DanielCostnerAMERICA200Daniel.Costner@PARULA.EXAMPLE.COM14529-Aug-77singleMI: 170,000 – 189,999
114DianneDerekAMERICA200Dianne.Derek@SAW-WHET.EXAMPLE.COM14517-Sep-48marriedMH: 150,000 – 169,999
115GeraldineSchneiderAMERICA200Geraldine.Schneider@SCAUP.EXAMPLE.COM14518-Oct-31marriedMB: 30,000 – 49,999
116GeraldineMartinAMERICA200Geraldine.Martin@SCOTER.EXAMPLE.COM14528-Oct-27singleMA: Below 30,000
117GuillaumeEdwardsAMERICA200Guillaume.Edwards@SHRIKE.EXAMPLE.COM14516-Nov-52marriedME: 90,000 – 109,999
118MauriceMahoneyAMERICA200Maurice.Mahoney@SNIPE.EXAMPLE.COM14527-Nov-66singleMF: 110,000 – 129,999
119MauriceHasanAMERICA200Maurice.Hasan@STILT.EXAMPLE.COM14517-Dec-65marriedMG: 130,000 – 149,999
120DianeHigginsAMERICA200Diane.Higgins@TANAGER.EXAMPLE.COM14526-Dec-84singleMH: 150,000 – 169,999
121DianneSenAMERICA200Dianne.Sen@TATTLER.EXAMPLE.COM14515-Jan-53marriedMH: 150,000 – 169,999
122MauriceDaltreyAMERICA200Maurice.Daltrey@TEAL.EXAMPLE.COM14515-Feb-43marriedMA: Below 30,000
185MatthewWrightAMERICA1200Matthew.Wright@OVENBIRD.EXAMPLE.COM1491-Dec-59marriedFG: 130,000 – 149,999
186MeenaAlexanderAMERICA1200Meena.Alexander@PARULA.EXAMPLE.COM14911-Dec-61singleFK: 250,000 – 299,999
188CharlotteBuckleyAMERICA1200Charlotte.Buckley@PINTAIL.EXAMPLE.COM14910-Jan-49singleFF: 110,000 – 129,999
277DonSiegelAMERICA5000Don.Siegel@BITTERN.EXAMPLE.COM14920-Mar-50singleMB: 30,000 – 49,999
278GvtzBradfordAMERICA5000Gvtz.Bradford@BULBUL.EXAMPLE.COM1498-Apr-64marriedMK: 250,000 – 299,999
279HollyKurosawaAMERICA5000Holly.Kurosawa@CARACARA.EXAMPLE.COM14919-Apr-61singleMI: 170,000 – 189,999
280RobMacLaineAMERICA5000Rob.MacLaine@COOT.EXAMPLE.COM1499-May-49marriedMB: 30,000 – 49,999
281DonBarkinAMERICA5000Don.Barkin@CORMORANT.EXAMPLE.COM14918-May-56singleMI: 170,000 – 189,999
282KurtDansonAMERICA5000Kurt.Danson@COWBIRD.EXAMPLE.COM1457-Jun-88marriedMH: 150,000 – 169,999
283KurtHeardAMERICA5000Kurt.Heard@CURLEW.EXAMPLE.COM14518-Jun-94singleMH: 150,000 – 169,999
308GlendaDunawayCHINA1200Glenda.Dunaway@DOWITCHER.EXAMPLE.COM1488-Jul-57marriedMC: 50,000 – 69,999
309GlendaBatesCHINA1200Glenda.Bates@DIPPER.EXAMPLE.COM14818-Jul-55singleMF: 110,000 – 129,999
323GoetzFalkINDIA5000Goetz.Falk@VEERY.EXAMPLE.COM1486-Aug-80marriedFG: 130,000 – 149,999
326HalOlinGERMANY2400Hal.Olin@FLICKER.EXAMPLE.COM1476-Sep-59marriedFH: 150,000 – 169,999
327HannahKanthGERMANY2400Hannah.Kanth@GADWALL.EXAMPLE.COM14715-Sep-56singleMF: 110,000 – 129,999
328HannahFieldGERMANY2400Hannah.Field@GALLINULE.EXAMPLE.COM1476-Oct-85marriedFG: 130,000 – 149,999
333MargretPowellITALY1200Margret.Powell@ANI.EXAMPLE.COM14716-Oct-53singleMG: 130,000 – 149,999
334Harry MeanTaylorAMERICA1200HarryMean.Taylor@REDPOLL.EXAMPLE.COM14715-Nov-81singleMI: 170,000 – 189,999
335MargritGarnerITALY500Margrit.Garner@STILT.EXAMPLE.COM1475-Dec-82marriedFH: 150,000 – 169,999
337MariaWardenITALY500Maria.Warden@TANAGER.EXAMPLE.COM1473-Jan-73marriedFB: 30,000 – 49,999
361MarilouChapmanITALY500Marilou.Chapman@TEAL.EXAMPLE.COM14711-Aug-89singleFD: 70,000 – 89,999
363KathyLambertITALY2400Kathy.Lambert@COOT.EXAMPLE.COM14731-Aug-56marriedMC: 50,000 – 69,999
360HelmutCapshawCHINA3600Helmut.Capshaw@TROGON.EXAMPLE.COM1481-Aug-77marriedMJ: 190,000 – 249,999
341KeirGeorgeITALY700Keir.George@VIREO.EXAMPLE.COM1473-Feb-63marriedFE: 90,000 – 109,999
342MarlonLaughtonITALY2400Marlon.Laughton@CORMORANT.EXAMPLE.COM14713-Feb-47singleFF: 110,000 – 129,999
343KeirChandarITALY700Keir.Chandar@WATERTHRUSH.EXAMPLE.COM1474-Mar-60marriedMG: 130,000 – 149,999
345KeirWeaverITALY700Keir.Weaver@WHIMBREL.EXAMPLE.COM1474-Apr-62marriedMH: 150,000 – 169,999
346MarlonClaptonITALY2400Marlon.Clapton@COWBIRD.EXAMPLE.COM14713-Apr-88marriedMK: 250,000 – 299,999
347KellyQuinlanITALY3600Kelly.Quinlan@PYRRHULOXIA.EXAMPLE.COM1473-May-29marriedFA: Below 30,000
349KenGlennITALY3600Ken.Glenn@SAW-WHET.EXAMPLE.COM1473-Jun-67marriedMK: 250,000 – 299,999
350KenChopraITALY3600Ken.Chopra@SCAUP.EXAMPLE.COM14713-Jun-51singleFF: 110,000 – 129,999
351KenWendersITALY3600Ken.Wenders@REDPOLL.EXAMPLE.COM1473-Jul-62marriedFF: 110,000 – 129,999
380MerylHoldenINDIA3700Meryl.Holden@DIPPER.EXAMPLE.COM14810-Oct-61singleFH: 150,000 – 169,999
447RichardCoppolaITALY500Richard.Coppola@SISKIN.EXAMPLE.COM14730-Oct-81marriedFC: 50,000 – 69,999
448RichardWintersITALY500Richard.Winters@SNIPE.EXAMPLE.COM14730-Nov-54marriedMF: 110,000 – 129,999
450RickLyonITALY1500Rick.Lyon@MERGANSER.EXAMPLE.COM1471-Jan-41marriedFF: 110,000 – 129,999
451RidleyHackmanITALY700Ridley.Hackman@ANHINGA.EXAMPLE.COM14711-Jan-50singleFH: 150,000 – 169,999
452RidleyCoyoteITALY700Ridley.Coyote@ANI.EXAMPLE.COM14731-Jan-49marriedMF: 110,000 – 129,999
454RobRussellINDIA5000Rob.Russell@VERDIN.EXAMPLE.COM1482-Mar-77marriedME: 90,000 – 109,999
458Robertde NiroINDIA3700Robert.deNiro@DOWITCHER.EXAMPLE.COM14812-Mar-86singleFH: 150,000 – 169,999
466RodolfoHersheyINDIA5000Rodolfo.Hershey@VIREO.EXAMPLE.COM14811-Apr-47singleMF: 110,000 – 129,999
467RodolfoDenchINDIA5000Rodolfo.Dench@SCOTER.EXAMPLE.COM1481-May-71marriedFF: 110,000 – 129,999
468RodolfoAltmanINDIA5000Rodolfo.Altman@SHRIKE.EXAMPLE.COM14811-May-83singleFF: 110,000 – 129,999
189GenaHarrisAMERICA1200Gena.Harris@PIPIT.EXAMPLE.COM14930-Jan-55marriedMF: 110,000 – 129,999
190GenaCurtisAMERICA1200Gena.Curtis@PLOVER.EXAMPLE.COM1499-Feb-82singleMJ: 190,000 – 249,999
191MaureenSandersAMERICA1200Maureen.Sanders@PUFFIN.EXAMPLE.COM14929-Feb-24marriedMA: Below 30,000
192SeanStockwellAMERICA1200Sean.Stockwell@PYRRHULOXIA.EXAMPLE.COM14930-Mar-56marriedMI: 170,000 – 189,999
193Harry deanKinskiAMERICA1200Harrydean.Kinski@REDPOLL.EXAMPLE.COM14930-Apr-55marriedMD: 70,000 – 89,999
194KathleenGarciaAMERICA1200Kathleen.Garcia@REDSTART.EXAMPLE.COM14930-May-71marriedFI: 170,000 – 189,999
195SeanOlinAMERICA1200Sean.Olin@SCAUP.EXAMPLE.COM1499-Jun-86singleFF: 110,000 – 129,999
196GerardDenchAMERICA1200Gerard.Dench@SCOTER.EXAMPLE.COM14929-Jun-53marriedFE: 90,000 – 109,999
197GerardAltmanAMERICA1200Gerard.Altman@SHRIKE.EXAMPLE.COM1498-Jul-84singleFF: 110,000 – 129,999
198Maureende FunesAMERICA1200Maureen.deFunes@SISKIN.EXAMPLE.COM14929-Jul-49marriedFD: 70,000 – 89,999
199ClintChapmanAMERICA1400Clint.Chapman@SNIPE.EXAMPLE.COM1497-Aug-52singleFF: 110,000 – 129,999
200ClintGielgudAMERICA1400Clint.Gielgud@STILT.EXAMPLE.COM14928-Aug-78marriedFE: 90,000 – 109,999
201EricPrashantAMERICA1400Eric.Prashant@TATTLER.EXAMPLE.COM14927-Sep-43marriedFC: 50,000 – 69,999
202IngridWellesAMERICA1400Ingrid.Welles@TEAL.EXAMPLE.COM14927-Oct-39marriedMD: 70,000 – 89,999
203IngridRamplingAMERICA1400Ingrid.Rampling@WIGEON.EXAMPLE.COM1495-Nov-48singleMF: 110,000 – 129,999
204CliffPuriAMERICA1400Cliff.Puri@CORMORANT.EXAMPLE.COM14926-Nov-61marriedMJ: 190,000 – 249,999
205EmilyPollackAMERICA1400Emily.Pollack@DIPPER.EXAMPLE.COM1496-Dec-55singleML: 300,000 and above
206FritzHackmanAMERICA1400Fritz.Hackman@DUNLIN.EXAMPLE.COM14926-Dec-83marriedFG: 130,000 – 149,999
207CybillLaughtonAMERICA1400Cybill.Laughton@EIDER.EXAMPLE.COM1494-Jan-89singleMF: 110,000 – 129,999
208CyndiGriemAMERICA1400Cyndi.Griem@GALLINULE.EXAMPLE.COM14925-Jan-56marriedME: 90,000 – 109,999
209CyndiCollinsAMERICA1400Cyndi.Collins@GODWIT.EXAMPLE.COM1494-Feb-46singleMD: 70,000 – 89,999
210CybillClaptonAMERICA1400Cybill.Clapton@GOLDENEYE.EXAMPLE.COM14924-Feb-74marriedFD: 70,000 – 89,999
211LuchinoJordanAMERICA1500Luchino.Jordan@GREBE.EXAMPLE.COM1496-Mar-83singleFA: Below 30,000
213LuchinoBradfordAMERICA1500Luchino.Bradford@PARULA.EXAMPLE.COM14924-Apr-76marriedMA: Below 30,000
214RobinDansonAMERICA1500Robin.Danson@PHAINOPEPLA.EXAMPLE.COM1495-May-46singleMF: 110,000 – 129,999
215OrsonPerkinsAMERICA1900Orson.Perkins@PINTAIL.EXAMPLE.COM14924-May-85marriedME: 90,000 – 109,999
216OrsonKoiralaAMERICA1900Orson.Koirala@PIPIT.EXAMPLE.COM1494-Jun-79singleFJ: 190,000 – 249,999
218BryanDvrrieAMERICA2300Bryan.Dvrrie@REDPOLL.EXAMPLE.COM1494-Jul-66singleFG: 130,000 – 149,999
219AjaySenAMERICA2300Ajay.Sen@TROGON.EXAMPLE.COM14913-Jul-77singleMK: 250,000 – 299,999
220CarolJordanAMERICA2300Carol.Jordan@TURNSTONE.EXAMPLE.COM14923-Jul-76marriedMI: 170,000 – 189,999
221CarolBradfordAMERICA2300Carol.Bradford@VERDIN.EXAMPLE.COM1492-Aug-53singleMG: 130,000 – 149,999
223CaryOlinAMERICA2300Cary.Olin@WATERTHRUSH.EXAMPLE.COM1492-Sep-35singleMD: 70,000 – 89,999
224ClaraKrigeAMERICA2300Clara.Krige@WHIMBREL.EXAMPLE.COM14922-Sep-59marriedMH: 150,000 – 169,999
225ClaraGanesanAMERICA2300Clara.Ganesan@WIGEON.EXAMPLE.COM1492-Oct-59singleFI: 170,000 – 189,999
227KathyPrashantAMERICA2400Kathy.Prashant@ANI.EXAMPLE.COM1491-Nov-83singleMJ: 190,000 – 249,999
228GrahamNeesonAMERICA2400Graham.Neeson@AUKLET.EXAMPLE.COM14920-Nov-41marriedME: 90,000 – 109,999
229IanChapmanAMERICA2400Ian.Chapman@AVOCET.EXAMPLE.COM14930-Nov-65singleMD: 70,000 – 89,999
230DannyWrightAMERICA2400Danny.Wright@BITTERN.EXAMPLE.COM14920-Dec-48marriedMF: 110,000 – 129,999
232DonaldHunterAMERICA2400Donald.Hunter@CHACHALACA.EXAMPLE.COM14520-Jan-60marriedMG: 130,000 – 149,999
233GrahamSpielbergAMERICA2400Graham.Spielberg@CHUKAR.EXAMPLE.COM14529-Jan-70singleMD: 70,000 – 89,999
234DanRobertsAMERICA2400Dan.Roberts@NUTHATCH.EXAMPLE.COM14518-Feb-73marriedMI: 170,000 – 189,999
235EdwardOatesAMERICA2400Edward.Oates@OVENBIRD.EXAMPLE.COM14521-Mar-55marriedME: 90,000 – 109,999
236EdwardJuliusAMERICA2400Edward.Julius@PARULA.EXAMPLE.COM14530-Mar-86singleMF: 110,000 – 129,999
237FarrahQuinlanAMERICA2400Farrah.Quinlan@PHAINOPEPLA.EXAMPLE.COM14519-Apr-48marriedMA: Below 30,000
238FarrahLangeAMERICA2400Farrah.Lange@PHALAROPE.EXAMPLE.COM14519-May-81marriedMF: 110,000 – 129,999
239HalStockwellAMERICA2400Hal.Stockwell@PHOEBE.EXAMPLE.COM14529-May-66singleMH: 150,000 – 169,999
240MalcolmKanthAMERICA2400Malcolm.Kanth@PIPIT.EXAMPLE.COM14519-Jun-55marriedFH: 150,000 – 169,999
241MalcolmBroderickAMERICA2400Malcolm.Broderick@PLOVER.EXAMPLE.COM14528-Jun-52singleMF: 110,000 – 129,999
242MaryLemmonAMERICA2400Mary.Lemmon@PUFFIN.EXAMPLE.COM14518-Jul-62marriedMK: 250,000 – 299,999
243MaryCollinsAMERICA2400Mary.Collins@PYRRHULOXIA.EXAMPLE.COM14518-Aug-55marriedFF: 110,000 – 129,999
244MattGueneyAMERICA2400Matt.Gueney@REDPOLL.EXAMPLE.COM14527-Aug-52singleMG: 130,000 – 149,999
245Maxvon SydowAMERICA2400Max.vonSydow@REDSTART.EXAMPLE.COM1457-Sep-67singleMK: 250,000 – 299,999
246MaxSchellAMERICA2400Max.Schell@SANDERLING.EXAMPLE.COM14516-Sep-84marriedMF: 110,000 – 129,999
247CyndaWhitcraftAMERICA2400Cynda.Whitcraft@SANDPIPER.EXAMPLE.COM14516-Oct-54marriedMB: 30,000 – 49,999
248DonaldMinnelliAMERICA2400Donald.Minnelli@SCAUP.EXAMPLE.COM14526-Oct-53singleMF: 110,000 – 129,999
249HannahBroderickAMERICA2400Hannah.Broderick@SHRIKE.EXAMPLE.COM14516-Nov-75marriedMD: 70,000 – 89,999
250DanWilliamsAMERICA2400Dan.Williams@SISKIN.EXAMPLE.COM14525-Nov-84singleMA: Below 30,000
251RaulWilderAMERICA2500Raul.Wilder@STILT.EXAMPLE.COM14515-Dec-45marriedME: 90,000 – 109,999
252Shah RukhFieldAMERICA2500ShahRukh.Field@WHIMBREL.EXAMPLE.COM14525-Dec-57singleMI: 170,000 – 189,999
253SallyBogartAMERICA2500Sally.Bogart@WILLET.EXAMPLE.COM14514-Jan-85marriedMH: 150,000 – 169,999
254BruceBatesAMERICA3500Bruce.Bates@COWBIRD.EXAMPLE.COM14525-Jan-40singleMD: 70,000 – 89,999
256Bende NiroAMERICA3500Ben.deNiro@KINGLET.EXAMPLE.COM14524-Feb-80singleMI: 170,000 – 189,999
257EmmetWalkenAMERICA3600Emmet.Walken@LIMPKIN.EXAMPLE.COM14515-Mar-75marriedMB: 30,000 – 49,999
258EllenPalinAMERICA3600Ellen.Palin@LONGSPUR.EXAMPLE.COM14514-Apr-77marriedMH: 150,000 – 169,999
259Denholmvon SydowAMERICA3600Denholm.vonSydow@MERGANSER.EXAMPLE.COM14524-Apr-43singleFD: 70,000 – 89,999
261EmmetGarciaAMERICA3600Emmet.Garcia@VIREO.EXAMPLE.COM14913-Jun-61marriedMH: 150,000 – 169,999
124DianeMasonAMERICA200Diane.Mason@TROGON.EXAMPLE.COM14516-Mar-81marriedFK: 250,000 – 299,999
125DianneAndrewsAMERICA200Dianne.Andrews@TURNSTONE.EXAMPLE.COM14527-Mar-59singleFF: 110,000 – 129,999
126CharlesFieldAMERICA300Charles.Field@BECARD.EXAMPLE.COM14516-Apr-46marriedFF: 110,000 – 129,999
128IsabellaReedAMERICA300Isabella.Reed@BRANT.EXAMPLE.COM14516-May-54marriedFJ: 190,000 – 249,999
129LouisJacksonAMERICA400Louis.Jackson@CARACARA.EXAMPLE.COM14526-May-39singleMD: 70,000 – 89,999
130LouisEdwardsAMERICA400Louis.Edwards@CHACHALACA.EXAMPLE.COM14514-Jun-44marriedMC: 50,000 – 69,999
131DorisDuttAMERICA400Doris.Dutt@CHUKAR.EXAMPLE.COM14514-Jul-76marriedFC: 50,000 – 69,999
133KristinMaldenAMERICA400Kristin.Malden@GODWIT.EXAMPLE.COM14514-Aug-50marriedFC: 50,000 – 69,999
134SissyPuriAMERICA400Sissy.Puri@GREBE.EXAMPLE.COM14512-Sep-72marriedFF: 110,000 – 129,999
135DorisBel GeddesAMERICA400Doris.BelGeddes@GROSBEAK.EXAMPLE.COM14522-Sep-80singleFB: 30,000 – 49,999
136SissyWardenAMERICA400Sissy.Warden@JACANA.EXAMPLE.COM14512-Oct-44marriedFF: 110,000 – 129,999
138ManiFondaAMERICA500Mani.Fonda@KINGLET.EXAMPLE.COM14511-Nov-77marriedMF: 110,000 – 129,999
139PlacidoKubrickAMERICA500Placido.Kubrick@SCOTER.EXAMPLE.COM14522-Nov-42singleMF: 110,000 – 129,999
140ClaudiaKurosawaAMERICA500Claudia.Kurosawa@CHUKAR.EXAMPLE.COM14511-Dec-81marriedME: 90,000 – 109,999
141MaximilianHennerAMERICA500Maximilian.Henner@DUNLIN.EXAMPLE.COM14521-Dec-73singleMH: 150,000 – 169,999
143SachinNeesonAMERICA500Sachin.Neeson@GALLINULE.EXAMPLE.COM14520-Jan-62singleMF: 110,000 – 129,999
767Klaus MariaRussellITALY100KlausMaria.Russell@COOT.EXAMPLE.COM14720-Jan-70marriedMC: 50,000 – 69,999
771Krisde NiroITALY400Kris.deNiro@DUNLIN.EXAMPLE.COM14721-Mar-77marriedME: 90,000 – 109,999
826AlainBarkinSWITZERLAND500Alain.Barkin@VERDIN.EXAMPLE.COM14720-May-69marriedMA: Below 30,000
830AlbertDuttSWITZERLAND3500Albert.Dutt@CURLEW.EXAMPLE.COM14729-Aug-47singleMF: 110,000 – 129,999
850AmandaFinneySWITZERLAND2300Amanda.Finney@STILT.EXAMPLE.COM14723-Aug-91singleMJ: 190,000 – 249,999
905BillyHersheyINDIA1400Billy.Hershey@BULBUL.EXAMPLE.COM14822-Oct-87singleFG: 130,000 – 149,999
911BoDickinsonINDIA5000Bo.Dickinson@TANAGER.EXAMPLE.COM14811-Dec-81marriedMH: 150,000 – 169,999
919BrookeMichalkowINDIA3500Brooke.Michalkow@GROSBEAK.EXAMPLE.COM14819-Feb-62singleMD: 70,000 – 89,999
924BrunoMontandINDIA5000Bruno.Montand@TOWHEE.EXAMPLE.COM14820-Apr-34singleFD: 70,000 – 89,999
930BusterJacksonINDIA900Buster.Jackson@KILLDEER.EXAMPLE.COM1488-Jul-24marriedMA: Below 30,000
980DanielLorenINDIA200Daniel.Loren@REDSTART.EXAMPLE.COM14817-Sep-70singleMF: 110,000 – 129,999
473RolfAshbyINDIA5000Rolf.Ashby@WATERTHRUSH.EXAMPLE.COM14810-Jun-49singleMG: 130,000 – 149,999
474RomySharifINDIA5000Romy.Sharif@SNIPE.EXAMPLE.COM14829-Jun-76marriedMF: 110,000 – 129,999
475RomyMcCarthyINDIA5000Romy.McCarthy@STILT.EXAMPLE.COM14810-Jul-33singleFD: 70,000 – 89,999
476RosanneHopkinsINDIA300Rosanne.Hopkins@ANI.EXAMPLE.COM14830-Jul-79marriedMD: 70,000 – 89,999
477RosanneDouglasINDIA300Rosanne.Douglas@ANHINGA.EXAMPLE.COM1489-Aug-70singleFF: 110,000 – 129,999
478RosanneBaldwinINDIA300Rosanne.Baldwin@AUKLET.EXAMPLE.COM14829-Aug-67marriedFA: Below 30,000
479RoxanneShepherdINDIA1200Roxanne.Shepherd@DUNLIN.EXAMPLE.COM1488-Sep-63singleFI: 170,000 – 189,999
480RoxanneMichalkowINDIA1200Roxanne.Michalkow@EIDER.EXAMPLE.COM14818-Sep-73singleML: 300,000 and above
481RoyHulceINDIA5000Roy.Hulce@SISKIN.EXAMPLE.COM14828-Sep-67marriedFE: 90,000 – 109,999
482RoyDunawayINDIA5000Roy.Dunaway@WHIMBREL.EXAMPLE.COM14828-Oct-55marriedFF: 110,000 – 129,999
483RoyBatesINDIA5000Roy.Bates@WIGEON.EXAMPLE.COM1487-Nov-42singleMG: 130,000 – 149,999
487RufusDvrrieINDIA1900Rufus.Dvrrie@PLOVER.EXAMPLE.COM14826-Nov-60marriedMJ: 190,000 – 249,999
488RufusBelushiINDIA1900Rufus.Belushi@PUFFIN.EXAMPLE.COM14826-Dec-52marriedMG: 130,000 – 149,999
492SallyEdwardsINDIA2500Sally.Edwards@TURNSTONE.EXAMPLE.COM1486-Jan-80marriedFK: 250,000 – 299,999
496ScottJordanINDIA5000Scott.Jordan@WILLET.EXAMPLE.COM14825-Jan-45marriedFG: 130,000 – 149,999
605ShammiPacinoINDIA500Shammi.Pacino@BITTERN.EXAMPLE.COM1485-Feb-59singleFB: 30,000 – 49,999
606SharmilaKazanINDIA500Sharmila.Kazan@BRANT.EXAMPLE.COM14825-Feb-38marriedFD: 70,000 – 89,999
609ShelleyTaylorINDIA3700Shelley.Taylor@CURLEW.EXAMPLE.COM14826-Mar-57marriedFI: 170,000 – 189,999
615ShyamPlummerINDIA2500Shyam.Plummer@VEERY.EXAMPLE.COM14825-Apr-69marriedMJ: 190,000 – 249,999
621SilkKurosawaINDIA1500Silk.Kurosawa@NUTHATCH.EXAMPLE.COM1485-May-84singleFG: 130,000 – 149,999
712M. EmmetStockwellITALY3700M.Emmet.Stockwell@COOT.EXAMPLE.COM1475-Jun-83singleMH: 150,000 – 169,999
713M. EmmetOlinITALY3700M.Emmet.Olin@CORMORANT.EXAMPLE.COM14724-Jun-48marriedFF: 110,000 – 129,999
717MammuttiSutherlandITALY500Mammutti.Sutherland@TOWHEE.EXAMPLE.COM14725-Jul-74marriedMD: 70,000 – 89,999
719ManiKazanITALY500Mani.Kazan@TROGON.EXAMPLE.COM1474-Aug-62singleMI: 170,000 – 189,999
721ManiBuckleyITALY500Mani.Buckley@TURNSTONE.EXAMPLE.COM14723-Aug-44marriedME: 90,000 – 109,999
729MargauxKrigeITALY2400Margaux.Krige@DUNLIN.EXAMPLE.COM14723-Sep-42marriedMF: 110,000 – 129,999
731MargauxCapshawITALY2400Margaux.Capshaw@EIDER.EXAMPLE.COM1472-Oct-33singleMB: 30,000 – 49,999
754KevinGoodmanITALY700Kevin.Goodman@WIGEON.EXAMPLE.COM14722-Oct-48marriedME: 90,000 – 109,999
756KevinWilderITALY700Kevin.Wilder@AUKLET.EXAMPLE.COM1472-Dec-86singleMG: 130,000 – 149,999
757KieferReynoldsITALY700Kiefer.Reynolds@AVOCET.EXAMPLE.COM14721-Dec-53marriedMF: 110,000 – 129,999
766KlausYoungITALY600Klaus.Young@OVENBIRD.EXAMPLE.COM1471-Jan-55singleMH: 150,000 – 169,999
768Klaus MariaMacLaineITALY100KlausMaria.MacLaine@CHUKAR.EXAMPLE.COM14731-Jan-80singleMA: Below 30,000
769KrisHarrisITALY400Kris.Harris@DIPPER.EXAMPLE.COM14719-Feb-49marriedMG: 130,000 – 149,999
770KrisCurtisITALY400Kris.Curtis@DOWITCHER.EXAMPLE.COM1472-Mar-55singleMK: 250,000 – 299,999
772KristinSavageITALY400Kristin.Savage@CURLEW.EXAMPLE.COM1471-Apr-43singleFF: 110,000 – 129,999
782LaurenceSeignierTHAILAND1200Laurence.Seignier@CREEPER.EXAMPLE.COM14921-Apr-83marriedMF: 110,000 – 129,999
825AlainDreyfussSWITZERLAND500Alain.Dreyfuss@VEERY.EXAMPLE.COM14730-Apr-76singleMJ: 190,000 – 249,999
827AlainSiegelSWITZERLAND500Alain.Siegel@VIREO.EXAMPLE.COM14719-Jun-73marriedFI: 170,000 – 189,999
828AlanMinnelliSWITZERLAND2300Alan.Minnelli@TANAGER.EXAMPLE.COM14720-Jul-55marriedMD: 70,000 – 89,999
829AlanHunterSWITZERLAND2300Alan.Hunter@TATTLER.EXAMPLE.COM14719-Aug-59marriedMI: 170,000 – 189,999
831AlbertBel GeddesSWITZERLAND3500Albert.BelGeddes@DIPPER.EXAMPLE.COM14717-Sep-52marriedME: 90,000 – 109,999
832AlbertSpacekSWITZERLAND3500Albert.Spacek@DOWITCHER.EXAMPLE.COM14727-Sep-76singleMF: 110,000 – 129,999
833AlecMoranisSWITZERLAND3500Alec.Moranis@DUNLIN.EXAMPLE.COM14717-Oct-34marriedMD: 70,000 – 89,999
834AlecIdleSWITZERLAND3500Alec.Idle@EIDER.EXAMPLE.COM14727-Oct-64singleMF: 110,000 – 129,999
835AlexanderEastwoodSWITZERLAND1200Alexander.Eastwood@AVOCET.EXAMPLE.COM14716-Nov-42marriedFE: 90,000 – 109,999
836AlexanderBerengerSWITZERLAND1200Alexander.Berenger@BECARD.EXAMPLE.COM14716-Dec-52marriedFC: 50,000 – 69,999
837AlexanderStantonSWITZERLAND1200Alexander.Stanton@AUKLET.EXAMPLE.COM14715-Jan-65marriedFD: 70,000 – 89,999
838AlfredNicholsonSWITZERLAND3500Alfred.Nicholson@CREEPER.EXAMPLE.COM14725-Jan-85singleMF: 110,000 – 129,999
839AlfredJohnsonSWITZERLAND3500Alfred.Johnson@FLICKER.EXAMPLE.COM14714-Feb-57marriedMJ: 190,000 – 249,999
840AliElliottSWITZERLAND1400Ali.Elliott@ANHINGA.EXAMPLE.COM14716-Mar-51marriedMG: 130,000 – 149,999
841AliBoyerSWITZERLAND1400Ali.Boyer@WILLET.EXAMPLE.COM14726-Mar-51singleMF: 110,000 – 129,999
842AliSternSWITZERLAND1400Ali.Stern@YELLOWTHROAT.EXAMPLE.COM14715-Apr-77marriedME: 90,000 – 109,999
843AliceOatesSWITZERLAND700Alice.Oates@BECARD.EXAMPLE.COM14725-Apr-59singleFD: 70,000 – 89,999
844AliceJuliusSWITZERLAND700Alice.Julius@BITTERN.EXAMPLE.COM14715-May-44marriedFD: 70,000 – 89,999
845AllyFawcettSWITZERLAND5000Ally.Fawcett@PLOVER.EXAMPLE.COM14725-May-44singleFA: Below 30,000
846AllyBrandoSWITZERLAND5000Ally.Brando@PINTAIL.EXAMPLE.COM14714-Jun-62marriedFL: 300,000 and above
847AllyStreepSWITZERLAND5000Ally.Streep@PIPIT.EXAMPLE.COM14714-Jul-42marriedMA: Below 30,000
848AlonsoOlmosSWITZERLAND1800Alonso.Olmos@PHALAROPE.EXAMPLE.COM14724-Jul-48singleFF: 110,000 – 129,999
849AlonsoKaurusmdkiSWITZERLAND1800Alonso.Kaurusmdki@PHOEBE.EXAMPLE.COM14713-Aug-80marriedFE: 90,000 – 109,999
851AmandaBrownSWITZERLAND2300Amanda.Brown@THRASHER.EXAMPLE.COM14712-Sep-51marriedFB: 30,000 – 49,999
852AmandaTannerSWITZERLAND2300Amanda.Tanner@TEAL.EXAMPLE.COM14722-Sep-53singleFG: 130,000 – 149,999
853AmrishPalinSWITZERLAND400Amrish.Palin@EIDER.EXAMPLE.COM14712-Oct-77marriedFI: 170,000 – 189,999
906BillyDenchINDIA1400Billy.Dench@CARACARA.EXAMPLE.COM14811-Nov-58marriedMI: 170,000 – 189,999
909BlakeMastroianniINDIA1200Blake.Mastroianni@FLICKER.EXAMPLE.COM14821-Nov-49singleMD: 70,000 – 89,999
912BoAshbyINDIA5000Bo.Ashby@TATTLER.EXAMPLE.COM14821-Dec-56singleMI: 170,000 – 189,999
913BobSharifINDIA5000Bob.Sharif@TEAL.EXAMPLE.COM14810-Jan-85marriedMF: 110,000 – 129,999
916BrianDouglasINDIA500Brian.Douglas@AVOCET.EXAMPLE.COM14820-Jan-78singleMJ: 190,000 – 249,999
917BrianBaldwinINDIA500Brian.Baldwin@BECARD.EXAMPLE.COM1489-Feb-75marriedME: 90,000 – 109,999
920BruceHulceINDIA3500Bruce.Hulce@JACANA.EXAMPLE.COM14810-Mar-72marriedMF: 110,000 – 129,999
921BruceDunawayINDIA3500Bruce.Dunaway@JUNCO.EXAMPLE.COM14820-Mar-48singleFF: 110,000 – 129,999
923BrunoSlaterINDIA5000Bruno.Slater@THRASHER.EXAMPLE.COM1489-Apr-60marriedFG: 130,000 – 149,999
927BryanBelushiINDIA2300Bryan.Belushi@TOWHEE.EXAMPLE.COM14810-May-61marriedMI: 170,000 – 189,999
928BurtSpielbergINDIA5000Burt.Spielberg@TROGON.EXAMPLE.COM1489-Jun-54marriedME: 90,000 – 109,999
929BurtNeesonINDIA5000Burt.Neeson@TURNSTONE.EXAMPLE.COM14819-Jun-78singleMF: 110,000 – 129,999
931BusterEdwardsINDIA900Buster.Edwards@KINGLET.EXAMPLE.COM1488-Aug-47marriedMF: 110,000 – 129,999
932BusterBogartINDIA900Buster.Bogart@KISKADEE.EXAMPLE.COM14817-Aug-52singleMH: 150,000 – 169,999
934C. ThomasNolteINDIA600C.Thomas.Nolte@PHOEBE.EXAMPLE.COM1487-Sep-59marriedMH: 150,000 – 169,999
981DanielGueneyCHINA200Daniel.Gueney@REDPOLL.EXAMPLE.COM1487-Oct-73marriedMK: 250,000 – 299,999
123ElizabethBrownAMERICA200Elizabeth.Brown@THRASHER.EXAMPLE.COM14524-Feb-49singleFF: 110,000 – 129,999
127CharlesBroderickAMERICA300Charles.Broderick@BITTERN.EXAMPLE.COM14526-Apr-43singleFB: 30,000 – 49,999
132DorisSpacekAMERICA400Doris.Spacek@FLICKER.EXAMPLE.COM14525-Jul-87singleMH: 150,000 – 169,999
137EliaBrandoAMERICA500Elia.Brando@JUNCO.EXAMPLE.COM14523-Oct-51singleMH: 150,000 – 169,999
142SachinSpielbergAMERICA500Sachin.Spielberg@GADWALL.EXAMPLE.COM14511-Jan-71marriedMC: 50,000 – 69,999
163ErnestChandarAMERICA900Ernest.Chandar@LIMPKIN.EXAMPLE.COM14516-Dec-62singleMH: 150,000 – 169,999
168HemaVoightAMERICA1200Hema.Voight@PHALAROPE.EXAMPLE.COM14516-Mar-50singleMH: 150,000 – 169,999
173KathleenWalkenAMERICA1200Kathleen.Walken@VIREO.EXAMPLE.COM1454-Jun-73marriedFE: 90,000 – 109,999
178GraceBelushiAMERICA1200Grace.Belushi@KILLDEER.EXAMPLE.COM1492-Sep-86marriedMH: 150,000 – 169,999
182LaurenDenchAMERICA1200Lauren.Dench@LONGSPUR.EXAMPLE.COM14922-Oct-75singleMK: 250,000 – 299,999
187GraceDvrrieAMERICA1200Grace.Dvrrie@PHOEBE.EXAMPLE.COM14931-Dec-48marriedFE: 90,000 – 109,999
212LuchinoFalkAMERICA1500Luchino.Falk@OVENBIRD.EXAMPLE.COM14925-Mar-72marriedML: 300,000 and above
217BryanHustonAMERICA2300Bryan.Huston@PYRRHULOXIA.EXAMPLE.COM14923-Jun-73marriedFB: 30,000 – 49,999
222CaryStockwellAMERICA2300Cary.Stockwell@VIREO.EXAMPLE.COM14923-Aug-63marriedMI: 170,000 – 189,999
226AjayAndrewsAMERICA2300Ajay.Andrews@YELLOWTHROAT.EXAMPLE.COM14921-Oct-56marriedMF: 110,000 – 129,999
231DannyRourkeAMERICA2400Danny.Rourke@BRANT.EXAMPLE.COM14531-Dec-47singleMF: 110,000 – 129,999
255BrookeShepherdAMERICA3500Brooke.Shepherd@KILLDEER.EXAMPLE.COM14513-Feb-85marriedMC: 50,000 – 69,999
260EllenKhanAMERICA3600Ellen.Khan@VERDIN.EXAMPLE.COM14914-May-62marriedMF: 110,000 – 129,999
264GeorgeAdjaniAMERICA3600George.Adjani@WILLET.EXAMPLE.COM14912-Aug-47marriedFF: 110,000 – 129,999
269KyleMartinAMERICA3700Kyle.Martin@EIDER.EXAMPLE.COM14511-Oct-58marriedFD: 70,000 – 89,999
273BoHitchcockAMERICA5000Bo.Hitchcock@ANHINGA.EXAMPLE.COM1459-Jan-54marriedME: 90,000 – 109,999
339MarilouLandisITALY500Marilou.Landis@TATTLER.EXAMPLE.COM14713-Jan-33singleMA: Below 30,000
344MarlonGodardJAPAN2400Marlon.Godard@MOORHEN.EXAMPLE.COM14814-Mar-60singleMH: 150,000 – 169,999
348KellyLangeITALY3600Kelly.Lange@SANDPIPER.EXAMPLE.COM14714-May-71singleMF: 110,000 – 129,999
352KennethRedfordITALY3600Kenneth.Redford@REDSTART.EXAMPLE.COM14713-Jul-71singleFB: 30,000 – 49,999
378MegSenTHAILAND3700Meg.Sen@COWBIRD.EXAMPLE.COM14930-Sep-53marriedMC: 50,000 – 69,999
449RickRomeroITALY1500Rick.Romero@LONGSPUR.EXAMPLE.COM14710-Dec-51singleFB: 30,000 – 49,999
453RidleyYoungINDIA700Ridley.Young@CHUKAR.EXAMPLE.COM14810-Feb-45singleMF: 110,000 – 129,999
463RobinAdjaniINDIA1500Robin.Adjani@MOORHEN.EXAMPLE.COM1481-Apr-49marriedFC: 50,000 – 69,999
470RogerMastroianniINDIA3700Roger.Mastroianni@CREEPER.EXAMPLE.COM14831-May-67marriedML: 300,000 and above
607SharmilaFondaINDIA500Sharmila.Fonda@BUFFLEHEAD.EXAMPLE.COM1486-Mar-49singleFH: 150,000 – 169,999
627SivajiGielgudINDIA500Sivaji.Gielgud@BULBUL.EXAMPLE.COM14825-May-49marriedFD: 70,000 – 89,999
715MalcolmFieldITALY2400Malcolm.Field@DOWITCHER.EXAMPLE.COM1475-Jul-51singleFG: 130,000 – 149,999
727MargaretUstinovITALY1200Margaret.Ustinov@ANHINGA.EXAMPLE.COM1472-Sep-49singleMH: 150,000 – 169,999
755KevinClevelandITALY700Kevin.Cleveland@WILLET.EXAMPLE.COM14721-Nov-81marriedMH: 150,000 – 169,999
oe.orders
For each order placed by a customer, various attributes are captured. There is one row per order.
order_idorder_dateorder_modecustomer_idorder_statusorder_totalsales_rep_idpromotion_id
245816-AUG-07 03.34.12.234359 PMdirect101078279.6153
239719-NOV-07 02.41.54.696211 PMdirect102142283.2154
245402-OCT-07 05.49.34.678340 PMdirect10316653.4154
235414-JUL-08 06.18.23.234567 PMdirect104046257155
235808-JAN-08 05.03.12.654278 PMdirect10527826155
238114-MAY-08 08.59.08.843679 PMdirect106323034.6156
244031-AUG-07 09.53.06.008765 PMdirect107370576.9156
235708-JAN-06 08.19.44.123456 PMdirect108559872.4158
239410-FEB-08 09.22.35.564789 PMdirect109521863158
243502-SEP-07 11.22.53.134567 PMdirect144662303159
245520-SEP-07 11.34.11.456789 AMdirect145714087.5160
237916-MAY-07 02.22.24.234567 AMdirect146817848.2161
239602-FEB-06 01.34.56.345678 AMdirect147834930161
240629-JUN-07 04.41.20.098765 AMdirect14882854.2161
243413-SEP-07 05.49.30.647893 AMdirect1498268651.8161
243602-SEP-07 06.18.04.378034 AMdirect11686394.8161
244627-JUL-07 07.03.08.302945 AMdirect1178103679.3161
244727-JUL-08 08.59.10.223344 AMdirect101833893.6161
243214-SEP-07 09.53.40.223345 AMdirect1021010523163
243313-SEP-07 10.19.00.654279 AMdirect1031078163
235526-JAN-06 09.22.51.962632 AMonline104894513.5
235626-JAN-08 09.22.41.934562 AMonline105529473.8
235908-JAN-06 09.34.13.112233 PMonline10695543.1
236014-NOV-07 12.22.31.223344 PMonline1074990.4
236113-NOV-07 01.34.21.986210 PMonline1088120131.3
236213-NOV-07 02.41.10.619477 PMonline109492829.4
236323-OCT-07 05.49.56.346122 PMonline144010082.3
236428-AUG-07 06.18.45.942399 PMonline14549500
236528-AUG-07 07.03.34.003399 PMonline146927455.3
236628-AUG-07 08.59.23.144778 PMonline147537319.4
236727-JUN-08 09.53.32.335522 PMonline14810144054.8
236826-JUN-08 10.19.43.190089 PMonline1491060065
236926-JUN-07 11.22.54.009932 PMonline116011097.4
237027-JUN-08 12.22.11.647398 AMonline1174126
237116-MAY-07 01.34.56.113356 AMonline118679405.6
237227-FEB-07 12.22.33.356789 AMonline119916447.2
237327-FEB-08 01.34.51.220065 AMonline1204416
237427-FEB-08 02.41.45.109654 AMonline12104797
237526-FEB-07 03.49.50.459233 AMonline1222103834.4
237607-JUN-07 06.18.08.883310 AMonline123611006.2
237707-JUN-07 07.03.01.001100 AMonline141538017.8
237824-MAY-07 08.59.10.010101 AMonline142525691.3
238016-MAY-07 09.53.02.909090 AMonline143327132.6
238214-MAY-08 10.19.03.828321 AMonline144871173
238312-MAY-08 11.22.30.545103 AMonline145836374.7
238412-MAY-08 12.22.34.525972 PMonline146329249.1
238508-DEC-07 11.34.11.331392 AMonline1474295892
238606-DEC-07 12.22.34.225609 PMonline1481021116.9
238711-MAR-07 03.34.56.536966 PMonline149552758.9
238804-JUN-07 04.41.12.554435 PMonline1504282694.3
238904-JUN-08 05.49.43.546954 PMonline151417620
239018-NOV-07 04.18.50.546851 PMonline15297616.8
239127-FEB-06 05.03.03.828330 PMdirect153248070.6156
239221-JUL-07 08.59.57.571057 PMdirect154926632161
239310-FEB-08 07.53.19.528202 PMdirect155423431.9161
239502-FEB-06 08.19.11.227550 PMdirect156368501163
239819-NOV-07 09.22.53.224175 PMdirect15797110.3163
239919-NOV-07 10.22.38.340990 PMdirect158025270.3161
240010-JUL-07 01.34.29.559387 AMdirect159269286.4161
240110-JUL-07 02.22.53.554822 AMdirect1603969.2163
240202-JUL-07 03.34.44.665170 AMdirect1618600154
240301-JUL-07 04.49.13.615512 PMdirect1620220154
240401-JUL-07 04.49.13.664085 PMdirect1636510158
240501-JUL-07 04.49.13.678123 PMdirect16451233159
240729-JUN-07 07.03.21.526005 AMdirect16592519155
240829-JUN-07 08.59.31.333617 AMdirect1661309158
240929-JUN-07 09.53.41.984501 AMdirect167248154
241024-MAY-08 10.19.51.985501 AMdirect168645175156
241124-MAY-07 11.22.10.548639 AMdirect169815760.5156
241229-MAR-06 10.22.09.509801 AMdirect170966816158
241329-MAR-08 01.34.04.525934 PMdirect101548552161
241429-MAR-07 02.22.40.536996 PMdirect102810794.6153
241529-MAR-06 01.34.50.545196 PMdirect1036310161
241629-MAR-07 04.41.20.945676 PMdirect1046384160
241720-MAR-07 05.49.10.974352 PMdirect10551926.6163
241820-MAR-04 04.18.21.862632 PMdirect10645546.6163
241920-MAR-07 07.03.32.764632 PMdirect107331574160
242013-MAR-07 08.59.43.666320 PMdirect108229750160
242112-MAR-07 09.53.54.562432 PMdirect109172836
242216-DEC-07 08.19.55.462332 PMdirect144211188.5153
242321-NOV-07 10.22.33.362632 AMdirect145310367.7160
242421-NOV-07 10.22.33.263332 AMdirect146413824153
242516-NOV-06 11.34.22.162552 PMdirect14751500.8163
242617-NOV-06 12.22.11.262552 AMdirect14867200
242710-NOV-07 01.34.22.362124 AMdirect14979055163
242810-NOV-07 02.41.34.463567 AMdirect116814685.8
242910-NOV-07 03.49.25.526321 AMdirect117950125154
243002-OCT-07 06.18.36.663332 AMdirect101829669.9159
243114-SEP-06 07.03.04.763452 AMdirect10215610.6163
243701-SEP-06 08.59.15.826132 AMdirect103413550163
243801-SEP-07 09.53.26.934626 AMdirect10405451154
243931-AUG-07 10.19.37.811132 AMdirect105122150.1159
244101-AUG-08 11.22.48.734526 AMdirect10652075.2160
244227-JUL-06 12.22.59.662632 PMdirect107952471.9154
244327-JUL-06 01.34.16.562632 PMdirect10803646154
244427-JUL-07 02.22.27.462632 PMdirect109177727.2155
244527-JUL-06 03.34.38.362632 PMdirect14485537.8158
244818-JUN-07 04.41.49.262632 PMdirect14551388158
244913-JUN-07 05.49.07.162632 PMdirect146686155
245011-APR-07 06.18.10.362632 PMdirect14731636159
245117-DEC-07 05.03.52.562632 PMdirect148710474.6154
245206-OCT-07 08.59.43.462632 PMdirect149512589159
245304-OCT-07 09.53.34.362632 PMdirect1160129153
245607-NOV-06 07.53.25.989889 PMdirect11703878.4163
245731-OCT-07 11.22.16.162632 PMdirect118521586.2159

Simple CASE Expressions
This case expression form allows users little flexibility in terms of the expressions used and the condition being evaluated. The simple case expression allows users to compare an expression to another expression in terms of equality. The syntax can be found below.

CASE expression_1
    WHEN comparison_expression_1
        THEN returned_expression_1
    WHEN comparison_expression_2
        THEN returned_expression_2
    ELSE catch_all_expression
END AS attribute_alias

expression_1 represents a value for a specific row for a specific pre-existing attribute. comparison_expression_1 represents the value for which expression_1 is compared. If expression_1 equals comparison_expression_1, then returned_expression_1 is returned for the row. If the condition captured in the first WHEN and comparison_expression pair does not evaluate to TRUE, then expression_1 is compared to the expression following the subsequent WHEN. In the code above, that is comparison_expression_2. This process continues for each specified WHEN and comparison_expression pair. If none of the specified pairs evaluate to TRUE, then NULL is returned, by default. This default behavior can be overridden by explicitly stating a catch_all_expression preceded by the ELSE keyword.

Let us put this simple case expression to work. Suppose the data stored for each customer contains a gender attribute specifying the customer’s gender. Currently, the possible values are M, F, and NULL; however, for the purposes of generating a report containing the number of customers per unique gender value, you would like to replace the values with Male, Female, and Not Specified, respectively. Using a simple case expression, each row’s gender value can be compared to a specific value for equality. When the two values are equal, the corresponding value following the THEN keyword replaces the original. For example, when a row’s gender value is “M,” then the value returned is “Male.” For clarity, see the code and corresponding output below.

SELECT 
    CASE oe.customers.gender
    	WHEN 'M'
    		THEN 'Male'
    	WHEN 'F'
    		THEN 'Female'
    	ELSE 'Not Specified'
    END AS gender,
    COUNT(*) AS customer_count
FROM
	oe.customers
GROUP BY
    CASE oe.customers.gender
    	WHEN 'M'
    		THEN 'Male'
    	WHEN 'F'
    		THEN 'Female'
    	ELSE 'Not Specified'
    END;
gendercustomer_count
Male209
Female110

Searched CASE Expressions
I can count on both hands the number of times I have made use of simple case expressions to solve real-world problems. I tend to use searched case expressions out of habit and necessity. Searched case expressions provide users more flexibility in terms of developing conditional logic. Each WHEN…THEN branch can contain a wide-variety of comparison operators, including, among others, =, !=, >, >=, and <=. Additionally, each branch can contain expressions other than pre-existing attributes and constants. Review the syntax for searched case expressions below, and then let dive into a few real-world problems.

CASE
    WHEN condition_1
        THEN returned_expression_1
    WHEN condition_2
        THEN returned_expression_2
    ELSE catch_all_expression
END AS attribute_alias

For the first real-world problem, consider the classic programming problem where the goal is to programmatically classify integer values as even or odd. In the code below, a recursive common table expression is used to generate the integer values one through ten. Subsequently, a searched case expression consisting of two branches is used to capture whether the integer value is even or odd. The first branch is responsible for determining if the integer is even and the second used to return a catch-all value of “odd” when the first branch’s condition evaluates to FALSE. In the first branch, the MOD function is used to calculate the remainder when each integer value is divided by two. If the remainder is zero, then the value must be even. If the value is not even, then it must be odd. Hence, the ELSE keyword being followed by the catch-all value of “odd.”

WITH integer_sequence (integer_value) AS (
    SELECT
        1 AS integer_value 
    FROM
        dual
    UNION ALL
    SELECT
        integer_value + 1
    FROM
        integer_sequence
    WHERE
        integer_sequence.integer_value < 10
)
SELECT
    integer_sequence.integer_value,
    CASE
        WHEN MOD(integer_sequence.integer_value, 2) = 0
            THEN 'Even'
        WHEN MOD(integer_sequence.integer_value, 2) = 1
    		THEN 'Odd'
    	ELSE 'N/A'
    END AS number_category
FROM
    integer_sequence;
integer_valuenumber_category
1Odd
2Even
3Odd
4Even
5Odd
6Even
7Odd
8Even
9Odd
10Even

If you are unfamiliar with the concept of recursion and how it can be used to solve other, real-world problems, then consider reading my page dedicated to recursion here.

Despite the problem above being a classic, it may not ring “real-world” to you. Let us explore another real-world problem that undoubtedly sufficiently highlights the usefulness of CASE expressions.

Suppose you are tasked with generating a report containing the details corresponding to each order. The necessary attributes are order ID, order date, order mode, customer ID, order status, and order total. In addition to those attributes, you are required to include an attribute categorizing each order based on the order total value and the range the value falls within. Management has provided the following ranges:

0-10k
10-25k
25-50k
50-75k
75-100k
100k+

A searched case expression can be used to categorize each order total value into one of the ranges above. In the code below, each order total value is compared against constant values (e.g., 10000, 25000, etc.) serving as non-inclusive cutoffs. For example, if the order total is less than $10,000, then the order total category value for the specific order will read as “0-10k.” If the order total value is not less than $10,000, then the first WHEN branch will evaluate to FALSE and the categorization process will continue to each subsequent branch until one of the WHEN branches evaluates to TRUE or the ELSE branch is reached and the order total category takes on the catch-all value of “100k+.” Keep in mind the branches are evaluated in the order they are written, so it is important to order the branches in a sensible way. In this scenario, to avoid categorizing an order total value incorrectly, ensure the constant values across the branches are in ascending or descending order.

SELECT
    oe.orders.order_id,
    oe.orders.order_date,
    oe.orders.order_mode,
    oe.orders.customer_id,
    oe.orders.order_status,
    oe.orders.order_total,
    CASE
        WHEN oe.orders.order_total < 10000
            THEN '0-10k'
        WHEN oe.orders.order_total < 25000
            THEN '10-25k'
        WHEN oe.orders.order_total < 50000
            THEN '25-50k'
        WHEN oe.orders.order_total < 75000
            THEN '50-75k'
        WHEN oe.orders.order_total < 100000
            THEN '75-100k'
        ELSE '100k+'
    END AS order_total_category
FROM
    oe.orders;
order_idorder_dateorder_modecustomer_idorder_statusorder_totalorder_total_category
245816-AUG-07 03.34.12.234359 PMdirect101078279.675-100k
239719-NOV-07 02.41.54.696211 PMdirect102142283.225-50k
245402-OCT-07 05.49.34.678340 PMdirect10316653.40-10k
235414-JUL-08 06.18.23.234567 PMdirect10404625725-50k
235808-JAN-08 05.03.12.654278 PMdirect105278260-10k
238114-MAY-08 08.59.08.843679 PMdirect106323034.610-25k
244031-AUG-07 09.53.06.008765 PMdirect107370576.950-75k
235708-JAN-06 08.19.44.123456 PMdirect108559872.450-75k
239410-FEB-08 09.22.35.564789 PMdirect10952186310-25k
243502-SEP-07 11.22.53.134567 PMdirect14466230350-75k
245520-SEP-07 11.34.11.456789 AMdirect145714087.510-25k
237916-MAY-07 02.22.24.234567 AMdirect146817848.210-25k
239602-FEB-06 01.34.56.345678 AMdirect14783493025-50k
240629-JUN-07 04.41.20.098765 AMdirect14882854.20-10k
243413-SEP-07 05.49.30.647893 AMdirect1498268651.8100k+
243602-SEP-07 06.18.04.378034 AMdirect11686394.80-10k
244627-JUL-07 07.03.08.302945 AMdirect1178103679.3100k+
244727-JUL-08 08.59.10.223344 AMdirect101833893.625-50k
243214-SEP-07 09.53.40.223345 AMdirect102101052310-25k
243313-SEP-07 10.19.00.654279 AMdirect10310780-10k
235526-JAN-06 09.22.51.962632 AMonline104894513.575-100k
235626-JAN-08 09.22.41.934562 AMonline105529473.825-50k
235908-JAN-06 09.34.13.112233 PMonline10695543.10-10k
236014-NOV-07 12.22.31.223344 PMonline1074990.40-10k
236113-NOV-07 01.34.21.986210 PMonline1088120131.3100k+
236213-NOV-07 02.41.10.619477 PMonline109492829.475-100k
236323-OCT-07 05.49.56.346122 PMonline144010082.310-25k
236428-AUG-07 06.18.45.942399 PMonline145495000-10k
236528-AUG-07 07.03.34.003399 PMonline146927455.325-50k
236628-AUG-07 08.59.23.144778 PMonline147537319.425-50k
236727-JUN-08 09.53.32.335522 PMonline14810144054.8100k+
236826-JUN-08 10.19.43.190089 PMonline149106006550-75k
236926-JUN-07 11.22.54.009932 PMonline116011097.410-25k
237027-JUN-08 12.22.11.647398 AMonline11741260-10k
237116-MAY-07 01.34.56.113356 AMonline118679405.675-100k
237227-FEB-07 12.22.33.356789 AMonline119916447.210-25k
237327-FEB-08 01.34.51.220065 AMonline12044160-10k
237427-FEB-08 02.41.45.109654 AMonline121047970-10k
237526-FEB-07 03.49.50.459233 AMonline1222103834.4100k+
237607-JUN-07 06.18.08.883310 AMonline123611006.210-25k
237707-JUN-07 07.03.01.001100 AMonline141538017.825-50k
237824-MAY-07 08.59.10.010101 AMonline142525691.325-50k
238016-MAY-07 09.53.02.909090 AMonline143327132.625-50k
238214-MAY-08 10.19.03.828321 AMonline14487117350-75k
238312-MAY-08 11.22.30.545103 AMonline145836374.725-50k
238412-MAY-08 12.22.34.525972 PMonline146329249.125-50k
238508-DEC-07 11.34.11.331392 AMonline1474295892100k+
238606-DEC-07 12.22.34.225609 PMonline1481021116.910-25k
238711-MAR-07 03.34.56.536966 PMonline149552758.950-75k
238804-JUN-07 04.41.12.554435 PMonline1504282694.3100k+
238904-JUN-08 05.49.43.546954 PMonline15141762010-25k
239018-NOV-07 04.18.50.546851 PMonline15297616.80-10k
239127-FEB-06 05.03.03.828330 PMdirect153248070.625-50k
239221-JUL-07 08.59.57.571057 PMdirect15492663225-50k
239310-FEB-08 07.53.19.528202 PMdirect155423431.910-25k
239502-FEB-06 08.19.11.227550 PMdirect15636850150-75k
239819-NOV-07 09.22.53.224175 PMdirect15797110.30-10k
239919-NOV-07 10.22.38.340990 PMdirect158025270.325-50k
240010-JUL-07 01.34.29.559387 AMdirect159269286.450-75k
240110-JUL-07 02.22.53.554822 AMdirect1603969.20-10k
240202-JUL-07 03.34.44.665170 AMdirect16186000-10k
240301-JUL-07 04.49.13.615512 PMdirect16202200-10k
240401-JUL-07 04.49.13.664085 PMdirect16365100-10k
240501-JUL-07 04.49.13.678123 PMdirect164512330-10k
240729-JUN-07 07.03.21.526005 AMdirect165925190-10k
240829-JUN-07 08.59.31.333617 AMdirect16613090-10k
240929-JUN-07 09.53.41.984501 AMdirect1672480-10k
241024-MAY-08 10.19.51.985501 AMdirect16864517525-50k
241124-MAY-07 11.22.10.548639 AMdirect169815760.510-25k
241229-MAR-06 10.22.09.509801 AMdirect17096681650-75k
241329-MAR-08 01.34.04.525934 PMdirect10154855225-50k
241429-MAR-07 02.22.40.536996 PMdirect102810794.610-25k
241529-MAR-06 01.34.50.545196 PMdirect10363100-10k
241629-MAR-07 04.41.20.945676 PMdirect10463840-10k
241720-MAR-07 05.49.10.974352 PMdirect10551926.60-10k
241820-MAR-04 04.18.21.862632 PMdirect10645546.60-10k
241920-MAR-07 07.03.32.764632 PMdirect10733157425-50k
242013-MAR-07 08.59.43.666320 PMdirect10822975025-50k
242112-MAR-07 09.53.54.562432 PMdirect10917283650-75k
242216-DEC-07 08.19.55.462332 PMdirect144211188.510-25k
242321-NOV-07 10.22.33.362632 AMdirect145310367.710-25k
242421-NOV-07 10.22.33.263332 AMdirect14641382410-25k
242516-NOV-06 11.34.22.162552 PMdirect14751500.80-10k
242617-NOV-06 12.22.11.262552 AMdirect148672000-10k
242710-NOV-07 01.34.22.362124 AMdirect149790550-10k
242810-NOV-07 02.41.34.463567 AMdirect116814685.810-25k
242910-NOV-07 03.49.25.526321 AMdirect11795012550-75k
243002-OCT-07 06.18.36.663332 AMdirect101829669.925-50k
243114-SEP-06 07.03.04.763452 AMdirect10215610.60-10k
243701-SEP-06 08.59.15.826132 AMdirect10341355010-25k
243801-SEP-07 09.53.26.934626 AMdirect104054510-10k
243931-AUG-07 10.19.37.811132 AMdirect105122150.110-25k
244101-AUG-08 11.22.48.734526 AMdirect10652075.20-10k
244227-JUL-06 12.22.59.662632 PMdirect107952471.950-75k
244327-JUL-06 01.34.16.562632 PMdirect108036460-10k
244427-JUL-07 02.22.27.462632 PMdirect109177727.275-100k
244527-JUL-06 03.34.38.362632 PMdirect14485537.80-10k
244818-JUN-07 04.41.49.262632 PMdirect145513880-10k
244913-JUN-07 05.49.07.162632 PMdirect1466860-10k
245011-APR-07 06.18.10.362632 PMdirect147316360-10k
245117-DEC-07 05.03.52.562632 PMdirect148710474.610-25k
245206-OCT-07 08.59.43.462632 PMdirect14951258910-25k
245304-OCT-07 09.53.34.362632 PMdirect11601290-10k
245607-NOV-06 07.53.25.989889 PMdirect11703878.40-10k
245731-OCT-07 11.22.16.162632 PMdirect118521586.210-25k

For the final real-world problem, I want to highlight how CASE expressions can be used with aggregate functions to perform a powerful transformation commonly known as pivoting rows to attributes or columns. Using the orders table, suppose you are tasked with generating a report containing one row per customer. Within each row, the corresponding customer’s order total values need to be bucketed into the same order total categories specified in the previous problem; however, this report requires the order total category values to be represented as attributes or columns (e.g., 0-10k, 10-25k, etc.). The values within the corresponding row and column are to represent the number of orders the customer placed within the corresponding order total category. For clarity, you are attempting to generate the output below. The first row reads as, “customer ID 107 placed one order in the 0-10k range, zero in 10-25k range, one in the 25-50k range, two in the 50-75k range, zero in the 75-100k range, and zero in the 100k+ range.” Review the output below and then let us take a look at the code required to generate the desired output.

customer_id0-10k10-25k25-50k50-75k75-100k100k+
107101200
108101101
158001000
161100000
166100000
105211000
109010120
143001000
159000100
162100000
163100000
168001000
104201010
118010010
145221000
121100000
141001000
155010000
101003010
103310000
116220000
120100000
142001000
151010000
156000100
157100000
169010000
146122000
148220001
149110201
122000001
152100000
170000100
144120200
119010000
153001000
164100000
167100000
102121000
106310000
147202001
117200101
123010000
150000001
154001000
160100000
165100000

In the code below, the GROUP BY clause groups each customer’s orders. From these groups, the customer ID value is selected as the single non-aggregate attribute in the SELECT clause. The remainder are derived attributes making use of the SUM function. Each of these derived attributes include a CASE expression nested within to determine the number of orders the corresponding customer placed falling within a specific order total category. The CASE expression’s conditions are evaluated on each of the rows or orders corresponding to each customer (i.e., the grouped rows). For each order meeting the condition specified in the initial WHEN branch, a value of one is recorded. Otherwise, a zero is recorded. After evaluating the CASE expression’s conditions for each of the customer’s orders, the individual results are summed up. This sum represents the total number of orders the customer placed within the order total category represented by the attribute’s alias (e.g., 0-10k) and driven by the conditions evaluated in the CASE expression.

SELECT
    oe.orders.customer_id,
    SUM(
        CASE
            WHEN oe.orders.order_total < 10000
                THEN 1
            ELSE 0
        END
    ) AS "0-10k",
    SUM(
        CASE
            WHEN oe.orders.order_total >= 10000
                AND oe.orders.order_total < 25000
                THEN 1
            ELSE 0
        END
    ) AS "10-25k",
    SUM(
        CASE
            WHEN oe.orders.order_total >= 25000
                AND oe.orders.order_total < 50000
                THEN 1
            ELSE 0
        END
    ) AS "25-50k",
    SUM(
        CASE
            WHEN oe.orders.order_total >= 50000
                AND oe.orders.order_total < 75000
                THEN 1
            ELSE 0
        END
    ) AS "50-75k",
    SUM(
        CASE
            WHEN oe.orders.order_total >= 75000
                AND oe.orders.order_total < 100000
                THEN 1
            ELSE 0
        END
    ) AS "75-100k",
    SUM(
        CASE
            WHEN oe.orders.order_total >= 100000
                THEN 1
            ELSE 0
        END
    ) AS "100k+"
FROM
    oe.orders
GROUP BY
    oe.orders.customer_id;

If you are interested in seeing the role CASE expressions can play when creating data visualizations, consider checking out a brief example on my Tableau Public page here.

Rewriting Simple CASE Expressions
Any simple case expression can be rewritten as a searched case expression, including the one featured in the first example on this page. The equivalent can be found below.

CASE
    WHEN oe.customers.gender = 'M'
        THEN 'Male'
    WHEN oe.customers.gender = 'F'
        THEN 'Female'
    ELSE 'Not Specified'
END AS gender

Additionally, some searched case expressions can be rewritten as simple case expressions, including the one used in a previous example above to classify integers as odd or even. The equivalent can be found below.

CASE MOD(integer_sequence.integer_value, 2)
    WHEN 0
        THEN 'Even'
    WHEN 1
        THEN 'Odd'
    ELSE 'N/A'
END AS number_category

Short-circuit Evaluation
For both types of CASE expressions, it is important to keep in mind the branches are traversed in the order they are written. When you are building a CASE expression consisting of multiple branches, consider placing the branch with the condition most likely to evaluate to TRUE first because subsequent branches are not traversed when a previous branch evaluates to TRUE for a row. By doing so, you can ensure the minimal amount of branches and corresponding conditions are evaluated.

Knowledge Check
If you’d like to confirm your understanding on the use of CASE expressions and other fundamental concepts, consider solving a handful of my practice problems here.