In this example we use VerbaGPT to get a semi-complex query involving multiple joins using the Chinook dataset1.
Video:
User question: what are the top 3 selling genre in chinook data?
VerbaGPT response:
Cost of query: $0.00
Name TotalSold
Rock 835
Latin 386
Metal 264
VerbaGPT answers the question correctly. The query seems innocuous enough, but there is more going on under the surface.
Check out the code below, answering this question involved joins across three tables and VerbaGPT was able to leverage the power of gpt4 to get the question answered.
VerbaGPT Message Window
import pandas as pd query = ''' SELECT TOP 3 g.Name, SUM(il.Quantity) AS TotalSold FROM Genre g JOIN Track t ON g.GenreId = t.GenreId JOIN InvoiceLine il ON t.TrackId = il.TrackId GROUP BY g.Name ORDER BY TotalSold DESC ''' df = pd.read_sql(query, conn) print(df)
Leave a Reply