context
stringlengths
0
489
instruction
stringlengths
16
244
response
stringlengths
38
557
CREATE TABLE CLASS (crs_code VARCHAR); CREATE TABLE department (dept_name VARCHAR, dept_code VARCHAR); CREATE TABLE course (dept_code VARCHAR, crs_code VARCHAR, crs_credit INTEGER)
Find the name of the department that offers the largest number of credits of all classes.
SELECT T3.dept_name FROM course AS T1 JOIN CLASS AS T2 ON T1.crs_code = T2.crs_code JOIN department AS T3 ON T1.dept_code = T3.dept_code GROUP BY T1.dept_code ORDER BY SUM(T1.crs_credit) DESC LIMIT 1
CREATE TABLE student (stu_fname VARCHAR, stu_num VARCHAR); CREATE TABLE CLASS (class_code VARCHAR, crs_code VARCHAR); CREATE TABLE enroll (class_code VARCHAR, stu_num VARCHAR)
What is the first name of each student enrolled in class ACCT-211?
SELECT T3.stu_fname FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN student AS T3 ON T2.stu_num = T3.stu_num WHERE T1.crs_code = 'ACCT-211'
CREATE TABLE CLASS (class_code VARCHAR, crs_code VARCHAR); CREATE TABLE student (stu_fname VARCHAR, stu_num VARCHAR); CREATE TABLE enroll (class_code VARCHAR, stu_num VARCHAR, enroll_grade VARCHAR)
What is the first name of students enrolled in class ACCT-211 and got grade C?
SELECT T3.stu_fname FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN student AS T3 ON T2.stu_num = T3.stu_num WHERE T1.crs_code = 'ACCT-211' AND T2.enroll_grade = 'C'
CREATE TABLE enroll (class_code VARCHAR); CREATE TABLE CLASS (class_code VARCHAR, crs_code VARCHAR)
How many students enrolled in class ACCT-211?
SELECT COUNT(*) FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code WHERE T1.crs_code = 'ACCT-211'
CREATE TABLE table_name_54 (artist VARCHAR, week VARCHAR)
Which Artist has a Week of Top 12?
SELECT artist FROM table_name_54 WHERE week = "top 12"
CREATE TABLE enroll (class_code VARCHAR); CREATE TABLE department (dept_code VARCHAR, dept_name VARCHAR); CREATE TABLE course (crs_code VARCHAR, dept_code VARCHAR); CREATE TABLE CLASS (class_code VARCHAR, crs_code VARCHAR)
How many students are enrolled in the class taught by some professor from the accounting department?
SELECT COUNT(*) FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN course AS T3 ON T1.crs_code = T3.crs_code JOIN department AS T4 ON T3.dept_code = T4.dept_code WHERE T4.dept_name = 'Accounting'
CREATE TABLE enroll (class_code VARCHAR); CREATE TABLE CLASS (class_code VARCHAR, crs_code VARCHAR); CREATE TABLE course (dept_code VARCHAR, crs_code VARCHAR); CREATE TABLE department (dept_name VARCHAR, dept_code VARCHAR)
What is the name of the department that has the largest number of students enrolled?
SELECT T4.dept_name FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN course AS T3 ON T1.crs_code = T3.crs_code JOIN department AS T4 ON T3.dept_code = T4.dept_code GROUP BY T3.dept_code ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE table_name_12 (rank_points VARCHAR, total VARCHAR, shooter VARCHAR)
What is Rank Points, when Total is "17", and when Shooter is "Lalita Yauhleuskaya ( AUS )"?
SELECT rank_points FROM table_name_12 WHERE total = "17" AND shooter = "lalita yauhleuskaya ( aus )"
CREATE TABLE table_21436373_12 (attendance VARCHAR, date_year VARCHAR)
what is the attendance in 2011 records
SELECT attendance FROM table_21436373_12 WHERE date_year = "2011"
CREATE TABLE table_name_37 (place VARCHAR, year VARCHAR, champion VARCHAR)
What is Place, when Year is greater than 2006, and when Champion is "Asvel"?
SELECT place FROM table_name_37 WHERE year > 2006 AND champion = "asvel"
CREATE TABLE student (stu_fname VARCHAR, stu_lname VARCHAR, stu_gpa INTEGER, stu_dob VARCHAR)
What is the first, last name, gpa of the youngest one among students whose GPA is above 3?
SELECT stu_fname, stu_lname, stu_gpa FROM student WHERE stu_gpa > 3 ORDER BY stu_dob DESC LIMIT 1
CREATE TABLE table_21436373_12 (type_of_record VARCHAR, result_games VARCHAR)
how many records had result/games: 10 games (29,606 avg.)
SELECT COUNT(type_of_record) FROM table_21436373_12 WHERE result_games = "10 games (29,606 avg.)"
CREATE TABLE table_21436373_12 (attendance INTEGER, type_of_record VARCHAR)
what is the highest attendance for a total attendance-regular season record
SELECT MAX(attendance) FROM table_21436373_12 WHERE type_of_record = "Total attendance-Regular season"
CREATE TABLE professor (dept_code VARCHAR, prof_high_degree VARCHAR); CREATE TABLE department (dept_name VARCHAR, dept_code VARCHAR)
What is the name of department where has the largest number of professors with a Ph.D. degree?
SELECT T2.dept_name, T1.dept_code FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE T1.prof_high_degree = 'Ph.D.' GROUP BY T1.dept_code ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE employee (emp_fname VARCHAR, emp_jobcode VARCHAR); CREATE TABLE CLASS (prof_num VARCHAR); CREATE TABLE employee (emp_fname VARCHAR, emp_num VARCHAR)
What are the first names of the professors who do not teach a class.
SELECT emp_fname FROM employee WHERE emp_jobcode = 'PROF' EXCEPT SELECT T1.emp_fname FROM employee AS T1 JOIN CLASS AS T2 ON T1.emp_num = T2.prof_num
CREATE TABLE professor (emp_num VARCHAR, dept_code VARCHAR); CREATE TABLE department (dept_code VARCHAR, dept_name VARCHAR); CREATE TABLE CLASS (prof_num VARCHAR); CREATE TABLE employee (emp_fname VARCHAR, emp_num VARCHAR)
What is the first names of the professors from the history department who do not teach a class.
SELECT T1.emp_fname FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T2.dept_code = T3.dept_code WHERE T3.dept_name = 'History' EXCEPT SELECT T4.emp_fname FROM employee AS T4 JOIN CLASS AS T5 ON T4.emp_num = T5.prof_num
CREATE TABLE department (dept_code VARCHAR, dept_name VARCHAR); CREATE TABLE employee (emp_lname VARCHAR, emp_num VARCHAR); CREATE TABLE professor (prof_office VARCHAR, emp_num VARCHAR, dept_code VARCHAR)
What is the last name and office of the professor from the history department?
SELECT T1.emp_lname, T2.prof_office FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T2.dept_code = T3.dept_code WHERE T3.dept_name = 'History'
CREATE TABLE employee (emp_num VARCHAR, emp_lname VARCHAR); CREATE TABLE department (dept_name VARCHAR, dept_code VARCHAR); CREATE TABLE professor (prof_office VARCHAR, emp_num VARCHAR, dept_code VARCHAR)
What is department name and office for the professor whose last name is Heffington?
SELECT T3.dept_name, T2.prof_office FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T2.dept_code = T3.dept_code WHERE T1.emp_lname = 'Heffington'
CREATE TABLE table_name_65 (total INTEGER, bronze VARCHAR, gold VARCHAR)
What is the highest total when bronze is less than 1 and gold more than 0?
SELECT MAX(total) FROM table_name_65 WHERE bronze < 1 AND gold > 0
CREATE TABLE student (stu_num VARCHAR, stu_lname VARCHAR); CREATE TABLE enroll (class_code VARCHAR, stu_num VARCHAR); CREATE TABLE CLASS (crs_code VARCHAR, class_code VARCHAR)
What is the code of the course which the student whose last name is Smithson took?
SELECT T1.crs_code FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN student AS T3 ON T3.stu_num = T2.stu_num WHERE T3.stu_lname = 'Smithson'
CREATE TABLE student (stu_num VARCHAR, stu_lname VARCHAR); CREATE TABLE course (crs_description VARCHAR, crs_credit VARCHAR, crs_code VARCHAR); CREATE TABLE CLASS (class_code VARCHAR, crs_code VARCHAR); CREATE TABLE enroll (class_code VARCHAR, stu_num VARCHAR)
What are the description and credit of the course which the student whose last name is Smithson took?
SELECT T4.crs_description, T4.crs_credit FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN student AS T3 ON T3.stu_num = T2.stu_num JOIN course AS T4 ON T4.crs_code = T1.crs_code WHERE T3.stu_lname = 'Smithson'
CREATE TABLE table_name_4 (rank VARCHAR, nation VARCHAR, bronze VARCHAR)
How many times is the nation china and bronze more than 0?
SELECT COUNT(rank) FROM table_name_4 WHERE nation = "china" AND bronze > 0
CREATE TABLE department (dept_code VARCHAR, dept_name VARCHAR); CREATE TABLE professor (dept_code VARCHAR)
How many professors who are from either Accounting or Biology department?
SELECT COUNT(*) FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE T2.dept_name = 'Accounting' OR T2.dept_name = 'Biology'
CREATE TABLE CLASS (prof_num VARCHAR); CREATE TABLE employee (emp_fname VARCHAR, emp_num VARCHAR)
Find the first name of the professor who is teaching two courses with code CIS-220 and QM-261.
SELECT T1.emp_fname FROM employee AS T1 JOIN CLASS AS T2 ON T1.emp_num = T2.prof_num WHERE crs_code = 'CIS-220' INTERSECT SELECT T1.emp_fname FROM employee AS T1 JOIN CLASS AS T2 ON T1.emp_num = T2.prof_num WHERE crs_code = 'QM-261'
CREATE TABLE CLASS (class_code VARCHAR, crs_code VARCHAR); CREATE TABLE enroll (stu_num VARCHAR, class_code VARCHAR); CREATE TABLE department (dept_code VARCHAR, dept_name VARCHAR); CREATE TABLE course (crs_code VARCHAR, dept_code VARCHAR); CREATE TABLE student (stu_fname VARCHAR, stu_num VARCHAR)
Find the first name of student who is taking classes from accounting and Computer Info. Systems departments
SELECT T1.stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T2.class_code = T3.class_code JOIN course AS T4 ON T3.crs_code = T4.crs_code JOIN department AS T5 ON T5.dept_code = T4.dept_code WHERE T5.dept_name = 'Accounting' INTERSECT SELECT T1.stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T2.class_code = T3.class_code JOIN course AS T4 ON T3.crs_code = T4.crs_code JOIN department AS T5 ON T5.dept_code = T4.dept_code WHERE T5.dept_name = 'Computer Info. Systems'
CREATE TABLE enroll (stu_num VARCHAR, class_code VARCHAR); CREATE TABLE CLASS (class_code VARCHAR, crs_code VARCHAR); CREATE TABLE student (stu_gpa INTEGER, stu_num VARCHAR)
What is the average gpa of the students enrolled in the course with code ACCT-211?
SELECT AVG(T2.stu_gpa) FROM enroll AS T1 JOIN student AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T1.class_code = T3.class_code WHERE T3.crs_code = 'ACCT-211'
CREATE TABLE table_name_61 (byes INTEGER, draws VARCHAR, against VARCHAR, losses VARCHAR)
What is the highest value for Byes, when Against is less than 1794, when Losses is "6", and when Draws is less than 0?
SELECT MAX(byes) FROM table_name_61 WHERE against < 1794 AND losses = 6 AND draws < 0
CREATE TABLE table_name_89 (teams VARCHAR, season VARCHAR)
what is the teams for season 1950-51?
SELECT teams FROM table_name_89 WHERE season = "1950-51"
CREATE TABLE student (stu_fname VARCHAR, stu_gpa INTEGER)
Find the first name and gpa of the students whose gpa is lower than the average gpa of all students.
SELECT stu_fname, stu_gpa FROM student WHERE stu_gpa < (SELECT AVG(stu_gpa) FROM student)
CREATE TABLE student (dept_code VARCHAR); CREATE TABLE department (dept_name VARCHAR, dept_address VARCHAR, dept_code VARCHAR)
Find the name and address of the department that has the highest number of students.
SELECT T2.dept_name, T2.dept_address FROM student AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.dept_code ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE student (dept_code VARCHAR); CREATE TABLE department (dept_name VARCHAR, dept_address VARCHAR, dept_code VARCHAR)
Find the name, address, number of students in the departments that have the top 3 highest number of students.
SELECT T2.dept_name, T2.dept_address, COUNT(*) FROM student AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.dept_code ORDER BY COUNT(*) DESC LIMIT 3
CREATE TABLE department (dept_code VARCHAR, dept_name VARCHAR); CREATE TABLE professor (prof_office VARCHAR, emp_num VARCHAR, dept_code VARCHAR, prof_high_degree VARCHAR); CREATE TABLE employee (emp_fname VARCHAR, emp_num VARCHAR)
Find the first name and office of the professor who is in the history department and has a Ph.D. degree.
SELECT T1.emp_fname, T2.prof_office FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T3.dept_code = T2.dept_code WHERE T3.dept_name = 'History' AND T2.prof_high_degree = 'Ph.D.'
CREATE TABLE table_21436373_6 (type_of_record VARCHAR, result_games VARCHAR)
Which type of record has result/games of b.c. 16 @ edmonton 22?
SELECT type_of_record FROM table_21436373_6 WHERE result_games = "B.C. 16 @ Edmonton 22"
CREATE TABLE course (crs_description VARCHAR, crs_code VARCHAR); CREATE TABLE CLASS (prof_num VARCHAR, crs_code VARCHAR); CREATE TABLE employee (emp_fname VARCHAR, emp_num VARCHAR)
Find the first names of all instructors who have taught some course and the course description.
SELECT T2.emp_fname, T3.crs_description FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN course AS T3 ON T1.crs_code = T3.crs_code
CREATE TABLE professor (prof_office VARCHAR, emp_num VARCHAR); CREATE TABLE course (crs_description VARCHAR, crs_code VARCHAR); CREATE TABLE CLASS (prof_num VARCHAR, crs_code VARCHAR); CREATE TABLE employee (emp_fname VARCHAR, emp_num VARCHAR)
Find the first names and offices of all instructors who have taught some course and also find the course description.
SELECT T2.emp_fname, T4.prof_office, T3.crs_description FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN course AS T3 ON T1.crs_code = T3.crs_code JOIN professor AS T4 ON T2.emp_num = T4.emp_num
CREATE TABLE employee (emp_fname VARCHAR, emp_num VARCHAR); CREATE TABLE department (dept_name VARCHAR, dept_code VARCHAR); CREATE TABLE course (crs_description VARCHAR, crs_code VARCHAR); CREATE TABLE CLASS (prof_num VARCHAR, crs_code VARCHAR); CREATE TABLE professor (prof_office VARCHAR, emp_num VARCHAR, dept_code VARCHAR)
Find the first names and offices of all instructors who have taught some course and the course description and the department name.
SELECT T2.emp_fname, T4.prof_office, T3.crs_description, T5.dept_name FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN course AS T3 ON T1.crs_code = T3.crs_code JOIN professor AS T4 ON T2.emp_num = T4.emp_num JOIN department AS T5 ON T4.dept_code = T5.dept_code
CREATE TABLE enroll (stu_num VARCHAR, class_code VARCHAR); CREATE TABLE course (crs_description VARCHAR, crs_code VARCHAR); CREATE TABLE CLASS (class_code VARCHAR, crs_code VARCHAR); CREATE TABLE student (stu_fname VARCHAR, stu_lname VARCHAR, stu_num VARCHAR)
Find names of all students who took some course and the course description.
SELECT T1.stu_fname, T1.stu_lname, T4.crs_description FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T2.class_code = T3.class_code JOIN course AS T4 ON T3.crs_code = T4.crs_code
CREATE TABLE table_21469545_2 (to_par VARCHAR, date VARCHAR)
Name the to par for 20 feb 2005
SELECT to_par FROM table_21469545_2 WHERE date = "20 Feb 2005"
CREATE TABLE CLASS (class_room VARCHAR, prof_num VARCHAR); CREATE TABLE professor (emp_num VARCHAR, dept_code VARCHAR); CREATE TABLE department (dept_code VARCHAR, dept_name VARCHAR); CREATE TABLE employee (emp_fname VARCHAR, emp_num VARCHAR)
Find the first names of all professors in the Accounting department who is teaching some course and the class room.
SELECT T2.emp_fname, T1.class_room FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN professor AS T3 ON T2.emp_num = T3.emp_num JOIN department AS T4 ON T4.dept_code = T3.dept_code WHERE T4.dept_name = 'Accounting'
CREATE TABLE professor (prof_high_degree VARCHAR, emp_num VARCHAR, dept_code VARCHAR); CREATE TABLE department (dept_code VARCHAR, dept_name VARCHAR); CREATE TABLE employee (emp_fname VARCHAR, emp_num VARCHAR); CREATE TABLE CLASS (prof_num VARCHAR)
Find the first names and degree of all professors who are teaching some class in Computer Info. Systems department.
SELECT DISTINCT T2.emp_fname, T3.prof_high_degree FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN professor AS T3 ON T2.emp_num = T3.emp_num JOIN department AS T4 ON T4.dept_code = T3.dept_code WHERE T4.dept_name = 'Computer Info. Systems'
CREATE TABLE enroll (stu_num VARCHAR, enroll_grade VARCHAR); CREATE TABLE student (stu_fname VARCHAR, stu_lname VARCHAR, stu_num VARCHAR)
Find names of all students who took some course and got A or C.
SELECT T1.stu_fname, T1.stu_lname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num WHERE T2.enroll_grade = 'C' OR T2.enroll_grade = 'A'
CREATE TABLE department (dept_code VARCHAR, dept_name VARCHAR); CREATE TABLE professor (prof_office VARCHAR, emp_num VARCHAR, dept_code VARCHAR, prof_high_degree VARCHAR); CREATE TABLE employee (emp_fname VARCHAR, emp_num VARCHAR)
Find the first name and office of history professor who did not get a Ph.D. degree.
SELECT T2.emp_fname, T1.prof_office FROM professor AS T1 JOIN employee AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T1.dept_code = T3.dept_code WHERE T3.dept_name = 'History' AND T1.prof_high_degree <> 'Ph.D.'
CREATE TABLE employee (emp_fname VARCHAR, emp_num VARCHAR); CREATE TABLE CLASS (prof_num VARCHAR)
Find the first names of professors who are teaching more than one class.
SELECT T2.emp_fname FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num GROUP BY T1.prof_num HAVING COUNT(*) > 1
CREATE TABLE table_21458142_1 (total_copies_sold VARCHAR, release_date VARCHAR)
How many copies were sold of the game released on october 23, 2008?
SELECT total_copies_sold FROM table_21458142_1 WHERE release_date = "October 23, 2008"
CREATE TABLE enroll (stu_num VARCHAR, class_code VARCHAR); CREATE TABLE CLASS (class_code VARCHAR, crs_code VARCHAR); CREATE TABLE student (stu_fname VARCHAR, stu_num VARCHAR, stu_lname VARCHAR)
What is the first name of the student whose last name starting with the letter S and is taking ACCT-211 class?
SELECT T1.stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T2.class_code = T3.class_code WHERE T3.crs_code = 'ACCT-211' AND T1.stu_lname LIKE 'S%'
CREATE TABLE table_name_28 (first_elected VARCHAR, party VARCHAR, district VARCHAR)
What is the total number of First Elected, when Party is "Democratic", and when District is "Tennessee 5"?
SELECT COUNT(first_elected) FROM table_name_28 WHERE party = "democratic" AND district = "tennessee 5"
CREATE TABLE table_2147588_3 (reason_for_change VARCHAR, date_of_successors_formal_installation VARCHAR)
What change caused a change of staff in March 9, 1865?
SELECT reason_for_change FROM table_2147588_3 WHERE date_of_successors_formal_installation = "March 9, 1865"
CREATE TABLE table_2147588_4 (district VARCHAR, successor VARCHAR)
When william b. campbell (u) is the successor what is the district?
SELECT district FROM table_2147588_4 WHERE successor = "William B. Campbell (U)"
CREATE TABLE table_2147588_4 (date_successor_seated VARCHAR, vacator VARCHAR)
When james brooks (d) is the vacator what is the date the successor was seated?
SELECT date_successor_seated FROM table_2147588_4 WHERE vacator = "James Brooks (D)"
CREATE TABLE player (Points INTEGER, Club_ID VARCHAR); CREATE TABLE club (Club_ID VARCHAR, name VARCHAR)
What is the average points of players from club with name "AIB".
SELECT AVG(T2.Points) FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID WHERE T1.name = "AIB"
CREATE TABLE table_name_92 (season VARCHAR, division_two VARCHAR)
Which Season was the Division Two Fownhope Reserves champions?
SELECT season FROM table_name_92 WHERE division_two = "fownhope reserves"
CREATE TABLE table_2150068_1 (launch_date__utc_ VARCHAR, diameter_m_ VARCHAR, usage VARCHAR, mass_kg_ VARCHAR)
What was the launch date for the sattelite with ado that was 4 kg and 3 meters in diameter?
SELECT launch_date__utc_ FROM table_2150068_1 WHERE usage = "ado" AND mass_kg_ = "4" AND diameter_m_ = "3"
CREATE TABLE competition (country VARCHAR, competition_type VARCHAR)
Find the countries that have never participated in any competition with Friendly type.
SELECT country FROM competition EXCEPT SELECT country FROM competition WHERE competition_type = 'Friendly'
CREATE TABLE table_name_17 (place VARCHAR, country VARCHAR, score VARCHAR)
Name the Place which has a Score of 67-71=138, united states?
SELECT place FROM table_name_17 WHERE country = "united states" AND score = 67 - 71 = 138
CREATE TABLE table_21500850_1 (song_title VARCHAR, artist VARCHAR, genre VARCHAR, original_game VARCHAR)
What is every song title for the rock genre and Guitar Hero as original game and the artist is Queens of the Stone Age?
SELECT song_title FROM table_21500850_1 WHERE genre = "Rock" AND original_game = "Guitar Hero" AND artist = "Queens of the Stone Age"
CREATE TABLE furniture (market_rate INTEGER)
find the total market rate of the furnitures that have the top 2 market shares.
SELECT SUM(market_rate) FROM furniture ORDER BY market_rate DESC LIMIT 2
CREATE TABLE furniture_manufacte (Furniture_ID VARCHAR, Price_in_Dollar INTEGER); CREATE TABLE furniture (name VARCHAR, Furniture_ID VARCHAR); CREATE TABLE furniture_manufacte (Price_in_Dollar INTEGER)
Find the names of furnitures whose prices are lower than the highest price.
SELECT t1.name FROM furniture AS t1 JOIN furniture_manufacte AS t2 ON t1.Furniture_ID = t2.Furniture_ID WHERE t2.Price_in_Dollar < (SELECT MAX(Price_in_Dollar) FROM furniture_manufacte)
CREATE TABLE table_name_19 (winner VARCHAR, year VARCHAR)
Who won in 2003?
SELECT winner FROM table_name_19 WHERE year = 2003
CREATE TABLE table_21501564_1 (week__number VARCHAR, original_artist VARCHAR)
What week #(s featured sara bareilles as the original artist?
SELECT week__number FROM table_21501564_1 WHERE original_artist = "Sara Bareilles"
CREATE TABLE manufacturer (manufacturer_id VARCHAR, num_of_shops VARCHAR); CREATE TABLE furniture_manufacte (manufacturer_id VARCHAR, Price_in_Dollar VARCHAR)
Find the id and number of shops for the company that produces the most expensive furniture.
SELECT t1.manufacturer_id, t1.num_of_shops FROM manufacturer AS t1 JOIN furniture_manufacte AS t2 ON t1.manufacturer_id = t2.manufacturer_id ORDER BY t2.Price_in_Dollar DESC LIMIT 1
CREATE TABLE table_21501565_1 (original_artist VARCHAR, order__number VARCHAR, theme VARCHAR)
With order number 7 and the theme is Motown, who were the original artists?
SELECT original_artist FROM table_21501565_1 WHERE order__number = "7" AND theme = "Motown"
CREATE TABLE furniture_manufacte (manufacturer_id VARCHAR); CREATE TABLE manufacturer (name VARCHAR, manufacturer_id VARCHAR)
Find the number of funiture types produced by each manufacturer as well as the company names.
SELECT COUNT(*), t1.name FROM manufacturer AS t1 JOIN furniture_manufacte AS t2 ON t1.manufacturer_id = t2.manufacturer_id GROUP BY t1.manufacturer_id
CREATE TABLE furniture (Market_Rate VARCHAR, name VARCHAR, Furniture_ID VARCHAR); CREATE TABLE furniture_manufacte (Market_Rate VARCHAR, name VARCHAR, Furniture_ID VARCHAR)
Find the market shares and names of furnitures which no any company is producing in our records.
SELECT Market_Rate, name FROM furniture WHERE NOT Furniture_ID IN (SELECT Furniture_ID FROM furniture_manufacte)
CREATE TABLE furniture_manufacte (Furniture_ID VARCHAR, manufacturer_id VARCHAR); CREATE TABLE manufacturer (name VARCHAR, manufacturer_id VARCHAR); CREATE TABLE furniture (Furniture_ID VARCHAR, num_of_component INTEGER)
Find the name of the company that produces both furnitures with less than 6 components and furnitures with more than 10 components.
SELECT t3.name FROM furniture AS t1 JOIN furniture_manufacte AS t2 ON t1.Furniture_ID = t2.Furniture_ID JOIN manufacturer AS t3 ON t2.manufacturer_id = t3.manufacturer_id WHERE t1.num_of_component < 6 INTERSECT SELECT t3.name FROM furniture AS t1 JOIN furniture_manufacte AS t2 ON t1.Furniture_ID = t2.Furniture_ID JOIN manufacturer AS t3 ON t2.manufacturer_id = t3.manufacturer_id WHERE t1.num_of_component > 10
CREATE TABLE table_name_25 (year VARCHAR, displacement_cc VARCHAR, type VARCHAR, engine VARCHAR)
What year was the Grand Prix with an i8 engine and a cc displacement of 1500?
SELECT year FROM table_name_25 WHERE type = "grand prix" AND engine = "i8" AND displacement_cc = "1500"
CREATE TABLE departments (department_name VARCHAR, department_id VARCHAR); CREATE TABLE employees (first_name VARCHAR, department_id VARCHAR)
Display the first name and department name for each employee.
SELECT T1.first_name, T2.department_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id
CREATE TABLE table_name_95 (year_s__won VARCHAR, player VARCHAR, to_par VARCHAR)
What is the total number of years won by Justin Leonard with a to par under 9?
SELECT COUNT(year_s__won) FROM table_name_95 WHERE player = "justin leonard" AND to_par < 9
CREATE TABLE table_name_47 (date__opening_ VARCHAR, opening_film VARCHAR)
What is Date (Opening), when Opening Film is "Another Myanmar, Mae Sot"?
SELECT date__opening_ FROM table_name_47 WHERE opening_film = "another myanmar, mae sot"
CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, salary VARCHAR, commission_pct VARCHAR)
What are the full name (first and last name) and salary for all employees who does not have any value for commission?
SELECT first_name, last_name, salary FROM employees WHERE commission_pct = "null"
CREATE TABLE table_name_38 (earnings_per_share__ VARCHAR, net_profit__us_$m_ VARCHAR, year_to_april VARCHAR)
Name the number of Earnings per share (¢) which has a Net profit (US $m) larger than 66, and a Year to April smaller than 2010?
SELECT COUNT(earnings_per_share__) AS ¢_ FROM table_name_38 WHERE net_profit__us_$m_ > 66 AND year_to_april < 2010
CREATE TABLE table_name_35 (ebit__us_ VARCHAR, revenue__us_$million_ VARCHAR, net_profit__us_$m_ VARCHAR)
COunt the EBIT (US $m) which has a Revenue (US $million) larger than 434.8 and a Net profit (US $m) larger than 96.4?
SELECT COUNT(ebit__us_) AS $m_ FROM table_name_35 WHERE revenue__us_$million_ > 434.8 AND net_profit__us_$m_ > 96.4
CREATE TABLE employees (salary VARCHAR, first_name VARCHAR)
display all the information for all employees who have the letters D or S in their first name and also arrange the result in descending order by salary.
SELECT * FROM employees WHERE first_name LIKE '%D%' OR first_name LIKE '%S%' ORDER BY salary DESC
CREATE TABLE jobs (job_title VARCHAR, max_salary INTEGER, min_salary VARCHAR)
display job Title, the difference between minimum and maximum salaries for those jobs which max salary within the range 12000 to 18000.
SELECT job_title, max_salary - min_salary FROM jobs WHERE max_salary BETWEEN 12000 AND 18000
CREATE TABLE table_name_90 (last_cf INTEGER, cf_wins VARCHAR, cf_appearances VARCHAR, cup_wins VARCHAR)
What is the lowest number of last cfs of the team with 2 cf appearances, 0 cup wins, and less than 0 cf wins?
SELECT MIN(last_cf) FROM table_name_90 WHERE cf_appearances = 2 AND cup_wins = 0 AND cf_wins < 0
CREATE TABLE employees (department_id VARCHAR, commission_pct VARCHAR)
display those departments where more than ten employees work who got a commission percentage.
SELECT department_id FROM employees GROUP BY department_id HAVING COUNT(commission_pct) > 10
CREATE TABLE table_2155836_1 (population__millions VARCHAR, _2011_ VARCHAR, gdp__nominal___billions_usd_ VARCHAR)
What is the population in millions for 2011 where the GDP (nominal) (billions USD) is 4?
SELECT population__millions, _2011_ FROM table_2155836_1 WHERE gdp__nominal___billions_usd_ = "4"
CREATE TABLE countries (country_name VARCHAR, country_id VARCHAR); CREATE TABLE departments (department_id VARCHAR, location_id VARCHAR); CREATE TABLE locations (location_id VARCHAR, country_id VARCHAR); CREATE TABLE employees (employee_id VARCHAR, department_id VARCHAR)
Find employee with ID and name of the country presently where (s)he is working.
SELECT T1.employee_id, T4.country_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id JOIN locations AS T3 ON T2.location_id = T3.location_id JOIN countries AS T4 ON T3.country_id = T4.country_id
CREATE TABLE table_2155836_1 (_per_capita_ VARCHAR, gdp__ppp___usd INTEGER, country VARCHAR)
What is the GDP (PPP) (USD, per capita) for Algeria?
SELECT MIN(gdp__ppp___usd), _per_capita_ FROM table_2155836_1 WHERE country = "Algeria"
CREATE TABLE departments (department_name VARCHAR, department_id VARCHAR); CREATE TABLE employees (department_id VARCHAR)
display the department name and number of employees in each of the department.
SELECT T2.department_name, COUNT(*) FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id GROUP BY T2.department_name
CREATE TABLE table_name_9 (score_points VARCHAR, event VARCHAR, rank_points VARCHAR)
Which Score points has an Event of og beijing, and Rank points of olympic gold medalist?
SELECT score_points FROM table_name_9 WHERE event = "og beijing" AND rank_points = "olympic gold medalist"
CREATE TABLE table_name_42 (rank_points VARCHAR, score_points VARCHAR)
Which Rank points has a Score points of olympic silver medalist?
SELECT rank_points FROM table_name_42 WHERE score_points = "olympic silver medalist"
CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, salary INTEGER, employee_id VARCHAR)
What is the full name ( first name and last name ) for those employees who gets more salary than the employee whose id is 163?
SELECT first_name, last_name FROM employees WHERE salary > (SELECT salary FROM employees WHERE employee_id = 163)
CREATE TABLE table_name_27 (score_points VARCHAR, event VARCHAR, total VARCHAR)
Name Event of wc milan and a Total of 23?
SELECT score_points FROM table_name_27 WHERE event = "wc milan" AND total = "23"
CREATE TABLE employees (employee_id VARCHAR, salary VARCHAR, manager_id VARCHAR, first_name VARCHAR)
display the employee id and salary of all employees who report to Payam (first name).
SELECT employee_id, salary FROM employees WHERE manager_id = (SELECT employee_id FROM employees WHERE first_name = 'Payam')
CREATE TABLE departments (department_name VARCHAR, department_id VARCHAR); CREATE TABLE employees (department_id VARCHAR)
find the name of all departments that do actually have one or more employees assigned to them.
SELECT DISTINCT T2.department_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id
CREATE TABLE departments (department_id VARCHAR, manager_id VARCHAR); CREATE TABLE employees (department_id VARCHAR, employee_id VARCHAR)
get the details of employees who manage a department.
SELECT DISTINCT * FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id WHERE T1.employee_id = T2.manager_id
CREATE TABLE jobs (job_title VARCHAR, job_id VARCHAR); CREATE TABLE employees (employee_id VARCHAR, job_id VARCHAR, department_id VARCHAR)
display the employee ID and job name for all those jobs in department 80.
SELECT T1.employee_id, T2.job_title FROM employees AS T1 JOIN jobs AS T2 ON T1.job_id = T2.job_id WHERE T1.department_id = 80
CREATE TABLE departments (department_id VARCHAR, department_name VARCHAR); CREATE TABLE employees (first_name VARCHAR, job_id VARCHAR, department_id VARCHAR)
What is the first name and job id for all employees in the Finance department?
SELECT T1.first_name, T1.job_id FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id WHERE T2.department_name = 'Finance'
CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, hire_date VARCHAR, department_id VARCHAR)
display the employee name ( first name and last name ) and hire date for all employees in the same department as Clara.
SELECT first_name, last_name, hire_date FROM employees WHERE department_id = (SELECT department_id FROM employees WHERE first_name = "Clara")
CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, hire_date VARCHAR, department_id VARCHAR)
display the employee name ( first name and last name ) and hire date for all employees in the same department as Clara excluding Clara.
SELECT first_name, last_name, hire_date FROM employees WHERE department_id = (SELECT department_id FROM employees WHERE first_name = "Clara") AND first_name <> "Clara"
CREATE TABLE employees (employee_id VARCHAR, first_name VARCHAR, last_name VARCHAR, department_id VARCHAR)
display the employee number and name( first name and last name ) for all employees who work in a department with any employee whose name contains a ’T’.
SELECT employee_id, first_name, last_name FROM employees WHERE department_id IN (SELECT department_id FROM employees WHERE first_name LIKE '%T%')
CREATE TABLE employees (employee_id VARCHAR, first_name VARCHAR, last_name VARCHAR, salary INTEGER, department_id VARCHAR)
display the employee number, name( first name and last name ), and salary for all employees who earn more than the average salary and who work in a department with any employee with a 'J' in their first name.
SELECT employee_id, first_name, last_name, salary FROM employees WHERE salary > (SELECT AVG(salary) FROM employees) AND department_id IN (SELECT department_id FROM employees WHERE first_name LIKE '%J%')
CREATE TABLE employees (employee_id VARCHAR, job_id VARCHAR, salary INTEGER)
display the employee number and job id for all employees whose salary is smaller than any salary of those employees whose job title is MK_MAN.
SELECT employee_id, job_id FROM employees WHERE salary < (SELECT MIN(salary) FROM employees WHERE job_id = 'MK_MAN')
CREATE TABLE table_name_61 (wins INTEGER, played VARCHAR, goals_against VARCHAR, points VARCHAR, goal_difference VARCHAR)
What is the average number of wins for entries with more than 32 points, a goal difference smaller than 23, and a Goals against of 36, and a Played smaller than 30?
SELECT AVG(wins) FROM table_name_61 WHERE points > 32 AND goal_difference < 23 AND goals_against = 36 AND played < 30
CREATE TABLE table_21578303_2 (time VARCHAR, stage VARCHAR)
What is the time when ss12 is stage?
SELECT time FROM table_21578303_2 WHERE stage = "SS12"
CREATE TABLE table_2159506_3 (state__class_ VARCHAR, reason_for_change VARCHAR)
Name the state class for resigned november 3, 1964
SELECT state__class_ FROM table_2159506_3 WHERE reason_for_change = "Resigned November 3, 1964"
CREATE TABLE employees (employee_id VARCHAR, first_name VARCHAR, last_name VARCHAR, job_id VARCHAR, salary INTEGER)
display the employee number, name( first name and last name ) and job title for all employees whose salary is more than any salary of those employees whose job title is PU_MAN.
SELECT employee_id, first_name, last_name, job_id FROM employees WHERE salary > (SELECT MAX(salary) FROM employees WHERE job_id = 'PU_MAN')
CREATE TABLE departments (department_name VARCHAR, department_id VARCHAR, location_id VARCHAR); CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, department_id VARCHAR); CREATE TABLE locations (city VARCHAR, state_province VARCHAR, location_id VARCHAR)
display the first and last name, department, city, and state province for each employee.
SELECT T1.first_name, T1.last_name, T2.department_name, T3.city, T3.state_province FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id JOIN locations AS T3 ON T2.location_id = T3.location_id
CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, salary INTEGER, department_id VARCHAR)
display the department ID, full name (first and last name), salary for those employees who is highest salary in every department.
SELECT first_name, last_name, salary, department_id, MAX(salary) FROM employees GROUP BY department_id
CREATE TABLE locations (city VARCHAR, state_province VARCHAR, location_id VARCHAR); CREATE TABLE departments (department_name VARCHAR, location_id VARCHAR)
display the department name, city, and state province for each department.
SELECT T1.department_name, T2.city, T2.state_province FROM departments AS T1 JOIN locations AS T2 ON T2.location_id = T1.location_id