db_id
stringclasses 20
values | question
stringlengths 18
174
| db_info
stringclasses 20
values | ground_truth
stringlengths 20
474
|
---|---|---|---|
world_1
|
What are the names and areas of countries with the top 5 largest area?
|
# city ( id , name , countrycode , district , population )
# sqlite_sequence ( name , seq )
# country ( code , name , continent , region , surfacearea , indepyear , population , lifeexpectancy , gnp , gnpold , localname , governmentform , headofstate , capital , code2 )
# countrylanguage ( countrycode , language , isofficial , percentage )
# city.countrycode = country.code
# countrylanguage.countrycode = country.code
|
select name , surfacearea from country order by surfacearea desc limit 5
|
world_1
|
Return the names and surface areas of the 5 largest countries.
|
# city ( id , name , countrycode , district , population )
# sqlite_sequence ( name , seq )
# country ( code , name , continent , region , surfacearea , indepyear , population , lifeexpectancy , gnp , gnpold , localname , governmentform , headofstate , capital , code2 )
# countrylanguage ( countrycode , language , isofficial , percentage )
# city.countrycode = country.code
# countrylanguage.countrycode = country.code
|
select name , surfacearea from country order by surfacearea desc limit 5
|
world_1
|
What are names of countries with the top 3 largest population?
|
# city ( id , name , countrycode , district , population )
# sqlite_sequence ( name , seq )
# country ( code , name , continent , region , surfacearea , indepyear , population , lifeexpectancy , gnp , gnpold , localname , governmentform , headofstate , capital , code2 )
# countrylanguage ( countrycode , language , isofficial , percentage )
# city.countrycode = country.code
# countrylanguage.countrycode = country.code
|
select name from country order by population desc limit 3
|
world_1
|
Return the names of the 3 most populated countries.
|
# city ( id , name , countrycode , district , population )
# sqlite_sequence ( name , seq )
# country ( code , name , continent , region , surfacearea , indepyear , population , lifeexpectancy , gnp , gnpold , localname , governmentform , headofstate , capital , code2 )
# countrylanguage ( countrycode , language , isofficial , percentage )
# city.countrycode = country.code
# countrylanguage.countrycode = country.code
|
select name from country order by population desc limit 3
|
world_1
|
What are the names of the nations with the 3 lowest populations?
|
# city ( id , name , countrycode , district , population )
# sqlite_sequence ( name , seq )
# country ( code , name , continent , region , surfacearea , indepyear , population , lifeexpectancy , gnp , gnpold , localname , governmentform , headofstate , capital , code2 )
# countrylanguage ( countrycode , language , isofficial , percentage )
# city.countrycode = country.code
# countrylanguage.countrycode = country.code
|
select name from country order by population asc limit 3
|
world_1
|
Return the names of the 3 countries with the fewest people.
|
# city ( id , name , countrycode , district , population )
# sqlite_sequence ( name , seq )
# country ( code , name , continent , region , surfacearea , indepyear , population , lifeexpectancy , gnp , gnpold , localname , governmentform , headofstate , capital , code2 )
# countrylanguage ( countrycode , language , isofficial , percentage )
# city.countrycode = country.code
# countrylanguage.countrycode = country.code
|
select name from country order by population asc limit 3
|
world_1
|
how many countries are in Asia?
|
# city ( id , name , countrycode , district , population )
# sqlite_sequence ( name , seq )
# country ( code , name , continent , region , surfacearea , indepyear , population , lifeexpectancy , gnp , gnpold , localname , governmentform , headofstate , capital , code2 )
# countrylanguage ( countrycode , language , isofficial , percentage )
# city.countrycode = country.code
# countrylanguage.countrycode = country.code
|
select count ( * ) from country where continent = 'Asia'
|
world_1
|
Count the number of countries in Asia.
|
# city ( id , name , countrycode , district , population )
# sqlite_sequence ( name , seq )
# country ( code , name , continent , region , surfacearea , indepyear , population , lifeexpectancy , gnp , gnpold , localname , governmentform , headofstate , capital , code2 )
# countrylanguage ( countrycode , language , isofficial , percentage )
# city.countrycode = country.code
# countrylanguage.countrycode = country.code
|
select count ( * ) from country where continent = 'Asia'
|
world_1
|
What are the names of the countries that are in the continent of Europe and have a population of 80000?
|
# city ( id , name , countrycode , district , population )
# sqlite_sequence ( name , seq )
# country ( code , name , continent , region , surfacearea , indepyear , population , lifeexpectancy , gnp , gnpold , localname , governmentform , headofstate , capital , code2 )
# countrylanguage ( countrycode , language , isofficial , percentage )
# city.countrycode = country.code
# countrylanguage.countrycode = country.code
|
select name from country where continent = 'Europe' and population = '80000'
|
world_1
|
Give the names of countries that are in Europe and have a population equal to 80000.
|
# city ( id , name , countrycode , district , population )
# sqlite_sequence ( name , seq )
# country ( code , name , continent , region , surfacearea , indepyear , population , lifeexpectancy , gnp , gnpold , localname , governmentform , headofstate , capital , code2 )
# countrylanguage ( countrycode , language , isofficial , percentage )
# city.countrycode = country.code
# countrylanguage.countrycode = country.code
|
select name from country where continent = 'Europe' and population = '80000'
|
world_1
|
What is the total population and average area of countries in the continent of North America whose area is bigger than 3000 ?
|
# city ( id , name , countrycode , district , population )
# sqlite_sequence ( name , seq )
# country ( code , name , continent , region , surfacearea , indepyear , population , lifeexpectancy , gnp , gnpold , localname , governmentform , headofstate , capital , code2 )
# countrylanguage ( countrycode , language , isofficial , percentage )
# city.countrycode = country.code
# countrylanguage.countrycode = country.code
|
select sum ( population ) , avg ( surfacearea ) from country where continent = 'north america' and surfacearea > 3000
|
world_1
|
Give the total population and average surface area corresponding to countries in North America that have a surface area greater than 3000 .
|
# city ( id , name , countrycode , district , population )
# sqlite_sequence ( name , seq )
# country ( code , name , continent , region , surfacearea , indepyear , population , lifeexpectancy , gnp , gnpold , localname , governmentform , headofstate , capital , code2 )
# countrylanguage ( countrycode , language , isofficial , percentage )
# city.countrycode = country.code
# countrylanguage.countrycode = country.code
|
select sum ( population ) , avg ( surfacearea ) from country where continent = 'north america' and surfacearea > 3000
|
world_1
|
What are the cities whose population is between 160000 and 900000?
|
# city ( id , name , countrycode , district , population )
# sqlite_sequence ( name , seq )
# country ( code , name , continent , region , surfacearea , indepyear , population , lifeexpectancy , gnp , gnpold , localname , governmentform , headofstate , capital , code2 )
# countrylanguage ( countrycode , language , isofficial , percentage )
# city.countrycode = country.code
# countrylanguage.countrycode = country.code
|
select name from city where population between 160000 and 900000
|
world_1
|
Return the names of cities that have a population between 160000 and 900000 .
|
# city ( id , name , countrycode , district , population )
# sqlite_sequence ( name , seq )
# country ( code , name , continent , region , surfacearea , indepyear , population , lifeexpectancy , gnp , gnpold , localname , governmentform , headofstate , capital , code2 )
# countrylanguage ( countrycode , language , isofficial , percentage )
# city.countrycode = country.code
# countrylanguage.countrycode = country.code
|
select name from city where population between 160000 and 900000
|
world_1
|
Which language is spoken by the largest number of countries?
|
# city ( id , name , countrycode , district , population )
# sqlite_sequence ( name , seq )
# country ( code , name , continent , region , surfacearea , indepyear , population , lifeexpectancy , gnp , gnpold , localname , governmentform , headofstate , capital , code2 )
# countrylanguage ( countrycode , language , isofficial , percentage )
# city.countrycode = country.code
# countrylanguage.countrycode = country.code
|
select language from countrylanguage group by language order by count ( * ) desc limit 1
|
world_1
|
Give the language that is spoken in the most countries.
|
# city ( id , name , countrycode , district , population )
# sqlite_sequence ( name , seq )
# country ( code , name , continent , region , surfacearea , indepyear , population , lifeexpectancy , gnp , gnpold , localname , governmentform , headofstate , capital , code2 )
# countrylanguage ( countrycode , language , isofficial , percentage )
# city.countrycode = country.code
# countrylanguage.countrycode = country.code
|
select language from countrylanguage group by language order by count ( * ) desc limit 1
|
world_1
|
What is the language spoken by the largest percentage of people in each country?
|
# city ( id , name , countrycode , district , population )
# sqlite_sequence ( name , seq )
# country ( code , name , continent , region , surfacearea , indepyear , population , lifeexpectancy , gnp , gnpold , localname , governmentform , headofstate , capital , code2 )
# countrylanguage ( countrycode , language , isofficial , percentage )
# city.countrycode = country.code
# countrylanguage.countrycode = country.code
|
select language , countrycode , max ( percentage ) from countrylanguage group by countrycode
|
world_1
|
What are the country codes of the different countries, and what are the languages spoken by the greatest percentage of people for each?
|
# city ( id , name , countrycode , district , population )
# sqlite_sequence ( name , seq )
# country ( code , name , continent , region , surfacearea , indepyear , population , lifeexpectancy , gnp , gnpold , localname , governmentform , headofstate , capital , code2 )
# countrylanguage ( countrycode , language , isofficial , percentage )
# city.countrycode = country.code
# countrylanguage.countrycode = country.code
|
select language , countrycode , max ( percentage ) from countrylanguage group by countrycode
|
world_1
|
What is the total number of countries where Spanish is spoken by the largest percentage of people?
|
# city ( id , name , countrycode , district , population )
# sqlite_sequence ( name , seq )
# country ( code , name , continent , region , surfacearea , indepyear , population , lifeexpectancy , gnp , gnpold , localname , governmentform , headofstate , capital , code2 )
# countrylanguage ( countrycode , language , isofficial , percentage )
# city.countrycode = country.code
# countrylanguage.countrycode = country.code
|
select count ( * ) , max ( percentage ) from countrylanguage where language = 'Spanish' group by countrycode
|
world_1
|
Count the number of countries for which Spanish is the predominantly spoken language.
|
# city ( id , name , countrycode , district , population )
# sqlite_sequence ( name , seq )
# country ( code , name , continent , region , surfacearea , indepyear , population , lifeexpectancy , gnp , gnpold , localname , governmentform , headofstate , capital , code2 )
# countrylanguage ( countrycode , language , isofficial , percentage )
# city.countrycode = country.code
# countrylanguage.countrycode = country.code
|
select count ( * ) , max ( percentage ) from countrylanguage where language = 'Spanish' group by countrycode
|
world_1
|
What are the codes of countries where Spanish is spoken by the largest percentage of people?
|
# city ( id , name , countrycode , district , population )
# sqlite_sequence ( name , seq )
# country ( code , name , continent , region , surfacearea , indepyear , population , lifeexpectancy , gnp , gnpold , localname , governmentform , headofstate , capital , code2 )
# countrylanguage ( countrycode , language , isofficial , percentage )
# city.countrycode = country.code
# countrylanguage.countrycode = country.code
|
select countrycode , max ( percentage ) from countrylanguage where language = 'Spanish' group by countrycode
|
world_1
|
Return the codes of countries for which Spanish is the predominantly spoken language.
|
# city ( id , name , countrycode , district , population )
# sqlite_sequence ( name , seq )
# country ( code , name , continent , region , surfacearea , indepyear , population , lifeexpectancy , gnp , gnpold , localname , governmentform , headofstate , capital , code2 )
# countrylanguage ( countrycode , language , isofficial , percentage )
# city.countrycode = country.code
# countrylanguage.countrycode = country.code
|
select countrycode , max ( percentage ) from countrylanguage where language = 'Spanish' group by countrycode
|
orchestra
|
How many conductors are there?
|
# conductor ( conductor_id , name , age , nationality , year_of_work )
# orchestra ( orchestra_id , orchestra , conductor_id , record_company , year_of_founded , major_record_format )
# performance ( performance_id , orchestra_id , type , date , official_ratings_(millions) , weekly_rank , share )
# show ( show_id , performance_id , if_first_show , result , attendance )
# orchestra.conductor_id = conductor.conductor_id
# performance.orchestra_id = orchestra.orchestra_id
# show.performance_id = performance.performance_id
|
select count ( * ) from conductor
|
orchestra
|
Count the number of conductors.
|
# conductor ( conductor_id , name , age , nationality , year_of_work )
# orchestra ( orchestra_id , orchestra , conductor_id , record_company , year_of_founded , major_record_format )
# performance ( performance_id , orchestra_id , type , date , official_ratings_(millions) , weekly_rank , share )
# show ( show_id , performance_id , if_first_show , result , attendance )
# orchestra.conductor_id = conductor.conductor_id
# performance.orchestra_id = orchestra.orchestra_id
# show.performance_id = performance.performance_id
|
select count ( * ) from conductor
|
orchestra
|
List the names of conductors in ascending order of age.
|
# conductor ( conductor_id , name , age , nationality , year_of_work )
# orchestra ( orchestra_id , orchestra , conductor_id , record_company , year_of_founded , major_record_format )
# performance ( performance_id , orchestra_id , type , date , official_ratings_(millions) , weekly_rank , share )
# show ( show_id , performance_id , if_first_show , result , attendance )
# orchestra.conductor_id = conductor.conductor_id
# performance.orchestra_id = orchestra.orchestra_id
# show.performance_id = performance.performance_id
|
select name from conductor order by age asc
|
orchestra
|
What are the names of conductors, ordered by age?
|
# conductor ( conductor_id , name , age , nationality , year_of_work )
# orchestra ( orchestra_id , orchestra , conductor_id , record_company , year_of_founded , major_record_format )
# performance ( performance_id , orchestra_id , type , date , official_ratings_(millions) , weekly_rank , share )
# show ( show_id , performance_id , if_first_show , result , attendance )
# orchestra.conductor_id = conductor.conductor_id
# performance.orchestra_id = orchestra.orchestra_id
# show.performance_id = performance.performance_id
|
select name from conductor order by age asc
|
orchestra
|
What are the names of conductors whose nationalities are not "USA"?
|
# conductor ( conductor_id , name , age , nationality , year_of_work )
# orchestra ( orchestra_id , orchestra , conductor_id , record_company , year_of_founded , major_record_format )
# performance ( performance_id , orchestra_id , type , date , official_ratings_(millions) , weekly_rank , share )
# show ( show_id , performance_id , if_first_show , result , attendance )
# orchestra.conductor_id = conductor.conductor_id
# performance.orchestra_id = orchestra.orchestra_id
# show.performance_id = performance.performance_id
|
select name from conductor where nationality != 'USA'
|
orchestra
|
Return the names of conductors that do not have the nationality "USA".
|
# conductor ( conductor_id , name , age , nationality , year_of_work )
# orchestra ( orchestra_id , orchestra , conductor_id , record_company , year_of_founded , major_record_format )
# performance ( performance_id , orchestra_id , type , date , official_ratings_(millions) , weekly_rank , share )
# show ( show_id , performance_id , if_first_show , result , attendance )
# orchestra.conductor_id = conductor.conductor_id
# performance.orchestra_id = orchestra.orchestra_id
# show.performance_id = performance.performance_id
|
select name from conductor where nationality != 'USA'
|
orchestra
|
What are the record companies of orchestras in descending order of years in which they were founded?
|
# conductor ( conductor_id , name , age , nationality , year_of_work )
# orchestra ( orchestra_id , orchestra , conductor_id , record_company , year_of_founded , major_record_format )
# performance ( performance_id , orchestra_id , type , date , official_ratings_(millions) , weekly_rank , share )
# show ( show_id , performance_id , if_first_show , result , attendance )
# orchestra.conductor_id = conductor.conductor_id
# performance.orchestra_id = orchestra.orchestra_id
# show.performance_id = performance.performance_id
|
select record_company from orchestra order by year_of_founded desc
|
orchestra
|
Return the record companies of orchestras, sorted descending by the years in which they were founded.
|
# conductor ( conductor_id , name , age , nationality , year_of_work )
# orchestra ( orchestra_id , orchestra , conductor_id , record_company , year_of_founded , major_record_format )
# performance ( performance_id , orchestra_id , type , date , official_ratings_(millions) , weekly_rank , share )
# show ( show_id , performance_id , if_first_show , result , attendance )
# orchestra.conductor_id = conductor.conductor_id
# performance.orchestra_id = orchestra.orchestra_id
# show.performance_id = performance.performance_id
|
select record_company from orchestra order by year_of_founded desc
|
orchestra
|
What is the average attendance of shows?
|
# conductor ( conductor_id , name , age , nationality , year_of_work )
# orchestra ( orchestra_id , orchestra , conductor_id , record_company , year_of_founded , major_record_format )
# performance ( performance_id , orchestra_id , type , date , official_ratings_(millions) , weekly_rank , share )
# show ( show_id , performance_id , if_first_show , result , attendance )
# orchestra.conductor_id = conductor.conductor_id
# performance.orchestra_id = orchestra.orchestra_id
# show.performance_id = performance.performance_id
|
select avg ( attendance ) from show
|
orchestra
|
Return the average attendance across all shows.
|
# conductor ( conductor_id , name , age , nationality , year_of_work )
# orchestra ( orchestra_id , orchestra , conductor_id , record_company , year_of_founded , major_record_format )
# performance ( performance_id , orchestra_id , type , date , official_ratings_(millions) , weekly_rank , share )
# show ( show_id , performance_id , if_first_show , result , attendance )
# orchestra.conductor_id = conductor.conductor_id
# performance.orchestra_id = orchestra.orchestra_id
# show.performance_id = performance.performance_id
|
select avg ( attendance ) from show
|
orchestra
|
What are the maximum and minimum share of performances whose type is not "Live final".
|
# conductor ( conductor_id , name , age , nationality , year_of_work )
# orchestra ( orchestra_id , orchestra , conductor_id , record_company , year_of_founded , major_record_format )
# performance ( performance_id , orchestra_id , type , date , official_ratings_(millions) , weekly_rank , share )
# show ( show_id , performance_id , if_first_show , result , attendance )
# orchestra.conductor_id = conductor.conductor_id
# performance.orchestra_id = orchestra.orchestra_id
# show.performance_id = performance.performance_id
|
select max ( share ) , min ( share ) from performance where type != 'Live final'
|
orchestra
|
Return the maximum and minimum shares for performances that do not have the type "Live final".
|
# conductor ( conductor_id , name , age , nationality , year_of_work )
# orchestra ( orchestra_id , orchestra , conductor_id , record_company , year_of_founded , major_record_format )
# performance ( performance_id , orchestra_id , type , date , official_ratings_(millions) , weekly_rank , share )
# show ( show_id , performance_id , if_first_show , result , attendance )
# orchestra.conductor_id = conductor.conductor_id
# performance.orchestra_id = orchestra.orchestra_id
# show.performance_id = performance.performance_id
|
select max ( share ) , min ( share ) from performance where type != 'Live final'
|
orchestra
|
How many different nationalities do conductors have?
|
# conductor ( conductor_id , name , age , nationality , year_of_work )
# orchestra ( orchestra_id , orchestra , conductor_id , record_company , year_of_founded , major_record_format )
# performance ( performance_id , orchestra_id , type , date , official_ratings_(millions) , weekly_rank , share )
# show ( show_id , performance_id , if_first_show , result , attendance )
# orchestra.conductor_id = conductor.conductor_id
# performance.orchestra_id = orchestra.orchestra_id
# show.performance_id = performance.performance_id
|
select count ( distinct nationality ) from conductor
|
orchestra
|
Count the number of different nationalities of conductors.
|
# conductor ( conductor_id , name , age , nationality , year_of_work )
# orchestra ( orchestra_id , orchestra , conductor_id , record_company , year_of_founded , major_record_format )
# performance ( performance_id , orchestra_id , type , date , official_ratings_(millions) , weekly_rank , share )
# show ( show_id , performance_id , if_first_show , result , attendance )
# orchestra.conductor_id = conductor.conductor_id
# performance.orchestra_id = orchestra.orchestra_id
# show.performance_id = performance.performance_id
|
select count ( distinct nationality ) from conductor
|
orchestra
|
List names of conductors in descending order of years of work.
|
# conductor ( conductor_id , name , age , nationality , year_of_work )
# orchestra ( orchestra_id , orchestra , conductor_id , record_company , year_of_founded , major_record_format )
# performance ( performance_id , orchestra_id , type , date , official_ratings_(millions) , weekly_rank , share )
# show ( show_id , performance_id , if_first_show , result , attendance )
# orchestra.conductor_id = conductor.conductor_id
# performance.orchestra_id = orchestra.orchestra_id
# show.performance_id = performance.performance_id
|
select name from conductor order by year_of_work desc
|
orchestra
|
What are the names of conductors, sorted descending by the number of years they have worked?
|
# conductor ( conductor_id , name , age , nationality , year_of_work )
# orchestra ( orchestra_id , orchestra , conductor_id , record_company , year_of_founded , major_record_format )
# performance ( performance_id , orchestra_id , type , date , official_ratings_(millions) , weekly_rank , share )
# show ( show_id , performance_id , if_first_show , result , attendance )
# orchestra.conductor_id = conductor.conductor_id
# performance.orchestra_id = orchestra.orchestra_id
# show.performance_id = performance.performance_id
|
select name from conductor order by year_of_work desc
|
orchestra
|
List the name of the conductor with the most years of work.
|
# conductor ( conductor_id , name , age , nationality , year_of_work )
# orchestra ( orchestra_id , orchestra , conductor_id , record_company , year_of_founded , major_record_format )
# performance ( performance_id , orchestra_id , type , date , official_ratings_(millions) , weekly_rank , share )
# show ( show_id , performance_id , if_first_show , result , attendance )
# orchestra.conductor_id = conductor.conductor_id
# performance.orchestra_id = orchestra.orchestra_id
# show.performance_id = performance.performance_id
|
select name from conductor order by year_of_work desc limit 1
|
orchestra
|
What is the name of the conductor who has worked the greatest number of years?
|
# conductor ( conductor_id , name , age , nationality , year_of_work )
# orchestra ( orchestra_id , orchestra , conductor_id , record_company , year_of_founded , major_record_format )
# performance ( performance_id , orchestra_id , type , date , official_ratings_(millions) , weekly_rank , share )
# show ( show_id , performance_id , if_first_show , result , attendance )
# orchestra.conductor_id = conductor.conductor_id
# performance.orchestra_id = orchestra.orchestra_id
# show.performance_id = performance.performance_id
|
select name from conductor order by year_of_work desc limit 1
|
orchestra
|
Show the names of conductors and the orchestras they have conducted.
|
# conductor ( conductor_id , name , age , nationality , year_of_work )
# orchestra ( orchestra_id , orchestra , conductor_id , record_company , year_of_founded , major_record_format )
# performance ( performance_id , orchestra_id , type , date , official_ratings_(millions) , weekly_rank , share )
# show ( show_id , performance_id , if_first_show , result , attendance )
# orchestra.conductor_id = conductor.conductor_id
# performance.orchestra_id = orchestra.orchestra_id
# show.performance_id = performance.performance_id
|
select conductor.name , orchestra.orchestra from conductor join orchestra on conductor.conductor_id = orchestra.conductor_id
|
orchestra
|
What are the names of conductors as well as the corresonding orchestras that they have conducted?
|
# conductor ( conductor_id , name , age , nationality , year_of_work )
# orchestra ( orchestra_id , orchestra , conductor_id , record_company , year_of_founded , major_record_format )
# performance ( performance_id , orchestra_id , type , date , official_ratings_(millions) , weekly_rank , share )
# show ( show_id , performance_id , if_first_show , result , attendance )
# orchestra.conductor_id = conductor.conductor_id
# performance.orchestra_id = orchestra.orchestra_id
# show.performance_id = performance.performance_id
|
select conductor.name , orchestra.orchestra from conductor join orchestra on conductor.conductor_id = orchestra.conductor_id
|
orchestra
|
Show the names of conductors that have conducted more than one orchestras.
|
# conductor ( conductor_id , name , age , nationality , year_of_work )
# orchestra ( orchestra_id , orchestra , conductor_id , record_company , year_of_founded , major_record_format )
# performance ( performance_id , orchestra_id , type , date , official_ratings_(millions) , weekly_rank , share )
# show ( show_id , performance_id , if_first_show , result , attendance )
# orchestra.conductor_id = conductor.conductor_id
# performance.orchestra_id = orchestra.orchestra_id
# show.performance_id = performance.performance_id
|
select conductor.name from conductor join orchestra on conductor.conductor_id = orchestra.conductor_id group by orchestra.conductor_id having count ( * ) > 1
|
orchestra
|
What are the names of conductors who have conducted at more than one orchestra?
|
# conductor ( conductor_id , name , age , nationality , year_of_work )
# orchestra ( orchestra_id , orchestra , conductor_id , record_company , year_of_founded , major_record_format )
# performance ( performance_id , orchestra_id , type , date , official_ratings_(millions) , weekly_rank , share )
# show ( show_id , performance_id , if_first_show , result , attendance )
# orchestra.conductor_id = conductor.conductor_id
# performance.orchestra_id = orchestra.orchestra_id
# show.performance_id = performance.performance_id
|
select conductor.name from conductor join orchestra on conductor.conductor_id = orchestra.conductor_id group by orchestra.conductor_id having count ( * ) > 1
|
orchestra
|
Show the name of the conductor that has conducted the most number of orchestras.
|
# conductor ( conductor_id , name , age , nationality , year_of_work )
# orchestra ( orchestra_id , orchestra , conductor_id , record_company , year_of_founded , major_record_format )
# performance ( performance_id , orchestra_id , type , date , official_ratings_(millions) , weekly_rank , share )
# show ( show_id , performance_id , if_first_show , result , attendance )
# orchestra.conductor_id = conductor.conductor_id
# performance.orchestra_id = orchestra.orchestra_id
# show.performance_id = performance.performance_id
|
select conductor.name from conductor join orchestra on conductor.conductor_id = orchestra.conductor_id group by orchestra.conductor_id order by count ( * ) desc limit 1
|
orchestra
|
What is the name of the conductor who has conducted the most orchestras?
|
# conductor ( conductor_id , name , age , nationality , year_of_work )
# orchestra ( orchestra_id , orchestra , conductor_id , record_company , year_of_founded , major_record_format )
# performance ( performance_id , orchestra_id , type , date , official_ratings_(millions) , weekly_rank , share )
# show ( show_id , performance_id , if_first_show , result , attendance )
# orchestra.conductor_id = conductor.conductor_id
# performance.orchestra_id = orchestra.orchestra_id
# show.performance_id = performance.performance_id
|
select conductor.name from conductor join orchestra on conductor.conductor_id = orchestra.conductor_id group by orchestra.conductor_id order by count ( * ) desc limit 1
|
orchestra
|
Please show the name of the conductor that has conducted orchestras founded after 2008.
|
# conductor ( conductor_id , name , age , nationality , year_of_work )
# orchestra ( orchestra_id , orchestra , conductor_id , record_company , year_of_founded , major_record_format )
# performance ( performance_id , orchestra_id , type , date , official_ratings_(millions) , weekly_rank , share )
# show ( show_id , performance_id , if_first_show , result , attendance )
# orchestra.conductor_id = conductor.conductor_id
# performance.orchestra_id = orchestra.orchestra_id
# show.performance_id = performance.performance_id
|
select conductor.name from conductor join orchestra on conductor.conductor_id = orchestra.conductor_id where year_of_founded > 2008
|
orchestra
|
What are the names of conductors who have conducted orchestras founded after the year 2008?
|
# conductor ( conductor_id , name , age , nationality , year_of_work )
# orchestra ( orchestra_id , orchestra , conductor_id , record_company , year_of_founded , major_record_format )
# performance ( performance_id , orchestra_id , type , date , official_ratings_(millions) , weekly_rank , share )
# show ( show_id , performance_id , if_first_show , result , attendance )
# orchestra.conductor_id = conductor.conductor_id
# performance.orchestra_id = orchestra.orchestra_id
# show.performance_id = performance.performance_id
|
select conductor.name from conductor join orchestra on conductor.conductor_id = orchestra.conductor_id where year_of_founded > 2008
|
orchestra
|
Please show the different record companies and the corresponding number of orchestras.
|
# conductor ( conductor_id , name , age , nationality , year_of_work )
# orchestra ( orchestra_id , orchestra , conductor_id , record_company , year_of_founded , major_record_format )
# performance ( performance_id , orchestra_id , type , date , official_ratings_(millions) , weekly_rank , share )
# show ( show_id , performance_id , if_first_show , result , attendance )
# orchestra.conductor_id = conductor.conductor_id
# performance.orchestra_id = orchestra.orchestra_id
# show.performance_id = performance.performance_id
|
select record_company , count ( * ) from orchestra group by record_company
|
orchestra
|
How many orchestras does each record company manage?
|
# conductor ( conductor_id , name , age , nationality , year_of_work )
# orchestra ( orchestra_id , orchestra , conductor_id , record_company , year_of_founded , major_record_format )
# performance ( performance_id , orchestra_id , type , date , official_ratings_(millions) , weekly_rank , share )
# show ( show_id , performance_id , if_first_show , result , attendance )
# orchestra.conductor_id = conductor.conductor_id
# performance.orchestra_id = orchestra.orchestra_id
# show.performance_id = performance.performance_id
|
select record_company , count ( * ) from orchestra group by record_company
|
orchestra
|
Please show the record formats of orchestras in ascending order of count.
|
# conductor ( conductor_id , name , age , nationality , year_of_work )
# orchestra ( orchestra_id , orchestra , conductor_id , record_company , year_of_founded , major_record_format )
# performance ( performance_id , orchestra_id , type , date , official_ratings_(millions) , weekly_rank , share )
# show ( show_id , performance_id , if_first_show , result , attendance )
# orchestra.conductor_id = conductor.conductor_id
# performance.orchestra_id = orchestra.orchestra_id
# show.performance_id = performance.performance_id
|
select major_record_format from orchestra group by major_record_format order by count ( * ) asc
|
orchestra
|
What are the major record formats of orchestras, sorted by their frequency?
|
# conductor ( conductor_id , name , age , nationality , year_of_work )
# orchestra ( orchestra_id , orchestra , conductor_id , record_company , year_of_founded , major_record_format )
# performance ( performance_id , orchestra_id , type , date , official_ratings_(millions) , weekly_rank , share )
# show ( show_id , performance_id , if_first_show , result , attendance )
# orchestra.conductor_id = conductor.conductor_id
# performance.orchestra_id = orchestra.orchestra_id
# show.performance_id = performance.performance_id
|
select major_record_format from orchestra group by major_record_format order by count ( * ) asc
|
orchestra
|
List the record company shared by the most number of orchestras.
|
# conductor ( conductor_id , name , age , nationality , year_of_work )
# orchestra ( orchestra_id , orchestra , conductor_id , record_company , year_of_founded , major_record_format )
# performance ( performance_id , orchestra_id , type , date , official_ratings_(millions) , weekly_rank , share )
# show ( show_id , performance_id , if_first_show , result , attendance )
# orchestra.conductor_id = conductor.conductor_id
# performance.orchestra_id = orchestra.orchestra_id
# show.performance_id = performance.performance_id
|
select record_company from orchestra group by record_company order by count ( * ) desc limit 1
|
orchestra
|
What is the record company used by the greatest number of orchestras?
|
# conductor ( conductor_id , name , age , nationality , year_of_work )
# orchestra ( orchestra_id , orchestra , conductor_id , record_company , year_of_founded , major_record_format )
# performance ( performance_id , orchestra_id , type , date , official_ratings_(millions) , weekly_rank , share )
# show ( show_id , performance_id , if_first_show , result , attendance )
# orchestra.conductor_id = conductor.conductor_id
# performance.orchestra_id = orchestra.orchestra_id
# show.performance_id = performance.performance_id
|
select record_company from orchestra group by record_company order by count ( * ) desc limit 1
|
orchestra
|
List the names of orchestras that have no performance.
|
# conductor ( conductor_id , name , age , nationality , year_of_work )
# orchestra ( orchestra_id , orchestra , conductor_id , record_company , year_of_founded , major_record_format )
# performance ( performance_id , orchestra_id , type , date , official_ratings_(millions) , weekly_rank , share )
# show ( show_id , performance_id , if_first_show , result , attendance )
# orchestra.conductor_id = conductor.conductor_id
# performance.orchestra_id = orchestra.orchestra_id
# show.performance_id = performance.performance_id
|
select orchestra from orchestra where orchestra_id not in ( select orchestra_id from performance )
|
orchestra
|
What are the orchestras that do not have any performances?
|
# conductor ( conductor_id , name , age , nationality , year_of_work )
# orchestra ( orchestra_id , orchestra , conductor_id , record_company , year_of_founded , major_record_format )
# performance ( performance_id , orchestra_id , type , date , official_ratings_(millions) , weekly_rank , share )
# show ( show_id , performance_id , if_first_show , result , attendance )
# orchestra.conductor_id = conductor.conductor_id
# performance.orchestra_id = orchestra.orchestra_id
# show.performance_id = performance.performance_id
|
select orchestra from orchestra where orchestra_id not in ( select orchestra_id from performance )
|
orchestra
|
Show the record companies shared by orchestras founded before 2003 and after 2003.
|
# conductor ( conductor_id , name , age , nationality , year_of_work )
# orchestra ( orchestra_id , orchestra , conductor_id , record_company , year_of_founded , major_record_format )
# performance ( performance_id , orchestra_id , type , date , official_ratings_(millions) , weekly_rank , share )
# show ( show_id , performance_id , if_first_show , result , attendance )
# orchestra.conductor_id = conductor.conductor_id
# performance.orchestra_id = orchestra.orchestra_id
# show.performance_id = performance.performance_id
|
select record_company from orchestra where year_of_founded < 2003 intersect select record_company from orchestra where year_of_founded > 2003
|
orchestra
|
What are the record companies that are used by both orchestras founded before 2003 and those founded after 2003?
|
# conductor ( conductor_id , name , age , nationality , year_of_work )
# orchestra ( orchestra_id , orchestra , conductor_id , record_company , year_of_founded , major_record_format )
# performance ( performance_id , orchestra_id , type , date , official_ratings_(millions) , weekly_rank , share )
# show ( show_id , performance_id , if_first_show , result , attendance )
# orchestra.conductor_id = conductor.conductor_id
# performance.orchestra_id = orchestra.orchestra_id
# show.performance_id = performance.performance_id
|
select record_company from orchestra where year_of_founded < 2003 intersect select record_company from orchestra where year_of_founded > 2003
|
orchestra
|
Find the number of orchestras whose record format is "CD" or "DVD".
|
# conductor ( conductor_id , name , age , nationality , year_of_work )
# orchestra ( orchestra_id , orchestra , conductor_id , record_company , year_of_founded , major_record_format )
# performance ( performance_id , orchestra_id , type , date , official_ratings_(millions) , weekly_rank , share )
# show ( show_id , performance_id , if_first_show , result , attendance )
# orchestra.conductor_id = conductor.conductor_id
# performance.orchestra_id = orchestra.orchestra_id
# show.performance_id = performance.performance_id
|
select count ( * ) from orchestra where major_record_format = 'CD' or major_record_format = 'DVD'
|
orchestra
|
Count the number of orchestras that have CD or DVD as their record format.
|
# conductor ( conductor_id , name , age , nationality , year_of_work )
# orchestra ( orchestra_id , orchestra , conductor_id , record_company , year_of_founded , major_record_format )
# performance ( performance_id , orchestra_id , type , date , official_ratings_(millions) , weekly_rank , share )
# show ( show_id , performance_id , if_first_show , result , attendance )
# orchestra.conductor_id = conductor.conductor_id
# performance.orchestra_id = orchestra.orchestra_id
# show.performance_id = performance.performance_id
|
select count ( * ) from orchestra where major_record_format = 'CD' or major_record_format = 'DVD'
|
orchestra
|
Show the years in which orchestras that have given more than one performance are founded.
|
# conductor ( conductor_id , name , age , nationality , year_of_work )
# orchestra ( orchestra_id , orchestra , conductor_id , record_company , year_of_founded , major_record_format )
# performance ( performance_id , orchestra_id , type , date , official_ratings_(millions) , weekly_rank , share )
# show ( show_id , performance_id , if_first_show , result , attendance )
# orchestra.conductor_id = conductor.conductor_id
# performance.orchestra_id = orchestra.orchestra_id
# show.performance_id = performance.performance_id
|
select year_of_founded from orchestra join performance on orchestra.orchestra_id = performance.orchestra_id group by performance.orchestra_id having count ( * ) > 1
|
orchestra
|
What are years of founding for orchestras that have had more than a single performance?
|
# conductor ( conductor_id , name , age , nationality , year_of_work )
# orchestra ( orchestra_id , orchestra , conductor_id , record_company , year_of_founded , major_record_format )
# performance ( performance_id , orchestra_id , type , date , official_ratings_(millions) , weekly_rank , share )
# show ( show_id , performance_id , if_first_show , result , attendance )
# orchestra.conductor_id = conductor.conductor_id
# performance.orchestra_id = orchestra.orchestra_id
# show.performance_id = performance.performance_id
|
select year_of_founded from orchestra join performance on orchestra.orchestra_id = performance.orchestra_id group by performance.orchestra_id having count ( * ) > 1
|
network_1
|
How many high schoolers are there?
|
# highschooler ( id , name , grade )
# friend ( student_id , friend_id )
# likes ( student_id , liked_id )
# friend.friend_id = highschooler.id
# friend.student_id = highschooler.id
# likes.student_id = highschooler.id
# likes.liked_id = highschooler.id
|
select count ( * ) from highschooler
|
network_1
|
Count the number of high schoolers.
|
# highschooler ( id , name , grade )
# friend ( student_id , friend_id )
# likes ( student_id , liked_id )
# friend.friend_id = highschooler.id
# friend.student_id = highschooler.id
# likes.student_id = highschooler.id
# likes.liked_id = highschooler.id
|
select count ( * ) from highschooler
|
network_1
|
Show the names and grades of each high schooler.
|
# highschooler ( id , name , grade )
# friend ( student_id , friend_id )
# likes ( student_id , liked_id )
# friend.friend_id = highschooler.id
# friend.student_id = highschooler.id
# likes.student_id = highschooler.id
# likes.liked_id = highschooler.id
|
select name , grade from highschooler
|
network_1
|
What are the names and grades for each high schooler?
|
# highschooler ( id , name , grade )
# friend ( student_id , friend_id )
# likes ( student_id , liked_id )
# friend.friend_id = highschooler.id
# friend.student_id = highschooler.id
# likes.student_id = highschooler.id
# likes.liked_id = highschooler.id
|
select name , grade from highschooler
|
network_1
|
Show all the grades of the high schoolers.
|
# highschooler ( id , name , grade )
# friend ( student_id , friend_id )
# likes ( student_id , liked_id )
# friend.friend_id = highschooler.id
# friend.student_id = highschooler.id
# likes.student_id = highschooler.id
# likes.liked_id = highschooler.id
|
select grade from highschooler
|
network_1
|
What is the grade of each high schooler?
|
# highschooler ( id , name , grade )
# friend ( student_id , friend_id )
# likes ( student_id , liked_id )
# friend.friend_id = highschooler.id
# friend.student_id = highschooler.id
# likes.student_id = highschooler.id
# likes.liked_id = highschooler.id
|
select grade from highschooler
|
network_1
|
What grade is Kyle in?
|
# highschooler ( id , name , grade )
# friend ( student_id , friend_id )
# likes ( student_id , liked_id )
# friend.friend_id = highschooler.id
# friend.student_id = highschooler.id
# likes.student_id = highschooler.id
# likes.liked_id = highschooler.id
|
select grade from highschooler where name = 'Kyle'
|
network_1
|
Return the grade for the high schooler named Kyle.
|
# highschooler ( id , name , grade )
# friend ( student_id , friend_id )
# likes ( student_id , liked_id )
# friend.friend_id = highschooler.id
# friend.student_id = highschooler.id
# likes.student_id = highschooler.id
# likes.liked_id = highschooler.id
|
select grade from highschooler where name = 'Kyle'
|
network_1
|
Show the names of all high schoolers in grade 10.
|
# highschooler ( id , name , grade )
# friend ( student_id , friend_id )
# likes ( student_id , liked_id )
# friend.friend_id = highschooler.id
# friend.student_id = highschooler.id
# likes.student_id = highschooler.id
# likes.liked_id = highschooler.id
|
select name from highschooler where grade = 10
|
network_1
|
What are the names of all high schoolers in grade 10?
|
# highschooler ( id , name , grade )
# friend ( student_id , friend_id )
# likes ( student_id , liked_id )
# friend.friend_id = highschooler.id
# friend.student_id = highschooler.id
# likes.student_id = highschooler.id
# likes.liked_id = highschooler.id
|
select name from highschooler where grade = 10
|
network_1
|
Show the ID of the high schooler named Kyle.
|
# highschooler ( id , name , grade )
# friend ( student_id , friend_id )
# likes ( student_id , liked_id )
# friend.friend_id = highschooler.id
# friend.student_id = highschooler.id
# likes.student_id = highschooler.id
# likes.liked_id = highschooler.id
|
select id from highschooler where name = 'Kyle'
|
network_1
|
What is Kyle's id?
|
# highschooler ( id , name , grade )
# friend ( student_id , friend_id )
# likes ( student_id , liked_id )
# friend.friend_id = highschooler.id
# friend.student_id = highschooler.id
# likes.student_id = highschooler.id
# likes.liked_id = highschooler.id
|
select id from highschooler where name = 'Kyle'
|
network_1
|
How many high schoolers are there in grade 9 or 10?
|
# highschooler ( id , name , grade )
# friend ( student_id , friend_id )
# likes ( student_id , liked_id )
# friend.friend_id = highschooler.id
# friend.student_id = highschooler.id
# likes.student_id = highschooler.id
# likes.liked_id = highschooler.id
|
select count ( * ) from highschooler where grade = 9 or grade = 10
|
network_1
|
Count the number of high schoolers in grades 9 or 10.
|
# highschooler ( id , name , grade )
# friend ( student_id , friend_id )
# likes ( student_id , liked_id )
# friend.friend_id = highschooler.id
# friend.student_id = highschooler.id
# likes.student_id = highschooler.id
# likes.liked_id = highschooler.id
|
select count ( * ) from highschooler where grade = 9 or grade = 10
|
network_1
|
Show the number of high schoolers for each grade.
|
# highschooler ( id , name , grade )
# friend ( student_id , friend_id )
# likes ( student_id , liked_id )
# friend.friend_id = highschooler.id
# friend.student_id = highschooler.id
# likes.student_id = highschooler.id
# likes.liked_id = highschooler.id
|
select grade , count ( * ) from highschooler group by grade
|
network_1
|
How many high schoolers are in each grade?
|
# highschooler ( id , name , grade )
# friend ( student_id , friend_id )
# likes ( student_id , liked_id )
# friend.friend_id = highschooler.id
# friend.student_id = highschooler.id
# likes.student_id = highschooler.id
# likes.liked_id = highschooler.id
|
select grade , count ( * ) from highschooler group by grade
|
network_1
|
Which grade has the most high schoolers?
|
# highschooler ( id , name , grade )
# friend ( student_id , friend_id )
# likes ( student_id , liked_id )
# friend.friend_id = highschooler.id
# friend.student_id = highschooler.id
# likes.student_id = highschooler.id
# likes.liked_id = highschooler.id
|
select grade from highschooler group by grade order by count ( * ) desc limit 1
|
network_1
|
Return the grade that has the greatest number of high schoolers.
|
# highschooler ( id , name , grade )
# friend ( student_id , friend_id )
# likes ( student_id , liked_id )
# friend.friend_id = highschooler.id
# friend.student_id = highschooler.id
# likes.student_id = highschooler.id
# likes.liked_id = highschooler.id
|
select grade from highschooler group by grade order by count ( * ) desc limit 1
|
network_1
|
Show me all grades that have at least 4 students.
|
# highschooler ( id , name , grade )
# friend ( student_id , friend_id )
# likes ( student_id , liked_id )
# friend.friend_id = highschooler.id
# friend.student_id = highschooler.id
# likes.student_id = highschooler.id
# likes.liked_id = highschooler.id
|
select grade from highschooler group by grade having count ( * ) >= 4
|
network_1
|
Which grades have 4 or more high schoolers?
|
# highschooler ( id , name , grade )
# friend ( student_id , friend_id )
# likes ( student_id , liked_id )
# friend.friend_id = highschooler.id
# friend.student_id = highschooler.id
# likes.student_id = highschooler.id
# likes.liked_id = highschooler.id
|
select grade from highschooler group by grade having count ( * ) >= 4
|
network_1
|
Show the student IDs and numbers of friends corresponding to each.
|
# highschooler ( id , name , grade )
# friend ( student_id , friend_id )
# likes ( student_id , liked_id )
# friend.friend_id = highschooler.id
# friend.student_id = highschooler.id
# likes.student_id = highschooler.id
# likes.liked_id = highschooler.id
|
select student_id , count ( * ) from friend group by student_id
|
network_1
|
How many friends does each student have?
|
# highschooler ( id , name , grade )
# friend ( student_id , friend_id )
# likes ( student_id , liked_id )
# friend.friend_id = highschooler.id
# friend.student_id = highschooler.id
# likes.student_id = highschooler.id
# likes.liked_id = highschooler.id
|
select student_id , count ( * ) from friend group by student_id
|
network_1
|
Show the names of high school students and their corresponding number of friends.
|
# highschooler ( id , name , grade )
# friend ( student_id , friend_id )
# likes ( student_id , liked_id )
# friend.friend_id = highschooler.id
# friend.student_id = highschooler.id
# likes.student_id = highschooler.id
# likes.liked_id = highschooler.id
|
select highschooler.name , count ( * ) from friend join highschooler on friend.student_id = highschooler.id group by friend.student_id
|
network_1
|
What are the names of the high schoolers and how many friends does each have?
|
# highschooler ( id , name , grade )
# friend ( student_id , friend_id )
# likes ( student_id , liked_id )
# friend.friend_id = highschooler.id
# friend.student_id = highschooler.id
# likes.student_id = highschooler.id
# likes.liked_id = highschooler.id
|
select highschooler.name , count ( * ) from friend join highschooler on friend.student_id = highschooler.id group by friend.student_id
|
network_1
|
What is the name of the high schooler who has the greatest number of friends?
|
# highschooler ( id , name , grade )
# friend ( student_id , friend_id )
# likes ( student_id , liked_id )
# friend.friend_id = highschooler.id
# friend.student_id = highschooler.id
# likes.student_id = highschooler.id
# likes.liked_id = highschooler.id
|
select highschooler.name from friend join highschooler on friend.student_id = highschooler.id group by friend.student_id order by count ( * ) desc limit 1
|
network_1
|
Return the name of the high school student with the most friends.
|
# highschooler ( id , name , grade )
# friend ( student_id , friend_id )
# likes ( student_id , liked_id )
# friend.friend_id = highschooler.id
# friend.student_id = highschooler.id
# likes.student_id = highschooler.id
# likes.liked_id = highschooler.id
|
select highschooler.name from friend join highschooler on friend.student_id = highschooler.id group by friend.student_id order by count ( * ) desc limit 1
|
network_1
|
Show the names of high schoolers who have at least 3 friends.
|
# highschooler ( id , name , grade )
# friend ( student_id , friend_id )
# likes ( student_id , liked_id )
# friend.friend_id = highschooler.id
# friend.student_id = highschooler.id
# likes.student_id = highschooler.id
# likes.liked_id = highschooler.id
|
select highschooler.name from friend join highschooler on friend.student_id = highschooler.id group by friend.student_id having count ( * ) >= 3
|
network_1
|
What are the names of high schoolers who have 3 or more friends?
|
# highschooler ( id , name , grade )
# friend ( student_id , friend_id )
# likes ( student_id , liked_id )
# friend.friend_id = highschooler.id
# friend.student_id = highschooler.id
# likes.student_id = highschooler.id
# likes.liked_id = highschooler.id
|
select highschooler.name from friend join highschooler on friend.student_id = highschooler.id group by friend.student_id having count ( * ) >= 3
|
network_1
|
Show the names of all of the high schooler Kyle's friends.
|
# highschooler ( id , name , grade )
# friend ( student_id , friend_id )
# likes ( student_id , liked_id )
# friend.friend_id = highschooler.id
# friend.student_id = highschooler.id
# likes.student_id = highschooler.id
# likes.liked_id = highschooler.id
|
select highschooler.name from friend join highschooler on friend.student_id = highschooler.id join highschooler on friend.friend_id = highschooler.id where highschooler.name = 'Kyle'
|
network_1
|
Return the names of friends of the high school student Kyle.
|
# highschooler ( id , name , grade )
# friend ( student_id , friend_id )
# likes ( student_id , liked_id )
# friend.friend_id = highschooler.id
# friend.student_id = highschooler.id
# likes.student_id = highschooler.id
# likes.liked_id = highschooler.id
|
select highschooler.name from friend join highschooler on friend.student_id = highschooler.id join highschooler on friend.friend_id = highschooler.id where highschooler.name = 'Kyle'
|
network_1
|
How many friends does the high school student Kyle have?
|
# highschooler ( id , name , grade )
# friend ( student_id , friend_id )
# likes ( student_id , liked_id )
# friend.friend_id = highschooler.id
# friend.student_id = highschooler.id
# likes.student_id = highschooler.id
# likes.liked_id = highschooler.id
|
select count ( * ) from friend join highschooler on friend.student_id = highschooler.id where highschooler.name = 'Kyle'
|
network_1
|
Count the number of friends Kyle has.
|
# highschooler ( id , name , grade )
# friend ( student_id , friend_id )
# likes ( student_id , liked_id )
# friend.friend_id = highschooler.id
# friend.student_id = highschooler.id
# likes.student_id = highschooler.id
# likes.liked_id = highschooler.id
|
select count ( * ) from friend join highschooler on friend.student_id = highschooler.id where highschooler.name = 'Kyle'
|
network_1
|
Show ids of all students who do not have any friends.
|
# highschooler ( id , name , grade )
# friend ( student_id , friend_id )
# likes ( student_id , liked_id )
# friend.friend_id = highschooler.id
# friend.student_id = highschooler.id
# likes.student_id = highschooler.id
# likes.liked_id = highschooler.id
|
select id from highschooler except select student_id from friend
|
network_1
|
What are the ids of high school students who do not have friends?
|
# highschooler ( id , name , grade )
# friend ( student_id , friend_id )
# likes ( student_id , liked_id )
# friend.friend_id = highschooler.id
# friend.student_id = highschooler.id
# likes.student_id = highschooler.id
# likes.liked_id = highschooler.id
|
select id from highschooler except select student_id from friend
|
network_1
|
Show names of all high school students who do not have any friends.
|
# highschooler ( id , name , grade )
# friend ( student_id , friend_id )
# likes ( student_id , liked_id )
# friend.friend_id = highschooler.id
# friend.student_id = highschooler.id
# likes.student_id = highschooler.id
# likes.liked_id = highschooler.id
|
select name from highschooler except select highschooler.name from friend join highschooler on friend.student_id = highschooler.id
|
network_1
|
What are the names of students who have no friends?
|
# highschooler ( id , name , grade )
# friend ( student_id , friend_id )
# likes ( student_id , liked_id )
# friend.friend_id = highschooler.id
# friend.student_id = highschooler.id
# likes.student_id = highschooler.id
# likes.liked_id = highschooler.id
|
select name from highschooler except select highschooler.name from friend join highschooler on friend.student_id = highschooler.id
|
network_1
|
Show the ids of high schoolers who have friends and are also liked by someone else.
|
# highschooler ( id , name , grade )
# friend ( student_id , friend_id )
# likes ( student_id , liked_id )
# friend.friend_id = highschooler.id
# friend.student_id = highschooler.id
# likes.student_id = highschooler.id
# likes.liked_id = highschooler.id
|
select student_id from friend intersect select liked_id from likes
|
network_1
|
What are the ids of students who both have friends and are liked?
|
# highschooler ( id , name , grade )
# friend ( student_id , friend_id )
# likes ( student_id , liked_id )
# friend.friend_id = highschooler.id
# friend.student_id = highschooler.id
# likes.student_id = highschooler.id
# likes.liked_id = highschooler.id
|
select student_id from friend intersect select liked_id from likes
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.