queries.json 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. [
  2. {
  3. "name": "Sample: Salary Analysis",
  4. "desc": "Top salary 2007 above $100k, Salary growth (sorted) from 2007-08",
  5. "type": "2",
  6. "dialects": ["postgresql", "mysql", "presto"],
  7. "data": {
  8. "query": {
  9. "query": "SELECT sample_07.description, sample_07.salary\r\nFROM\r\n sample_07\r\nWHERE\r\n( sample_07.salary > 100000)\r\nORDER BY sample_07.salary DESC\r\nLIMIT 1000;\n\n\nSELECT s07.description, s07.salary, s08.salary,\r\n s08.salary - s07.salary\r\nFROM\r\n sample_07 s07 JOIN sample_08 s08\r\nON ( s07.code = s08.code)\r\nWHERE\r\n s07.salary < s08.salary\r\nORDER BY s08.salary-s07.salary DESC\r\nLIMIT 1000;\n\n\n",
  10. "type": 0,
  11. "email_notify": false,
  12. "is_parameterized": false,
  13. "database": "default"
  14. },
  15. "functions": [],
  16. "VERSION": "0.4.1",
  17. "file_resources": [],
  18. "settings": []
  19. }
  20. },
  21. {
  22. "name": "Sample: Top salary",
  23. "desc": "Top salary 2007 above $100k",
  24. "type": "0",
  25. "data": {
  26. "query": {
  27. "query": "SELECT sample_07.description, sample_07.salary\r\nFROM\r\n sample_07\r\nWHERE\r\n( sample_07.salary > 100000)\r\nORDER BY sample_07.salary DESC\r\nLIMIT 1000",
  28. "type": 0,
  29. "email_notify": false,
  30. "is_parameterized": false,
  31. "database": "default"
  32. },
  33. "functions": [],
  34. "VERSION": "0.4.1",
  35. "file_resources": [],
  36. "settings": []
  37. }
  38. },
  39. {
  40. "name": "Sample: Salary growth",
  41. "desc": "Salary growth (sorted) from 2007-08",
  42. "type": "0",
  43. "data": {
  44. "query": {
  45. "query": "SELECT s07.description, s07.salary, s08.salary,\r\n s08.salary - s07.salary\r\nFROM\r\n sample_07 s07 JOIN sample_08 s08\r\nON ( s07.code = s08.code)\r\nWHERE\r\n s07.salary < s08.salary\r\nORDER BY s08.salary-s07.salary DESC\r\nLIMIT 1000",
  46. "type": 0,
  47. "email_notify": false,
  48. "is_parameterized": false,
  49. "database": "default"
  50. },
  51. "functions": [],
  52. "VERSION": "0.4.1",
  53. "file_resources": [],
  54. "settings": []
  55. }
  56. },
  57. {
  58. "name": "Sample: Job loss",
  59. "desc": "Job loss among the top earners 2007-08",
  60. "type": "0",
  61. "data": {
  62. "query": {
  63. "query": "SELECT s07.description, s07.total_emp, s08.total_emp, s07.salary\r\nFROM\r\n sample_07 s07 JOIN \r\n sample_08 s08\r\nON ( s07.code = s08.code )\r\nWHERE\r\n( s07.total_emp > s08.total_emp\r\n AND s07.salary > 100000 )\r\nORDER BY s07.salary DESC\nLIMIT 1000",
  64. "type": 0,
  65. "email_notify": false,
  66. "is_parameterized": false,
  67. "database": "default"
  68. },
  69. "functions": [],
  70. "VERSION": "0.4.1",
  71. "file_resources": [],
  72. "settings": []
  73. }
  74. },
  75. {
  76. "name": "Sample: Customers",
  77. "desc": "Email Survey Opt-Ins, Customers for Shipping ZIP Code, Total Amount per Order",
  78. "type": "0",
  79. "data": {
  80. "query": {
  81. "query": "-- Get email survey opt-in values for all customers\nSELECT\r\n c.id,\r\n c.name,\r\n c.email_preferences.categories.surveys\r\nFROM customers c;\n\n\n\n-- Select customers for a given shipping ZIP Code\nSELECT\r\n customers.id,\r\n customers.name\r\nFROM customers\r\nWHERE customers.addresses['shipping'].zip_code = '76710';\n\n\n\n-- Compute total amount per order for all customers\nSELECT\r\n c.id AS customer_id,\r\n c.name AS customer_name,\r\n ords.order_id AS order_id,\r\n SUM(order_items.price * order_items.qty) AS total_amount\r\nFROM\r\n customers c\r\nLATERAL VIEW EXPLODE(c.orders) o AS ords\r\nLATERAL VIEW EXPLODE(ords.items) i AS order_items\r\nGROUP BY c.id, c.name, ords.order_id;",
  82. "type": 0,
  83. "email_notify": false,
  84. "is_parameterized": false,
  85. "database": "default"
  86. },
  87. "functions": [],
  88. "VERSION": "0.4.1",
  89. "file_resources": [],
  90. "settings": []
  91. }
  92. },
  93. {
  94. "name": "Sample: Top salary",
  95. "desc": "Top salary 2007 above $100k",
  96. "type": "1",
  97. "data": {
  98. "query": {
  99. "query": "SELECT sample_07.description, sample_07.salary\r\nFROM\r\n sample_07\r\nWHERE\r\n( sample_07.salary > 100000)\r\nORDER BY sample_07.salary DESC\r\nLIMIT 1000",
  100. "type": 1,
  101. "email_notify": false,
  102. "is_parameterized": false,
  103. "database": "default"
  104. },
  105. "functions": [],
  106. "VERSION": "0.4.1",
  107. "file_resources": [],
  108. "settings": []
  109. }
  110. },
  111. {
  112. "name": "Sample: Salary growth",
  113. "desc": "Salary growth (sorted) from 2007-08",
  114. "type": "1",
  115. "data": {
  116. "query": {
  117. "query": "SELECT s07.description, s07.salary, s08.salary,\r\n s08.salary - s07.salary\r\nFROM\r\n sample_07 s07 JOIN sample_08 s08\r\nON ( s07.code = s08.code)\r\nWHERE\r\n s07.salary < s08.salary\r\nORDER BY s08.salary-s07.salary DESC\r\nLIMIT 1000",
  118. "type": 1,
  119. "email_notify": false,
  120. "is_parameterized": false,
  121. "database": "default"
  122. },
  123. "functions": [],
  124. "VERSION": "0.4.1",
  125. "file_resources": [],
  126. "settings": []
  127. }
  128. },
  129. {
  130. "name": "Sample: Job loss",
  131. "desc": "Job loss among the top earners 2007-08",
  132. "type": "1",
  133. "data": {
  134. "query": {
  135. "query": "SELECT s07.description, s07.total_emp, s08.total_emp, s07.salary\r\nFROM\r\n sample_07 s07 JOIN \r\n sample_08 s08\r\nON ( s07.code = s08.code )\r\nWHERE\r\n( s07.total_emp > s08.total_emp\r\n AND s07.salary > 100000 )\r\nORDER BY s07.salary DESC\nLIMIT 1000",
  136. "type": 0,
  137. "email_notify": false,
  138. "is_parameterized": false,
  139. "database": "default"
  140. },
  141. "functions": [],
  142. "VERSION": "0.4.1",
  143. "file_resources": [],
  144. "settings": []
  145. }
  146. },
  147. {
  148. "name": "Sample: Customers",
  149. "desc": "Email Survey Opt-Ins, Customers for Shipping ZIP Code, Total Amount per Order",
  150. "type": "1",
  151. "data": {
  152. "query": {
  153. "query": "-- Get email survey opt-in values for all customers \nSELECT\r\n c.id,\r\n c.name,\r\n c.email_preferences.categories.surveys\r\nFROM customers c;\n\n\n\n-- Select customers for a given shipping ZIP Code\nSELECT\r\n c.id,\r\n c.name\r\nFROM customers c, c.addresses a\r\nWHERE a.key = 'shipping' and a.zip_code = '76710';\n\n\n\n-- Compute total amount per order for all customers\nSELECT\r\n c.id AS customer_id,\r\n c.name AS customer_name,\r\n o.order_id,\r\n v.total\r\nFROM\r\n customers c,\r\n c.orders o,\r\n (SELECT SUM(price * qty) total FROM o.items) v;",
  154. "type": 1,
  155. "email_notify": false,
  156. "is_parameterized": false,
  157. "database": "default"
  158. },
  159. "functions": [],
  160. "VERSION": "0.4.1",
  161. "file_resources": [],
  162. "settings": []
  163. }
  164. }
  165. ]