Datasets:
context
stringlengths 27
489
| answer
stringlengths 18
557
| question
stringlengths 12
280
|
---|---|---|
CREATE TABLE head (age INTEGER) | SELECT COUNT(*) FROM head WHERE age > 56 | Berapa banyak kepala departemen yang lebih tua dari 56? |
CREATE TABLE head (name VARCHAR, born_state VARCHAR, age VARCHAR) | SELECT name, born_state, age FROM head ORDER BY age | Sebutkan nama, lahir negara bagian dan usia kepala departemen yang dipesan berdasarkan usia. |
CREATE TABLE department (creation VARCHAR, name VARCHAR, budget_in_billions VARCHAR) | SELECT creation, name, budget_in_billions FROM department | Sebutkan tahun penciptaan, nama dan anggaran masing -masing departemen. |
CREATE TABLE department (budget_in_billions INTEGER) | SELECT MAX(budget_in_billions), MIN(budget_in_billions) FROM department | Berapa anggaran maksimum dan minimum departemen? |
CREATE TABLE department (num_employees INTEGER, ranking INTEGER) | SELECT AVG(num_employees) FROM department WHERE ranking BETWEEN 10 AND 15 | Berapa jumlah rata -rata karyawan departemen yang peringkatnya antara 10 dan 15? |
CREATE TABLE head (name VARCHAR, born_state VARCHAR) | SELECT name FROM head WHERE born_state <> 'California' | Apa nama kepala yang dilahirkan di luar negara bagian California? |
CREATE TABLE department (creation VARCHAR, department_id VARCHAR); CREATE TABLE management (department_id VARCHAR, head_id VARCHAR); CREATE TABLE head (head_id VARCHAR, born_state VARCHAR) | SELECT DISTINCT T1.creation FROM department AS T1 JOIN management AS T2 ON T1.department_id = T2.department_id JOIN head AS T3 ON T2.head_id = T3.head_id WHERE T3.born_state = 'Alabama' | Apa tahun penciptaan yang berbeda dari departemen yang dikelola oleh sekretaris yang lahir di negara bagian 'Alabama'? |
CREATE TABLE head (born_state VARCHAR) | SELECT born_state FROM head GROUP BY born_state HAVING COUNT(*) >= 3 | Apa nama negara bagian di mana setidaknya 3 kepala lahir? |
CREATE TABLE department (creation VARCHAR) | SELECT creation FROM department GROUP BY creation ORDER BY COUNT(*) DESC LIMIT 1 | Di tahun mana sebagian besar departemen didirikan? |
CREATE TABLE management (department_id VARCHAR, temporary_acting VARCHAR); CREATE TABLE department (name VARCHAR, num_employees VARCHAR, department_id VARCHAR) | SELECT T1.name, T1.num_employees FROM department AS T1 JOIN management AS T2 ON T1.department_id = T2.department_id WHERE T2.temporary_acting = 'Yes' | Tunjukkan nama dan jumlah karyawan untuk departemen yang dikelola oleh kepala yang nilai akting sementara yang 'ya'? |
CREATE TABLE management (temporary_acting VARCHAR) | SELECT COUNT(DISTINCT temporary_acting) FROM management | Ada berapa status akting? |
CREATE TABLE management (department_id VARCHAR); CREATE TABLE department (department_id VARCHAR) | SELECT COUNT(*) FROM department WHERE NOT department_id IN (SELECT department_id FROM management) | Berapa banyak departemen yang dipimpin oleh kepala yang tidak disebutkan? |
CREATE TABLE head (age VARCHAR, head_id VARCHAR); CREATE TABLE management (head_id VARCHAR, temporary_acting VARCHAR) | SELECT DISTINCT T1.age FROM management AS T2 JOIN head AS T1 ON T1.head_id = T2.head_id WHERE T2.temporary_acting = 'Yes' | Berapa usia yang berbeda dari kepala yang bertindak? |
CREATE TABLE management (department_id VARCHAR, head_id VARCHAR); CREATE TABLE head (born_state VARCHAR, head_id VARCHAR); CREATE TABLE department (department_id VARCHAR, name VARCHAR) | SELECT T3.born_state FROM department AS T1 JOIN management AS T2 ON T1.department_id = T2.department_id JOIN head AS T3 ON T2.head_id = T3.head_id WHERE T1.name = 'Treasury' INTERSECT SELECT T3.born_state FROM department AS T1 JOIN management AS T2 ON T1.department_id = T2.department_id JOIN head AS T3 ON T2.head_id = T3.head_id WHERE T1.name = 'Homeland Security' | Sebutkan negara bagian di mana Sekretaris Departemen 'Treasury' dan Sekretaris 'Keamanan Dalam Negeri' lahir. |
CREATE TABLE management (department_id VARCHAR); CREATE TABLE department (department_id VARCHAR, name VARCHAR) | SELECT T1.department_id, T1.name, COUNT(*) FROM management AS T2 JOIN department AS T1 ON T1.department_id = T2.department_id GROUP BY T1.department_id HAVING COUNT(*) > 1 | Departemen mana yang memiliki lebih dari 1 kepala sekaligus?Sebutkan ID, nama, dan jumlah kepala. |
CREATE TABLE head (head_id VARCHAR, name VARCHAR) | SELECT head_id, name FROM head WHERE name LIKE '%Ha%' | Nama kepala mana yang memiliki 'ha' substring?Sebutkan ID dan nama. |
CREATE TABLE farm (Id VARCHAR) | SELECT COUNT(*) FROM farm | Ada berapa peternakan? |
CREATE TABLE farm (Total_Horses VARCHAR) | SELECT Total_Horses FROM farm ORDER BY Total_Horses | Sebutkan jumlah total kuda di peternakan dalam urutan naik. |
CREATE TABLE farm_competition (Hosts VARCHAR, Theme VARCHAR) | SELECT Hosts FROM farm_competition WHERE Theme <> 'Aliens' | Apa tuan rumah kompetisi yang temanya bukan "alien"? |
CREATE TABLE farm_competition (Theme VARCHAR, YEAR VARCHAR) | SELECT Theme FROM farm_competition ORDER BY YEAR | Apa tema kompetisi pertanian yang diurutkan berdasarkan tahun dalam urutan naik? |
CREATE TABLE farm (Working_Horses INTEGER, Total_Horses INTEGER) | SELECT AVG(Working_Horses) FROM farm WHERE Total_Horses > 5000 | Berapa jumlah rata -rata kuda yang bekerja di peternakan dengan lebih dari 5.000 jumlah kuda? |
CREATE TABLE farm (Cows INTEGER) | SELECT MAX(Cows), MIN(Cows) FROM farm | Berapa jumlah sapi maksimum dan minimum di semua peternakan. |
CREATE TABLE city (Status VARCHAR) | SELECT COUNT(DISTINCT Status) FROM city | Berapa banyak status berbeda yang dimiliki kota? |
CREATE TABLE city (Official_Name VARCHAR, Population VARCHAR) | SELECT Official_Name FROM city ORDER BY Population DESC | Daftar nama resmi kota dalam urutan populasi yang menurun. |
CREATE TABLE city (Official_Name VARCHAR, Status VARCHAR, Population VARCHAR) | SELECT Official_Name, Status FROM city ORDER BY Population DESC LIMIT 1 | Sebutkan nama dan status resmi kota dengan populasi terbesar. |
CREATE TABLE city (Official_Name VARCHAR, City_ID VARCHAR); CREATE TABLE farm_competition (Year VARCHAR, Host_city_ID VARCHAR) | SELECT T2.Year, T1.Official_Name FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID | Tunjukkan tahun -tahun dan nama -nama resmi dari kota -kota tuan rumah kompetisi. |
CREATE TABLE farm_competition (Host_city_ID VARCHAR); CREATE TABLE city (Official_Name VARCHAR, City_ID VARCHAR) | SELECT T1.Official_Name FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID GROUP BY T2.Host_city_ID HAVING COUNT(*) > 1 | Tunjukkan nama -nama resmi kota -kota yang telah menjadi tuan rumah lebih dari satu kompetisi. |
CREATE TABLE city (Status VARCHAR, City_ID VARCHAR); CREATE TABLE farm_competition (Host_city_ID VARCHAR) | SELECT T1.Status FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID GROUP BY T2.Host_city_ID ORDER BY COUNT(*) DESC LIMIT 1 | Tunjukkan status kota yang telah menjadi tuan rumah kompetisi terbesar. |
CREATE TABLE city (City_ID VARCHAR, Population INTEGER); CREATE TABLE farm_competition (Theme VARCHAR, Host_city_ID VARCHAR) | SELECT T2.Theme FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID WHERE T1.Population > 1000 | Tolong tunjukkan tema kompetisi dengan kota -kota tuan rumah yang memiliki populasi lebih besar dari 1000. |
CREATE TABLE city (Status VARCHAR, Population INTEGER) | SELECT Status, AVG(Population) FROM city GROUP BY Status | Harap tunjukkan berbagai status kota dan populasi rata -rata kota dengan setiap status. |
CREATE TABLE city (Status VARCHAR) | SELECT Status FROM city GROUP BY Status ORDER BY COUNT(*) | Harap tunjukkan status yang berbeda, dipesan oleh jumlah kota yang memiliki masing -masing. |
CREATE TABLE city (Status VARCHAR) | SELECT Status FROM city GROUP BY Status ORDER BY COUNT(*) DESC LIMIT 1 | Sebutkan jenis status yang paling umum di seluruh kota. |
CREATE TABLE farm_competition (Official_Name VARCHAR, City_ID VARCHAR, Host_city_ID VARCHAR); CREATE TABLE city (Official_Name VARCHAR, City_ID VARCHAR, Host_city_ID VARCHAR) | SELECT Official_Name FROM city WHERE NOT City_ID IN (SELECT Host_city_ID FROM farm_competition) | Buat daftar nama resmi kota yang belum mengadakan kompetisi. |
CREATE TABLE city (Status VARCHAR, Population INTEGER) | SELECT Status FROM city WHERE Population > 1500 INTERSECT SELECT Status FROM city WHERE Population < 500 | Tunjukkan status yang dibagikan oleh kota -kota dengan populasi lebih besar dari 1500 dan lebih kecil dari 500. |
CREATE TABLE city (Official_Name VARCHAR, Population VARCHAR) | SELECT Official_Name FROM city WHERE Population > 1500 OR Population < 500 | Temukan nama resmi kota dengan populasi yang lebih besar dari 1500 atau lebih kecil dari 500. |
CREATE TABLE city (Census_Ranking VARCHAR, Status VARCHAR) | SELECT Census_Ranking FROM city WHERE Status <> "Village" | Tunjukkan peringkat sensus kota yang statusnya bukan "desa". |
CREATE TABLE courses (course_name VARCHAR, course_id VARCHAR); CREATE TABLE student_course_registrations (course_Id VARCHAR) | SELECT T1.course_name FROM courses AS T1 JOIN student_course_registrations AS T2 ON T1.course_id = T2.course_Id GROUP BY T1.course_id ORDER BY COUNT(*) DESC LIMIT 1 | Kursus mana yang memiliki sebagian besar siswa terdaftar? |
CREATE TABLE student_course_registrations (student_id VARCHAR) | SELECT student_id FROM student_course_registrations GROUP BY student_id ORDER BY COUNT(*) LIMIT 1 | Apa ID siswa yang mendaftarkan beberapa kursus tetapi paling sedikit kursus pada siswa ini? |
CREATE TABLE candidates (candidate_id VARCHAR); CREATE TABLE people (first_name VARCHAR, last_name VARCHAR, person_id VARCHAR) | SELECT T2.first_name, T2.last_name FROM candidates AS T1 JOIN people AS T2 ON T1.candidate_id = T2.person_id | Apa nama depan dan nama belakang semua kandidat? |
CREATE TABLE student_course_attendance (student_id VARCHAR); CREATE TABLE students (student_id VARCHAR) | SELECT student_id FROM students WHERE NOT student_id IN (SELECT student_id FROM student_course_attendance) | Sebutkan ID siswa yang tidak pernah menghadiri kursus? |
CREATE TABLE student_course_attendance (student_id VARCHAR) | SELECT student_id FROM student_course_attendance | Sebutkan ID siswa yang menghadiri beberapa kursus? |
CREATE TABLE courses (course_name VARCHAR, course_id VARCHAR); CREATE TABLE student_course_registrations (student_id VARCHAR, course_id VARCHAR) | SELECT T1.student_id, T2.course_name FROM student_course_registrations AS T1 JOIN courses AS T2 ON T1.course_id = T2.course_id | Apa saja ID dari semua siswa untuk kursus dan apa nama kursus itu? |
CREATE TABLE student_course_registrations (student_id VARCHAR, registration_date VARCHAR); CREATE TABLE students (student_details VARCHAR, student_id VARCHAR) | SELECT T2.student_details FROM student_course_registrations AS T1 JOIN students AS T2 ON T1.student_id = T2.student_id ORDER BY T1.registration_date DESC LIMIT 1 | Apa detail siswa yang baru saja terdaftar? |
CREATE TABLE student_course_attendance (course_id VARCHAR); CREATE TABLE courses (course_id VARCHAR, course_name VARCHAR) | SELECT COUNT(*) FROM courses AS T1 JOIN student_course_attendance AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = "English" | Berapa banyak siswa yang menghadiri kursus bahasa Inggris? |
CREATE TABLE courses (course_id VARCHAR); CREATE TABLE student_course_attendance (course_id VARCHAR, student_id VARCHAR) | SELECT COUNT(*) FROM courses AS T1 JOIN student_course_attendance AS T2 ON T1.course_id = T2.course_id WHERE T2.student_id = 171 | Berapa banyak kursus yang dilakukan oleh siswa yang ID 171? |
CREATE TABLE candidates (candidate_id VARCHAR); CREATE TABLE people (person_id VARCHAR, email_address VARCHAR) | SELECT T2.candidate_id FROM people AS T1 JOIN candidates AS T2 ON T1.person_id = T2.candidate_id WHERE T1.email_address = "stanley.monahan@example.org" | Temukan ID kandidat yang emailnya stanley.monahan@example.org? |
CREATE TABLE candidate_assessments (candidate_id VARCHAR, assessment_date VARCHAR) | SELECT candidate_id FROM candidate_assessments ORDER BY assessment_date DESC LIMIT 1 | Temukan ID kandidat yang baru -baru ini mengakses kursus? |
CREATE TABLE students (student_details VARCHAR, student_id VARCHAR); CREATE TABLE student_course_registrations (student_id VARCHAR) | SELECT T1.student_details FROM students AS T1 JOIN student_course_registrations AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id ORDER BY COUNT(*) DESC LIMIT 1 | Apa detail siswa yang mendaftarkan jumlah kursus terbanyak? |
CREATE TABLE students (student_id VARCHAR); CREATE TABLE student_course_registrations (student_id VARCHAR) | SELECT T1.student_id, COUNT(*) FROM students AS T1 JOIN student_course_registrations AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id | Sebutkan ID siswa yang mendaftarkan beberapa kursus dan jumlah kursus terdaftar mereka? |
CREATE TABLE students (student_id VARCHAR); CREATE TABLE courses (course_name VARCHAR, course_id VARCHAR); CREATE TABLE student_course_registrations (course_id VARCHAR, student_id VARCHAR) | SELECT T3.course_name, COUNT(*) FROM students AS T1 JOIN student_course_registrations AS T2 ON T1.student_id = T2.student_id JOIN courses AS T3 ON T2.course_id = T3.course_id GROUP BY T2.course_id | Berapa banyak siswa terdaftar yang dilakukan setiap kursus?Daftar nama kursus dan jumlah siswa terdaftar mereka? |
CREATE TABLE candidate_assessments (candidate_id VARCHAR, asessment_outcome_code VARCHAR) | SELECT candidate_id FROM candidate_assessments WHERE asessment_outcome_code = "Pass" | Temukan ID kandidat yang kode penilaiannya "lulus"? |
CREATE TABLE candidates (candidate_id VARCHAR); CREATE TABLE people (cell_mobile_number VARCHAR, person_id VARCHAR); CREATE TABLE candidate_assessments (candidate_id VARCHAR, asessment_outcome_code VARCHAR) | SELECT T3.cell_mobile_number FROM candidates AS T1 JOIN candidate_assessments AS T2 ON T1.candidate_id = T2.candidate_id JOIN people AS T3 ON T1.candidate_id = T3.person_id WHERE T2.asessment_outcome_code = "Fail" | Temukan nomor ponsel kandidat yang kode penilaiannya "gagal"? |
CREATE TABLE student_course_attendance (student_id VARCHAR, course_id VARCHAR) | SELECT student_id FROM student_course_attendance WHERE course_id = 301 | Apa ID siswa yang mendaftarkan kursus 301? |
CREATE TABLE student_course_attendance (student_id VARCHAR, course_id VARCHAR, date_of_attendance VARCHAR) | SELECT student_id FROM student_course_attendance WHERE course_id = 301 ORDER BY date_of_attendance DESC LIMIT 1 | Apa ID siswa yang baru saja terdaftar Kursus 301? |
CREATE TABLE addresses (city VARCHAR, address_id VARCHAR); CREATE TABLE people_addresses (address_id VARCHAR) | SELECT DISTINCT T1.city FROM addresses AS T1 JOIN people_addresses AS T2 ON T1.address_id = T2.address_id | Temukan kota alamat orang yang berbeda? |
CREATE TABLE students (student_id VARCHAR); CREATE TABLE addresses (city VARCHAR, address_id VARCHAR); CREATE TABLE people_addresses (address_id VARCHAR, person_id VARCHAR) | SELECT DISTINCT T1.city FROM addresses AS T1 JOIN people_addresses AS T2 ON T1.address_id = T2.address_id JOIN students AS T3 ON T2.person_id = T3.student_id | Temukan kota yang berbeda dari alamat siswa? |
CREATE TABLE courses (course_name VARCHAR) | SELECT course_name FROM courses ORDER BY course_name | Sebutkan nama kursus dalam urutan abjad? |
CREATE TABLE people (first_name VARCHAR) | SELECT first_name FROM people ORDER BY first_name | Sebutkan nama depan orang dalam urutan abjad? |
CREATE TABLE student_course_attendance (student_id VARCHAR); CREATE TABLE student_course_registrations (student_id VARCHAR) | SELECT student_id FROM student_course_registrations UNION SELECT student_id FROM student_course_attendance | Apa ID siswa yang mendaftarkan kursus atau menghadiri kursus? |
CREATE TABLE student_course_attendance (course_id VARCHAR, student_id VARCHAR); CREATE TABLE student_course_registrations (course_id VARCHAR, student_id VARCHAR) | SELECT course_id FROM student_course_registrations WHERE student_id = 121 UNION SELECT course_id FROM student_course_attendance WHERE student_id = 121 | Temukan ID kursus yang terdaftar atau dihadiri oleh siswa yang IDnya 121? |
CREATE TABLE student_course_attendance (student_id VARCHAR); CREATE TABLE student_course_registrations (student_id VARCHAR) | SELECT * FROM student_course_registrations WHERE NOT student_id IN (SELECT student_id FROM student_course_attendance) | Apa saja info siswa yang mendaftarkan kursus tetapi tidak menghadiri kursus? |
CREATE TABLE student_course_registrations (student_id VARCHAR, course_id VARCHAR, registration_date VARCHAR); CREATE TABLE courses (course_id VARCHAR, course_name VARCHAR) | SELECT T2.student_id FROM courses AS T1 JOIN student_course_registrations AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = "statistics" ORDER BY T2.registration_date | Sebutkan ID siswa yang mendaftarkan statistik kursus dalam urutan tanggal pendaftaran. |
CREATE TABLE student_course_attendance (student_id VARCHAR, course_id VARCHAR, date_of_attendance VARCHAR); CREATE TABLE courses (course_id VARCHAR, course_name VARCHAR) | SELECT T2.student_id FROM courses AS T1 JOIN student_course_attendance AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = "statistics" ORDER BY T2.date_of_attendance | Sebutkan ID siswa yang menghadiri kursus statistik dalam urutan tanggal kehadiran. |
CREATE TABLE weather (date VARCHAR, max_temperature_f INTEGER) | SELECT date FROM weather WHERE max_temperature_f > 85 | Beri saya tanggal ketika suhu maksimal lebih tinggi dari 85. |
CREATE TABLE station (name VARCHAR, lat INTEGER) | SELECT name FROM station WHERE lat < 37.5 | Apa nama stasiun yang memiliki garis lintang lebih rendah dari 37.5? |
CREATE TABLE station (city VARCHAR, lat INTEGER) | SELECT city, MAX(lat) FROM station GROUP BY city | Untuk setiap kota, kembalikan garis lintang tertinggi di antara stasiunnya. |
CREATE TABLE trip (start_station_name VARCHAR, end_station_name VARCHAR, id VARCHAR) | SELECT start_station_name, end_station_name FROM trip ORDER BY id LIMIT 3 | Beri saya stasiun mulai dan stasiun akhir untuk perjalanan dengan tiga ID tertua. |
CREATE TABLE station (lat INTEGER, long INTEGER, city VARCHAR) | SELECT AVG(lat), AVG(long) FROM station WHERE city = "San Jose" | Berapa rata -rata garis lintang dan bujur stasiun yang terletak di San Jose City? |
CREATE TABLE trip (id VARCHAR, duration VARCHAR) | SELECT id FROM trip ORDER BY duration LIMIT 1 | Apa ID dari perjalanan yang memiliki durasi terpendek? |
CREATE TABLE trip (duration INTEGER, bike_id VARCHAR) | SELECT SUM(duration), MAX(duration) FROM trip WHERE bike_id = 636 | Berapa durasi total dan maksimum perjalanan dengan ID sepeda 636? |
CREATE TABLE weather (zip_code VARCHAR, mean_temperature_f INTEGER, date VARCHAR) | SELECT zip_code, AVG(mean_temperature_f) FROM weather WHERE date LIKE "8/%" GROUP BY zip_code | Untuk setiap kode pos, kembalikan suhu rata -rata rata -rata Agustus di sana. |
CREATE TABLE trip (bike_id VARCHAR) | SELECT COUNT(DISTINCT bike_id) FROM trip | Dari catatan perjalanan, temukan jumlah sepeda unik. |
CREATE TABLE station (city VARCHAR) | SELECT COUNT(DISTINCT city) FROM station | Berapa jumlah kota yang berbeda di stasiun itu? |
CREATE TABLE station (city VARCHAR) | SELECT COUNT(*) FROM station WHERE city = "Mountain View" | Berapa banyak stasiun yang dimiliki Mountain View City? |
CREATE TABLE station (name VARCHAR, id VARCHAR); CREATE TABLE status (station_id VARCHAR, bikes_available VARCHAR) | SELECT DISTINCT T1.name FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id WHERE T2.bikes_available = 7 | Kembalikan nama unik untuk stasiun yang pernah memiliki 7 sepeda tersedia. |
CREATE TABLE trip (start_station_name VARCHAR, start_station_id VARCHAR, start_date VARCHAR) | SELECT start_station_name, start_station_id FROM trip WHERE start_date LIKE "8/%" GROUP BY start_station_name ORDER BY COUNT(*) DESC LIMIT 1 | Stasiun awal mana yang memiliki perjalanan terbanyak mulai dari Agustus?Beri saya nama dan ID stasiun. |
CREATE TABLE trip (bike_id VARCHAR, zip_code VARCHAR) | SELECT bike_id FROM trip WHERE zip_code = 94002 GROUP BY bike_id ORDER BY COUNT(*) DESC LIMIT 1 | Sepeda mana yang paling sering bepergian dalam kode pos 94002? |
CREATE TABLE weather (mean_humidity VARCHAR, mean_visibility_miles VARCHAR) | SELECT COUNT(*) FROM weather WHERE mean_humidity > 50 AND mean_visibility_miles > 8 | Berapa hari keduanya berarti kelembaban di atas 50 dan visibilitas rata -rata di atas 8? |
CREATE TABLE trip (start_station_id VARCHAR, duration VARCHAR); CREATE TABLE station (lat VARCHAR, long VARCHAR, city VARCHAR, id VARCHAR) | SELECT T1.lat, T1.long, T1.city FROM station AS T1 JOIN trip AS T2 ON T1.id = T2.start_station_id ORDER BY T2.duration LIMIT 1 | Apa garis lintang, bujur, kota stasiun dari mana perjalanan terpendek dimulai? |
CREATE TABLE status (id VARCHAR, station_id VARCHAR, city VARCHAR, bikes_available INTEGER); CREATE TABLE station (id VARCHAR, station_id VARCHAR, city VARCHAR, bikes_available INTEGER) | SELECT id FROM station WHERE city = "San Francisco" INTERSECT SELECT station_id FROM status GROUP BY station_id HAVING AVG(bikes_available) > 10 | Apa saja ID stasiun yang terletak di San Francisco dan memiliki ketersediaan sepeda rata -rata di atas 10. |
CREATE TABLE station (name VARCHAR, id VARCHAR); CREATE TABLE station (name VARCHAR, id VARCHAR, installation_date VARCHAR); CREATE TABLE status (station_id VARCHAR, bikes_available INTEGER) | SELECT T1.name, T1.id FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id GROUP BY T2.station_id HAVING AVG(T2.bikes_available) > 14 UNION SELECT name, id FROM station WHERE installation_date LIKE "12/%" | Apa nama dan ID stasiun yang memiliki lebih dari 14 sepeda tersedia rata -rata atau diinstal pada bulan Desember? |
CREATE TABLE weather (cloud_cover VARCHAR, zip_code VARCHAR) | SELECT cloud_cover FROM weather WHERE zip_code = 94107 GROUP BY cloud_cover ORDER BY COUNT(*) DESC LIMIT 3 | Berapa 3 tingkat tutupan cloud yang paling umum di wilayah kode pos 94107? |
CREATE TABLE weather (zip_code VARCHAR, mean_sea_level_pressure_inches INTEGER) | SELECT zip_code FROM weather GROUP BY zip_code ORDER BY AVG(mean_sea_level_pressure_inches) LIMIT 1 | Apa kode pos di mana rata -rata tekanan permukaan laut adalah yang terendah? |
CREATE TABLE status (bikes_available INTEGER, station_id VARCHAR, id VARCHAR, city VARCHAR); CREATE TABLE station (bikes_available INTEGER, station_id VARCHAR, id VARCHAR, city VARCHAR) | SELECT AVG(bikes_available) FROM status WHERE NOT station_id IN (SELECT id FROM station WHERE city = "Palo Alto") | Apa ketersediaan sepeda rata -rata di stasiun yang tidak terletak di Palo Alto? |
CREATE TABLE station (long INTEGER, id VARCHAR, station_id VARCHAR, bikes_available INTEGER); CREATE TABLE status (long INTEGER, id VARCHAR, station_id VARCHAR, bikes_available INTEGER) | SELECT AVG(long) FROM station WHERE NOT id IN (SELECT station_id FROM status GROUP BY station_id HAVING MAX(bikes_available) > 10) | Berapa rata -rata bujur stasiun yang tidak pernah memiliki ketersediaan sepeda lebih dari 10? |
CREATE TABLE weather (date VARCHAR, zip_code VARCHAR, max_temperature_f VARCHAR) | SELECT date, zip_code FROM weather WHERE max_temperature_f >= 80 | Kapan dan dalam kode pos apa suhu maksimal mencapai 80? |
CREATE TABLE trip (id VARCHAR, zip_code VARCHAR); CREATE TABLE weather (zip_code VARCHAR, mean_temperature_f INTEGER) | SELECT T1.id FROM trip AS T1 JOIN weather AS T2 ON T1.zip_code = T2.zip_code GROUP BY T2.zip_code HAVING AVG(T2.mean_temperature_f) > 60 | Beri saya ID untuk semua perjalanan yang terjadi di area kode pos dengan suhu rata -rata rata -rata di atas 60. |
CREATE TABLE weather (zip_code VARCHAR, max_wind_Speed_mph VARCHAR) | SELECT zip_code, COUNT(*) FROM weather WHERE max_wind_Speed_mph >= 25 GROUP BY zip_code | Untuk setiap kode pos, kembalikan berapa kali kecepatan angin maksimal mencapai 25? |
CREATE TABLE weather (date VARCHAR, zip_code VARCHAR, min_dew_point_f INTEGER) | SELECT date, zip_code FROM weather WHERE min_dew_point_f < (SELECT MIN(min_dew_point_f) FROM weather WHERE zip_code = 94107) | Pada hari mana dan di mana kode pos adalah titik embun lebih rendah dari hari apa pun dalam kode pos 94107? |
CREATE TABLE station (installation_date VARCHAR, id VARCHAR); CREATE TABLE trip (id VARCHAR, end_station_id VARCHAR) | SELECT T1.id, T2.installation_date FROM trip AS T1 JOIN station AS T2 ON T1.end_station_id = T2.id | Untuk setiap perjalanan, kembalikan tanggal pemasangan stasiun akhir. |
CREATE TABLE trip (id VARCHAR, start_station_id VARCHAR); CREATE TABLE station (id VARCHAR, dock_count VARCHAR) | SELECT T1.id FROM trip AS T1 JOIN station AS T2 ON T1.start_station_id = T2.id ORDER BY T2.dock_count DESC LIMIT 1 | Perjalanan mana yang dimulai dari stasiun dengan jumlah dermaga terbesar?Beri aku ID perjalanan. |
CREATE TABLE trip (end_station_id VARCHAR); CREATE TABLE station (id VARCHAR, city VARCHAR) | SELECT COUNT(*) FROM trip AS T1 JOIN station AS T2 ON T1.end_station_id = T2.id WHERE T2.city <> "San Francisco" | Hitung jumlah perjalanan yang tidak berakhir di San Francisco City. |
CREATE TABLE weather (date VARCHAR, EVENTS VARCHAR, zip_code VARCHAR) | SELECT date FROM weather WHERE zip_code = 94107 AND EVENTS <> "Fog" AND EVENTS <> "Rain" | Dalam kode pos 94107, pada hari mana kabut maupun hujan tidak diamati? |
CREATE TABLE status (id VARCHAR, station_id VARCHAR, lat INTEGER, bikes_available INTEGER); CREATE TABLE station (id VARCHAR, station_id VARCHAR, lat INTEGER, bikes_available INTEGER) | SELECT id FROM station WHERE lat > 37.4 EXCEPT SELECT station_id FROM status GROUP BY station_id HAVING MIN(bikes_available) < 7 | Apa ID stasiun yang memiliki garis lintang di atas 37.4 dan tidak pernah memiliki ketersediaan sepeda di bawah 7? |
CREATE TABLE station (name VARCHAR, id VARCHAR); CREATE TABLE status (station_id VARCHAR); CREATE TABLE station (name VARCHAR, city VARCHAR, bikes_available INTEGER) | SELECT T1.name FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id GROUP BY T2.station_id HAVING AVG(bikes_available) > 10 EXCEPT SELECT name FROM station WHERE city = "San Jose" | Apa nama stasiun yang memiliki ketersediaan sepeda rata -rata di atas 10 dan tidak berlokasi di San Jose City? |
CREATE TABLE station (name VARCHAR, lat VARCHAR, city VARCHAR) | SELECT name, lat, city FROM station ORDER BY lat LIMIT 1 | Apa nama, garis lintang, dan kota stasiun dengan garis lintang terendah? |
CREATE TABLE weather (date VARCHAR, mean_temperature_f VARCHAR, mean_humidity VARCHAR, max_gust_speed_mph VARCHAR) | SELECT date, mean_temperature_f, mean_humidity FROM weather ORDER BY max_gust_speed_mph DESC LIMIT 3 | Berapa tanggal, suhu rata -rata, dan kelembaban rata -rata selama 3 hari teratas dengan kecepatan maksam maks terbesar? |
CREATE TABLE station (city VARCHAR) | SELECT city, COUNT(*) FROM station GROUP BY city HAVING COUNT(*) >= 15 | Sebutkan nama dan jumlah stasiun untuk semua kota yang memiliki setidaknya 15 stasiun. |
CREATE TABLE trip (start_station_id VARCHAR, start_station_name VARCHAR) | SELECT start_station_id, start_station_name FROM trip GROUP BY start_station_name HAVING COUNT(*) >= 200 | Temukan ID dan nama stasiun dari mana setidaknya 200 perjalanan dimulai. |
CREATE TABLE weather (zip_code VARCHAR, mean_visibility_miles INTEGER) | SELECT zip_code FROM weather GROUP BY zip_code HAVING AVG(mean_visibility_miles) < 10 | Temukan kode pos di mana visibilitas rata -rata rata -rata lebih rendah dari 10. |
Overview
This dataset is a fork from sql-create-context
This dataset builds from WikiSQL and Spider.
There are 78,577 examples of natural language queries, SQL CREATE TABLE statements, and SQL Query answering the question using the CREATE statement as context. This dataset was built with text-to-sql LLMs in mind, intending to prevent hallucination of column and table names often seen when trained on text-to-sql datasets. The CREATE TABLE statement can often be copy and pasted from different DBMS and provides table names, column names and their data types. By providing just the CREATE TABLE statement as context, we can hopefully provide better grounding for models without having to provide actual rows of data, limiting token usage and exposure to private, sensitive, or proprietary data.
Cleansing and Augmentation
Cleansing and data augmentation has been done on the combined WikiSQL and Spider data. I used SQLGlot on queries from Spider and WikiSQL and parsed them into different tables and columns, I then inferred column data types based on usage of >
<
operators as well as the use of MIN()
MAX()
AVG()
SUM()
on columns. While this isn't perfect, it increases the likelihood of inferring the correct datatype for a column, the columns otherwise default to VARCHAR type. These tables and columns are then used to generate CREATE TABLE statements using the inferred types. SQLGlot is used again to ensure both the SQL queries and CREATE TABLE statements parse without errors.
Some queries that do not have column names, e.g. SELECT * FROM table, have a default Id column added to the CREATE TABLE statement. Some other queries which use the generic table
as the FROM table have instead been changed to a variation of table_name_1
or some other number which is also reflected in the CREATE TABLE statement.
TODO
- Further augment the data by converting queries and CREATE TABLE statements into different SQL dialects, this can be done with SQLGlot. Reference to the dialect might also be added to the question.
- Support other informative contexts beyond CREATE TABLE
- Better parse datatypes to clean up things like numbers for column names and other numbers as strings
If you have any edits you'd like to see in a version 2 of this dataset, let me know.
Random sample:
{
"question": "Berapa banyak kepala departemen yang lebih tua dari 56 tahun?",
"context": "CREATE TABLE head (age INTEGER)",
"answer": "SELECT COUNT(*) FROM head WHERE age > 56"
},
{
"question": "Sebutkan nama, lahir negara bagian mana dan usia kepala departemen yang dipesan berdasarkan usia.",
"context": "CREATE TABLE head (name VARCHAR, born_state VARCHAR, age VARCHAR)",
"answer": "SELECT name, born_state, age FROM head ORDER BY age"
},
- Downloads last month
- 41