Trainer

A data-work simulator: tickets from real coworkers, real tasks, real SQL.

217 tickets · 30 free for everyone
  1. Now

    #1Getting to know the data

    SELECTDifficulty 1 of 3
    Open ticket
  2. #2A short price listSELECT→
  3. #3A price list for partnersSELECT→
  4. #4The discounted priceSELECT→
  5. #5A price tag without centsSELECT→
  6. #6A ready-made price tagSELECTSTRINGS→
  7. #7Price segmentsSELECT→
  8. #8What categories do we even haveSELECT→
  9. #9Phones onlyWHERE→
  10. #10Everything except phonesWHERE→
  11. #11Low on stockWHERE→
  12. #12The budget selectionWHERE→
  13. #13Affordable phonesWHERE→
  14. #14Top-end laptopsWHERE→
  15. #15Products that need attentionWHERE→
  16. #16A sale with several conditionsWHERE→
  17. #17The mid-range segmentWHERE→
  18. #18Mobile devicesWHERE→
  19. #19Searching for "Pro"WHERE→
  20. #20The Galaxy familyWHERE→
  21. #21A catalogue without SonyWHERE→
  22. #22Search that ignores caseWHERE→
  23. #23The catalogue in alphabetical orderSELECTORDER BY→
  24. #24Cheapest firstSELECTORDER BY→
  25. #25Expensive products for the showcaseORDER BYWHERE→
  26. #26The three most expensiveSELECTORDER BY→
  27. #27The second pageSELECTORDER BY→
  28. #28The third page of the catalogueSELECTORDER BY→
  29. #29The catalogue by shelvesSELECTORDER BY→
  30. #30Discount rulesSELECT→
  31. #31How many products in totalSELECTAGGREGATE
  32. #32How many categoriesSELECTAGGREGATE
  33. #33How many expensive productsWHEREAGGREGATE
  34. #34The cheapest and the most expensiveSELECTAGGREGATE
  35. #35The total warehouse stockSELECTAGGREGATE
  36. #36The value of the stockSELECTAGGREGATE
  37. #37The average catalogue priceSELECTAGGREGATE
  38. #38The catalogue summarySELECTAGGREGATE
  39. #39A summary with breakdownsWHEREAGGREGATE
  40. #40More expensive than averageWHERESUBQUERYAGGREGATE
  41. #41The three priciest above averageORDER BYWHERESUBQUERY+1
  42. #42Names longer than averageORDER BYWHERESUBQUERY+2
  43. #43Above or below the averageSUBQUERYAGGREGATE
  44. #44How many products in each categoryGROUP BYAGGREGATE
  45. #45Stock by categoryGROUP BYAGGREGATE
  46. #46The flagship of each categoryGROUP BYAGGREGATE
  47. #47Categories with more than 2 productsGROUP BYHAVINGAGGREGATE
  48. #48Premium categoriesGROUP BYHAVINGAGGREGATE
  49. #49Categories above the overall averageGROUP BYHAVINGSUBQUERY+1
  50. #50Categories by stockGROUP BYORDER BYAGGREGATE
  51. #51A profile of the categoriesGROUP BYAGGREGATE
  52. #52A price list in other currenciesJOINWHERE
  53. #53A separate table for categoriesDDLCONSTRAINTS
  54. #54Filling in the categoriesDML
  55. #55The average price by categoryJOINGROUP BYAGGREGATE
  56. #56Preparing the key to the categoriesDDL
  57. #57Linking products to categoriesWHERESUBQUERYDML
  58. #58A protected link: FOREIGN KEYDDLCONSTRAINTS
  59. #59A product's category by keyJOIN
  60. #60A new product in the catalogueDML
  61. #61A discount on laptopsWHEREDML
  62. #62Dropping a product lineWHEREDML
  63. #63Removing the redundant textDDL
  64. #64Closing the camera line (by id)WHERESUBQUERYDML
  65. #65A new table: customersDDLCONSTRAINTS
  66. #66Filling in the customersDML
  67. #67A new table: ordersDDLCONSTRAINTS
  68. #68Filling in the ordersDATESDML
  69. #69Does the key really workDATESDML
  70. #70Orders with the customer's nameJOIN
  71. #71Orders with a size labelJOIN
  72. #72How much each customer spentJOINGROUP BYAGGREGATE
  73. #73A new column: emailDDL
  74. #74Recording the customers' emailsDML
  75. #75Protection from duplicates: UNIQUEDDLCONSTRAINTS
  76. #76Every customer and their ordersJOINGROUP BYAGGREGATE
  77. #77Active and dormant customersJOINGROUP BYAGGREGATE
  78. #78Revenue by statusGROUP BYAGGREGATE
  79. #79The real revenueWHEREAGGREGATE
  80. #80The average order valueSELECTAGGREGATE
  81. #81Who places the biggest ordersJOINGROUP BYORDER BY+2
  82. #82The best customerJOINGROUP BYORDER BY+2
  83. #83The orders for one monthWHEREDATES
  84. #84Product URLs (slugs)STRINGSDDLDML
  85. #85Customers by email domainGROUP BYSTRINGSAGGREGATE
  86. #86Orders by email domainJOINGROUP BYSTRINGS+1
  87. #87Popular email servicesGROUP BYHAVINGSTRINGS+1
  88. #88Domains by monthJOINGROUP BYDATES+2
  89. #89Will the database take a duplicate emailDML
  90. #90Labels for the mobile versionWHERESTRINGS
  91. #91Customers by cityGROUP BYAGGREGATE
  92. #92Quiet citiesJOINGROUP BYHAVING+1
  93. #93Quiet cities by moneyJOINGROUP BYHAVING+1
  94. #94Revenue by cityJOINGROUP BYAGGREGATE
  95. #95Repeat customersJOINGROUP BYHAVING+1
  96. #96Repeat customers through a CTEJOINGROUP BYWHERE+2
  97. #97Orders by monthGROUP BYDATESAGGREGATE
  98. #98Strong monthsGROUP BYHAVINGDATES+1
  99. #99The month as a real dateGROUP BYORDER BYDATES+1
  100. #100Orders after paydayWHEREDATES
  101. #101Recent ordersWHERESUBQUERYDATES+1
  102. #102The three most recent ordersSELECTORDER BYDATES
  103. #103The season of an orderSELECTDATES
  104. #104The top three customersJOINGROUP BYORDER BY+2
  105. #105Orders above averageWHERESUBQUERYAGGREGATE
  106. #106A shared delivery runJOIN
  107. #107Who has never orderedWHERESUBQUERY
  108. #108Orders by sizeGROUP BYAGGREGATE
  109. #109The processing queueSELECTORDER BY
  110. #110The large order groupsGROUP BYHAVINGAGGREGATE
  111. #111The spending of every customerJOINGROUP BYAGGREGATE
  112. #112Order line itemsDDLCONSTRAINTS
  113. #113Filling in the line itemsDML
  114. #114Bought for lessJOINWHERE
  115. #115An index on a foreign keyDDL
  116. #116A table to experiment onDATESDDLDML
  117. #117What the query plan saysDDL
  118. #118Raise the prices and see the resultWHEREDML
  119. #119A staging table for the price listDDLDML
  120. #120Applying the price listWHEREDML
  121. #121Clearing up after yourselfDDL
  122. #122Who bought whatJOIN
  123. #123Sales by productJOINGROUP BYAGGREGATE
  124. #124Revenue by productJOINGROUP BYAGGREGATE
  125. #125Revenue by categoryJOINGROUP BYAGGREGATE
  126. #126Top 3 among the varied categoriesJOINGROUP BYHAVING+2
  127. #127A category's share of the revenueJOINGROUP BYSUBQUERY+2
  128. #128How far behind the leaderJOINGROUP BYCTE+2
  129. #129Categories by strengthJOINGROUP BYCTE+1
  130. #130The catalogue with revenueJOINGROUP BYCTE+1
  131. #131Two breakdowns in one queryJOINGROUP BYAGGREGATE
  132. #132Every breakdown at onceJOINGROUP BYAGGREGATE
  133. #133The April calendar with no gapsJOINGROUP BYORDER BY+2
  134. #134Total against the sum of the line itemsJOINGROUP BYAGGREGATE
  135. #135A running total of the revenueORDER BYWINDOWDATES+1
  136. #136A moving averageORDER BYWINDOWDATES+1
  137. #137Ranking customers by spendingJOINGROUP BYORDER BY+2
  138. #138Ranking every customerJOINGROUP BYORDER BY+2
  139. #139Who is the leaderJOINGROUP BYORDER BY+2
  140. #140Ranking among the large categoriesJOINGROUP BYHAVING+3
  141. #141The leader in each categoryJOINGROUP BYORDER BY+4
  142. #142Categories with high revenueJOINGROUP BYWHERE+3
  143. #143Products nobody has boughtWHERESUBQUERYUNION
  144. #144The priciest that do not sellJOINORDER BYWHERE
  145. #145Two lists into oneWHERESUBQUERYUNION
  146. #146The list without duplicatesWHERESUBQUERYUNION
  147. #147The worst candidatesWHERESUBQUERYUNION
  148. #148Categories that have emptied outWHERESUBQUERY
  149. #149A comparison that is safe with NULLWHEREAGGREGATE
  150. #150Working out the order totalsWHERESUBQUERYAGGREGATE
  151. #151A view for the catalogueJOINDDL
  152. #152A view over an aggregateJOINGROUP BYDDL+1
  153. #153How the revenue changes month to monthGROUP BYORDER BYWHERE+3
  154. #154The change with no empty cellsGROUP BYORDER BYCTE+3
  155. #155Price tiers of the catalogueORDER BYWINDOW
  156. #156Do the customers come backJOINORDER BYWINDOW+1
  157. #157A report with subtotalsJOINGROUP BYORDER BY+1
  158. #158A total row by handJOINGROUP BYUNION+1
  159. #159A price list from the supplierDML
  160. #160A discount: the column, the data and the ruleWHEREDDLDML+1
  161. #161Protection from a nonsensical priceDDLCONSTRAINTS
  162. #162A default statusDATESDDLDML+1
  163. #163Rolling back only the mistakeWHEREDMLTRANSACTION
  164. #164Reserving stock safelyWHEREDMLTRANSACTION
  165. #165The reviews tableDDLCONSTRAINTS
  166. #166The first reviewsDML
  167. #167A rating off the scaleDML
  168. #168Product ratingsJOINGROUP BYAGGREGATE
  169. #169Places by ratingJOINGROUP BYORDER BY+2
  170. #170The weakest by ratingJOINGROUP BYORDER BY+1
  171. #171The sentiment of the reviewsGROUP BYAGGREGATE
  172. #172What people write about the batteryJOINWHERE
  173. #173The most detailed reviewsJOINORDER BYSTRINGS
  174. #174Revenue per reviewJOINGROUP BYAGGREGATE
  175. #175The gap between sales and reviewsJOINWHERESUBQUERY
  176. #176Products with no reviewsJOINWHERE
  177. #177Rating against revenueJOINGROUP BYCTE+1
  178. #178Reviews from people who did not buyJOINWHERESUBQUERY
  179. #179A many-to-many linkDDLCONSTRAINTS
  180. #180Moving the existing links acrossDML
  181. #181A product in several categoriesDML
  182. #182A product with all its categoriesJOINGROUP BYORDER BY+2
  183. #183How many products in a category nowJOINGROUP BYAGGREGATE
  184. #184Products on two shelvesJOINGROUP BYHAVING+1
  185. #185Neighbouring categoriesJOINGROUP BYAGGREGATE
  186. #186Removing a link that is not neededWHEREDML
  187. #187Category revenue after M:NJOINGROUP BYAGGREGATE
  188. #188Removing the redundant columnDDL
  189. #189The payments tableDDLCONSTRAINTS
  190. #190The statement from accountingDATESDML
  191. #191A payment with no amountDML
  192. #192What has not been paid for yetJOINWHERE
  193. #193Reconciling the paymentsJOINGROUP BYHAVING+1
  194. #194How exactly people payGROUP BYAGGREGATE
  195. #195Which months the money came inSELECTORDER BYDATES
  196. #196How much each customer paidJOINGROUP BYAGGREGATE
  197. #197How the money piled upORDER BYWINDOWDATES+1
  198. #198The latest payment for each orderSELECTORDER BYDATES
  199. #199Money for something cancelledJOINGROUP BYWHERE+1
  200. #200The shipments tableDDLCONSTRAINTS
  201. #201The dispatch logDATESDML
  202. #202Paid for but not dispatchedWHERESUBQUERY
  203. #203How many days delivery takesJOINWHEREDATES
  204. #204What is on its way right nowJOINWHEREDATES
  205. #205The carriers' workloadGROUP BYHAVINGAGGREGATE
  206. #206What is waiting to be dispatchedJOINGROUP BYWHERE+1
  207. #207Who delivers fasterJOINGROUP BYWHERE+2
  208. #208How long we take to pack a parcelJOINGROUP BYDATES+1
  209. #209Dispatched without waiting for the moneyJOINGROUP BYHAVING+2
  210. #210Does a long delivery spoil the ratingJOINWHEREDATES
  211. #211A review but no moneyJOINWHERESUBQUERY
  212. #212How people pay in different citiesJOINGROUP BYAGGREGATE
  213. #213An order cardJOINWHERESUBQUERY+1
  214. #214An order's event feedJOINUNIONDATES
  215. #215The state of the orders at a glanceJOINGROUP BYDATES+1
  216. #216An order from start to finishWHERESUBQUERYDATES+3
  217. #217Closing the stale ordersWHERESUBQUERYDATES+1