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# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### How many students does each advisor have?\nSELECT \n"
},
{
"role": "assistant",
"content": "advisor , count ( * ) from student group by advisor"
}
] |
[
{
"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# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Which advisor has most number of students?\nSELECT \n"
},
{
"role": "assistant",
"content": "advisor from student group by advisor 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# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Give the advisor with the most students.\nSELECT \n"
},
{
"role": "assistant",
"content": "advisor from student group by advisor 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# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### How many students have cat allergies?\nSELECT \n"
},
{
"role": "assistant",
"content": "count ( * ) from has_allergy where allergy = 'Cat'"
}
] |
[
{
"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# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### How many students are affected by cat allergies?\nSELECT \n"
},
{
"role": "assistant",
"content": "count ( * ) from has_allergy where allergy = 'Cat'"
}
] |
[
{
"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# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Show all student IDs who have at least two allergies.\nSELECT \n"
},
{
"role": "assistant",
"content": "stuid from has_allergy group by stuid 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# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### What are the students ids of students who have more than one allergy?\nSELECT \n"
},
{
"role": "assistant",
"content": "stuid from has_allergy group by stuid 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# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### What are the student ids of students who don't have any allergies?\nSELECT \n"
},
{
"role": "assistant",
"content": "stuid from student except select stuid from has_allergy"
}
] |
[
{
"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# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Which students are unaffected by allergies?\nSELECT \n"
},
{
"role": "assistant",
"content": "stuid from student except select stuid from has_allergy"
}
] |
[
{
"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# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### How many female students have milk or egg allergies?\nSELECT \n"
},
{
"role": "assistant",
"content": "count ( * ) from has_allergy join student on has_allergy.stuid = student.stuid where student.sex = 'F' and has_allergy.allergy = 'Milk' or has_allergy.allergy = 'Eggs'"
}
] |
[
{
"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# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### How many students who are female are allergic to milk or eggs?\nSELECT \n"
},
{
"role": "assistant",
"content": "count ( * ) from has_allergy join student on has_allergy.stuid = student.stuid where student.sex = 'F' and has_allergy.allergy = 'Milk' or has_allergy.allergy = 'Eggs'"
}
] |
[
{
"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# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### How many students have a food allergy?\nSELECT \n"
},
{
"role": "assistant",
"content": "count ( * ) from has_allergy join allergy_type on has_allergy.allergy = allergy_type.allergy where allergy_type.allergytype = 'food'"
}
] |
[
{
"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# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### How many students are affected by food related allergies?\nSELECT \n"
},
{
"role": "assistant",
"content": "count ( * ) from has_allergy join allergy_type on has_allergy.allergy = allergy_type.allergy where allergy_type.allergytype = 'food'"
}
] |
[
{
"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# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Which allergy has most number of students affected?\nSELECT \n"
},
{
"role": "assistant",
"content": "allergy from has_allergy group by allergy 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# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Which allergy is the most common?\nSELECT \n"
},
{
"role": "assistant",
"content": "allergy from has_allergy group by allergy 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# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Show all allergies with number of students affected.\nSELECT \n"
},
{
"role": "assistant",
"content": "allergy , count ( * ) from has_allergy group by allergy"
}
] |
[
{
"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# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### How many students have each different allergy?\nSELECT \n"
},
{
"role": "assistant",
"content": "allergy , count ( * ) from has_allergy group by allergy"
}
] |
[
{
"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# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Show all allergy type with number of students affected.\nSELECT \n"
},
{
"role": "assistant",
"content": "allergy_type.allergytype , count ( * ) from has_allergy join allergy_type on has_allergy.allergy = allergy_type.allergy group by allergy_type.allergytype"
}
] |
[
{
"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# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### How many students are affected by each allergy type?\nSELECT \n"
},
{
"role": "assistant",
"content": "allergy_type.allergytype , count ( * ) from has_allergy join allergy_type on has_allergy.allergy = allergy_type.allergy group by allergy_type.allergytype"
}
] |
[
{
"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# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Find the last name and age of the student who has allergy to both milk and cat.\nSELECT \n"
},
{
"role": "assistant",
"content": "lname , age from student where stuid in ( select stuid from has_allergy where allergy = 'Milk' intersect select stuid from has_allergy where allergy = 'Cat' )"
}
] |
[
{
"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# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### What are the last names and ages of the students who are allergic to milk and cat?\nSELECT \n"
},
{
"role": "assistant",
"content": "lname , age from student where stuid in ( select stuid from has_allergy where allergy = 'Milk' intersect select stuid from has_allergy where allergy = 'Cat' )"
}
] |
[
{
"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# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### What are the allergies and their types that the student with first name Lisa has? And order the result by name of allergies.\nSELECT \n"
},
{
"role": "assistant",
"content": "allergy_type.allergy , allergy_type.allergytype from allergy_type join has_allergy on allergy_type.allergy = has_allergy.allergy join student on student.stuid = has_allergy.stuid where student.fname = 'Lisa' order by allergy_type.allergy 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# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### What are the allergies the girl named Lisa has? And what are the types of them? Order the result by allergy names.\nSELECT \n"
},
{
"role": "assistant",
"content": "allergy_type.allergy , allergy_type.allergytype from allergy_type join has_allergy on allergy_type.allergy = has_allergy.allergy join student on student.stuid = has_allergy.stuid where student.fname = 'Lisa' order by allergy_type.allergy 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# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Find the first name and gender of the student who has allergy to milk but not cat.\nSELECT \n"
},
{
"role": "assistant",
"content": "fname , sex from student where stuid in ( select stuid from has_allergy where allergy = 'Milk' except select stuid from has_allergy where allergy = 'Cat' )"
}
] |
[
{
"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# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### What are the first name and gender of the students who have allergy to milk but can put up with cats?\nSELECT \n"
},
{
"role": "assistant",
"content": "fname , sex from student where stuid in ( select stuid from has_allergy where allergy = 'Milk' except select stuid from has_allergy where allergy = 'Cat' )"
}
] |
[
{
"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# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Find the average age of the students who have allergies with food and animal types.\nSELECT \n"
},
{
"role": "assistant",
"content": "avg ( age ) from student where stuid in ( select has_allergy.stuid from has_allergy join allergy_type on has_allergy.allergy = allergy_type.allergy where allergy_type.allergytype = 'food' intersect select has_allergy.stuid from has_allergy join allergy_type on has_allergy.allergy = allergy_type.allergy where allergy_type.allergytype = 'animal' )"
}
] |
[
{
"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# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### How old are the students with allergies to food and animal types on average?\nSELECT \n"
},
{
"role": "assistant",
"content": "avg ( age ) from student where stuid in ( select has_allergy.stuid from has_allergy join allergy_type on has_allergy.allergy = allergy_type.allergy where allergy_type.allergytype = 'food' intersect select has_allergy.stuid from has_allergy join allergy_type on has_allergy.allergy = allergy_type.allergy where allergy_type.allergytype = 'animal' )"
}
] |
[
{
"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# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### List the first and last name of the students who do not have any food type allergy.\nSELECT \n"
},
{
"role": "assistant",
"content": "fname , lname from student where stuid not in ( select has_allergy.stuid from has_allergy join allergy_type on has_allergy.allergy = allergy_type.allergy where allergy_type.allergytype = 'food' )"
}
] |
[
{
"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# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### What is the full name of each student who is not allergic to any type of food.\nSELECT \n"
},
{
"role": "assistant",
"content": "fname , lname from student where stuid not in ( select has_allergy.stuid from has_allergy join allergy_type on has_allergy.allergy = allergy_type.allergy where allergy_type.allergytype = 'food' )"
}
] |
[
{
"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# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Find the number of male (sex is 'M') students who have some food type allery.\nSELECT \n"
},
{
"role": "assistant",
"content": "count ( * ) from student where sex = 'M' and stuid in ( select stuid from has_allergy join allergy_type on has_allergy.allergy = allergy_type.allergy where allergy_type.allergytype = 'food' )"
}
] |
[
{
"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# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### How many male students (sex is 'M') are allergic to any type of food?\nSELECT \n"
},
{
"role": "assistant",
"content": "count ( * ) from student where sex = 'M' and stuid in ( select stuid from has_allergy join allergy_type on has_allergy.allergy = allergy_type.allergy where allergy_type.allergytype = 'food' )"
}
] |
[
{
"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# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Find the different first names and cities of the students who have allergy to milk or cat.\nSELECT \n"
},
{
"role": "assistant",
"content": "distinct student.fname , student.city_code from student join has_allergy on student.stuid = has_allergy.stuid where has_allergy.allergy = 'Milk' or has_allergy.allergy = 'Cat'"
}
] |
[
{
"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# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### What are the distinct first names and cities of the students who have allergy either to milk or to cat?\nSELECT \n"
},
{
"role": "assistant",
"content": "distinct student.fname , student.city_code from student join has_allergy on student.stuid = has_allergy.stuid where has_allergy.allergy = 'Milk' or has_allergy.allergy = 'Cat'"
}
] |
[
{
"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# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Find the number of students who are older than 18 and do not have allergy to either food or animal.\nSELECT \n"
},
{
"role": "assistant",
"content": "count ( * ) from student where age > 18 and stuid not in ( select stuid from has_allergy join allergy_type on has_allergy.allergy = allergy_type.allergy where allergy_type.allergytype = 'food' or allergy_type.allergytype = 'animal' )"
}
] |
[
{
"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# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### How many students are over 18 and do not have allergy to food type or animal type?\nSELECT \n"
},
{
"role": "assistant",
"content": "count ( * ) from student where age > 18 and stuid not in ( select stuid from has_allergy join allergy_type on has_allergy.allergy = allergy_type.allergy where allergy_type.allergytype = 'food' or allergy_type.allergytype = 'animal' )"
}
] |
[
{
"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# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Find the first name and major of the students who are not allegry to soy.\nSELECT \n"
},
{
"role": "assistant",
"content": "fname , major from student where stuid not in ( select stuid from has_allergy where allergy = 'Soy' )"
}
] |
[
{
"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# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### What are the first name and major of the students who are able to consume soy?\nSELECT \n"
},
{
"role": "assistant",
"content": "fname , major from student where stuid not in ( select stuid from has_allergy where allergy = 'Soy' )"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### A list of the top 5 countries by number of invoices. List country name and number of invoices.\nSELECT \n"
},
{
"role": "assistant",
"content": "billing_country , count ( * ) from invoices group by billing_country order by count ( * ) desc limit 5"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### What are the top 5 countries by number of invoices and how many do they have?\nSELECT \n"
},
{
"role": "assistant",
"content": "billing_country , count ( * ) from invoices group by billing_country order by count ( * ) desc limit 5"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### A list of the top 8 countries by gross/total invoice size. List country name and gross invoice size.\nSELECT \n"
},
{
"role": "assistant",
"content": "billing_country , sum ( total ) from invoices group by billing_country order by sum ( total ) desc limit 8"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### What are the names of the top 8 countries by total invoice size and what are those sizes?\nSELECT \n"
},
{
"role": "assistant",
"content": "billing_country , sum ( total ) from invoices group by billing_country order by sum ( total ) desc limit 8"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### A list of the top 10 countries by average invoice size. List country name and average invoice size.\nSELECT \n"
},
{
"role": "assistant",
"content": "billing_country , avg ( total ) from invoices group by billing_country order by avg ( total ) desc limit 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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### What are the names of the countries and average invoice size of the top countries by size?\nSELECT \n"
},
{
"role": "assistant",
"content": "billing_country , avg ( total ) from invoices group by billing_country order by avg ( total ) desc limit 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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### Find out 5 customers who most recently purchased something. List customers' first and last name.\nSELECT \n"
},
{
"role": "assistant",
"content": "customers.first_name , customers.last_name from customers join invoices on invoices.customer_id = customers.id order by invoices.invoice_date desc limit 5"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### What are the first and last names of the 5 customers who purchased something most recently?\nSELECT \n"
},
{
"role": "assistant",
"content": "customers.first_name , customers.last_name from customers join invoices on invoices.customer_id = customers.id order by invoices.invoice_date desc limit 5"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### Find out the top 10 customers by total number of orders. List customers' first and last name and the number of total orders.\nSELECT \n"
},
{
"role": "assistant",
"content": "customers.first_name , customers.last_name , count ( * ) from customers join invoices on invoices.customer_id = customers.id group by customers.id order by count ( * ) desc limit 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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### What are the top 10 customers' first and last names by total number of orders and how many orders did they make?\nSELECT \n"
},
{
"role": "assistant",
"content": "customers.first_name , customers.last_name , count ( * ) from customers join invoices on invoices.customer_id = customers.id group by customers.id order by count ( * ) desc limit 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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### List the top 10 customers by total gross sales. List customers' first and last name and total gross sales.\nSELECT \n"
},
{
"role": "assistant",
"content": "customers.first_name , customers.last_name , sum ( invoices.total ) from customers join invoices on invoices.customer_id = customers.id group by customers.id order by sum ( invoices.total ) desc limit 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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### What are the top 10 customers' first and last names with the highest gross sales, and also what are the sales?\nSELECT \n"
},
{
"role": "assistant",
"content": "customers.first_name , customers.last_name , sum ( invoices.total ) from customers join invoices on invoices.customer_id = customers.id group by customers.id order by sum ( invoices.total ) desc limit 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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### List the top 5 genres by number of tracks. List genres name and total tracks.\nSELECT \n"
},
{
"role": "assistant",
"content": "genres.name , count ( * ) from genres join tracks on tracks.genre_id = genres.id group by genres.id order by count ( * ) desc limit 5"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### How many tracks does each genre have and what are the names of the top 5?\nSELECT \n"
},
{
"role": "assistant",
"content": "genres.name , count ( * ) from genres join tracks on tracks.genre_id = genres.id group by genres.id order by count ( * ) desc limit 5"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### List every album's title.\nSELECT \n"
},
{
"role": "assistant",
"content": "title from albums"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### What are the titles of all the albums?\nSELECT \n"
},
{
"role": "assistant",
"content": "title from albums"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### List every album ordered by album title in ascending order.\nSELECT \n"
},
{
"role": "assistant",
"content": "title from albums 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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### What are the titles of all the albums alphabetically ascending?\nSELECT \n"
},
{
"role": "assistant",
"content": "title from albums 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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### List every album whose title starts with A in alphabetical order.\nSELECT \n"
},
{
"role": "assistant",
"content": "title from albums where title like 'A%' 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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### What are the titles of all albums that start with A in alphabetical order?\nSELECT \n"
},
{
"role": "assistant",
"content": "title from albums where title like 'A%' 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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### List the customers first and last name of 10 least expensive invoices.\nSELECT \n"
},
{
"role": "assistant",
"content": "customers.first_name , customers.last_name from customers join invoices on invoices.customer_id = customers.id order by total asc limit 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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### What are the first and last names of the customers with the 10 cheapest invoices?\nSELECT \n"
},
{
"role": "assistant",
"content": "customers.first_name , customers.last_name from customers join invoices on invoices.customer_id = customers.id order by total asc limit 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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### List total amount of invoice from Chicago, IL.\nSELECT \n"
},
{
"role": "assistant",
"content": "sum ( total ) from invoices where billing_city = 'Chicago' and billing_state = 'IL'"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### What are the total amount of money in the invoices billed from Chicago, Illinois?\nSELECT \n"
},
{
"role": "assistant",
"content": "sum ( total ) from invoices where billing_city = 'Chicago' and billing_state = 'IL'"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### List the number of invoices from Chicago, IL.\nSELECT \n"
},
{
"role": "assistant",
"content": "count ( * ) from invoices where billing_city = 'Chicago' and billing_state = 'IL'"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### How many invoices were billed from Chicago, IL?\nSELECT \n"
},
{
"role": "assistant",
"content": "count ( * ) from invoices where billing_city = 'Chicago' and billing_state = 'IL'"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### List the number of invoices from the US, grouped by state.\nSELECT \n"
},
{
"role": "assistant",
"content": "billing_state , count ( * ) from invoices where billing_country = 'USA' group by billing_state"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### How many invoices were billed from each state?\nSELECT \n"
},
{
"role": "assistant",
"content": "billing_state , count ( * ) from invoices where billing_country = 'USA' group by billing_state"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### List the state in the US with the most invoices.\nSELECT \n"
},
{
"role": "assistant",
"content": "billing_state , count ( * ) from invoices where billing_country = 'USA' group by billing_state 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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### What are the states with the most invoices?\nSELECT \n"
},
{
"role": "assistant",
"content": "billing_state , count ( * ) from invoices where billing_country = 'USA' group by billing_state 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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### List the number of invoices and the invoice total from California.\nSELECT \n"
},
{
"role": "assistant",
"content": "billing_state , count ( * ) , sum ( total ) from invoices where billing_state = 'CA'"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### What is the number of invoices and total money billed in them from CA?\nSELECT \n"
},
{
"role": "assistant",
"content": "billing_state , count ( * ) , sum ( total ) from invoices where billing_state = 'CA'"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### List Aerosmith's albums.\nSELECT \n"
},
{
"role": "assistant",
"content": "albums.title from albums join artists on albums.artist_id = artists.id where artists.name = 'Aerosmith'"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### What are the titles of all the Aerosmith albums?\nSELECT \n"
},
{
"role": "assistant",
"content": "albums.title from albums join artists on albums.artist_id = artists.id where artists.name = 'Aerosmith'"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### How many albums does Billy Cobham has?\nSELECT \n"
},
{
"role": "assistant",
"content": "count ( * ) from albums join artists on albums.artist_id = artists.id where artists.name = 'Billy Cobham'"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### How many albums has Billy Cobam released?\nSELECT \n"
},
{
"role": "assistant",
"content": "count ( * ) from albums join artists on albums.artist_id = artists.id where artists.name = 'Billy Cobham'"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### Eduardo Martins is a customer at which company?\nSELECT \n"
},
{
"role": "assistant",
"content": "company from customers where first_name = 'Eduardo' and last_name = 'Martins'"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### What is the company where Eduardo Martins is a customer?\nSELECT \n"
},
{
"role": "assistant",
"content": "company from customers where first_name = 'Eduardo' and last_name = 'Martins'"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### What is Astrid Gruber's email and phone number?\nSELECT \n"
},
{
"role": "assistant",
"content": "email , phone from customers where first_name = 'Astrid' and last_name = '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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### What is the email and phone number of Astrid Gruber the customer?\nSELECT \n"
},
{
"role": "assistant",
"content": "email , phone from customers where first_name = 'Astrid' and last_name = '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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### How many customers live in Prague city?\nSELECT \n"
},
{
"role": "assistant",
"content": "count ( * ) from customers where city = 'Prague'"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### How many customers live in the city of Prague?\nSELECT \n"
},
{
"role": "assistant",
"content": "count ( * ) from customers where city = 'Prague'"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### How many customers in state of CA?\nSELECT \n"
},
{
"role": "assistant",
"content": "count ( * ) from customers where state = 'CA'"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### How many customers are from California?\nSELECT \n"
},
{
"role": "assistant",
"content": "count ( * ) from customers where state = 'CA'"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### What country does Roberto Almeida live?\nSELECT \n"
},
{
"role": "assistant",
"content": "country from customers where first_name = 'Roberto' and last_name = 'Almeida'"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### In which country does Roberto Almeida?\nSELECT \n"
},
{
"role": "assistant",
"content": "country from customers where first_name = 'Roberto' and last_name = 'Almeida'"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### List the name of albums that are released by aritist whose name has 'Led'\nSELECT \n"
},
{
"role": "assistant",
"content": "albums.title from artists join albums on artists.id = albums.artist_id where artists.name like '%Led%'"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### What is the title of the album that was released by the artist whose name has the phrase 'Led'?\nSELECT \n"
},
{
"role": "assistant",
"content": "albums.title from artists join albums on artists.id = albums.artist_id where artists.name like '%Led%'"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### How many customers does Steve Johnson support?\nSELECT \n"
},
{
"role": "assistant",
"content": "count ( * ) from employees join customers on customers.support_rep_id = employees.id where employees.first_name = 'Steve' and employees.last_name = 'Johnson'"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### What is the count of customers that Steve Johnson supports?\nSELECT \n"
},
{
"role": "assistant",
"content": "count ( * ) from employees join customers on customers.support_rep_id = employees.id where employees.first_name = 'Steve' and employees.last_name = 'Johnson'"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### What is the title, phone and hire date of Nancy Edwards?\nSELECT \n"
},
{
"role": "assistant",
"content": "title , phone , hire_date from employees where first_name = 'Nancy' and last_name = 'Edwards'"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### What is the title, phone number and hire date for the employee named Nancy Edwards?\nSELECT \n"
},
{
"role": "assistant",
"content": "title , phone , hire_date from employees where first_name = 'Nancy' and last_name = 'Edwards'"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### find the full name of employees who report to Nancy Edwards?\nSELECT \n"
},
{
"role": "assistant",
"content": "employees.first_name , employees.last_name from employees join employees on employees.id = employees.reports_to where employees.first_name = 'Nancy' and employees.last_name = 'Edwards'"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### What is the first and last name of the employee who reports to Nancy Edwards?\nSELECT \n"
},
{
"role": "assistant",
"content": "employees.first_name , employees.last_name from employees join employees on employees.id = employees.reports_to where employees.first_name = 'Nancy' and employees.last_name = 'Edwards'"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### What is the address of employee Nancy Edwards?\nSELECT \n"
},
{
"role": "assistant",
"content": "address from employees where first_name = 'Nancy' and last_name = 'Edwards'"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### What is Nancy Edwards's address?\nSELECT \n"
},
{
"role": "assistant",
"content": "address from employees where first_name = 'Nancy' and last_name = 'Edwards'"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### Find the full name of employee who supported the most number of customers.\nSELECT \n"
},
{
"role": "assistant",
"content": "employees.first_name , employees.last_name from employees join customers on employees.id = customers.support_rep_id group by employees.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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### What is the full name of the employee who has the most customers?\nSELECT \n"
},
{
"role": "assistant",
"content": "employees.first_name , employees.last_name from employees join customers on employees.id = customers.support_rep_id group by employees.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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### How many employees are living in Canada?\nSELECT \n"
},
{
"role": "assistant",
"content": "count ( * ) from employees where country = 'Canada'"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### How many employees live in Canada?\nSELECT \n"
},
{
"role": "assistant",
"content": "count ( * ) from employees where country = 'Canada'"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### What is employee Nancy Edwards's phone number?\nSELECT \n"
},
{
"role": "assistant",
"content": "phone from employees where first_name = 'Nancy' and last_name = 'Edwards'"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### What is the the phone number of Nancy Edwards?\nSELECT \n"
},
{
"role": "assistant",
"content": "phone from employees where first_name = 'Nancy' and last_name = 'Edwards'"
}
] |
[
{
"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# artists ( id , name )\n# sqlite_sequence ( name , seq )\n# albums ( id , title , artist_id )\n# employees ( id , last_name , first_name , title , reports_to , birth_date , hire_date , address , city , state , country , postal_code , phone , fax , email )\n# customers ( id , first_name , last_name , company , address , city , state , country , postal_code , phone , fax , email , support_rep_id )\n# genres ( id , name )\n# invoices ( id , customer_id , invoice_date , billing_address , billing_city , billing_state , billing_country , billing_postal_code , total )\n# media_types ( id , name )\n# tracks ( id , name , album_id , media_type_id , genre_id , composer , milliseconds , bytes , unit_price )\n# invoice_lines ( id , invoice_id , track_id , unit_price , quantity )\n# playlists ( id , name )\n# playlist_tracks ( playlist_id , track_id )\n# albums.artist_id = artists.id\n# employees.reports_to = employees.id\n# customers.support_rep_id = employees.id\n# invoices.customer_id = customers.id\n# tracks.media_type_id = media_types.id\n# tracks.genre_id = genres.id\n# tracks.album_id = albums.id\n# invoice_lines.track_id = tracks.id\n# invoice_lines.invoice_id = invoices.id\n# playlist_tracks.track_id = tracks.id\n# playlist_tracks.playlist_id = playlists.id\n\n#\n### Who is the youngest employee in the company? List employee's first and last name.\nSELECT \n"
},
{
"role": "assistant",
"content": "first_name , last_name from employees order by birth_date desc limit 1"
}
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.