File size: 38,893 Bytes
9e24782
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "What are the top 5 most popular genres of music in the database, based on the number of tracks in each genre?"}
{"role": "assistant", "content": "SELECT T2.Name, COUNT(T1.TrackId) as TrackCount FROM Track T1 INNER JOIN Genre T2 ON T1.GenreId = T2.GenreId GROUP BY T2.Name ORDER BY TrackCount DESC LIMIT 5;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "Which artist has the most albums in the database?"}
{"role": "assistant", "content": "SELECT T1.Name, COUNT(T2.AlbumId) as AlbumCount FROM Artist T1 INNER JOIN Album T2 ON T1.ArtistId = T2.ArtistId GROUP BY T1.Name ORDER BY AlbumCount DESC LIMIT 1;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "What is the total revenue generated by each genre of music in the database?"}
{"role": "assistant", "content": "SELECT T2.Name, SUM(T1.UnitPrice * T3.Quantity) as TotalRevenue FROM Track T1 INNER JOIN Genre T2 ON T1.GenreId = T2.GenreId INNER JOIN InvoiceLine T3 ON T1.TrackId = T3.TrackId GROUP BY T2.Name;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "Which customers have purchased tracks from more than one genre of music?"}
{"role": "assistant", "content": "SELECT DISTINCT T1.CustomerId FROM InvoiceLine T1 INNER JOIN Track T2 ON T1.TrackId = T2.TrackId INNER JOIN Genre T3 ON T2.GenreId = T3.GenreId GROUP BY T1.CustomerId HAVING COUNT(DISTINCT T3.GenreId) > 1;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "What is the average price of tracks in each genre of music?"}
{"role": "assistant", "content": "SELECT T2.Name, AVG(T1.UnitPrice) as AveragePrice FROM Track T1 INNER JOIN Genre T2 ON T1.GenreId = T2.GenreId GROUP BY T2.Name;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "Which artists have tracks in more than one genre of music?"}
{"role": "assistant", "content": "SELECT DISTINCT T1.ArtistId FROM Album T1 INNER JOIN Track T2 ON T1.AlbumId = T2.AlbumId INNER JOIN Genre T3 ON T2.GenreId = T3.GenreId GROUP BY T1.ArtistId HAVING COUNT(DISTINCT T3.GenreId) > 1;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "What is the total number of tracks in each playlist?"}
{"role": "assistant", "content": "SELECT T1.PlaylistId, COUNT(T2.TrackId) as TrackCount FROM Playlist T1 INNER JOIN PlaylistTrack T2 ON T1.PlaylistId = T2.PlaylistId GROUP BY T1.PlaylistId;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "Which customers have purchased tracks from the same artist more than once?"}
{"role": "assistant", "content": "SELECT DISTINCT T1.CustomerId FROM InvoiceLine T1 INNER JOIN Track T2 ON T1.TrackId = T2.TrackId INNER JOIN Album T3 ON T2.AlbumId = T3.AlbumId INNER JOIN Artist T4 ON T3.ArtistId = T4.ArtistId GROUP BY T1.CustomerId, T4.ArtistId HAVING COUNT(T1.InvoiceLineId) > 1;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "What is the total revenue generated by each artist in the database?"}
{"role": "assistant", "content": "SELECT T1.Name, SUM(T4.UnitPrice * T5.Quantity) as TotalRevenue FROM Artist T1 INNER JOIN Album T2 ON T1.ArtistId = T2.ArtistId INNER JOIN Track T3 ON T2.AlbumId = T3.AlbumId INNER JOIN InvoiceLine T4 ON T3.TrackId = T4.TrackId INNER JOIN Invoice T5 ON T4.InvoiceId = T5.InvoiceId GROUP BY T1.Name;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "Which genres of music have the most tracks with a duration of more than 5 minutes?"}
{"role": "assistant", "content": "SELECT T2.Name, COUNT(T1.TrackId) as TrackCount FROM Track T1 INNER JOIN Genre T2 ON T1.GenreId = T2.GenreId WHERE T1.Milliseconds > 300000 GROUP BY T2.Name ORDER BY TrackCount DESC;"}
]
}{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "What is the average number of tracks per album for each artist in the database?"}
{"role": "assistant", "content": "SELECT T1.Name, AVG(T3.TrackCount) as AverageTracksPerAlbum FROM Artist T1 INNER JOIN Album T2 ON T1.ArtistId = T2.ArtistId INNER JOIN (SELECT AlbumId, COUNT(TrackId) as TrackCount FROM Track GROUP BY AlbumId) T3 ON T2.AlbumId = T3.AlbumId GROUP BY T1.Name;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "Which customers have purchased tracks from artists who have won a Grammy award?"}
{"role": "assistant", "content": "SELECT DISTINCT T1.CustomerId FROM InvoiceLine T1 INNER JOIN Track T2 ON T1.TrackId = T2.TrackId INNER JOIN Album T3 ON T2.AlbumId = T3.AlbumId INNER JOIN Artist T4 ON T3.ArtistId = T4.ArtistId WHERE T4.Name IN (SELECT Name FROM Artist WHERE GrammyWinner = 1);" }
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "What is the total number of tracks in each genre that have been purchased by customers from the USA?"}
{"role": "assistant", "content": "SELECT T2.Name, COUNT(T1.TrackId) as TrackCount FROM Track T1 INNER JOIN Genre T2 ON T1.GenreId = T2.GenreId INNER JOIN InvoiceLine T3 ON T1.TrackId = T3.TrackId INNER JOIN Invoice T4 ON T3.InvoiceId = T4.InvoiceId INNER JOIN Customer T5 ON T4.CustomerId = T5.CustomerId WHERE T5.Country = 'USA' GROUP BY T2.Name;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "Which artists have the most tracks in the 'Rock' genre?"}
{"role": "assistant", "content": "SELECT T1.Name, COUNT(T2.TrackId) as TrackCount FROM Artist T1 INNER JOIN Album T3 ON T1.ArtistId = T3.ArtistId INNER JOIN Track T2 ON T3.AlbumId = T2.AlbumId INNER JOIN Genre T4 ON T2.GenreId = T4.GenreId WHERE T4.Name = 'Rock' GROUP BY T1.Name ORDER BY TrackCount DESC;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "What is the average price of tracks in each genre that have been purchased by customers from Europe?"}
{"role": "assistant", "content": "SELECT T2.Name, AVG(T1.UnitPrice) as AveragePrice FROM Track T1 INNER JOIN Genre T2 ON T1.GenreId = T2.GenreId INNER JOIN InvoiceLine T3 ON T1.TrackId = T3.TrackId INNER JOIN Invoice T4 ON T3.InvoiceId = T4.InvoiceId INNER JOIN Customer T5 ON T4.CustomerId = T5.CustomerId WHERE T5.Country IN (SELECT Country FROM Country WHERE Continent = 'Europe') GROUP BY T2.Name;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "Which customers have purchased tracks from artists who have released albums in the 'Jazz' genre?"}
{"role": "assistant", "content": "SELECT DISTINCT T1.CustomerId FROM InvoiceLine T1 INNER JOIN Track T2 ON T1.TrackId = T2.TrackId INNER JOIN Album T3 ON T2.AlbumId = T3.AlbumId INNER JOIN Artist T4 ON T3.ArtistId = T4.ArtistId WHERE T4.ArtistId IN (SELECT T3.ArtistId FROM Album T3 INNER JOIN Track T2 ON T3.AlbumId = T2.AlbumId INNER JOIN Genre T4 ON T2.GenreId = T4.GenreId WHERE T4.Name = 'Jazz');" }
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "What is the total revenue generated by each artist in the 'Pop' genre?"}
{"role": "assistant", "content": "SELECT T1.Name, SUM(T4.UnitPrice * T5.Quantity) as TotalRevenue FROM Artist T1 INNER JOIN Album T2 ON T1.ArtistId = T2.ArtistId INNER JOIN Track T3 ON T2.AlbumId = T3.AlbumId INNER JOIN InvoiceLine T4 ON T3.TrackId = T4.TrackId INNER JOIN Invoice T5 ON T4.InvoiceId = T5.InvoiceId INNER JOIN Genre T6 ON T3.GenreId = T6.GenreId WHERE T6.Name = 'Pop' GROUP BY T1.Name;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "Which genres of music have the most tracks with a duration of less than 3 minutes?"}
{"role": "assistant", "content": "SELECT T2.Name, COUNT(T1.TrackId) as TrackCount FROM Track T1 INNER JOIN Genre T2 ON T1.GenreId = T2.GenreId WHERE T1.Milliseconds < 180000 GROUP BY T2.Name ORDER BY TrackCount DESC;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "What is the average number of tracks per playlist for each genre of music?"}
{"role": "assistant", "content": "SELECT T2.Name, AVG(T4.TrackCount) as AverageTracksPerPlaylist FROM Genre T2 INNER JOIN Track T1 ON T2.GenreId = T1.GenreId INNER JOIN PlaylistTrack T3 ON T1.TrackId = T3.TrackId INNER JOIN (SELECT PlaylistId, COUNT(TrackId) as TrackCount FROM PlaylistTrack GROUP BY PlaylistId) T4 ON T3.PlaylistId = T4.PlaylistId GROUP BY T2.Name;"}
]
}{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "What is the average price of tracks in each genre of music, considering only the tracks that have been purchased at least once?"}
{"role": "assistant", "content": "SELECT T2.Name, AVG(T1.UnitPrice) as AveragePrice FROM Track T1 INNER JOIN Genre T2 ON T1.GenreId = T2.GenreId INNER JOIN InvoiceLine T3 ON T1.TrackId = T3.TrackId GROUP BY T2.Name;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "Which artists have released tracks in the most genres of music?"}
{"role": "assistant", "content": "SELECT T1.Name, COUNT(DISTINCT T3.GenreId) as GenreCount FROM Artist T1 INNER JOIN Album T2 ON T1.ArtistId = T2.ArtistId INNER JOIN Track T3 ON T2.AlbumId = T3.AlbumId GROUP BY T1.Name ORDER BY GenreCount DESC;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "What is the total revenue generated by each artist in the 'Rock' genre, considering only the tracks that have been purchased in the year 2010?"}
{"role": "assistant", "content": "SELECT T1.Name, SUM(T5.UnitPrice * T6.Quantity) as TotalRevenue FROM Artist T1 INNER JOIN Album T2 ON T1.ArtistId = T2.ArtistId INNER JOIN Track T3 ON T2.AlbumId = T3.AlbumId INNER JOIN InvoiceLine T5 ON T3.TrackId = T5.TrackId INNER JOIN Invoice T6 ON T5.InvoiceId = T6.InvoiceId INNER JOIN Genre T7 ON T3.GenreId = T7.GenreId WHERE T7.Name = 'Rock' AND STRFTIME('%Y', T6.InvoiceDate) = '2010' GROUP BY T1.Name;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "Which genres of music have the most tracks with a duration of more than 5 minutes?"}
{"role": "assistant", "content": "SELECT T2.Name, COUNT(T1.TrackId) as TrackCount FROM Track T1 INNER JOIN Genre T2 ON T1.GenreId = T2.GenreId WHERE T1.Milliseconds > 300000 GROUP BY T2.Name ORDER BY TrackCount DESC;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "What is the average number of tracks per album for each artist?"}
{"role": "assistant", "content": "SELECT T1.Name, AVG(T3.TrackCount) as AverageTracksPerAlbum FROM Artist T1 INNER JOIN Album T2 ON T1.ArtistId = T2.ArtistId INNER JOIN (SELECT AlbumId, COUNT(TrackId) as TrackCount FROM Track GROUP BY AlbumId) T3 ON T2.AlbumId = T3.AlbumId GROUP BY T1.Name;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "Which customers have purchased tracks from artists who have released albums in the 'Classical' genre?"}
{"role": "assistant", "content": "SELECT DISTINCT T1.CustomerId FROM InvoiceLine T1 INNER JOIN Track T2 ON T1.TrackId = T2.TrackId INNER JOIN Album T3 ON T2.AlbumId = T3.AlbumId INNER JOIN Artist T4 ON T3.ArtistId = T4.ArtistId WHERE T4.ArtistId IN (SELECT T3.ArtistId FROM Album T3 INNER JOIN Track T2 ON T3.AlbumId = T2.AlbumId INNER JOIN Genre T4 ON T2.GenreId = T4.GenreId WHERE T4.Name = 'Classical');" }
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "What is the total revenue generated by each genre of music, considering only the tracks that have been purchased in the year 2015?"}
{"role": "assistant", "content": "SELECT T2.Name, SUM(T1.UnitPrice * T3.Quantity) as TotalRevenue FROM Track T1 INNER JOIN Genre T2 ON T1.GenreId = T2.GenreId INNER JOIN InvoiceLine T3 ON T1.TrackId = T3.TrackId INNER JOIN Invoice T4 ON T3.InvoiceId = T4.InvoiceId WHERE STRFTIME('%Y', T4.InvoiceDate) = '2015' GROUP BY T2.Name;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "Which artists have released tracks in the most genres of music, considering only the tracks that have been purchased at least once?"}
{"role": "assistant", "content": "SELECT T1.Name, COUNT(DISTINCT T3.GenreId) as GenreCount FROM Artist T1 INNER JOIN Album T2 ON T1.ArtistId = T2.ArtistId INNER JOIN Track T3 ON T2.AlbumId = T3.AlbumId INNER JOIN InvoiceLine T4 ON T3.TrackId = T4.TrackId GROUP BY T1.Name ORDER BY GenreCount DESC;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "What is the average price of tracks in each genre of music, considering only the tracks that have been purchased in the year 2010?"}
{"role": "assistant", "content": "SELECT T2.Name, AVG(T1.UnitPrice) as AveragePrice FROM Track T1 INNER JOIN Genre T2 ON T1.GenreId = T2.GenreId INNER JOIN InvoiceLine T3 ON T1.TrackId = T3.TrackId INNER JOIN Invoice T4 ON T3.InvoiceId = T4.InvoiceId WHERE STRFTIME('%Y', T4.InvoiceDate) = '2010' GROUP BY T2.Name;"}
]
}

{"messages":
[
{"role": "system", " content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "Which genres of music have the most tracks with a duration of less than 2 minutes?"}
{"role": "assistant", "content": "SELECT T2.Name, COUNT(T1.TrackId) as TrackCount FROM Track T1 INNER JOIN Genre T2 ON T1.GenreId = T2.GenreId WHERE T1.Milliseconds < 120000 GROUP BY T2.Name ORDER BY TrackCount DESC;"}
]
}{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "What is the average number of tracks per album for each artist?"}
{"role": "assistant", "content": "SELECT T1.Name, AVG(T2.TrackCount) as AverageTracksPerAlbum FROM Artist T1 INNER JOIN (SELECT T2.ArtistId, T2.AlbumId, COUNT(T1.TrackId) as TrackCount FROM Track T1 INNER JOIN Album T2 ON T1.AlbumId = T2.AlbumId GROUP BY T2.ArtistId, T2.AlbumId) T2 ON T1.ArtistId = T2.ArtistId GROUP BY T1.Name;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "Which customers have purchased tracks from the same artist more than once?"}
{"role": "assistant", "content": "SELECT DISTINCT T1.CustomerId FROM InvoiceLine T1 INNER JOIN Track T2 ON T1.TrackId = T2.TrackId INNER JOIN Album T3 ON T2.AlbumId = T3.AlbumId INNER JOIN Artist T4 ON T3.ArtistId = T4.ArtistId GROUP BY T1.CustomerId, T4.ArtistId HAVING COUNT(DISTINCT T1.InvoiceId) > 1;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "What is the total revenue generated by each artist, considering only the tracks that have been purchased in the year 2012?"}
{"role": "assistant", "content": "SELECT T1.Name, SUM(T4.UnitPrice * T5.Quantity) as TotalRevenue FROM Artist T1 INNER JOIN Album T2 ON T1.ArtistId = T2.ArtistId INNER JOIN Track T3 ON T2.AlbumId = T3.AlbumId INNER JOIN InvoiceLine T4 ON T3.TrackId = T4.TrackId INNER JOIN Invoice T5 ON T4.InvoiceId = T5.InvoiceId WHERE STRFTIME('%Y', T5.InvoiceDate) = '2012' GROUP BY T1.Name;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "Which genres of music have the most tracks with a duration of more than 5 minutes?"}
{"role": "assistant", "content": "SELECT T2.Name, COUNT(T1.TrackId) as TrackCount FROM Track T1 INNER JOIN Genre T2 ON T1.GenreId = T2.GenreId WHERE T1.Milliseconds > 300000 GROUP BY T2.Name ORDER BY TrackCount DESC;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "What is the average price of tracks in each genre of music, considering only the tracks that have been purchased by customers from the USA?"}
{"role": "assistant", "content": "SELECT T2.Name, AVG(T1.UnitPrice) as AveragePrice FROM Track T1 INNER JOIN Genre T2 ON T1.GenreId = T2.GenreId INNER JOIN InvoiceLine T3 ON T1.TrackId = T3.TrackId INNER JOIN Invoice T4 ON T3.InvoiceId = T4.InvoiceId INNER JOIN Customer T5 ON T4.CustomerId = T5.CustomerId WHERE T5.Country = 'USA' GROUP BY T2.Name;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "Which artists have released tracks in the most genres of music, considering only the tracks that have been purchased at least once and have a duration of more than 3 minutes?"}
{"role": "assistant", "content": "SELECT T1.Name, COUNT(DISTINCT T3.GenreId) as GenreCount FROM Artist T1 INNER JOIN Album T2 ON T1.ArtistId = T2.ArtistId INNER JOIN Track T3 ON T2.AlbumId = T3.AlbumId INNER JOIN InvoiceLine T4 ON T3.TrackId = T4.TrackId WHERE T3.Milliseconds > 180000 GROUP BY T1.Name ORDER BY GenreCount DESC;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "What is the total revenue generated by each genre of music, considering only the tracks that have been purchased by customers from the UK and have a duration of less than 4 minutes?"}
{"role": "assistant", "content": "SELECT T2.Name, SUM(T1.UnitPrice * T4.Quantity) as TotalRevenue FROM Track T1 INNER JOIN Genre T2 ON T1.GenreId = T2.GenreId INNER JOIN InvoiceLine T3 ON T1.TrackId = T3.TrackId INNER JOIN Invoice T4 ON T3.InvoiceId = T4.InvoiceId INNER JOIN Customer T5 ON T4.CustomerId = T5.CustomerId WHERE T5.Country = 'UK' AND T1.Milliseconds < 240000 GROUP BY T2.Name;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "Which customers have purchased tracks from the same artist more than twice?"}
{"role": "assistant", "content": "SELECT DISTINCT T1.CustomerId FROM InvoiceLine T1 INNER JOIN Track T2 ON T1.TrackId = T2.TrackId INNER JOIN Album T3 ON T2.AlbumId = T3.AlbumId INNER JOIN Artist T4 ON T3.ArtistId = T4.ArtistId GROUP BY T1.CustomerId, T4.ArtistId HAVING COUNT(DISTINCT T1.InvoiceId) > 2;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "What is the average number of tracks per album for each artist, considering only the albums that have been released after 2000?"}
{"role": "assistant", "content": "SELECT T1.Name, AVG(T2.TrackCount) as AverageTracksPerAlbum FROM Artist T1 INNER JOIN (SELECT T2.ArtistId, T2.AlbumId, COUNT(T1.TrackId) as TrackCount FROM Track T1 INNER JOIN Album T2 ON T1.AlbumId = T2.AlbumId WHERE T2.ReleaseDate > '2000-01-01' GROUP BY T2.ArtistId, T2.AlbumId) T2 ON T1.ArtistId = T2.ArtistId GROUP BY T1.Name;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "Which genres of music have the most tracks with a duration of more than 10 minutes?"}
{"role": "assistant", "content": "SELECT T2.Name, COUNT(T1.TrackId) as TrackCount FROM Track T1 INNER JOIN Genre T2 ON T1.GenreId = T2.GenreId WHERE T1.Milliseconds > 600000 GROUP BY T2.Name ORDER BY TrackCount DESC;"}
]
}{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "What is the average price of tracks in each genre of music, considering only the tracks that have been purchased by customers from the USA?"}
{"role": "assistant", "content": "SELECT T2.Name, AVG(T1.UnitPrice) as AveragePrice FROM Track T1 INNER JOIN Genre T2 ON T1.GenreId = T2.GenreId INNER JOIN InvoiceLine T3 ON T1.TrackId = T3.TrackId INNER JOIN Invoice T4 ON T3.InvoiceId = T4.InvoiceId INNER JOIN Customer T5 ON T4.CustomerId = T5.CustomerId WHERE T5.Country = 'USA' GROUP BY T2.Name;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "Which artists have the most tracks in the 'Rock' genre?"}
{"role": "assistant", "content": "SELECT T1.Name, COUNT(T2.TrackId) as TrackCount FROM Artist T1 INNER JOIN Album T2 ON T1.ArtistId = T2.ArtistId INNER JOIN Track T3 ON T2.AlbumId = T3.AlbumId INNER JOIN Genre T4 ON T3.GenreId = T4.GenreId WHERE T4.Name = 'Rock' GROUP BY T1.Name ORDER BY TrackCount DESC;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "What is the total revenue generated by each artist, considering only the tracks that have been purchased by customers from the UK?"}
{"role": "assistant", "content": "SELECT T1.Name, SUM(T2.UnitPrice * T4.Quantity) as TotalRevenue FROM Artist T1 INNER JOIN Album T2 ON T1.ArtistId = T2.ArtistId INNER JOIN Track T3 ON T2.AlbumId = T3.AlbumId INNER JOIN InvoiceLine T4 ON T3.TrackId = T4.TrackId INNER JOIN Invoice T5 ON T4.InvoiceId = T5.InvoiceId INNER JOIN Customer T6 ON T5.CustomerId = T6.CustomerId WHERE T6.Country = 'UK' GROUP BY T1.Name;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "Which genres of music have the most tracks with a duration of less than 2 minutes?"}
{"role": "assistant", "content": "SELECT T2.Name, COUNT(T1.TrackId) as TrackCount FROM Track T1 INNER JOIN Genre T2 ON T1.GenreId = T2.GenreId WHERE T1.Milliseconds < 120000 GROUP BY T2.Name ORDER BY TrackCount DESC;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "What is the average number of tracks per album for each genre of music?"}
{"role": "assistant", "content": "SELECT T1.Name, AVG(T2.TrackCount) as AverageTracksPerAlbum FROM Genre T1 INNER JOIN (SELECT T2.GenreId, T2.AlbumId, COUNT(T1.TrackId) as TrackCount FROM Track T1 INNER JOIN Album T2 ON T1.AlbumId = T2.AlbumId GROUP BY T2.GenreId, T2.AlbumId) T2 ON T1.GenreId = T2.GenreId GROUP BY T1.Name;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "Which customers have purchased tracks from the same artist more than three times?"}
{"role": "assistant", "content": "SELECT DISTINCT T1.CustomerId FROM InvoiceLine T1 INNER JOIN Track T2 ON T1.TrackId = T2.TrackId INNER JOIN Album T3 ON T2.AlbumId = T3.AlbumId INNER JOIN Artist T4 ON T3.ArtistId = T4.ArtistId GROUP BY T1.CustomerId, T4.ArtistId HAVING COUNT(DISTINCT T1.InvoiceId) > 3;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "What is the total revenue generated by each media type, considering only the tracks that have been purchased by customers from the USA?"}
{"role": "assistant", "content": "SELECT T1.Name, SUM(T2.UnitPrice * T4.Quantity) as TotalRevenue FROM MediaType T1 INNER JOIN Track T2 ON T1.MediaTypeId = T2.MediaTypeId INNER JOIN InvoiceLine T3 ON T2.TrackId = T3.TrackId INNER JOIN Invoice T4 ON T3.InvoiceId = T4.InvoiceId INNER JOIN Customer T5 ON T4.CustomerId = T5.CustomerId WHERE T5.Country = 'USA' GROUP BY T1.Name;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "Which genres of music have the most tracks with a duration of more than 5 minutes?"}
{"role": "assistant", "content": "SELECT T2.Name, COUNT(T1.TrackId) as TrackCount FROM Track T1 INNER JOIN Genre T2 ON T1.GenreId = T2.GenreId WHERE T1.Milliseconds > 300000 GROUP BY T2.Name ORDER BY TrackCount DESC;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "What is the average price of tracks in each media type, considering only the tracks that have been purchased by customers from the UK?"}
{"role": "assistant", "content": "SELECT T1.Name, AVG(T2.UnitPrice) as AveragePrice FROM MediaType T1 INNER JOIN Track T2 ON T1.MediaTypeId = T2.MediaTypeId INNER JOIN InvoiceLine T3 ON T2.TrackId = T3.TrackId INNER JOIN Invoice T4 ON T3.InvoiceId = T4.InvoiceId INNER JOIN Customer T5 ON T4.CustomerId = T5.CustomerId WHERE T5.Country = 'UK' GROUP BY T1.Name;"}
]
}{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "What is the average number of tracks per album for each artist, considering only the albums with more than 10 tracks?"}
{"role": "assistant", "content": "SELECT T1.Name, AVG(T2.TrackCount) as AverageTracksPerAlbum FROM Artist T1 INNER JOIN (SELECT T2.ArtistId, T2.AlbumId, COUNT(T1.TrackId) as TrackCount FROM Track T1 INNER JOIN Album T2 ON T1.AlbumId = T2.AlbumId GROUP BY T2.ArtistId, T2.AlbumId HAVING COUNT(T1.TrackId) > 10) T2 ON T1.ArtistId = T2.ArtistId GROUP BY T1.Name;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "Which customers have purchased tracks from the same artist more than five times, considering only the tracks that have been purchased in the year 2010?"}
{"role": "assistant", "content": "SELECT DISTINCT T1.CustomerId FROM InvoiceLine T1 INNER JOIN Track T2 ON T1.TrackId = T2.TrackId INNER JOIN Album T3 ON T2.AlbumId = T3.AlbumId INNER JOIN Artist T4 ON T3.ArtistId = T4.ArtistId INNER JOIN Invoice T5 ON T1.InvoiceId = T5.InvoiceId WHERE T5.InvoiceDate LIKE '%2010%' GROUP BY T1.CustomerId, T4.ArtistId HAVING COUNT(DISTINCT T1.InvoiceId) > 5;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "What is the total revenue generated by each genre of music, considering only the tracks that have been purchased by customers from Europe?"}
{"role": "assistant", "content": "SELECT T1.Name, SUM(T2.UnitPrice * T4.Quantity) as TotalRevenue FROM Genre T1 INNER JOIN Track T2 ON T1.GenreId = T2.GenreId INNER JOIN InvoiceLine T3 ON T2.TrackId = T3.TrackId INNER JOIN Invoice T4 ON T3.InvoiceId = T4.InvoiceId INNER JOIN Customer T5 ON T4.CustomerId = T5.CustomerId WHERE T5.Country IN ('UK', 'France', 'Germany', 'Italy', 'Spain') GROUP BY T1.Name;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "Which artists have tracks in more than two genres of music, considering only the tracks that have been purchased by customers from the USA?"}
{"role": "assistant", "content": "SELECT DISTINCT T1.ArtistId FROM Album T1 INNER JOIN Track T2 ON T1.AlbumId = T2.AlbumId INNER JOIN Genre T3 ON T2.GenreId = T3.GenreId INNER JOIN InvoiceLine T4 ON T2.TrackId = T4.TrackId INNER JOIN Invoice T5 ON T4.InvoiceId = T5.InvoiceId INNER JOIN Customer T6 ON T5.CustomerId = T6.CustomerId WHERE T6.Country = 'USA' GROUP BY T1.ArtistId HAVING COUNT(DISTINCT T3.GenreId) > 2;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "What is the average price of tracks in each media type, considering only the tracks that have been purchased by customers from Asia?"}
{"role": "assistant", "content": "SELECT T1.Name, AVG(T2.UnitPrice) as AveragePrice FROM MediaType T1 INNER JOIN Track T2 ON T1.MediaTypeId = T2.MediaTypeId INNER JOIN InvoiceLine T3 ON T2.TrackId = T3.TrackId INNER JOIN Invoice T4 ON T3.InvoiceId = T4.InvoiceId INNER JOIN Customer T5 ON T4.CustomerId = T5.CustomerId WHERE T5.Country IN ('China', 'Japan', 'India', 'South Korea') GROUP BY T1.Name;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "Which genres of music have the most tracks with a duration of more than 10 minutes, considering only the tracks that have been purchased by customers from South America?"}
{"role": "assistant", "content": "SELECT T2.Name, COUNT(T1.TrackId) as TrackCount FROM Track T1 INNER JOIN Genre T2 ON T1.GenreId = T2.GenreId INNER JOIN InvoiceLine T3 ON T1.TrackId = T3.TrackId INNER JOIN Invoice T4 ON T3.InvoiceId = T4.InvoiceId INNER JOIN Customer T5 ON T4.CustomerId = T5.CustomerId WHERE T5.Country IN ('Brazil', 'Argentina', 'Chile', 'Colombia') AND T1.Milliseconds > 600000 GROUP BY T2.Name ORDER BY TrackCount DESC;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "What is the total revenue generated by each artist, considering only the tracks that have been purchased by customers from Africa?"}
{"role": "assistant", "content": "SELECT T1.Name, SUM(T2.UnitPrice * T4.Quantity) as TotalRevenue FROM Artist T1 INNER JOIN Album T2 ON T1.ArtistId = T2.ArtistId INNER JOIN Track T3 ON T2.AlbumId = T3.AlbumId INNER JOIN InvoiceLine T4 ON T3.TrackId = T4.TrackId INNER JOIN Invoice T5 ON T4.InvoiceId = T5.InvoiceId INNER JOIN Customer T6 ON T5.CustomerId = T6.CustomerId WHERE T6.Country IN ('Egypt', 'South Africa', 'Nigeria', 'Morocco') GROUP BY T1.Name;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "Which customers have purchased tracks from more than three genres of music, considering only the tracks that have been purchased in the year 2015?"}
{"role": "assistant", "content": "SELECT DISTINCT T1.CustomerId FROM InvoiceLine T1 INNER JOIN Track T2 ON T1.TrackId = T2.TrackId INNER JOIN Genre T3 ON T2.GenreId = T3.GenreId INNER JOIN Invoice T4 ON T1.InvoiceId = T4.InvoiceId WHERE T4.InvoiceDate LIKE '%2015%' GROUP BY T1.CustomerId HAVING COUNT(DISTINCT T3.GenreId) > 3;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "What is the average price of tracks in each genre of music, considering only the tracks that have been purchased by customers from North America?"}
{"role": "assistant", "content": "SELECT T1.Name, AVG(T2.UnitPrice) as AveragePrice FROM Genre T1 INNER JOIN Track T2 ON T1.GenreId = T2.GenreId INNER JOIN InvoiceLine T3 ON T2.TrackId = T3.TrackId INNER JOIN Invoice T4 ON T3.InvoiceId = T4.InvoiceId INNER JOIN Customer T5 ON T4.CustomerId = T5.CustomerId WHERE T5.Country IN ('USA', 'Canada', 'Mexico') GROUP BY T1.Name;"}
]
}

{"messages":
[
{"role": "system", "content": "You are a SQL expert assistant. Generate clear, efficient SQL queries based on user requests. Provide only the SQL query without any additional text or explanation."}
{"role": "user", "content": "Which artists have tracks in more than one genre of music, considering only the tracks that have been purchased by customers from Australia?"}
{"role": "assistant", "content": "SELECT DISTINCT T1.ArtistId FROM Album T1 INNER JOIN Track T2 ON T1.AlbumId = T2.AlbumId INNER JOIN Genre T3 ON T2.GenreId = T3.GenreId INNER JOIN InvoiceLine T4 ON T2.TrackId = T4.TrackId INNER JOIN Invoice T5 ON T4.InvoiceId = T5.InvoiceId INNER JOIN Customer T6 ON T5.CustomerId = T6.CustomerId WHERE T6.Country = 'Australia' GROUP BY T1.ArtistId HAVING COUNT(DISTINCT T3.GenreId) > 1;"}
]
}