SQL
stringlengths 18
577
| question
stringlengths 317
11.5k
|
---|---|
SELECT Name FROM ship WHERE Nationality = "United States" OR Nationality = "United Kingdom"
|
Given the Table mission having columns as Mission_ID has datatype number, Ship_ID has datatype number, Code has datatype text, Launched_Year has datatype number, Location has datatype text, Speed_knots has datatype number, Fate has datatype text which has Mission_ID and Given the Table ship having columns as Ship_ID has datatype number, Name has datatype text, Type has datatype text, Nationality has datatype text, Tonnage has datatype number which has Ship_ID. Answer the question by writing the appropriate SQL code. What are the names of the ships that are from either the US or the UK?
|
SELECT Name FROM ship ORDER BY Tonnage DESC LIMIT 1
|
Given the Table mission having columns as Mission_ID has datatype number, Ship_ID has datatype number, Code has datatype text, Launched_Year has datatype number, Location has datatype text, Speed_knots has datatype number, Fate has datatype text which has Mission_ID and Given the Table ship having columns as Ship_ID has datatype number, Name has datatype text, Type has datatype text, Nationality has datatype text, Tonnage has datatype number which has Ship_ID. Answer the question by writing the appropriate SQL code. What is the name of the ship with the largest tonnage?
|
SELECT Name FROM ship ORDER BY Tonnage DESC LIMIT 1
|
Given the Table mission having columns as Mission_ID has datatype number, Ship_ID has datatype number, Code has datatype text, Launched_Year has datatype number, Location has datatype text, Speed_knots has datatype number, Fate has datatype text which has Mission_ID and Given the Table ship having columns as Ship_ID has datatype number, Name has datatype text, Type has datatype text, Nationality has datatype text, Tonnage has datatype number which has Ship_ID. Answer the question by writing the appropriate SQL code. What is the ship with the largest amount of tonnage called?
|
SELECT TYPE , COUNT(*) FROM ship GROUP BY TYPE
|
Given the Table mission having columns as Mission_ID has datatype number, Ship_ID has datatype number, Code has datatype text, Launched_Year has datatype number, Location has datatype text, Speed_knots has datatype number, Fate has datatype text which has Mission_ID and Given the Table ship having columns as Ship_ID has datatype number, Name has datatype text, Type has datatype text, Nationality has datatype text, Tonnage has datatype number which has Ship_ID. Answer the question by writing the appropriate SQL code. Show different types of ships and the number of ships of each type.
|
SELECT TYPE , COUNT(*) FROM ship GROUP BY TYPE
|
Given the Table mission having columns as Mission_ID has datatype number, Ship_ID has datatype number, Code has datatype text, Launched_Year has datatype number, Location has datatype text, Speed_knots has datatype number, Fate has datatype text which has Mission_ID and Given the Table ship having columns as Ship_ID has datatype number, Name has datatype text, Type has datatype text, Nationality has datatype text, Tonnage has datatype number which has Ship_ID. Answer the question by writing the appropriate SQL code. For each type, how many ships are there?
|
SELECT TYPE FROM ship GROUP BY TYPE ORDER BY COUNT(*) DESC LIMIT 1
|
Given the Table mission having columns as Mission_ID has datatype number, Ship_ID has datatype number, Code has datatype text, Launched_Year has datatype number, Location has datatype text, Speed_knots has datatype number, Fate has datatype text which has Mission_ID and Given the Table ship having columns as Ship_ID has datatype number, Name has datatype text, Type has datatype text, Nationality has datatype text, Tonnage has datatype number which has Ship_ID. Answer the question by writing the appropriate SQL code. Please show the most common type of ships.
|
SELECT TYPE FROM ship GROUP BY TYPE ORDER BY COUNT(*) DESC LIMIT 1
|
Given the Table mission having columns as Mission_ID has datatype number, Ship_ID has datatype number, Code has datatype text, Launched_Year has datatype number, Location has datatype text, Speed_knots has datatype number, Fate has datatype text which has Mission_ID and Given the Table ship having columns as Ship_ID has datatype number, Name has datatype text, Type has datatype text, Nationality has datatype text, Tonnage has datatype number which has Ship_ID. Answer the question by writing the appropriate SQL code. What is the most common type of ships?
|
SELECT Nationality FROM ship GROUP BY Nationality HAVING COUNT(*) > 2
|
Given the Table mission having columns as Mission_ID has datatype number, Ship_ID has datatype number, Code has datatype text, Launched_Year has datatype number, Location has datatype text, Speed_knots has datatype number, Fate has datatype text which has Mission_ID and Given the Table ship having columns as Ship_ID has datatype number, Name has datatype text, Type has datatype text, Nationality has datatype text, Tonnage has datatype number which has Ship_ID. Answer the question by writing the appropriate SQL code. List the nations that have more than two ships.
|
SELECT Nationality FROM ship GROUP BY Nationality HAVING COUNT(*) > 2
|
Given the Table mission having columns as Mission_ID has datatype number, Ship_ID has datatype number, Code has datatype text, Launched_Year has datatype number, Location has datatype text, Speed_knots has datatype number, Fate has datatype text which has Mission_ID and Given the Table ship having columns as Ship_ID has datatype number, Name has datatype text, Type has datatype text, Nationality has datatype text, Tonnage has datatype number which has Ship_ID. Answer the question by writing the appropriate SQL code. What are the nations that have more than two ships?
|
SELECT TYPE , avg(Tonnage) FROM ship GROUP BY TYPE
|
Given the Table mission having columns as Mission_ID has datatype number, Ship_ID has datatype number, Code has datatype text, Launched_Year has datatype number, Location has datatype text, Speed_knots has datatype number, Fate has datatype text which has Mission_ID and Given the Table ship having columns as Ship_ID has datatype number, Name has datatype text, Type has datatype text, Nationality has datatype text, Tonnage has datatype number which has Ship_ID. Answer the question by writing the appropriate SQL code. Show different types of ships and the average tonnage of ships of each type.
|
SELECT TYPE , avg(Tonnage) FROM ship GROUP BY TYPE
|
Given the Table mission having columns as Mission_ID has datatype number, Ship_ID has datatype number, Code has datatype text, Launched_Year has datatype number, Location has datatype text, Speed_knots has datatype number, Fate has datatype text which has Mission_ID and Given the Table ship having columns as Ship_ID has datatype number, Name has datatype text, Type has datatype text, Nationality has datatype text, Tonnage has datatype number which has Ship_ID. Answer the question by writing the appropriate SQL code. For each type, what is the average tonnage?
|
SELECT T1.Code , T1.Fate , T2.Name FROM mission AS T1 JOIN ship AS T2 ON T1.Ship_ID = T2.Ship_ID
|
Given the Table mission having columns as Mission_ID has datatype number, Ship_ID has datatype number, Code has datatype text, Launched_Year has datatype number, Location has datatype text, Speed_knots has datatype number, Fate has datatype text which has Mission_ID and Given the Table ship having columns as Ship_ID has datatype number, Name has datatype text, Type has datatype text, Nationality has datatype text, Tonnage has datatype number which has Ship_ID. Answer the question by writing the appropriate SQL code. Show codes and fates of missions, and names of ships involved.
|
SELECT T1.Code , T1.Fate , T2.Name FROM mission AS T1 JOIN ship AS T2 ON T1.Ship_ID = T2.Ship_ID
|
Given the Table mission having columns as Mission_ID has datatype number, Ship_ID has datatype number, Code has datatype text, Launched_Year has datatype number, Location has datatype text, Speed_knots has datatype number, Fate has datatype text which has Mission_ID and Given the Table ship having columns as Ship_ID has datatype number, Name has datatype text, Type has datatype text, Nationality has datatype text, Tonnage has datatype number which has Ship_ID. Answer the question by writing the appropriate SQL code. What are the mission codes, fates, and names of the ships involved?
|
SELECT T2.Name FROM mission AS T1 JOIN ship AS T2 ON T1.Ship_ID = T2.Ship_ID WHERE T1.Launched_Year > 1928
|
Given the Table mission having columns as Mission_ID has datatype number, Ship_ID has datatype number, Code has datatype text, Launched_Year has datatype number, Location has datatype text, Speed_knots has datatype number, Fate has datatype text which has Mission_ID and Given the Table ship having columns as Ship_ID has datatype number, Name has datatype text, Type has datatype text, Nationality has datatype text, Tonnage has datatype number which has Ship_ID. Answer the question by writing the appropriate SQL code. Show names of ships involved in a mission launched after 1928.
|
SELECT T2.Name FROM mission AS T1 JOIN ship AS T2 ON T1.Ship_ID = T2.Ship_ID WHERE T1.Launched_Year > 1928
|
Given the Table mission having columns as Mission_ID has datatype number, Ship_ID has datatype number, Code has datatype text, Launched_Year has datatype number, Location has datatype text, Speed_knots has datatype number, Fate has datatype text which has Mission_ID and Given the Table ship having columns as Ship_ID has datatype number, Name has datatype text, Type has datatype text, Nationality has datatype text, Tonnage has datatype number which has Ship_ID. Answer the question by writing the appropriate SQL code. What are the names of ships that were involved in a mission launched after 1928?
|
SELECT DISTINCT T1.Fate FROM mission AS T1 JOIN ship AS T2 ON T1.Ship_ID = T2.Ship_ID WHERE T2.Nationality = "United States"
|
Given the Table mission having columns as Mission_ID has datatype number, Ship_ID has datatype number, Code has datatype text, Launched_Year has datatype number, Location has datatype text, Speed_knots has datatype number, Fate has datatype text which has Mission_ID and Given the Table ship having columns as Ship_ID has datatype number, Name has datatype text, Type has datatype text, Nationality has datatype text, Tonnage has datatype number which has Ship_ID. Answer the question by writing the appropriate SQL code. Show the distinct fate of missions that involve ships with nationality "United States"
|
SELECT DISTINCT T1.Fate FROM mission AS T1 JOIN ship AS T2 ON T1.Ship_ID = T2.Ship_ID WHERE T2.Nationality = "United States"
|
Given the Table mission having columns as Mission_ID has datatype number, Ship_ID has datatype number, Code has datatype text, Launched_Year has datatype number, Location has datatype text, Speed_knots has datatype number, Fate has datatype text which has Mission_ID and Given the Table ship having columns as Ship_ID has datatype number, Name has datatype text, Type has datatype text, Nationality has datatype text, Tonnage has datatype number which has Ship_ID. Answer the question by writing the appropriate SQL code. What are the different fates of the mission that involved ships from the United States?
|
SELECT Name FROM ship WHERE Ship_ID NOT IN (SELECT Ship_ID FROM mission)
|
Given the Table mission having columns as Mission_ID has datatype number, Ship_ID has datatype number, Code has datatype text, Launched_Year has datatype number, Location has datatype text, Speed_knots has datatype number, Fate has datatype text which has Mission_ID and Given the Table ship having columns as Ship_ID has datatype number, Name has datatype text, Type has datatype text, Nationality has datatype text, Tonnage has datatype number which has Ship_ID. Answer the question by writing the appropriate SQL code. List the name of ships that are not involved in any mission
|
SELECT Name FROM ship WHERE Ship_ID NOT IN (SELECT Ship_ID FROM mission)
|
Given the Table mission having columns as Mission_ID has datatype number, Ship_ID has datatype number, Code has datatype text, Launched_Year has datatype number, Location has datatype text, Speed_knots has datatype number, Fate has datatype text which has Mission_ID and Given the Table ship having columns as Ship_ID has datatype number, Name has datatype text, Type has datatype text, Nationality has datatype text, Tonnage has datatype number which has Ship_ID. Answer the question by writing the appropriate SQL code. What are the names of the ships that are not involved in any missions?
|
SELECT TYPE FROM ship WHERE Tonnage > 6000 INTERSECT SELECT TYPE FROM ship WHERE Tonnage < 4000
|
Given the Table mission having columns as Mission_ID has datatype number, Ship_ID has datatype number, Code has datatype text, Launched_Year has datatype number, Location has datatype text, Speed_knots has datatype number, Fate has datatype text which has Mission_ID and Given the Table ship having columns as Ship_ID has datatype number, Name has datatype text, Type has datatype text, Nationality has datatype text, Tonnage has datatype number which has Ship_ID. Answer the question by writing the appropriate SQL code. Show the types of ships that have both ships with tonnage larger than 6000 and ships with tonnage smaller than 4000.
|
SELECT TYPE FROM ship WHERE Tonnage > 6000 INTERSECT SELECT TYPE FROM ship WHERE Tonnage < 4000
|
Given the Table mission having columns as Mission_ID has datatype number, Ship_ID has datatype number, Code has datatype text, Launched_Year has datatype number, Location has datatype text, Speed_knots has datatype number, Fate has datatype text which has Mission_ID and Given the Table ship having columns as Ship_ID has datatype number, Name has datatype text, Type has datatype text, Nationality has datatype text, Tonnage has datatype number which has Ship_ID. Answer the question by writing the appropriate SQL code. What are the types of the ships that have both shiips with tonnage more than 6000 and those with tonnage less than 4000?
|
SELECT count(*) FROM list
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Find the number of students in total.
|
SELECT count(*) FROM list
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. How many students are there?
|
SELECT lastname FROM list WHERE classroom = 111
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Find the last names of students studying in room 111.
|
SELECT lastname FROM list WHERE classroom = 111
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. What are the last names of students in room 111?
|
SELECT firstname FROM list WHERE classroom = 108
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Find the first names of students studying in room 108.
|
SELECT firstname FROM list WHERE classroom = 108
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. What are the first names of students in room 108?
|
SELECT DISTINCT firstname FROM list WHERE classroom = 107
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. What are the first names of students studying in room 107?
|
SELECT DISTINCT firstname FROM list WHERE classroom = 107
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. List the first names of all the students in room 107.
|
SELECT DISTINCT classroom , grade FROM list
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. For each classroom report the grade that is taught in it. Report just the classroom number and the grade number.
|
SELECT DISTINCT classroom , grade FROM list
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. What are the grade number and classroom number of each class in the list?
|
SELECT DISTINCT grade FROM list WHERE classroom = 103
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Which grade is studying in classroom 103?
|
SELECT DISTINCT grade FROM list WHERE classroom = 103
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Find the grade taught in classroom 103.
|
SELECT DISTINCT grade FROM list WHERE classroom = 105
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Find the grade studying in room 105.
|
SELECT DISTINCT grade FROM list WHERE classroom = 105
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Which grade is studying in room 105?
|
SELECT DISTINCT classroom FROM list WHERE grade = 4
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Which classrooms are used by grade 4?
|
SELECT DISTINCT classroom FROM list WHERE grade = 4
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Find the classrooms in which grade 4 is studying.
|
SELECT DISTINCT classroom FROM list WHERE grade = 5
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Which classrooms are used by grade 5?
|
SELECT DISTINCT classroom FROM list WHERE grade = 5
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Show me the classrooms grade 5 is using.
|
SELECT DISTINCT T2.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE grade = 5
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Find the last names of the teachers that teach fifth grade.
|
SELECT DISTINCT T2.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE grade = 5
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. what are the last names of the teachers who teach grade 5?
|
SELECT DISTINCT T2.firstname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE grade = 1
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Find the first names of the teachers that teach first grade.
|
SELECT DISTINCT T2.firstname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE grade = 1
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. What are the first names of the teachers who teach grade 1?
|
SELECT firstname FROM teachers WHERE classroom = 110
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Find the first names of all the teachers that teach in classroom 110.
|
SELECT firstname FROM teachers WHERE classroom = 110
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Which teachers teach in classroom 110? Give me their first names.
|
SELECT lastname FROM teachers WHERE classroom = 109
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Find the last names of teachers teaching in classroom 109.
|
SELECT lastname FROM teachers WHERE classroom = 109
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Which teachers teach in classroom 109? Give me their last names.
|
SELECT DISTINCT firstname , lastname FROM teachers
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Report the first name and last name of all the teachers.
|
SELECT DISTINCT firstname , lastname FROM teachers
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. What are the first name and last name of all the teachers?
|
SELECT DISTINCT firstname , lastname FROM list
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Report the first name and last name of all the students.
|
SELECT DISTINCT firstname , lastname FROM list
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Show each student's first name and last name.
|
SELECT T1.firstname , T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = "OTHA" AND T2.lastname = "MOYER"
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Find all students taught by OTHA MOYER. Output the first and last names of the students.
|
SELECT T1.firstname , T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = "OTHA" AND T2.lastname = "MOYER"
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Which students study under the teacher named OTHA MOYER? Give me the first and last names of the students.
|
SELECT T1.firstname , T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = "MARROTTE" AND T2.lastname = "KIRK"
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Find all students taught by MARROTTE KIRK. Output first and last names of students.
|
SELECT T1.firstname , T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = "MARROTTE" AND T2.lastname = "KIRK"
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Which are the first and last names of the students taught by MARROTTE KIRK?
|
SELECT T2.firstname , T2.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.firstname = "EVELINA" AND T1.lastname = "BROMLEY"
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Find the first and last name of all the teachers that teach EVELINA BROMLEY.
|
SELECT T2.firstname , T2.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.firstname = "EVELINA" AND T1.lastname = "BROMLEY"
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Which teachers teach the student named EVELINA BROMLEY? Give me the first and last name of the teachers.
|
SELECT T2.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.firstname = "GELL" AND T1.lastname = "TAMI"
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Find the last names of all the teachers that teach GELL TAMI.
|
SELECT T2.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.firstname = "GELL" AND T1.lastname = "TAMI"
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. What are the last names of the teachers who teach the student called GELL TAMI?
|
SELECT count(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = "LORIA" AND T2.lastname = "ONDERSMA"
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. How many students does LORIA ONDERSMA teaches?
|
SELECT count(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = "LORIA" AND T2.lastname = "ONDERSMA"
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Count the number of students the teacher LORIA ONDERSMA teaches.
|
SELECT count(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = "KAWA" AND T2.lastname = "GORDON"
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. How many students does KAWA GORDON teaches?
|
SELECT count(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = "KAWA" AND T2.lastname = "GORDON"
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Find the number of students taught by the teacher KAWA GORDON.
|
SELECT count(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = "TARRING" AND T2.lastname = "LEIA"
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Find the number of students taught by TARRING LEIA.
|
SELECT count(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = "TARRING" AND T2.lastname = "LEIA"
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. How many students are taught by teacher TARRING LEIA?
|
SELECT count(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.firstname = "CHRISSY" AND T1.lastname = "NABOZNY"
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. How many teachers does the student named CHRISSY NABOZNY have?
|
SELECT count(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.firstname = "CHRISSY" AND T1.lastname = "NABOZNY"
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Find the number of teachers who teach the student called CHRISSY NABOZNY.
|
SELECT count(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.firstname = "MADLOCK" AND T1.lastname = "RAY"
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. How many teachers does the student named MADLOCK RAY have?
|
SELECT count(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.firstname = "MADLOCK" AND T1.lastname = "RAY"
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Find the number of teachers who teach the student called MADLOCK RAY.
|
SELECT DISTINCT T1.firstname , T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.grade = 1 EXCEPT SELECT T1.firstname , T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = "OTHA" AND T2.lastname = "MOYER"
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Find all first-grade students who are NOT taught by OTHA MOYER. Report their first and last names.
|
SELECT DISTINCT T1.firstname , T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.grade = 1 EXCEPT SELECT T1.firstname , T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = "OTHA" AND T2.lastname = "MOYER"
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. What are the first and last names of the first-grade students who are NOT taught by teacher OTHA MOYER?
|
SELECT DISTINCT T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.grade = 3 AND T2.firstname != "COVIN" AND T2.lastname != "JEROME"
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Find the last names of the students in third grade that are not taught by COVIN JEROME.
|
SELECT DISTINCT T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.grade = 3 AND T2.firstname != "COVIN" AND T2.lastname != "JEROME"
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Which students in third grade are not taught by teacher COVIN JEROME? Give me the last names of the students.
|
SELECT grade , count(DISTINCT classroom) , count(*) FROM list GROUP BY grade
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. For each grade, report the grade, the number of classrooms in which it is taught and the total number of students in the grade.
|
SELECT grade , count(DISTINCT classroom) , count(*) FROM list GROUP BY grade
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. For each grade, return the grade number, the number of classrooms used for the grade, and the total number of students enrolled in the grade.
|
SELECT classroom , count(DISTINCT grade) FROM list GROUP BY classroom
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. For each classroom, report the classroom number and the number of grades using it.
|
SELECT classroom , count(DISTINCT grade) FROM list GROUP BY classroom
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. For each classroom, show the classroom number and count the number of distinct grades that use the room.
|
SELECT classroom FROM list GROUP BY classroom ORDER BY count(*) DESC LIMIT 1
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Which classroom has the most students?
|
SELECT classroom FROM list GROUP BY classroom ORDER BY count(*) DESC LIMIT 1
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Find the classroom that the most students use.
|
SELECT classroom , count(*) FROM list GROUP BY classroom
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Report the number of students in each classroom.
|
SELECT classroom , count(*) FROM list GROUP BY classroom
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. For each classroom, show the classroom number and find how many students are using it.
|
SELECT classroom , count(*) FROM list WHERE grade = "0" GROUP BY classroom
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. For each grade 0 classroom, report the total number of students.
|
SELECT classroom , count(*) FROM list WHERE grade = "0" GROUP BY classroom
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. For each grade 0 classroom, return the classroom number and the count of students.
|
SELECT classroom , count(*) FROM list WHERE grade = "4" GROUP BY classroom
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Report the total number of students for each fourth-grade classroom.
|
SELECT classroom , count(*) FROM list WHERE grade = "4" GROUP BY classroom
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. For each fourth-grade classroom, show the classroom number and the total number of students using it.
|
SELECT T2.firstname , T2.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom GROUP BY T2.firstname , T2.lastname ORDER BY count(*) DESC LIMIT 1
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Find the name of the teacher who teaches the largest number of students.
|
SELECT T2.firstname , T2.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom GROUP BY T2.firstname , T2.lastname ORDER BY count(*) DESC LIMIT 1
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Which teacher teaches the most students? Give me the first name and last name of the teacher.
|
SELECT count(*) , classroom FROM list GROUP BY classroom
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. Find the number of students in one classroom.
|
SELECT count(*) , classroom FROM list GROUP BY classroom
|
Given the Table list having columns as LastName has datatype text, FirstName has datatype text, Grade has datatype number, Classroom has datatype number which has LastName and Given the Table teachers having columns as LastName has datatype text, FirstName has datatype text, Classroom has datatype number which has LastName. Answer the question by writing the appropriate SQL code. How many students does one classroom have?
|
SELECT count(*) FROM company WHERE Headquarters = 'USA'
|
Given the Table people having columns as People_ID has datatype number, Age has datatype number, Name has datatype text, Nationality has datatype text, Graduation_College has datatype text which has People_ID and Given the Table company having columns as Company_ID has datatype number, Name has datatype text, Headquarters has datatype text, Industry has datatype text, Sales_in_Billion has datatype number, Profits_in_Billion has datatype number, Assets_in_Billion has datatype number, Market_Value_in_Billion has datatype number which has Company_ID and Given the Table employment having columns as Company_ID has datatype number, People_ID has datatype number, Year_working has datatype number which has Company_ID. Answer the question by writing the appropriate SQL code. How many companies are headquartered in the US?
|
SELECT Name FROM company ORDER BY Sales_in_Billion ASC
|
Given the Table people having columns as People_ID has datatype number, Age has datatype number, Name has datatype text, Nationality has datatype text, Graduation_College has datatype text which has People_ID and Given the Table company having columns as Company_ID has datatype number, Name has datatype text, Headquarters has datatype text, Industry has datatype text, Sales_in_Billion has datatype number, Profits_in_Billion has datatype number, Assets_in_Billion has datatype number, Market_Value_in_Billion has datatype number which has Company_ID and Given the Table employment having columns as Company_ID has datatype number, People_ID has datatype number, Year_working has datatype number which has Company_ID. Answer the question by writing the appropriate SQL code. List the names of companies by ascending number of sales.
|
SELECT Headquarters , Industry FROM company
|
Given the Table people having columns as People_ID has datatype number, Age has datatype number, Name has datatype text, Nationality has datatype text, Graduation_College has datatype text which has People_ID and Given the Table company having columns as Company_ID has datatype number, Name has datatype text, Headquarters has datatype text, Industry has datatype text, Sales_in_Billion has datatype number, Profits_in_Billion has datatype number, Assets_in_Billion has datatype number, Market_Value_in_Billion has datatype number which has Company_ID and Given the Table employment having columns as Company_ID has datatype number, People_ID has datatype number, Year_working has datatype number which has Company_ID. Answer the question by writing the appropriate SQL code. What are the headquarters and industries of all companies?
|
SELECT Name FROM company WHERE Industry = "Banking" OR Industry = "Retailing"
|
Given the Table people having columns as People_ID has datatype number, Age has datatype number, Name has datatype text, Nationality has datatype text, Graduation_College has datatype text which has People_ID and Given the Table company having columns as Company_ID has datatype number, Name has datatype text, Headquarters has datatype text, Industry has datatype text, Sales_in_Billion has datatype number, Profits_in_Billion has datatype number, Assets_in_Billion has datatype number, Market_Value_in_Billion has datatype number which has Company_ID and Given the Table employment having columns as Company_ID has datatype number, People_ID has datatype number, Year_working has datatype number which has Company_ID. Answer the question by writing the appropriate SQL code. Show the names of companies in the banking or retailing industry?
|
SELECT max(Market_Value_in_Billion) , min(Market_Value_in_Billion) FROM company
|
Given the Table people having columns as People_ID has datatype number, Age has datatype number, Name has datatype text, Nationality has datatype text, Graduation_College has datatype text which has People_ID and Given the Table company having columns as Company_ID has datatype number, Name has datatype text, Headquarters has datatype text, Industry has datatype text, Sales_in_Billion has datatype number, Profits_in_Billion has datatype number, Assets_in_Billion has datatype number, Market_Value_in_Billion has datatype number which has Company_ID and Given the Table employment having columns as Company_ID has datatype number, People_ID has datatype number, Year_working has datatype number which has Company_ID. Answer the question by writing the appropriate SQL code. What is the maximum and minimum market value of companies?
|
SELECT Headquarters FROM company ORDER BY Sales_in_Billion DESC LIMIT 1
|
Given the Table people having columns as People_ID has datatype number, Age has datatype number, Name has datatype text, Nationality has datatype text, Graduation_College has datatype text which has People_ID and Given the Table company having columns as Company_ID has datatype number, Name has datatype text, Headquarters has datatype text, Industry has datatype text, Sales_in_Billion has datatype number, Profits_in_Billion has datatype number, Assets_in_Billion has datatype number, Market_Value_in_Billion has datatype number which has Company_ID and Given the Table employment having columns as Company_ID has datatype number, People_ID has datatype number, Year_working has datatype number which has Company_ID. Answer the question by writing the appropriate SQL code. What is the headquarter of the company with the largest sales?
|
SELECT Headquarters , COUNT(*) FROM company GROUP BY Headquarters
|
Given the Table people having columns as People_ID has datatype number, Age has datatype number, Name has datatype text, Nationality has datatype text, Graduation_College has datatype text which has People_ID and Given the Table company having columns as Company_ID has datatype number, Name has datatype text, Headquarters has datatype text, Industry has datatype text, Sales_in_Billion has datatype number, Profits_in_Billion has datatype number, Assets_in_Billion has datatype number, Market_Value_in_Billion has datatype number which has Company_ID and Given the Table employment having columns as Company_ID has datatype number, People_ID has datatype number, Year_working has datatype number which has Company_ID. Answer the question by writing the appropriate SQL code. Show the different headquarters and number of companies at each headquarter.
|
SELECT Headquarters FROM company GROUP BY Headquarters ORDER BY COUNT(*) DESC LIMIT 1
|
Given the Table people having columns as People_ID has datatype number, Age has datatype number, Name has datatype text, Nationality has datatype text, Graduation_College has datatype text which has People_ID and Given the Table company having columns as Company_ID has datatype number, Name has datatype text, Headquarters has datatype text, Industry has datatype text, Sales_in_Billion has datatype number, Profits_in_Billion has datatype number, Assets_in_Billion has datatype number, Market_Value_in_Billion has datatype number which has Company_ID and Given the Table employment having columns as Company_ID has datatype number, People_ID has datatype number, Year_working has datatype number which has Company_ID. Answer the question by writing the appropriate SQL code. Show the most common headquarter for companies.
|
SELECT Headquarters FROM company GROUP BY Headquarters HAVING COUNT(*) >= 2
|
Given the Table people having columns as People_ID has datatype number, Age has datatype number, Name has datatype text, Nationality has datatype text, Graduation_College has datatype text which has People_ID and Given the Table company having columns as Company_ID has datatype number, Name has datatype text, Headquarters has datatype text, Industry has datatype text, Sales_in_Billion has datatype number, Profits_in_Billion has datatype number, Assets_in_Billion has datatype number, Market_Value_in_Billion has datatype number which has Company_ID and Given the Table employment having columns as Company_ID has datatype number, People_ID has datatype number, Year_working has datatype number which has Company_ID. Answer the question by writing the appropriate SQL code. Show the headquarters that have at least two companies.
|
SELECT Headquarters FROM company WHERE Industry = "Banking" INTERSECT SELECT Headquarters FROM company WHERE Industry = "Oil and gas"
|
Given the Table people having columns as People_ID has datatype number, Age has datatype number, Name has datatype text, Nationality has datatype text, Graduation_College has datatype text which has People_ID and Given the Table company having columns as Company_ID has datatype number, Name has datatype text, Headquarters has datatype text, Industry has datatype text, Sales_in_Billion has datatype number, Profits_in_Billion has datatype number, Assets_in_Billion has datatype number, Market_Value_in_Billion has datatype number which has Company_ID and Given the Table employment having columns as Company_ID has datatype number, People_ID has datatype number, Year_working has datatype number which has Company_ID. Answer the question by writing the appropriate SQL code. Show the headquarters that have both companies in banking industry and companies in oil and gas industry.
|
SELECT T3.Name , T2.Name FROM employment AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID JOIN company AS T3 ON T1.Company_ID = T3.Company_ID
|
Given the Table people having columns as People_ID has datatype number, Age has datatype number, Name has datatype text, Nationality has datatype text, Graduation_College has datatype text which has People_ID and Given the Table company having columns as Company_ID has datatype number, Name has datatype text, Headquarters has datatype text, Industry has datatype text, Sales_in_Billion has datatype number, Profits_in_Billion has datatype number, Assets_in_Billion has datatype number, Market_Value_in_Billion has datatype number which has Company_ID and Given the Table employment having columns as Company_ID has datatype number, People_ID has datatype number, Year_working has datatype number which has Company_ID. Answer the question by writing the appropriate SQL code. Show the names of companies and of employees.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.