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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[
|
2 |
+
{
|
3 |
+
"db_id": "hn",
|
4 |
+
"query": "SELECT COUNT(*) as domain_count, \nSUBSTRING(SPLIT_PART(url, '//', 2), 1, POSITION('/' IN SPLIT_PART(url, '//', 2)) - 1) as domain \nFROM hacker_news\nWHERE url IS NOT NULL GROUP BY domain ORDER BY domain_count DESC LIMIT 10;",
|
5 |
+
"setup_sql": ";",
|
6 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
7 |
+
"question": "what are the top domains being shared on hacker_news?",
|
8 |
+
"category": "hard"
|
9 |
+
},
|
10 |
+
{
|
11 |
+
"db_id": "laptop",
|
12 |
+
"query": "SELECT c.firstname, c.lastname, COUNT(*) AS num_pcs_bought\nFROM customers c\nJOIN sales s ON c.customer_id = s.customer_id\nJOIN pcs p ON s.model = p.model\nGROUP BY c.customer_id, c.firstname, c.lastname\nORDER BY num_pcs_bought DESC\nLIMIT 1;",
|
13 |
+
"setup_sql": ";",
|
14 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
15 |
+
"question": "Who bought the most PCs, print also the users name?",
|
16 |
+
"category": "medium"
|
17 |
+
},
|
18 |
+
{
|
19 |
+
"db_id": "transactions",
|
20 |
+
"query": "select users.id, users.name, sum(transactions.amount) as balance from users join transactions on users.id = transactions.user_id group by users.id, users.name having balance = 0",
|
21 |
+
"setup_sql": ";",
|
22 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
23 |
+
"question": "list the names off account holders who have negative balances",
|
24 |
+
"category": "easy"
|
25 |
+
},
|
26 |
+
{
|
27 |
+
"db_id": "laptop",
|
28 |
+
"query": "SELECT model FROM products WHERE maker = 'B';",
|
29 |
+
"setup_sql": ";",
|
30 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
31 |
+
"question": "List only the model number of all products made by maker B.",
|
32 |
+
"category": "easy"
|
33 |
+
},
|
34 |
+
{
|
35 |
+
"db_id": "laptop",
|
36 |
+
"query": "SELECT model FROM products WHERE maker <> 'B';",
|
37 |
+
"setup_sql": ";",
|
38 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
39 |
+
"question": "List the model numbers of all products not made by maker B.",
|
40 |
+
"category": "easy"
|
41 |
+
},
|
42 |
+
{
|
43 |
+
"db_id": "laptop",
|
44 |
+
"query": "SELECT AVG(speed) FROM pcs WHERE speed >= 3.00",
|
45 |
+
"setup_sql": ";",
|
46 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
47 |
+
"question": "Return the average speed all PCs with speed >= 3.00",
|
48 |
+
"category": "easy"
|
49 |
+
},
|
50 |
+
{
|
51 |
+
"db_id": "laptop",
|
52 |
+
"query": "SELECT MAX(price) FROM printers WHERE color = 'TRUE' AND type='laser'",
|
53 |
+
"setup_sql": ";",
|
54 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
55 |
+
"question": "Return the price of the most expensive color laser printer",
|
56 |
+
"category": "medium"
|
57 |
+
},
|
58 |
+
{
|
59 |
+
"db_id": "laptop",
|
60 |
+
"query": "SELECT MIN(paid) FROM sales WHERE type_of_payment LIKE '%visa%'",
|
61 |
+
"setup_sql": ";",
|
62 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
63 |
+
"question": "Return the minimum amount paid by customers who used a visa card (debit or credit) to purchase a product",
|
64 |
+
"category": "medium"
|
65 |
+
},
|
66 |
+
{
|
67 |
+
"db_id": "laptop",
|
68 |
+
"query": "SELECT customer_id FROM customers WHERE firstname LIKE '%e%' OR lastname LIKE '%e%'",
|
69 |
+
"setup_sql": ";",
|
70 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
71 |
+
"question": "Find the customer_id of customers who have the letter 'e' either in their first name or in their last name",
|
72 |
+
"category": "medium"
|
73 |
+
},
|
74 |
+
{
|
75 |
+
"db_id": "laptop",
|
76 |
+
"query": "SELECT model, price/0.85 AS 'price (USD)' FROM laptops WHERE ram >= 1024",
|
77 |
+
"setup_sql": ";",
|
78 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
79 |
+
"question": "Assume all prices in the table Laptops are in Euro. List the prices of laptops with at least 1024 ram. You should return the price in USD in a column called 'price (USD)'. Assume that 1 USD = 0.85 EURO. Name the price column 'price (USD)'.",
|
80 |
+
"category": "hard"
|
81 |
+
},
|
82 |
+
{
|
83 |
+
"db_id": "laptop",
|
84 |
+
"query": "SELECT maker FROM products GROUP BY maker HAVING COUNT(maker) > 4;",
|
85 |
+
"setup_sql": ";",
|
86 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
87 |
+
"question": "Return a list of makers that make more than four different products.",
|
88 |
+
"category": "medium"
|
89 |
+
},
|
90 |
+
{
|
91 |
+
"db_id": "laptop",
|
92 |
+
"query": "SELECT model FROM laptops WHERE speed > 1.7 ORDER BY speed DESC;",
|
93 |
+
"setup_sql": ";",
|
94 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
95 |
+
"question": "List all the laptop model numbers that have a speed greater than 1.7 in descending order of speed.",
|
96 |
+
"category": "medium"
|
97 |
+
},
|
98 |
+
{
|
99 |
+
"db_id": "laptop",
|
100 |
+
"query": "SELECT firstname \n FROM sales \n JOIN customers ON sales.customer_id = customers.customer_id \n GROUP BY firstname \n ORDER BY COUNT(firstname);",
|
101 |
+
"setup_sql": ";",
|
102 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
103 |
+
"question": "List firstnames of customers in an ascending order based on the number of purchases made by customers with this firstname.",
|
104 |
+
"category": "medium"
|
105 |
+
},
|
106 |
+
{
|
107 |
+
"db_id": "laptop",
|
108 |
+
"query": "SELECT DISTINCT maker FROM products JOIN pcs ON products.model = pcs.model WHERE ram > 1500;",
|
109 |
+
"setup_sql": ";",
|
110 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
111 |
+
"question": "List all the makers (with only one entry per maker) who make PCs with RAM greater than 1500.",
|
112 |
+
"category": "medium"
|
113 |
+
},
|
114 |
+
{
|
115 |
+
"db_id": "laptop",
|
116 |
+
"query": "SELECT city, AVG(paid) as 'avg_spend' FROM sales JOIN customers ON sales.customer_id = customers.customer_id GROUP BY city",
|
117 |
+
"setup_sql": ";",
|
118 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
119 |
+
"question": "Find the city and the average amount of money spent by customers in each city. Name the column for the amount 'avg_spend'",
|
120 |
+
"category": "medium"
|
121 |
+
},
|
122 |
+
{
|
123 |
+
"db_id": "laptop",
|
124 |
+
"query": "SELECT color, MAX(price) as 'max_price' FROM printers GROUP BY color;",
|
125 |
+
"setup_sql": ";",
|
126 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
127 |
+
"question": "Find the maximum price for each color of printer. Name the column for the maximum price 'max_price'",
|
128 |
+
"category": "medium"
|
129 |
+
},
|
130 |
+
{
|
131 |
+
"db_id": "who",
|
132 |
+
"query": "select country_name, max(pm25_concentration) as worst_pm25_for_country\nfrom ambient_air_quality\ngroup by country_name\norder by worst_pm25_for_country desc\nlimit 1",
|
133 |
+
"setup_sql": ";",
|
134 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
135 |
+
"question": "Find the country with the worst single reading of air quality (highest PM 2.5 value). Show the PM 2.5 value as well.",
|
136 |
+
"category": "medium"
|
137 |
+
},
|
138 |
+
{
|
139 |
+
"db_id": "who",
|
140 |
+
"query": "select country_name, avg(pm25_concentration) as worst_avg_pm25_for_country\nfrom ambient_air_quality\ngroup by country_name\norder by worst_avg_pm25_for_country desc\nlimit 1",
|
141 |
+
"setup_sql": ";",
|
142 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
143 |
+
"question": "Find the country with the worst average air quality (highest PM 2.5 value). Show the PM 2.5 value as well.",
|
144 |
+
"category": "medium"
|
145 |
+
},
|
146 |
+
{
|
147 |
+
"db_id": "who",
|
148 |
+
"query": "select distinct country_name from ambient_air_quality order by country_name",
|
149 |
+
"setup_sql": ";",
|
150 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
151 |
+
"question": "Find all countries for which WHO air quality data is available. Sort alphabetically.",
|
152 |
+
"category": "medium"
|
153 |
+
},
|
154 |
+
{
|
155 |
+
"db_id": "who",
|
156 |
+
"query": "select year, avg(pm25_concentration) from ambient_air_quality \nwhere country_name = 'Singapore'\ngroup by year\norder by year",
|
157 |
+
"setup_sql": ";",
|
158 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
159 |
+
"question": "Find Singapore air quality defined as PM2.5 concentration over time",
|
160 |
+
"category": "medium"
|
161 |
+
},
|
162 |
+
{
|
163 |
+
"db_id": "nyc",
|
164 |
+
"query": "SELECT COLUMNS('^trip_') FROM rideshare LIMIT 10;",
|
165 |
+
"setup_sql": ";",
|
166 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
167 |
+
"question": "select only the column names from the rideshare table that start with trip_ and return the first 10 values",
|
168 |
+
"category": "duckdb"
|
169 |
+
},
|
170 |
+
{
|
171 |
+
"db_id": "nyc",
|
172 |
+
"query": "SELECT * FROM rideshare USING SAMPLE 1%;",
|
173 |
+
"setup_sql": ";",
|
174 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
175 |
+
"question": "select a 1% sample from the nyc.rideshare table",
|
176 |
+
"category": "duckdb"
|
177 |
+
},
|
178 |
+
{
|
179 |
+
"db_id": "laptop",
|
180 |
+
"query": "SELECT * EXCLUDE (customer_id) FROM customers;\n",
|
181 |
+
"setup_sql": ";",
|
182 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
183 |
+
"question": "select all columns from the customer table, except customer_id",
|
184 |
+
"category": "duckdb"
|
185 |
+
},
|
186 |
+
{
|
187 |
+
"db_id": "nyc",
|
188 |
+
"query": "SUMMARIZE rideshare;",
|
189 |
+
"setup_sql": ";",
|
190 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
191 |
+
"question": "show summary statistics of the rideshare table",
|
192 |
+
"category": "duckdb"
|
193 |
+
},
|
194 |
+
{
|
195 |
+
"db_id": "none",
|
196 |
+
"query": "SELECT * FROM read_csv_auto(\n'https://raw.githubusercontent.com/datasciencedojo/datasets/master/titanic.csv')",
|
197 |
+
"setup_sql": ";",
|
198 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
199 |
+
"question": "read a CSV from https://raw.githubusercontent.com/datasciencedojo/datasets/master/titanic.csv",
|
200 |
+
"category": "duckdb"
|
201 |
+
},
|
202 |
+
{
|
203 |
+
"db_id": "none",
|
204 |
+
"query": "COPY (SELECT * FROM read_csv_auto(\n'https://raw.githubusercontent.com/datasciencedojo/datasets/master/titanic.csv'))\nTO 'titanic.parquet' (FORMAT 'parquet');",
|
205 |
+
"setup_sql": ";",
|
206 |
+
"validation_sql": "SELECT * FROM 'titanic.parquet'",
|
207 |
+
"question": "read a CSV from https://raw.githubusercontent.com/datasciencedojo/datasets/master/titanic.csv and convert it to a parquet file called \"titanic\"",
|
208 |
+
"category": "duckdb"
|
209 |
+
},
|
210 |
+
{
|
211 |
+
"db_id": "none",
|
212 |
+
"query": "CREATE TABLE titanic AS (SELECT * FROM read_csv_auto(\n'https://raw.githubusercontent.com/datasciencedojo/datasets/master/titanic.csv'))",
|
213 |
+
"setup_sql": ";",
|
214 |
+
"validation_sql": "SELECT * FROM titanic;",
|
215 |
+
"question": "create a table called \"titanic\" from CSV file https://raw.githubusercontent.com/datasciencedojo/datasets/master/titanic.csv",
|
216 |
+
"category": "duckdb"
|
217 |
+
},
|
218 |
+
{
|
219 |
+
"db_id": "none",
|
220 |
+
"query": "PRAGMA default_null_order='NULLS LAST';",
|
221 |
+
"setup_sql": ";",
|
222 |
+
"validation_sql": "SELECT current_setting('default_null_order');",
|
223 |
+
"question": "configure duckdb to put null values last when sorting",
|
224 |
+
"category": "duckdb"
|
225 |
+
},
|
226 |
+
{
|
227 |
+
"db_id": "none",
|
228 |
+
"query": "CREATE TABLE IF NOT EXISTS products (\n maker varchar(10),\n model varchar(10),\n type varchar(10));",
|
229 |
+
"setup_sql": ";",
|
230 |
+
"validation_sql": "SELECT * FROM products;",
|
231 |
+
"question": "create a table about products, that contains a maker, model and type column",
|
232 |
+
"category": "ddl"
|
233 |
+
},
|
234 |
+
{
|
235 |
+
"db_id": "product",
|
236 |
+
"query": "INSERT INTO products (maker, model, type)\nVALUES\n ('A', '1001', 'pc');",
|
237 |
+
"setup_sql": ";",
|
238 |
+
"validation_sql": "SELECT * FROM products;",
|
239 |
+
"question": "add a row with values for model \"1001\" of type \"pc\", from maker \"A\" to products table",
|
240 |
+
"category": "ddl"
|
241 |
+
},
|
242 |
+
{
|
243 |
+
"db_id": "none",
|
244 |
+
"query": "CALL pragma_version();\n",
|
245 |
+
"setup_sql": ";",
|
246 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
247 |
+
"question": "get current version of duckdb",
|
248 |
+
"category": "duckdb"
|
249 |
+
},
|
250 |
+
{
|
251 |
+
"db_id": "nyc",
|
252 |
+
"query": "PRAGMA table_info('rideshare');",
|
253 |
+
"setup_sql": ";",
|
254 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
255 |
+
"question": "list all columns in table nyc.rideshare",
|
256 |
+
"category": "duckdb"
|
257 |
+
},
|
258 |
+
{
|
259 |
+
"db_id": "nyc",
|
260 |
+
"query": "PRAGMA show_tables;",
|
261 |
+
"setup_sql": ";",
|
262 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
263 |
+
"question": "show all tables in the curent database",
|
264 |
+
"category": "duckdb"
|
265 |
+
},
|
266 |
+
{
|
267 |
+
"db_id": "laptop",
|
268 |
+
"query": "SELECT customer_id, model, sum(paid) FROM sales GROUP BY ALL",
|
269 |
+
"setup_sql": ";",
|
270 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
271 |
+
"question": "how much did each customer spend per model type?",
|
272 |
+
"category": "easy"
|
273 |
+
},
|
274 |
+
{
|
275 |
+
"db_id": "nyc",
|
276 |
+
"query": "SELECT Max(datediff('minute', tpep_pickup_datetime, tpep_dropoff_datetime)) from nyc.taxi",
|
277 |
+
"setup_sql": ";",
|
278 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
279 |
+
"question": "What was the longest taxi ride in minutes?",
|
280 |
+
"category": "hard"
|
281 |
+
},
|
282 |
+
{
|
283 |
+
"db_id": "who",
|
284 |
+
"query": "with per_region as (\n select avg(pm10_concentration) as avg_pm10, who_region from ambient_air_quality group by who_region\n), max_region as (\n select who_region from per_region where avg_pm10 = (select max(avg_pm10) from per_region)\n), min_city_value_in_max_region as (\n select min(pm10_concentration) from ambient_air_quality where who_region in (from max_region)\n), min_city_in_max_region as (\n select city from ambient_air_quality where pm10_concentration in (from min_city_value_in_max_region) and who_region in (from max_region)\n)\nfrom min_city_in_max_region",
|
285 |
+
"setup_sql": ";",
|
286 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
287 |
+
"question": "What is the city with the lowest pm10 concentration in the region with the highest average pm10 concentration?",
|
288 |
+
"category": "hard"
|
289 |
+
},
|
290 |
+
{
|
291 |
+
"db_id": "hn",
|
292 |
+
"query": "SELECT *, regexp_extract(text, '([a-z0-9_\\.-]+)@([\\da-z\\.-]+)\\.([a-z\\.]{2,63})',0) email from hacker_news where email[:4]='test'",
|
293 |
+
"setup_sql": ";",
|
294 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
295 |
+
"question": "Get all posts on hn that contain an email address starting with test. Return all original columns, plus a new column containing the email address.",
|
296 |
+
"category": "hard"
|
297 |
+
},
|
298 |
+
{
|
299 |
+
"db_id": "json",
|
300 |
+
"query": "SELECT employee.id, employee.first_name FROM employee_json",
|
301 |
+
"setup_sql": ";",
|
302 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
303 |
+
"question": "Extract id and first_name properties as individual columns from the employee struct",
|
304 |
+
"category": "duckdb"
|
305 |
+
},
|
306 |
+
{
|
307 |
+
"db_id": "who",
|
308 |
+
"query": "SELECT who_region[1]::INT as region, * EXCLUDE (who_region) FROM who.ambient_air_quality",
|
309 |
+
"setup_sql": ";",
|
310 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
311 |
+
"question": "count quality measurements per region. Make sure to return the region code (first char of who_region) as integer and sort by region.",
|
312 |
+
"category": "duckdb"
|
313 |
+
},
|
314 |
+
{
|
315 |
+
"db_id": "flightinfo",
|
316 |
+
"query": "SELECT seat.seat_number FROM seat \nJOIN direct_flight ON direct_flight.flight_number = seat.flight_number \nJOIN airport AS departure_airport ON departure_airport.iata_code = direct_flight.departure_airport_iata_code \nJOIN airport AS arriving_airport ON arriving_airport.iata_code = direct_flight.arriving_airport_iata_code \nJOIN city AS departure_city ON departure_city.city_zipcode = departure_airport.city_zip_code \nJOIN city AS arriving_city ON arriving_city.city_zipcode = arriving_airport.city_zip_code \nWHERE departure_city.city_name = 'Bruxelles' AND arriving_city.city_name = 'Newark';",
|
317 |
+
"setup_sql": ";",
|
318 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
319 |
+
"question": "Which seats were available on the flight from Bruxelles to Newark?",
|
320 |
+
"category": "hard"
|
321 |
+
},
|
322 |
+
{
|
323 |
+
"db_id": "laptop",
|
324 |
+
"query": "COPY customers FROM 'customers_12_12_2023.csv';",
|
325 |
+
"setup_sql": "COPY customers TO 'customers_12_12_2023.csv';",
|
326 |
+
"validation_sql": "SELECT * FROM customers;",
|
327 |
+
"question": "copy content of csv file customers_12_12_2023.csv into customers table",
|
328 |
+
"category": "duckdb"
|
329 |
+
},
|
330 |
+
{
|
331 |
+
"db_id": "laptop",
|
332 |
+
"query": "COPY customers FROM 'customers_12_12_2023.csv' (DELIMITER '\\t');",
|
333 |
+
"setup_sql": "COPY customers TO 'customers_12_12_2023.csv' (FORMAT CSV, DELIMITER '\\t');",
|
334 |
+
"validation_sql": "SELECT * FROM customers;",
|
335 |
+
"question": "copy content of csv file costomers_12_12_2023.csv into customers table with tab separator",
|
336 |
+
"category": "duckdb"
|
337 |
+
},
|
338 |
+
{
|
339 |
+
"db_id": "laptop",
|
340 |
+
"query": "COPY customers FROM 'customers_partitioned/city=Amsterdam/*.parquet';",
|
341 |
+
"setup_sql": "COPY customers TO 'customers_partitioned' (FORMAT PARQUET, PARTITION_BY (city), OVERWRITE_OR_IGNORE True);",
|
342 |
+
"validation_sql": "SELECT * FROM customers;;",
|
343 |
+
"question": "copy any parquet files from 'customers_partitioned/city=Amsterdam/' into customers table",
|
344 |
+
"category": "duckdb"
|
345 |
+
},
|
346 |
+
{
|
347 |
+
"db_id": "laptop",
|
348 |
+
"query": "COPY customers(customer_id) FROM 'customers_customer_ids.csv';",
|
349 |
+
"setup_sql": "COPY customers(customer_id) TO 'customers_customer_ids.csv';",
|
350 |
+
"validation_sql": "SELECT * FROM customers;",
|
351 |
+
"question": "copy only the customer_id column from the customers_customer_ids.csv into the customers tables",
|
352 |
+
"category": "duckdb"
|
353 |
+
},
|
354 |
+
{
|
355 |
+
"db_id": "laptop",
|
356 |
+
"query": "CREATE TABLE test_tbl AS SELECT * FROM read_json_auto('test.json');",
|
357 |
+
"setup_sql": "COPY customers TO 'test.json'\n",
|
358 |
+
"validation_sql": "SELECT * FROM test_tbl;",
|
359 |
+
"question": "read json file from test.json and create new table from it called 'test_tbl'",
|
360 |
+
"category": "duckdb"
|
361 |
+
},
|
362 |
+
{
|
363 |
+
"db_id": "laptop",
|
364 |
+
"query": "SELECT * FROM read_csv_auto('test.csv');",
|
365 |
+
"setup_sql": "COPY customers TO 'test.csv';",
|
366 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
367 |
+
"question": "read csv from test.csv",
|
368 |
+
"category": "duckdb"
|
369 |
+
},
|
370 |
+
{
|
371 |
+
"db_id": "laptop",
|
372 |
+
"query": "SELECT * FROM read_csv_auto('test.csv', columns={'customer_id': 'VARCHAR', 'firstname': 'VARCHAR', 'lastname': 'VARCHAR'});",
|
373 |
+
"setup_sql": "COPY customers(customer_id, firstname, lastname) TO 'test.csv';",
|
374 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
375 |
+
"question": "read csv from test.csv with predefined column and types - customer_id: string, firstname: string, lastname: string",
|
376 |
+
"category": "duckdb"
|
377 |
+
},
|
378 |
+
{
|
379 |
+
"db_id": "laptop",
|
380 |
+
"query": "SELECT * EXCLUDE (ram, hd) FROM pcs;",
|
381 |
+
"setup_sql": ";",
|
382 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
383 |
+
"question": "select all columns from pcs table except for ram and hd",
|
384 |
+
"category": "duckdb"
|
385 |
+
},
|
386 |
+
{
|
387 |
+
"db_id": "laptop",
|
388 |
+
"query": "SELECT COLUMNS('name$') FROM customers;",
|
389 |
+
"setup_sql": ";",
|
390 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
391 |
+
"question": "select all columns ending with 'name' from customers table",
|
392 |
+
"category": "duckdb"
|
393 |
+
},
|
394 |
+
{
|
395 |
+
"db_id": "laptop",
|
396 |
+
"query": "SELECT LENGTH(COLUMNS('name$')) FROM customers",
|
397 |
+
"setup_sql": ";",
|
398 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
399 |
+
"question": "for each column ending with 'name' in the customers table, compute the string length",
|
400 |
+
"category": "duckdb"
|
401 |
+
},
|
402 |
+
{
|
403 |
+
"db_id": "laptop",
|
404 |
+
"query": "SELECT * REPLACE (upper(city) AS city) FROM customers;",
|
405 |
+
"setup_sql": ";",
|
406 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
407 |
+
"question": "get all columns from customer table, and make all city names uppercase",
|
408 |
+
"category": "duckdb"
|
409 |
+
},
|
410 |
+
{
|
411 |
+
"db_id": "laptop",
|
412 |
+
"query": "EXPLAIN SELECT * FROM customers",
|
413 |
+
"setup_sql": ";",
|
414 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
415 |
+
"question": "show query plan for query: SELECT * from customers",
|
416 |
+
"category": "duckdb"
|
417 |
+
},
|
418 |
+
{
|
419 |
+
"db_id": "laptop",
|
420 |
+
"query": "SELECT ascii(lastname) FROM customers;",
|
421 |
+
"setup_sql": ";",
|
422 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
423 |
+
"question": "get the first character of the firstname column and cast it to an INT",
|
424 |
+
"category": "duckdb"
|
425 |
+
},
|
426 |
+
{
|
427 |
+
"db_id": "laptop",
|
428 |
+
"query": "SELECT model, speed::INTEGER FROM laptops;",
|
429 |
+
"setup_sql": ";",
|
430 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
431 |
+
"question": "get laptop name and speed, return the speed as integer",
|
432 |
+
"category": "duckdb"
|
433 |
+
},
|
434 |
+
{
|
435 |
+
"db_id": "laptop_array",
|
436 |
+
"query": "SELECT phone_numbers[1] FROM customers;",
|
437 |
+
"setup_sql": ";",
|
438 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
439 |
+
"question": "get the first phone number of each customer",
|
440 |
+
"category": "duckdb"
|
441 |
+
},
|
442 |
+
{
|
443 |
+
"db_id": "laptop_array",
|
444 |
+
"query": "INSERT INTO customers(customer_id, phone_numbers) VALUES (5, ['12312323', '23123344']);",
|
445 |
+
"setup_sql": ";",
|
446 |
+
"validation_sql": "SELECT * FROM customers;",
|
447 |
+
"question": "insert two phone numbers to customer with id 5 [\\\"12312323\\\", and '23123344']",
|
448 |
+
"category": "duckdb"
|
449 |
+
},
|
450 |
+
{
|
451 |
+
"db_id": "laptop",
|
452 |
+
"query": "ALTER TABLE customers ADD COLUMN phone_numbers VARCHAR[];",
|
453 |
+
"setup_sql": ";",
|
454 |
+
"validation_sql": "DESCRIBE customers;",
|
455 |
+
"question": "how to add a new column phone_numbers to the customers table, with array type varchar",
|
456 |
+
"category": "duckdb"
|
457 |
+
},
|
458 |
+
{
|
459 |
+
"db_id": "laptop",
|
460 |
+
"query": "SELECT firstname[1] FROM customers;",
|
461 |
+
"setup_sql": ";",
|
462 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
463 |
+
"question": "get the first letter of the customers firstname",
|
464 |
+
"category": "duckdb"
|
465 |
+
},
|
466 |
+
{
|
467 |
+
"db_id": "laptop_array",
|
468 |
+
"query": "SELECT phone_numbers[:2] FROM customers;",
|
469 |
+
"setup_sql": ";",
|
470 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
471 |
+
"question": "get the first two phone numbers from the phone numbers array of each customer",
|
472 |
+
"category": "duckdb"
|
473 |
+
},
|
474 |
+
{
|
475 |
+
"db_id": "laptop",
|
476 |
+
"query": "SELECT {'a':1, 'b':2, 'c':3};",
|
477 |
+
"setup_sql": ";",
|
478 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
479 |
+
"question": "create a struct with keys a, b, c and values 1,2,3",
|
480 |
+
"category": "duckdb"
|
481 |
+
},
|
482 |
+
{
|
483 |
+
"db_id": "laptop",
|
484 |
+
"query": "SELECT [1,2,3];\n",
|
485 |
+
"setup_sql": ";",
|
486 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
487 |
+
"question": "create array with values 1,2,3",
|
488 |
+
"category": "duckdb"
|
489 |
+
},
|
490 |
+
{
|
491 |
+
"db_id": "laptop",
|
492 |
+
"query": "CREATE TABLE test (embeddings FLOAT[100]);",
|
493 |
+
"setup_sql": ";",
|
494 |
+
"validation_sql": "DESCRIBE test;",
|
495 |
+
"question": "create table test with a fix-sized array column with 100 dimenions, called embeddings",
|
496 |
+
"category": "duckdb"
|
497 |
+
},
|
498 |
+
{
|
499 |
+
"db_id": "laptop",
|
500 |
+
"query": "CREATE TABLE test (person STRUCT(name VARCHAR, id INTEGER));",
|
501 |
+
"setup_sql": ";",
|
502 |
+
"validation_sql": "DESCRIBE test;",
|
503 |
+
"question": "create table test with a struct column called person with properties name and id",
|
504 |
+
"category": "duckdb"
|
505 |
+
},
|
506 |
+
{
|
507 |
+
"db_id": "laptop_struct",
|
508 |
+
"query": "SELECT person.name, person.id FROM test;",
|
509 |
+
"setup_sql": ";",
|
510 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
511 |
+
"question": "get persons name and persons id from the test table.",
|
512 |
+
"category": "duckdb"
|
513 |
+
},
|
514 |
+
{
|
515 |
+
"db_id": "laptop",
|
516 |
+
"query": "UPDATE customers SET email = NULL;",
|
517 |
+
"setup_sql": ";",
|
518 |
+
"validation_sql": "SELECT email FROM customers;",
|
519 |
+
"question": "remove all values from email column in customers table",
|
520 |
+
"category": "duckdb"
|
521 |
+
},
|
522 |
+
{
|
523 |
+
"db_id": "laptop_json",
|
524 |
+
"query": "ALTER TABLE customers ALTER COLUMN email SET DATA TYPE VARCHAR;",
|
525 |
+
"setup_sql": ";",
|
526 |
+
"validation_sql": "DESCRIBE customers;",
|
527 |
+
"question": "make customer email of type VARCHAR",
|
528 |
+
"category": "duckdb"
|
529 |
+
},
|
530 |
+
{
|
531 |
+
"db_id": "laptop_json",
|
532 |
+
"query": "INSERT INTO customers (customer_id, email) VALUES (5,'{\"from\": \"[email protected]\", \"to\": \"[email protected]\"}');",
|
533 |
+
"setup_sql": ";",
|
534 |
+
"validation_sql": "SELECT * FROM customers;",
|
535 |
+
"question": "insert json into customer email for customer id 5: {'from': '[email protected]', 'to': '[email protected]'}",
|
536 |
+
"category": "duckdb"
|
537 |
+
},
|
538 |
+
{
|
539 |
+
"db_id": "laptop_json",
|
540 |
+
"query": "SELECT customers.email->>'from' FROM customers;",
|
541 |
+
"setup_sql": ";",
|
542 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
543 |
+
"question": "get 'from' field from customer email json",
|
544 |
+
"category": "duckdb"
|
545 |
+
},
|
546 |
+
{
|
547 |
+
"db_id": "laptop",
|
548 |
+
"query": "SUMMARIZE customers;",
|
549 |
+
"setup_sql": ";",
|
550 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
551 |
+
"question": "summarize the customer table",
|
552 |
+
"category": "duckdb"
|
553 |
+
},
|
554 |
+
{
|
555 |
+
"db_id": "laptop",
|
556 |
+
"query": "SELECT * FROM customers USING SAMPLE 10% (reservoir);",
|
557 |
+
"setup_sql": ";",
|
558 |
+
"validation_sql": "SELECT count(*) FROM ddb_benchmark_result;",
|
559 |
+
"question": "sample 10% from the customers table using reservoir sampling",
|
560 |
+
"category": "duckdb"
|
561 |
+
},
|
562 |
+
{
|
563 |
+
"db_id": "laptop",
|
564 |
+
"query": "SET threads = 10;",
|
565 |
+
"setup_sql": ";",
|
566 |
+
"validation_sql": "SELECT current_setting('threads');",
|
567 |
+
"question": "set number of threads to 10",
|
568 |
+
"category": "duckdb"
|
569 |
+
},
|
570 |
+
{
|
571 |
+
"db_id": "laptop",
|
572 |
+
"query": "SET memory_limit = '20G';\n",
|
573 |
+
"setup_sql": ";",
|
574 |
+
"validation_sql": "SELECT current_setting('memory_limit');",
|
575 |
+
"question": "set memory limit to 20 gigabyte",
|
576 |
+
"category": "duckdb"
|
577 |
+
},
|
578 |
+
{
|
579 |
+
"db_id": "laptop",
|
580 |
+
"query": "SELECT * EXCLUDE (price), avg(price) FROM laptops GROUP BY ALL;",
|
581 |
+
"setup_sql": ";",
|
582 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
583 |
+
"question": "show the average price of laptop and group by the remaining columns",
|
584 |
+
"category": "duckdb"
|
585 |
+
},
|
586 |
+
{
|
587 |
+
"db_id": "laptop",
|
588 |
+
"query": "SELECT * FROM laptops WHERE price > 1000 ORDER BY ALL;\n",
|
589 |
+
"setup_sql": ";",
|
590 |
+
"validation_sql": "SELECT * FROM ddb_benchmark_result;",
|
591 |
+
"question": "show all laptops with price above 1000 and order by all columns",
|
592 |
+
"category": "duckdb"
|
593 |
+
},
|
594 |
+
{
|
595 |
+
"db_id": "laptop",
|
596 |
+
"query": "ATTACH 'who.ddb';",
|
597 |
+
"setup_sql": ";",
|
598 |
+
"validation_sql": "SHOW DATABASES;",
|
599 |
+
"question": "attach database file who.ddb",
|
600 |
+
"category": "duckdb"
|
601 |
+
}
|
602 |
+
]
|