messages
listlengths 3
3
|
|---|
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# shop ( shop_id , address , num_of_staff , score , open_year )\n# member ( member_id , name , membership_card , age , time_of_purchase , level_of_membership , address )\n# happy_hour ( hh_id , shop_id , month , num_of_shaff_in_charge )\n# happy_hour_member ( hh_id , member_id , total_amount )\n# happy_hour.shop_id = shop.shop_id\n# happy_hour_member.member_id = member.member_id\n\n#\n### What are the average score and average staff number of all shops?\nSELECT \n"
},
{
"role": "assistant",
"content": "avg ( num_of_staff ) , avg ( score ) from shop"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# shop ( shop_id , address , num_of_staff , score , open_year )\n# member ( member_id , name , membership_card , age , time_of_purchase , level_of_membership , address )\n# happy_hour ( hh_id , shop_id , month , num_of_shaff_in_charge )\n# happy_hour_member ( hh_id , member_id , total_amount )\n# happy_hour.shop_id = shop.shop_id\n# happy_hour_member.member_id = member.member_id\n\n#\n### Find the id and address of the shops whose score is below the average score.\nSELECT \n"
},
{
"role": "assistant",
"content": "shop_id , address from shop where score < ( select avg ( score ) from shop )"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# shop ( shop_id , address , num_of_staff , score , open_year )\n# member ( member_id , name , membership_card , age , time_of_purchase , level_of_membership , address )\n# happy_hour ( hh_id , shop_id , month , num_of_shaff_in_charge )\n# happy_hour_member ( hh_id , member_id , total_amount )\n# happy_hour.shop_id = shop.shop_id\n# happy_hour_member.member_id = member.member_id\n\n#\n### Find the address and staff number of the shops that do not have any happy hour.\nSELECT \n"
},
{
"role": "assistant",
"content": "address , num_of_staff from shop where shop_id not in ( select shop_id from happy_hour )"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# shop ( shop_id , address , num_of_staff , score , open_year )\n# member ( member_id , name , membership_card , age , time_of_purchase , level_of_membership , address )\n# happy_hour ( hh_id , shop_id , month , num_of_shaff_in_charge )\n# happy_hour_member ( hh_id , member_id , total_amount )\n# happy_hour.shop_id = shop.shop_id\n# happy_hour_member.member_id = member.member_id\n\n#\n### What are the id and address of the shops which have a happy hour in May?\nSELECT \n"
},
{
"role": "assistant",
"content": "shop.address , shop.shop_id from shop join happy_hour on shop.shop_id = happy_hour.shop_id where month = 'May'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# shop ( shop_id , address , num_of_staff , score , open_year )\n# member ( member_id , name , membership_card , age , time_of_purchase , level_of_membership , address )\n# happy_hour ( hh_id , shop_id , month , num_of_shaff_in_charge )\n# happy_hour_member ( hh_id , member_id , total_amount )\n# happy_hour.shop_id = shop.shop_id\n# happy_hour_member.member_id = member.member_id\n\n#\n### which shop has happy hour most frequently? List its id and number of happy hours.\nSELECT \n"
},
{
"role": "assistant",
"content": "shop_id , count ( * ) from happy_hour group by shop_id order by count ( * ) desc limit 1"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# shop ( shop_id , address , num_of_staff , score , open_year )\n# member ( member_id , name , membership_card , age , time_of_purchase , level_of_membership , address )\n# happy_hour ( hh_id , shop_id , month , num_of_shaff_in_charge )\n# happy_hour_member ( hh_id , member_id , total_amount )\n# happy_hour.shop_id = shop.shop_id\n# happy_hour_member.member_id = member.member_id\n\n#\n### Which month has the most happy hours?\nSELECT \n"
},
{
"role": "assistant",
"content": "month from happy_hour group by month order by count ( * ) desc limit 1"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# shop ( shop_id , address , num_of_staff , score , open_year )\n# member ( member_id , name , membership_card , age , time_of_purchase , level_of_membership , address )\n# happy_hour ( hh_id , shop_id , month , num_of_shaff_in_charge )\n# happy_hour_member ( hh_id , member_id , total_amount )\n# happy_hour.shop_id = shop.shop_id\n# happy_hour_member.member_id = member.member_id\n\n#\n### Which months have more than 2 happy hours?\nSELECT \n"
},
{
"role": "assistant",
"content": "month from happy_hour group by month having count ( * ) > 2"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### How many albums are there?\nSELECT \n"
},
{
"role": "assistant",
"content": "count ( * ) from album"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Find the number of albums.\nSELECT \n"
},
{
"role": "assistant",
"content": "count ( * ) from album"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### List the names of all music genres.\nSELECT \n"
},
{
"role": "assistant",
"content": "name from genre"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### What are the names of different music genres?\nSELECT \n"
},
{
"role": "assistant",
"content": "name from genre"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Find all the customer information in state NY.\nSELECT \n"
},
{
"role": "assistant",
"content": "* from customer where state = 'NY'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### What is all the customer information for customers in NY state?\nSELECT \n"
},
{
"role": "assistant",
"content": "* from customer where state = 'NY'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### What are the first names and last names of the employees who live in Calgary city.\nSELECT \n"
},
{
"role": "assistant",
"content": "firstname , lastname from employee where city = 'Calgary'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Find the full names of employees living in the city of Calgary.\nSELECT \n"
},
{
"role": "assistant",
"content": "firstname , lastname from employee where city = 'Calgary'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### What are the distinct billing countries of the invoices?\nSELECT \n"
},
{
"role": "assistant",
"content": "distinct ( billingcountry ) from invoice"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Find the different billing countries for all invoices.\nSELECT \n"
},
{
"role": "assistant",
"content": "distinct ( billingcountry ) from invoice"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Find the names of all artists that have \"a\" in their names.\nSELECT \n"
},
{
"role": "assistant",
"content": "name from artist where name like '%a%'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### What are the names of artist who have the letter 'a' in their names?\nSELECT \n"
},
{
"role": "assistant",
"content": "name from artist where name like '%a%'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Find the title of all the albums of the artist \"AC/DC\".\nSELECT \n"
},
{
"role": "assistant",
"content": "title from album join artist on album.artistid = artist.artistid where artist.name = 'AC/DC'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### What are the titles of albums by the artist \"AC/DC\"?\nSELECT \n"
},
{
"role": "assistant",
"content": "title from album join artist on album.artistid = artist.artistid where artist.name = 'AC/DC'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Hom many albums does the artist \"Metallica\" have?\nSELECT \n"
},
{
"role": "assistant",
"content": "count ( * ) from album join artist on album.artistid = artist.artistid where artist.name = 'Metallica'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Find the number of albums by the artist \"Metallica\".\nSELECT \n"
},
{
"role": "assistant",
"content": "count ( * ) from album join artist on album.artistid = artist.artistid where artist.name = 'Metallica'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Which artist does the album \"Balls to the Wall\" belong to?\nSELECT \n"
},
{
"role": "assistant",
"content": "artist.name from album join artist on album.artistid = artist.artistid where album.title = 'Balls to the Wall'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Find the name of the artist who made the album \"Balls to the Wall\".\nSELECT \n"
},
{
"role": "assistant",
"content": "artist.name from album join artist on album.artistid = artist.artistid where album.title = 'Balls to the Wall'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Which artist has the most albums?\nSELECT \n"
},
{
"role": "assistant",
"content": "artist.name from album join artist on album.artistid = artist.artistid group by artist.name order by count ( * ) desc limit 1"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### What is the name of the artist with the greatest number of albums?\nSELECT \n"
},
{
"role": "assistant",
"content": "artist.name from album join artist on album.artistid = artist.artistid group by artist.name order by count ( * ) desc limit 1"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Find the names of all the tracks that contain the word \"you\".\nSELECT \n"
},
{
"role": "assistant",
"content": "name from track where name like '%you%'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### What are the names of tracks that contain the the word you in them?\nSELECT \n"
},
{
"role": "assistant",
"content": "name from track where name like '%you%'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### What is the average unit price of all the tracks?\nSELECT \n"
},
{
"role": "assistant",
"content": "avg ( unitprice ) from track"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Find the average unit price for a track.\nSELECT \n"
},
{
"role": "assistant",
"content": "avg ( unitprice ) from track"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### What are the durations of the longest and the shortest tracks in milliseconds?\nSELECT \n"
},
{
"role": "assistant",
"content": "max ( milliseconds ) , min ( milliseconds ) from track"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Find the maximum and minimum durations of tracks in milliseconds.\nSELECT \n"
},
{
"role": "assistant",
"content": "max ( milliseconds ) , min ( milliseconds ) from track"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Show the album names, ids and the number of tracks for each album.\nSELECT \n"
},
{
"role": "assistant",
"content": "album.title , track.albumid , count ( * ) from album join track on album.albumid = track.albumid group by track.albumid"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### What are the names and ids of the different albums, and how many tracks are on each?\nSELECT \n"
},
{
"role": "assistant",
"content": "album.title , track.albumid , count ( * ) from album join track on album.albumid = track.albumid group by track.albumid"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### What is the name of the most common genre in all tracks?\nSELECT \n"
},
{
"role": "assistant",
"content": "genre.name from genre join track on genre.genreid = track.genreid group by track.genreid order by count ( * ) desc limit 1"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Find the name of the genre that is most frequent across all tracks.\nSELECT \n"
},
{
"role": "assistant",
"content": "genre.name from genre join track on genre.genreid = track.genreid group by track.genreid order by count ( * ) desc limit 1"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### What is the least common media type in all tracks?\nSELECT \n"
},
{
"role": "assistant",
"content": "mediatype.name from mediatype join track on mediatype.mediatypeid = track.mediatypeid group by track.mediatypeid order by count ( * ) asc limit 1"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### What is the name of the media type that is least common across all tracks?\nSELECT \n"
},
{
"role": "assistant",
"content": "mediatype.name from mediatype join track on mediatype.mediatypeid = track.mediatypeid group by track.mediatypeid order by count ( * ) asc limit 1"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Show the album names and ids for albums that contain tracks with unit price bigger than 1.\nSELECT \n"
},
{
"role": "assistant",
"content": "album.title , track.albumid from album join track on album.albumid = track.albumid where track.unitprice > 1 group by track.albumid"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### What are the titles and ids for albums containing tracks with unit price greater than 1?\nSELECT \n"
},
{
"role": "assistant",
"content": "album.title , track.albumid from album join track on album.albumid = track.albumid where track.unitprice > 1 group by track.albumid"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### How many tracks belong to rock genre?\nSELECT \n"
},
{
"role": "assistant",
"content": "count ( * ) from genre join track on genre.genreid = track.genreid where genre.name = 'Rock'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Count the number of tracks that are part of the rock genre.\nSELECT \n"
},
{
"role": "assistant",
"content": "count ( * ) from genre join track on genre.genreid = track.genreid where genre.name = 'Rock'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### What is the average unit price of tracks that belong to Jazz genre?\nSELECT \n"
},
{
"role": "assistant",
"content": "avg ( unitprice ) from genre join track on genre.genreid = track.genreid where genre.name = 'Jazz'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Find the average unit price of jazz tracks.\nSELECT \n"
},
{
"role": "assistant",
"content": "avg ( unitprice ) from genre join track on genre.genreid = track.genreid where genre.name = 'Jazz'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### What is the first name and last name of the customer that has email \"luisg@embraer.com.br\"?\nSELECT \n"
},
{
"role": "assistant",
"content": "firstname , lastname from customer where email = 'luisg@embraer.com.br'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Find the full name of the customer with the email \"luisg@embraer.com.br\".\nSELECT \n"
},
{
"role": "assistant",
"content": "firstname , lastname from customer where email = 'luisg@embraer.com.br'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### How many customers have email that contains \"gmail.com\"?\nSELECT \n"
},
{
"role": "assistant",
"content": "count ( * ) from customer where email like '%gmail.com%'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Count the number of customers that have an email containing \"gmail.com\".\nSELECT \n"
},
{
"role": "assistant",
"content": "count ( * ) from customer where email like '%gmail.com%'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### What is the first name and last name employee helps the customer with first name Leonie?\nSELECT \n"
},
{
"role": "assistant",
"content": "employee.firstname , employee.lastname from customer join employee on customer.supportrepid = employee.employeeid where customer.firstname = 'Leonie'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Find the full names of employees who help customers with the first name Leonie.\nSELECT \n"
},
{
"role": "assistant",
"content": "employee.firstname , employee.lastname from customer join employee on customer.supportrepid = employee.employeeid where customer.firstname = 'Leonie'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### What city does the employee who helps the customer with postal code 70174 live in?\nSELECT \n"
},
{
"role": "assistant",
"content": "employee.city from customer join employee on customer.supportrepid = employee.employeeid where customer.postalcode = '70174'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Find the cities corresponding to employees who help customers with the postal code 70174.\nSELECT \n"
},
{
"role": "assistant",
"content": "employee.city from customer join employee on customer.supportrepid = employee.employeeid where customer.postalcode = '70174'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### How many distinct cities does the employees live in?\nSELECT \n"
},
{
"role": "assistant",
"content": "count ( distinct city ) from employee"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Find the number of different cities that employees live in.\nSELECT \n"
},
{
"role": "assistant",
"content": "count ( distinct city ) from employee"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Find all invoice dates corresponding to customers with first name Astrid and last name Gruber.\nSELECT \n"
},
{
"role": "assistant",
"content": "invoice.invoicedate from customer join invoice on customer.customerid = invoice.customerid where customer.firstname = 'Astrid' and lastname = 'Gruber'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### What are the invoice dates for customers with the first name Astrid and the last name Gruber?\nSELECT \n"
},
{
"role": "assistant",
"content": "invoice.invoicedate from customer join invoice on customer.customerid = invoice.customerid where customer.firstname = 'Astrid' and lastname = 'Gruber'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Find all the customer last names that do not have invoice totals larger than 20.\nSELECT \n"
},
{
"role": "assistant",
"content": "lastname from customer except select customer.lastname from customer join invoice on customer.customerid = invoice.customerid where invoice.total > 20"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### What are the last names of customers without invoice totals exceeding 20?\nSELECT \n"
},
{
"role": "assistant",
"content": "lastname from customer except select customer.lastname from customer join invoice on customer.customerid = invoice.customerid where invoice.total > 20"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Find the first names of all customers that live in Brazil and have an invoice.\nSELECT \n"
},
{
"role": "assistant",
"content": "distinct customer.firstname from customer join invoice on customer.customerid = invoice.customerid where customer.country = 'Brazil'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### What are the different first names for customers from Brazil who have also had an invoice?\nSELECT \n"
},
{
"role": "assistant",
"content": "distinct customer.firstname from customer join invoice on customer.customerid = invoice.customerid where customer.country = 'Brazil'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Find the address of all customers that live in Germany and have invoice.\nSELECT \n"
},
{
"role": "assistant",
"content": "distinct customer.address from customer join invoice on customer.customerid = invoice.customerid where customer.country = 'Germany'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### What are the addresses of customers living in Germany who have had an invoice?\nSELECT \n"
},
{
"role": "assistant",
"content": "distinct customer.address from customer join invoice on customer.customerid = invoice.customerid where customer.country = 'Germany'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### List the phone numbers of all employees.\nSELECT \n"
},
{
"role": "assistant",
"content": "phone from employee"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### What are the phone numbers for each employee?\nSELECT \n"
},
{
"role": "assistant",
"content": "phone from employee"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### How many tracks are in the AAC audio file media type?\nSELECT \n"
},
{
"role": "assistant",
"content": "count ( * ) from mediatype join track on mediatype.mediatypeid = track.mediatypeid where mediatype.name = 'AAC audio file'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Count the number of tracks that are of the media type \"AAC audio file\".\nSELECT \n"
},
{
"role": "assistant",
"content": "count ( * ) from mediatype join track on mediatype.mediatypeid = track.mediatypeid where mediatype.name = 'AAC audio file'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### What is the average duration in milliseconds of tracks that belong to Latin or Pop genre?\nSELECT \n"
},
{
"role": "assistant",
"content": "avg ( milliseconds ) from genre join track on genre.genreid = track.genreid where genre.name = 'Latin' or genre.name = 'Pop'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Find the average millisecond length of Latin and Pop tracks.\nSELECT \n"
},
{
"role": "assistant",
"content": "avg ( milliseconds ) from genre join track on genre.genreid = track.genreid where genre.name = 'Latin' or genre.name = 'Pop'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Please show the employee first names and ids of employees who serve at least 10 customers.\nSELECT \n"
},
{
"role": "assistant",
"content": "customer.firstname , customer.supportrepid from customer join employee on customer.supportrepid = employee.employeeid group by customer.supportrepid having count ( * ) >= 10"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### What are the first names and support rep ids for employees serving 10 or more customers?\nSELECT \n"
},
{
"role": "assistant",
"content": "customer.firstname , customer.supportrepid from customer join employee on customer.supportrepid = employee.employeeid group by customer.supportrepid having count ( * ) >= 10"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Please show the employee last names that serves no more than 20 customers.\nSELECT \n"
},
{
"role": "assistant",
"content": "customer.lastname from customer join employee on customer.supportrepid = employee.employeeid group by customer.supportrepid having count ( * ) <= 20"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### What are the last names of employees who serve at most 20 customers?\nSELECT \n"
},
{
"role": "assistant",
"content": "customer.lastname from customer join employee on customer.supportrepid = employee.employeeid group by customer.supportrepid having count ( * ) <= 20"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Please list all album titles in alphabetical order.\nSELECT \n"
},
{
"role": "assistant",
"content": "title from album order by title asc"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### What are all the album titles, in alphabetical order?\nSELECT \n"
},
{
"role": "assistant",
"content": "title from album order by title asc"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Please list the name and id of all artists that have at least 3 albums in alphabetical order.\nSELECT \n"
},
{
"role": "assistant",
"content": "artist.name , album.artistid from album join artist on album.artistid = artist.artistid group by album.artistid having count ( * ) >= 3 order by artist.name asc"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### What are the names and ids of artists with 3 or more albums, listed in alphabetical order?\nSELECT \n"
},
{
"role": "assistant",
"content": "artist.name , album.artistid from album join artist on album.artistid = artist.artistid group by album.artistid having count ( * ) >= 3 order by artist.name asc"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Find the names of artists that do not have any albums.\nSELECT \n"
},
{
"role": "assistant",
"content": "name from artist except select artist.name from album join artist on album.artistid = artist.artistid"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### What are the names of artists who have not released any albums?\nSELECT \n"
},
{
"role": "assistant",
"content": "name from artist except select artist.name from album join artist on album.artistid = artist.artistid"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### What is the average unit price of rock tracks?\nSELECT \n"
},
{
"role": "assistant",
"content": "avg ( track.unitprice ) from genre join track on genre.genreid = track.genreid where genre.name = 'Rock'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Find the average unit price of tracks from the Rock genre.\nSELECT \n"
},
{
"role": "assistant",
"content": "avg ( track.unitprice ) from genre join track on genre.genreid = track.genreid where genre.name = 'Rock'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### What are the duration of the longest and shortest pop tracks in milliseconds?\nSELECT \n"
},
{
"role": "assistant",
"content": "max ( milliseconds ) , min ( milliseconds ) from genre join track on genre.genreid = track.genreid where genre.name = 'Pop'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Find the maximum and minimum millisecond lengths of pop tracks.\nSELECT \n"
},
{
"role": "assistant",
"content": "max ( milliseconds ) , min ( milliseconds ) from genre join track on genre.genreid = track.genreid where genre.name = 'Pop'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### What are the birth dates of employees living in Edmonton?\nSELECT \n"
},
{
"role": "assistant",
"content": "birthdate from employee where city = 'Edmonton'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Find the birth dates corresponding to employees who live in the city of Edmonton.\nSELECT \n"
},
{
"role": "assistant",
"content": "birthdate from employee where city = 'Edmonton'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### What are the distinct unit prices of all tracks?\nSELECT \n"
},
{
"role": "assistant",
"content": "distinct ( unitprice ) from track"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Find the distinct unit prices for tracks.\nSELECT \n"
},
{
"role": "assistant",
"content": "distinct ( unitprice ) from track"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### How many artists do not have any album?\nSELECT \n"
},
{
"role": "assistant",
"content": "count ( * ) from artist where artistid not in ( select artistid from album )"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Cound the number of artists who have not released an album.\nSELECT \n"
},
{
"role": "assistant",
"content": "count ( * ) from artist where artistid not in ( select artistid from album )"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### What are the album titles for albums containing both 'Reggae' and 'Rock' genre tracks?\nSELECT \n"
},
{
"role": "assistant",
"content": "album.title from album join track on album.albumid = track.albumid join genre on track.genreid = genre.genreid where genre.name = 'Reggae' intersect select album.title from album join track on album.albumid = track.albumid join genre on track.genreid = genre.genreid where genre.name = 'Rock'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# album ( albumid , title , artistid )\n# artist ( artistid , name )\n# customer ( customerid , firstname , lastname , company , address , city , state , country , postalcode , phone , fax , email , supportrepid )\n# employee ( employeeid , lastname , firstname , title , reportsto , birthdate , hiredate , address , city , state , country , postalcode , phone , fax , email )\n# genre ( genreid , name )\n# invoice ( invoiceid , customerid , invoicedate , billingaddress , billingcity , billingstate , billingcountry , billingpostalcode , total )\n# invoiceline ( invoicelineid , invoiceid , trackid , unitprice , quantity )\n# mediatype ( mediatypeid , name )\n# playlist ( playlistid , name )\n# playlisttrack ( playlistid , trackid )\n# track ( trackid , name , albumid , mediatypeid , genreid , composer , milliseconds , bytes , unitprice )\n# album.artistid = artist.artistid\n# customer.supportrepid = employee.employeeid\n# employee.reportsto = employee.employeeid\n# invoice.customerid = customer.customerid\n# invoiceline.trackid = track.trackid\n# invoiceline.invoiceid = invoice.invoiceid\n# playlisttrack.trackid = track.trackid\n# playlisttrack.playlistid = playlist.playlistid\n# track.mediatypeid = mediatype.mediatypeid\n# track.genreid = genre.genreid\n# track.albumid = album.albumid\n\n#\n### Find the titles of albums that contain tracks of both the Reggae and Rock genres.\nSELECT \n"
},
{
"role": "assistant",
"content": "album.title from album join track on album.albumid = track.albumid join genre on track.genreid = genre.genreid where genre.name = 'Reggae' intersect select album.title from album join track on album.albumid = track.albumid join genre on track.genreid = genre.genreid where genre.name = 'Rock'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name )\n# services ( service_id , service_name )\n# available_policies ( policy_id , policy_type_code , customer_phone )\n# customers_policies ( customer_id , policy_id , date_opened , date_closed )\n# first_notification_of_loss ( fnol_id , customer_id , policy_id , service_id )\n# claims ( claim_id , fnol_id , effective_date )\n# settlements ( settlement_id , claim_id , effective_date , settlement_amount )\n# customers_policies.policy_id = available_policies.policy_id\n# customers_policies.customer_id = customers.customer_id\n# first_notification_of_loss.customer_id = customers_policies.customer_id\n# first_notification_of_loss.policy_id = customers_policies.policy_id\n# first_notification_of_loss.service_id = services.service_id\n# claims.fnol_id = first_notification_of_loss.fnol_id\n# settlements.claim_id = claims.claim_id\n\n#\n### Find all the phone numbers.\nSELECT \n"
},
{
"role": "assistant",
"content": "customer_phone from available_policies"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name )\n# services ( service_id , service_name )\n# available_policies ( policy_id , policy_type_code , customer_phone )\n# customers_policies ( customer_id , policy_id , date_opened , date_closed )\n# first_notification_of_loss ( fnol_id , customer_id , policy_id , service_id )\n# claims ( claim_id , fnol_id , effective_date )\n# settlements ( settlement_id , claim_id , effective_date , settlement_amount )\n# customers_policies.policy_id = available_policies.policy_id\n# customers_policies.customer_id = customers.customer_id\n# first_notification_of_loss.customer_id = customers_policies.customer_id\n# first_notification_of_loss.policy_id = customers_policies.policy_id\n# first_notification_of_loss.service_id = services.service_id\n# claims.fnol_id = first_notification_of_loss.fnol_id\n# settlements.claim_id = claims.claim_id\n\n#\n### What are all the phone numbers?\nSELECT \n"
},
{
"role": "assistant",
"content": "customer_phone from available_policies"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name )\n# services ( service_id , service_name )\n# available_policies ( policy_id , policy_type_code , customer_phone )\n# customers_policies ( customer_id , policy_id , date_opened , date_closed )\n# first_notification_of_loss ( fnol_id , customer_id , policy_id , service_id )\n# claims ( claim_id , fnol_id , effective_date )\n# settlements ( settlement_id , claim_id , effective_date , settlement_amount )\n# customers_policies.policy_id = available_policies.policy_id\n# customers_policies.customer_id = customers.customer_id\n# first_notification_of_loss.customer_id = customers_policies.customer_id\n# first_notification_of_loss.policy_id = customers_policies.policy_id\n# first_notification_of_loss.service_id = services.service_id\n# claims.fnol_id = first_notification_of_loss.fnol_id\n# settlements.claim_id = claims.claim_id\n\n#\n### What are the customer phone numbers under the policy \"Life Insurance\"?\nSELECT \n"
},
{
"role": "assistant",
"content": "customer_phone from available_policies where policy_type_code = 'Life Insurance'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name )\n# services ( service_id , service_name )\n# available_policies ( policy_id , policy_type_code , customer_phone )\n# customers_policies ( customer_id , policy_id , date_opened , date_closed )\n# first_notification_of_loss ( fnol_id , customer_id , policy_id , service_id )\n# claims ( claim_id , fnol_id , effective_date )\n# settlements ( settlement_id , claim_id , effective_date , settlement_amount )\n# customers_policies.policy_id = available_policies.policy_id\n# customers_policies.customer_id = customers.customer_id\n# first_notification_of_loss.customer_id = customers_policies.customer_id\n# first_notification_of_loss.policy_id = customers_policies.policy_id\n# first_notification_of_loss.service_id = services.service_id\n# claims.fnol_id = first_notification_of_loss.fnol_id\n# settlements.claim_id = claims.claim_id\n\n#\n### What are the phone numbers of customers using the policy with the code \"Life Insurance\"?\nSELECT \n"
},
{
"role": "assistant",
"content": "customer_phone from available_policies where policy_type_code = 'Life Insurance'"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name )\n# services ( service_id , service_name )\n# available_policies ( policy_id , policy_type_code , customer_phone )\n# customers_policies ( customer_id , policy_id , date_opened , date_closed )\n# first_notification_of_loss ( fnol_id , customer_id , policy_id , service_id )\n# claims ( claim_id , fnol_id , effective_date )\n# settlements ( settlement_id , claim_id , effective_date , settlement_amount )\n# customers_policies.policy_id = available_policies.policy_id\n# customers_policies.customer_id = customers.customer_id\n# first_notification_of_loss.customer_id = customers_policies.customer_id\n# first_notification_of_loss.policy_id = customers_policies.policy_id\n# first_notification_of_loss.service_id = services.service_id\n# claims.fnol_id = first_notification_of_loss.fnol_id\n# settlements.claim_id = claims.claim_id\n\n#\n### Which policy type has the most records in the database?\nSELECT \n"
},
{
"role": "assistant",
"content": "policy_type_code from available_policies group by policy_type_code order by count ( * ) desc limit 1"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name )\n# services ( service_id , service_name )\n# available_policies ( policy_id , policy_type_code , customer_phone )\n# customers_policies ( customer_id , policy_id , date_opened , date_closed )\n# first_notification_of_loss ( fnol_id , customer_id , policy_id , service_id )\n# claims ( claim_id , fnol_id , effective_date )\n# settlements ( settlement_id , claim_id , effective_date , settlement_amount )\n# customers_policies.policy_id = available_policies.policy_id\n# customers_policies.customer_id = customers.customer_id\n# first_notification_of_loss.customer_id = customers_policies.customer_id\n# first_notification_of_loss.policy_id = customers_policies.policy_id\n# first_notification_of_loss.service_id = services.service_id\n# claims.fnol_id = first_notification_of_loss.fnol_id\n# settlements.claim_id = claims.claim_id\n\n#\n### Which policy type appears most frequently in the available policies?\nSELECT \n"
},
{
"role": "assistant",
"content": "policy_type_code from available_policies group by policy_type_code order by count ( * ) desc limit 1"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name )\n# services ( service_id , service_name )\n# available_policies ( policy_id , policy_type_code , customer_phone )\n# customers_policies ( customer_id , policy_id , date_opened , date_closed )\n# first_notification_of_loss ( fnol_id , customer_id , policy_id , service_id )\n# claims ( claim_id , fnol_id , effective_date )\n# settlements ( settlement_id , claim_id , effective_date , settlement_amount )\n# customers_policies.policy_id = available_policies.policy_id\n# customers_policies.customer_id = customers.customer_id\n# first_notification_of_loss.customer_id = customers_policies.customer_id\n# first_notification_of_loss.policy_id = customers_policies.policy_id\n# first_notification_of_loss.service_id = services.service_id\n# claims.fnol_id = first_notification_of_loss.fnol_id\n# settlements.claim_id = claims.claim_id\n\n#\n### What are all the customer phone numbers under the most popular policy type?\nSELECT \n"
},
{
"role": "assistant",
"content": "customer_phone from available_policies where policy_type_code = ( select policy_type_code from available_policies group by policy_type_code order by count ( * ) desc limit 1 )"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name )\n# services ( service_id , service_name )\n# available_policies ( policy_id , policy_type_code , customer_phone )\n# customers_policies ( customer_id , policy_id , date_opened , date_closed )\n# first_notification_of_loss ( fnol_id , customer_id , policy_id , service_id )\n# claims ( claim_id , fnol_id , effective_date )\n# settlements ( settlement_id , claim_id , effective_date , settlement_amount )\n# customers_policies.policy_id = available_policies.policy_id\n# customers_policies.customer_id = customers.customer_id\n# first_notification_of_loss.customer_id = customers_policies.customer_id\n# first_notification_of_loss.policy_id = customers_policies.policy_id\n# first_notification_of_loss.service_id = services.service_id\n# claims.fnol_id = first_notification_of_loss.fnol_id\n# settlements.claim_id = claims.claim_id\n\n#\n### Find the phone numbers of customers using the most common policy type among the available policies.\nSELECT \n"
},
{
"role": "assistant",
"content": "customer_phone from available_policies where policy_type_code = ( select policy_type_code from available_policies group by policy_type_code order by count ( * ) desc limit 1 )"
}
] |
[
{
"role": "system",
"content": "You are an excellent SQL writer."
},
{
"role": "user",
"content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name )\n# services ( service_id , service_name )\n# available_policies ( policy_id , policy_type_code , customer_phone )\n# customers_policies ( customer_id , policy_id , date_opened , date_closed )\n# first_notification_of_loss ( fnol_id , customer_id , policy_id , service_id )\n# claims ( claim_id , fnol_id , effective_date )\n# settlements ( settlement_id , claim_id , effective_date , settlement_amount )\n# customers_policies.policy_id = available_policies.policy_id\n# customers_policies.customer_id = customers.customer_id\n# first_notification_of_loss.customer_id = customers_policies.customer_id\n# first_notification_of_loss.policy_id = customers_policies.policy_id\n# first_notification_of_loss.service_id = services.service_id\n# claims.fnol_id = first_notification_of_loss.fnol_id\n# settlements.claim_id = claims.claim_id\n\n#\n### Find the policy type used by more than 4 customers.\nSELECT \n"
},
{
"role": "assistant",
"content": "policy_type_code from available_policies group by policy_type_code having count ( * ) > 4"
}
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.