db_id
stringclasses
66 values
question
stringlengths
24
325
evidence
stringlengths
1
673
gold_query
stringlengths
23
804
db_schema
stringclasses
66 values
synthea
How many patients immunized against 'monovalent rotavirus' ceased their care plan on 11/23/2013?
immunized against monovalent rotavirus refers to immunizations.DESCRIPTION = 'rotavirus monovalent'; ceased their care plan on 11/23/2013 refers to careplans.STOP = '2013-11-23';
SELECT COUNT(DISTINCT T1.patient) FROM careplans AS T1 INNER JOIN immunizations AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'rotavirus monovalent' AND T1.STOP = '2013-11-23'
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE DATE, -- primary key (DATE, PATIENT, ENCOUNTER, CODE), DESCRIPTION TEXT, -- Example Values: `Influenza seasonal injectable preservative free`, `Td (adult) preservative free`, `meningococcal MCV4P`, `Tdap`, `HPV quadrivalent` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 ); CREATE TABLE allergies ( CODE INTEGER, -- Example Values: `232347008`, `300916003`, `419474003`, `424213003`, `300913006` | Value Statics: Total count 572 - Distinct count 15 - Null count 0 foreign key (ENCOUNTER) references encounters(ID), foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- primary key (PATIENT, ENCOUNTER, CODE), STOP TEXT, -- Example Values: `12/22/14`, `4/21/10`, `10/15/11`, `3/17/10`, `5/26/08` | Value Statics: Total count 16 - Distinct count 11 - Null count 556 START TEXT, -- DESCRIPTION TEXT, -- Example Values: `Allergy to dairy product`, `Allergy to tree pollen`, `Allergy to grass pollen`, `Dander (animal) allergy`, `House dust mite allergy` | Value Statics: Total count 572 - Distinct count 15 - Null count 0 ); CREATE TABLE observations ( DATE DATE, -- ENCOUNTER TEXT, -- VALUE REAL, -- UNITS TEXT, -- Example Values: `cm`, `kg`, `kg/m2`, `mmHg`, `Cel` | Value Statics: Total count 78444 - Distinct count 17 - Null count 455 DESCRIPTION TEXT, -- CODE TEXT, -- PATIENT TEXT, -- foreign key (PATIENT) references patients(patient), foreign key (ENCOUNTER) references encounters(ID), ); CREATE TABLE medications ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- PATIENT TEXT, -- STOP DATE, -- START DATE, -- REASONDESCRIPTION TEXT, -- DESCRIPTION TEXT, -- primary key (START, PATIENT, ENCOUNTER, CODE), foreign key (PATIENT) references patients(patient), REASONCODE INTEGER, -- ENCOUNTER TEXT, -- ); CREATE TABLE careplans ( START DATE, -- STOP DATE, -- ID TEXT, -- REASONCODE INTEGER, -- REASONDESCRIPTION TEXT, -- foreign key (PATIENT) references patients(patient), PATIENT TEXT, -- DESCRIPTION TEXT, -- CODE REAL, -- ENCOUNTER TEXT, -- foreign key (ENCOUNTER) references encounters(ID), ); CREATE TABLE encounters ( DATE DATE, -- REASONCODE INTEGER, -- CODE INTEGER, -- ID TEXT primary key, DESCRIPTION TEXT, -- foreign key (PATIENT) references patients(patient), PATIENT TEXT, -- REASONDESCRIPTION TEXT, -- ); CREATE TABLE procedures ( foreign key (PATIENT) references patients(patient), REASONDESCRIPTION TEXT, -- PATIENT TEXT, -- foreign key (ENCOUNTER) references encounters(ID), DATE DATE, -- DESCRIPTION TEXT, -- ENCOUNTER TEXT, -- CODE INTEGER, -- REASONCODE INTEGER, -- ); CREATE TABLE patients ( suffix TEXT, -- Example Values: `PhD`, `JD`, `MD` | Value Statics: Total count 45 - Distinct count 3 - Null count 1417 prefix TEXT, -- Example Values: `Mr.`, `Mrs.`, `Ms.` | Value Statics: Total count 1166 - Distinct count 3 - Null count 296 deathdate DATE, -- ethnicity TEXT, -- race TEXT, -- Example Values: `black`, `white`, `hispanic`, `asian` | Value Statics: Total count 1462 - Distinct count 4 - Null count 0 address TEXT, -- birthplace TEXT, -- passport TEXT, -- maiden TEXT, -- birthdate DATE, -- marital TEXT, -- Example Values: `S`, `M` | Value Statics: Total count 1033 - Distinct count 2 - Null count 429 gender TEXT, -- Example Values: `F`, `M` | Value Statics: Total count 1462 - Distinct count 2 - Null count 0 drivers TEXT, -- first TEXT, -- last TEXT, -- patient TEXT primary key, ssn TEXT, -- ); CREATE TABLE claims ( ENCOUNTER TEXT references encounters, -- PATIENT TEXT references patients, -- ORGANIZATION TEXT, -- Example Values: `temp organization` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0 TOTAL INTEGER, -- Example Values: `100` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0 BILLABLEPERIOD DATE, -- DIAGNOSIS TEXT, -- ID TEXT primary key, ); CREATE TABLE conditions ( START DATE, -- DESCRIPTION TEXT, -- foreign key (PATIENT) references patients(patient), PATIENT TEXT, -- CODE INTEGER, -- ENCOUNTER TEXT, -- STOP DATE, -- foreign key (ENCOUNTER) references encounters(ID), foreign key (DESCRIPTION) references all_prevalences(ITEM), ); CREATE TABLE all_prevalences ( "POPULATION TYPE" TEXT, -- Example Values: `LIVING` | Value Statics: Total count 244 - Distinct count 1 - Null count 0 "POPULATION COUNT" INTEGER, -- Example Values: `1000` | Value Statics: Total count 244 - Distinct count 1 - Null count 0 ITEM TEXT primary key, "PREVALENCE PERCENTAGE" REAL, -- "PREVALENCE RATE" REAL, -- OCCURRENCES INTEGER, -- );
cs_semester
List the student's email with grade of B in a course with difficulty greater than the 80% of average difficulty of all courses.
difficulty refers to diff; course with difficulty greater than the 80% of average difficulty refers to diff > MULTIPLY(AVG(diff), 80%);
SELECT T2.email FROM registration AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T1.course_id = T3.course_id WHERE T1.grade = 'B' GROUP BY T3.diff HAVING T3.diff > AVG(T3.diff) * 0.8
CREATE TABLE prof ( teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0 gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `npigford0@hku.hk`, `zzhihua@hku.hk`, `ozywicki2@hku.hk`, `mconkay3@ucla.edu`, `bmolen4@hku.hk` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 first_name TEXT, -- Example Values: `Nathaniel`, `Zhihua`, `Ogdon`, `Merwyn`, `Bernhard` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 graduate_from TEXT, -- Example Values: `University of Washington`, `Beijing Polytechnic University`, `University of Boston`, `Carnegie Mellon University`, `Princeton University` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 last_name TEXT, -- Example Values: `Pigford`, `Zhou`, `Zywicki`, `Conkay`, `Molen` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 popularity INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 prof_id INTEGER constraint prof_pk primary key, ); CREATE TABLE student ( email TEXT, -- f_name TEXT, -- intelligence INTEGER, -- Example Values: `5`, `2`, `1`, `3`, `4` | Value Statics: Total count 38 - Distinct count 5 - Null count 0 l_name TEXT, -- type TEXT, -- Example Values: `RPG`, `TPG`, `UG` | Value Statics: Total count 38 - Distinct count 3 - Null count 0 student_id INTEGER primary key, gpa REAL, -- Example Values: `2.4`, `2.7`, `3.5`, `2.8`, `3.9` | Value Statics: Total count 38 - Distinct count 16 - Null count 0 phone_number TEXT, -- ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, name TEXT, -- Example Values: `Machine Learning Theory`, `Intro to Database 1`, `Intro to Database 2`, `Natural Language Processing`, `Intro to BlockChain` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 diff INTEGER, -- Example Values: `3`, `4`, `1`, `5`, `2` | Value Statics: Total count 13 - Distinct count 5 - Null count 0 credit INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 13 - Distinct count 2 - Null count 0 ); CREATE TABLE registration ( sat INTEGER, -- Example Values: `5`, `4`, `3`, `2`, `1` | Value Statics: Total count 101 - Distinct count 5 - Null count 0 course_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 101 - Distinct count 13 - Null count 0 foreign key (student_id) references student(student_id), primary key (course_id, student_id), foreign key (course_id) references course(course_id), student_id INTEGER, -- grade TEXT, -- Example Values: `A`, `B`, `C`, `D` | Value Statics: Total count 96 - Distinct count 4 - Null count 5 ); CREATE TABLE RA ( prof_id INTEGER, -- Example Values: `7`, `10`, `13`, `9`, `2` | Value Statics: Total count 35 - Distinct count 13 - Null count 0 salary TEXT, -- Example Values: `med`, `high`, `low`, `free` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 student_id INTEGER, -- capability INTEGER, -- Example Values: `2`, `5`, `4`, `3` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 foreign key (prof_id) references prof(prof_id), foreign key (student_id) references student(student_id), primary key (student_id, prof_id), );
human_resources
Describe the employees' full name, positions, located city and office phone number within Colorado state.
full name = firstname, lastname; Colorado state refers to state = 'CO'; positions refers to positiontitle; located city refers to locationcity; office phone number refers to officephone;
SELECT T1.firstname, T1.lastname, T3.positiontitle, T2.locationcity, T2.officephone FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID INNER JOIN position AS T3 ON T3.positionID = T1.positionID WHERE T2.state = 'CO'
CREATE TABLE position ( minsalary TEXT, -- Example Values: `US$25,000.00`, `US$50,000.00`, `US$18,000.00`, `US$100,000.00` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 maxsalary TEXT, -- Example Values: `US$75,000.00`, `US$150,000.00`, `US$25,000.00`, `US$250,000.00` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 educationrequired TEXT, -- Example Values: `4 year degree`, `2 year degree`, `6 year degree` | Value Statics: Total count 4 - Distinct count 3 - Null count 0 positiontitle TEXT, -- Example Values: `Account Representative`, `Manager`, `Trainee`, `Regional Manager` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 positionID INTEGER constraint position_pk primary key, ); CREATE TABLE location ( officephone TEXT, -- Example Values: `(404)333-5555`, `(617)123-4444`, `(312)444-6666`, `(305)787-9999`, `(518)256-3100` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 locationcity TEXT, -- Example Values: `Atlanta`, `Boston`, `Chicago`, `Miami`, `New York City` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 zipcode INTEGER, -- Example Values: `30316`, `2190`, `60620`, `33103`, `15648` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 locationID INTEGER constraint location_pk primary key, address TEXT, -- Example Values: `450 Peachtree Rd`, `3 Commons Blvd`, `500 Loop Highway`, `210 Biscayne Blvd`, `1650 Washington Blvd` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 state TEXT, -- Example Values: `GA`, `MA`, `IL`, `FL`, `NY` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE employee ( positionID INTEGER, -- Example Values: `2`, `3`, `1`, `4` | Value Statics: Total count 25 - Distinct count 4 - Null count 0 performance TEXT, -- Example Values: `Average`, `Good`, `Poor` | Value Statics: Total count 23 - Distinct count 3 - Null count 2 lastname TEXT, -- foreign key (positionID) references position(positionID), firstname TEXT, -- Example Values: `Patricia`, `Sandy`, `Emily`, `Harold`, `James` | Value Statics: Total count 25 - Distinct count 19 - Null count 0 locationID INTEGER, -- Example Values: `2`, `1`, `5`, `3`, `4` | Value Statics: Total count 25 - Distinct count 7 - Null count 0 salary TEXT, -- ssn TEXT primary key, hiredate TEXT, -- gender TEXT, -- Example Values: `F`, `M` | Value Statics: Total count 24 - Distinct count 2 - Null count 1 foreign key (locationID) references location(locationID), );
hockey
Who is the youngest player who is still living. State the given name and date of birth.
still living refers to deathYear IS NULL; youngest refers to MAX(birthYear,birthMon,birthDay)
SELECT nameGiven , nameGiven , birthYear, birthMon, birthDay FROM Master WHERE deathYear IS NULL ORDER BY birthYear DESC, birthMon DESC, birthday DESC LIMIT 1
CREATE TABLE Scoring ( tmID TEXT, -- PIM INTEGER, -- PostA TEXT, -- GTG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 28106 - Distinct count 8 - Null count 17861 PostGP TEXT, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `PCHA`, `WCHL`, `NHA` | Value Statics: Total count 45967 - Distinct count 5 - Null count 0 PostG TEXT, -- PostSHG TEXT, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 14492 - Distinct count 4 - Null count 31475 "+/-" TEXT, -- "Post+/-" TEXT, -- PostSHA TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 8855 - Distinct count 5 - Null count 37112 PPA TEXT, -- SOG TEXT, -- PostSOG TEXT, -- foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, pos TEXT, -- foreign key (playerID) references Master (playerID) on update cascade on delete cascade, PostPPG TEXT, -- Example Values: `0`, `1`, `5`, `2`, `3` | Value Statics: Total count 14492 - Distinct count 10 - Null count 31475 SHA TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 23214 - Distinct count 11 - Null count 22753 SHG TEXT, -- Example Values: `0`, `2`, `1`, `5`, `7` | Value Statics: Total count 37744 - Distinct count 14 - Null count 8223 Pts INTEGER, -- A INTEGER, -- PostPIM TEXT, -- G INTEGER, -- PostGWG TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 15657 - Distinct count 8 - Null count 30310 PostPts TEXT, -- playerID TEXT, -- stint INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 45967 - Distinct count 4 - Null count 0 GWG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 36567 - Distinct count 16 - Null count 9400 PPG TEXT, -- PostPPA TEXT, -- Example Values: `0`, `1`, `3`, `2`, `4` | Value Statics: Total count 8854 - Distinct count 17 - Null count 37113 year INTEGER, -- ); CREATE TABLE AwardsCoaches ( coachID TEXT, -- foreign key (coachID) references Coaches (coachID), year INTEGER, -- note TEXT, -- award TEXT, -- Example Values: `First Team All-Star`, `Second Team All-Star`, `Jack Adams`, `Baldwin`, `Schmertz` | Value Statics: Total count 77 - Distinct count 5 - Null count 0 lgID TEXT, -- Example Values: `NHL`, `WHA` | Value Statics: Total count 77 - Distinct count 2 - Null count 0 ); CREATE TABLE HOF ( category TEXT, -- Example Values: `Player`, `Builder`, `Referee/Linesman` | Value Statics: Total count 365 - Distinct count 3 - Null count 0 hofID TEXT not null primary key, year INTEGER, -- name TEXT, -- ); CREATE TABLE SeriesPost ( GoalsLoser INTEGER, -- note TEXT, -- Example Values: `EX`, `TG`, `ND`, `DEF` | Value Statics: Total count 59 - Distinct count 4 - Null count 773 lgIDLoser TEXT, -- Example Values: `NHA`, `PCHA`, `NHL`, `WCHL`, `WHA` | Value Statics: Total count 832 - Distinct count 5 - Null count 0 tmIDWinner TEXT, -- series TEXT, -- Example Values: `A`, `B`, `C`, `D`, `E` | Value Statics: Total count 739 - Distinct count 15 - Null count 93 L INTEGER, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 832 - Distinct count 5 - Null count 0 tmIDLoser TEXT, -- foreign key (year, tmIDLoser) references Teams (year, tmID) on update cascade on delete cascade, year INTEGER, -- foreign key (year, tmIDWinner) references Teams (year, tmID) on update cascade on delete cascade, T INTEGER, -- Example Values: `0`, `1`, `2` | Value Statics: Total count 832 - Distinct count 3 - Null count 0 lgIDWinner TEXT, -- Example Values: `PCHA`, `NHA`, `NHL`, `WCHL`, `WHA` | Value Statics: Total count 832 - Distinct count 5 - Null count 0 round TEXT, -- Example Values: `SCF`, `F`, `SF`, `SCSF`, `WP` | Value Statics: Total count 832 - Distinct count 13 - Null count 0 GoalsWinner INTEGER, -- W INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `0` | Value Statics: Total count 832 - Distinct count 5 - Null count 0 ); CREATE TABLE abbrev ( Fullname TEXT, -- Code TEXT not null, -- primary key (Type, Code), Type TEXT not null, -- Example Values: `Conference`, `Division`, `Playoffs`, `Round` | Value Statics: Total count 58 - Distinct count 4 - Null count 0 ); CREATE TABLE AwardsMisc ( year INTEGER, -- lgID TEXT, -- Example Values: `NHL` | Value Statics: Total count 124 - Distinct count 1 - Null count 0 note TEXT, -- Example Values: `posthumous` | Value Statics: Total count 15 - Distinct count 1 - Null count 109 name TEXT not null primary key, ID TEXT, -- award TEXT, -- Example Values: `Patrick` | Value Statics: Total count 124 - Distinct count 1 - Null count 0 ); CREATE TABLE ScoringShootout ( year INTEGER, -- Example Values: `2006`, `2005`, `2007`, `2009`, `2008` | Value Statics: Total count 2072 - Distinct count 7 - Null count 0 foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, stint INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 2072 - Distinct count 3 - Null count 0 foreign key (playerID) references Master (playerID) on update cascade on delete cascade, G INTEGER, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 2072 - Distinct count 16 - Null count 0 tmID TEXT, -- GDG INTEGER, -- Example Values: `0`, `1`, `2`, `6`, `3` | Value Statics: Total count 2072 - Distinct count 8 - Null count 0 S INTEGER, -- Example Values: `1`, `2`, `5`, `6`, `3` | Value Statics: Total count 2072 - Distinct count 19 - Null count 0 playerID TEXT, -- ); CREATE TABLE TeamSplits ( OctOL TEXT, -- Example Values: `1`, `0`, `2`, `3`, `5` | Value Statics: Total count 358 - Distinct count 6 - Null count 1161 NovL TEXT, -- Example Values: `1`, `4`, `3`, `2`, `0` | Value Statics: Total count 1358 - Distinct count 14 - Null count 161 FebOL TEXT, -- Example Values: `0`, `1`, `4`, `2`, `3` | Value Statics: Total count 358 - Distinct count 6 - Null count 1161 NovW TEXT, -- Example Values: `5`, `1`, `2`, `0`, `4` | Value Statics: Total count 1358 - Distinct count 13 - Null count 161 primary key (year, tmID), JanT INTEGER, -- Example Values: `0`, `1`, `3`, `2`, `4` | Value Statics: Total count 1305 - Distinct count 9 - Null count 214 SepW TEXT, -- Example Values: `1` | Value Statics: Total count 2 - Distinct count 1 - Null count 1517 JanL INTEGER, -- Example Values: `1`, `3`, `2`, `0`, `6` | Value Statics: Total count 1515 - Distinct count 15 - Null count 4 lgID TEXT, -- Example Values: `NHA`, `PCHA`, `NHL`, `WCHL`, `WHA` | Value Statics: Total count 1519 - Distinct count 5 - Null count 0 OctW TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1199 - Distinct count 12 - Null count 320 AprW TEXT, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 1018 - Distinct count 11 - Null count 501 FebT INTEGER, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1300 - Distinct count 8 - Null count 219 JanW INTEGER, -- Example Values: `1`, `0`, `2`, `4`, `3` | Value Statics: Total count 1515 - Distinct count 14 - Null count 4 foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, rT INTEGER, -- Example Values: `0`, `1`, `2`, `3`, `6` | Value Statics: Total count 1309 - Distinct count 16 - Null count 210 tmID TEXT not null, -- DecW TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1473 - Distinct count 14 - Null count 46 year INTEGER not null, -- OctL TEXT, -- Example Values: `1`, `0`, `2`, `4`, `5` | Value Statics: Total count 1199 - Distinct count 13 - Null count 320 SepT TEXT, -- AprOL TEXT, -- Example Values: `1`, `0`, `2`, `3` | Value Statics: Total count 358 - Distinct count 4 - Null count 1161 NovOL TEXT, -- Example Values: `0`, `2`, `1`, `4`, `3` | Value Statics: Total count 358 - Distinct count 5 - Null count 1161 FebW INTEGER, -- Example Values: `2`, `1`, `6`, `5`, `4` | Value Statics: Total count 1510 - Distinct count 14 - Null count 9 MarOL TEXT, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 358 - Distinct count 7 - Null count 1161 hL INTEGER, -- MarL TEXT, -- Example Values: `4`, `0`, `2`, `1`, `3` | Value Statics: Total count 1485 - Distinct count 15 - Null count 34 hT INTEGER, -- Example Values: `0`, `1`, `2`, `4`, `3` | Value Statics: Total count 1309 - Distinct count 14 - Null count 210 JanOL TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 358 - Distinct count 6 - Null count 1161 rOTL TEXT, -- Example Values: `1`, `5`, `3`, `4`, `0` | Value Statics: Total count 358 - Distinct count 11 - Null count 1161 DecL TEXT, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 1473 - Distinct count 14 - Null count 46 MarT TEXT, -- Example Values: `0`, `1`, `2`, `4`, `3` | Value Statics: Total count 1275 - Distinct count 8 - Null count 244 FebL INTEGER, -- Example Values: `3`, `5`, `0`, `1`, `2` | Value Statics: Total count 1510 - Distinct count 13 - Null count 9 MarW TEXT, -- Example Values: `1`, `3`, `0`, `2`, `5` | Value Statics: Total count 1485 - Distinct count 14 - Null count 34 AprT TEXT, -- Example Values: `0`, `1`, `2`, `4`, `3` | Value Statics: Total count 808 - Distinct count 6 - Null count 711 OctT TEXT, -- Example Values: `0`, `1`, `4`, `2`, `3` | Value Statics: Total count 989 - Distinct count 7 - Null count 530 DecOL TEXT, -- Example Values: `0`, `2`, `1`, `3`, `4` | Value Statics: Total count 358 - Distinct count 6 - Null count 1161 DecT TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1263 - Distinct count 8 - Null count 256 NovT TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1148 - Distinct count 9 - Null count 371 hW INTEGER, -- AprL TEXT, -- Example Values: `0`, `2`, `1`, `3`, `4` | Value Statics: Total count 1018 - Distinct count 11 - Null count 501 SepOL TEXT, -- Example Values: `0` | Value Statics: Total count 2 - Distinct count 1 - Null count 1517 rW INTEGER, -- rL INTEGER, -- hOTL TEXT, -- Example Values: `2`, `3`, `1`, `0`, `4` | Value Statics: Total count 358 - Distinct count 12 - Null count 1161 SepL TEXT, -- Example Values: `1` | Value Statics: Total count 2 - Distinct count 1 - Null count 1517 ); CREATE TABLE Master ( lastNHL TEXT, -- deathMon TEXT, -- Example Values: `8`, `2`, `12`, `5`, `3` | Value Statics: Total count 1173 - Distinct count 12 - Null count 6588 birthCity TEXT, -- lastName TEXT not null, -- height TEXT, -- pos TEXT, -- Example Values: `C`, `D`, `G`, `L`, `R` | Value Statics: Total count 7447 - Distinct count 18 - Null count 314 nameGiven TEXT, -- playerID TEXT, -- deathDay TEXT, -- deathYear TEXT, -- hofID TEXT, -- deathCountry TEXT, -- Example Values: `USA`, `Canada`, `France`, `Belgium`, `Russia` | Value Statics: Total count 498 - Distinct count 14 - Null count 7263 deathState TEXT, -- firstNHL TEXT, -- birthCountry TEXT, -- birthDay TEXT, -- legendsID TEXT, -- hrefID TEXT, -- coachID TEXT, -- birthState TEXT, -- birthMon TEXT, -- Example Values: `3`, `8`, `2`, `5`, `12` | Value Statics: Total count 7506 - Distinct count 12 - Null count 255 deathCity TEXT, -- firstName TEXT, -- nameNick TEXT, -- firstWHA TEXT, -- Example Values: `1975`, `1976`, `1974`, `1973`, `1978` | Value Statics: Total count 903 - Distinct count 7 - Null count 6858 lastWHA TEXT, -- Example Values: `1975`, `1977`, `1976`, `1973`, `1978` | Value Statics: Total count 903 - Distinct count 7 - Null count 6858 foreign key (coachID) references Coaches (coachID) on update cascade on delete cascade, ihdbID TEXT, -- birthYear TEXT, -- weight TEXT, -- nameNote TEXT, -- Example Values: `also known as Bellehumeur`, `also listed as Bourdginon`, `born Bodnarchuk`, `also known as Bowcher`, `also known as Burmeister` | Value Statics: Total count 18 - Distinct count 18 - Null count 7743 shootCatch TEXT, -- Example Values: `L`, `R`, `B` | Value Statics: Total count 7048 - Distinct count 3 - Null count 713 ); CREATE TABLE TeamsPost ( year INTEGER not null, -- G INTEGER, -- PPG TEXT, -- L INTEGER, -- Example Values: `1`, `0`, `4`, `2`, `3` | Value Statics: Total count 927 - Distinct count 12 - Null count 0 BenchMinor TEXT, -- Example Values: `0`, `6`, `2`, `4`, `10` | Value Statics: Total count 572 - Distinct count 8 - Null count 355 PKC TEXT, -- SHA TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 604 - Distinct count 9 - Null count 323 tmID TEXT not null, -- foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, lgID TEXT, -- Example Values: `NHA`, `NHL`, `PCHA`, `WCHL`, `WHA` | Value Statics: Total count 927 - Distinct count 5 - Null count 0 PPC TEXT, -- PIM TEXT, -- GA INTEGER, -- GF INTEGER, -- SHF TEXT, -- Example Values: `0`, `1`, `3`, `5`, `2` | Value Statics: Total count 636 - Distinct count 11 - Null count 291 T INTEGER, -- Example Values: `0`, `1`, `2`, `4`, `3` | Value Statics: Total count 927 - Distinct count 5 - Null count 0 W INTEGER, -- Example Values: `1`, `0`, `4`, `2`, `3` | Value Statics: Total count 927 - Distinct count 17 - Null count 0 primary key (year, tmID), PKG TEXT, -- ); CREATE TABLE AwardsPlayers ( primary key (playerID, award, year), playerID TEXT not null, -- foreign key (playerID) references Master (playerID) on update cascade on delete cascade, award TEXT not null, -- year INTEGER not null, -- lgID TEXT, -- Example Values: `NHL`, `WHA` | Value Statics: Total count 2091 - Distinct count 2 - Null count 0 note TEXT, -- Example Values: `tie`, `shared`, `Most Gentlemanly`, `Rookie`, `Best Goaltender` | Value Statics: Total count 127 - Distinct count 8 - Null count 1964 pos TEXT, -- Example Values: `C`, `LW`, `F`, `RW`, `D` | Value Statics: Total count 1231 - Distinct count 7 - Null count 860 ); CREATE TABLE GoaliesShootout ( year INTEGER, -- Example Values: `2005`, `2006`, `2008`, `2009`, `2010` | Value Statics: Total count 480 - Distinct count 7 - Null count 0 stint INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 480 - Distinct count 2 - Null count 0 tmID TEXT, -- W INTEGER, -- Example Values: `2`, `0`, `1`, `7`, `6` | Value Statics: Total count 480 - Distinct count 11 - Null count 0 L INTEGER, -- Example Values: `1`, `2`, `3`, `0`, `4` | Value Statics: Total count 480 - Distinct count 10 - Null count 0 playerID TEXT, -- GA INTEGER, -- SA INTEGER, -- foreign key (playerID) references Master (playerID) on update cascade on delete cascade, foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, ); CREATE TABLE Teams ( L INTEGER, -- name TEXT, -- W INTEGER, -- confID TEXT, -- Example Values: `CC`, `WA`, `WC`, `EC` | Value Statics: Total count 902 - Distinct count 4 - Null count 617 GA INTEGER, -- SoL TEXT, -- Example Values: `7`, `5`, `8`, `2`, `3` | Value Statics: Total count 210 - Distinct count 12 - Null count 1309 BenchMinor TEXT, -- playoff TEXT, -- lgID TEXT, -- Example Values: `NHA`, `PCHA`, `NHL`, `WCHL`, `WHA` | Value Statics: Total count 1519 - Distinct count 5 - Null count 0 G INTEGER, -- GF INTEGER, -- OTL TEXT, -- Example Values: `3`, `4`, `6`, `5`, `0` | Value Statics: Total count 358 - Distinct count 18 - Null count 1161 tmID TEXT not null, -- franchID TEXT, -- primary key (year, tmID), PPC TEXT, -- SHF TEXT, -- T INTEGER, -- SoW TEXT, -- Example Values: `3`, `5`, `2`, `8`, `12` | Value Statics: Total count 210 - Distinct count 15 - Null count 1309 Pts INTEGER, -- PKG TEXT, -- PPG TEXT, -- PKC TEXT, -- divID TEXT, -- Example Values: `AM`, `CA`, `ED`, `WD`, `WW` | Value Statics: Total count 1171 - Distinct count 17 - Null count 348 PIM TEXT, -- rank INTEGER, -- Example Values: `4`, `5`, `7`, `6`, `1` | Value Statics: Total count 1519 - Distinct count 10 - Null count 0 SHA TEXT, -- year INTEGER not null, -- ); CREATE TABLE TeamVsTeam ( oppID TEXT not null, -- T INTEGER, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 19962 - Distinct count 9 - Null count 5640 foreign key (oppID, year) references Teams (tmID, year) on update cascade on delete cascade, OTL TEXT, -- Example Values: `0`, `1`, `3`, `2`, `4` | Value Statics: Total count 9874 - Distinct count 5 - Null count 15728 tmID TEXT not null, -- primary key (year, tmID, oppID), lgID TEXT, -- Example Values: `NHA`, `PCHA`, `NHL`, `WCHL`, `WHA` | Value Statics: Total count 25602 - Distinct count 5 - Null count 0 year INTEGER not null, -- L INTEGER, -- Example Values: `1`, `0`, `2`, `4`, `3` | Value Statics: Total count 25602 - Distinct count 14 - Null count 0 W INTEGER, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 25602 - Distinct count 14 - Null count 0 foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, ); CREATE TABLE ScoringSC ( foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, tmID TEXT, -- Example Values: `VML`, `CAT`, `VIC`, `TRS`, `MOC` | Value Statics: Total count 284 - Distinct count 17 - Null count 0 year INTEGER, -- Example Values: `1920`, `1921`, `1923`, `1924`, `1925` | Value Statics: Total count 284 - Distinct count 14 - Null count 0 playerID TEXT, -- G INTEGER, -- Example Values: `0`, `2`, `6`, `1`, `3` | Value Statics: Total count 284 - Distinct count 11 - Null count 0 foreign key (playerID) references Master (playerID) on update cascade on delete cascade, GP INTEGER, -- Example Values: `4`, `5`, `2`, `1`, `3` | Value Statics: Total count 284 - Distinct count 6 - Null count 0 A INTEGER, -- Example Values: `0`, `1`, `2`, `3`, `5` | Value Statics: Total count 284 - Distinct count 6 - Null count 0 PIM INTEGER, -- pos TEXT, -- Example Values: `R`, `C`, `L`, `F`, `G` | Value Statics: Total count 284 - Distinct count 11 - Null count 0 lgID TEXT, -- Example Values: `PCHA`, `WCHL`, `NHL`, `NHA` | Value Statics: Total count 284 - Distinct count 4 - Null count 0 Pts INTEGER, -- Example Values: `0`, `3`, `7`, `1`, `2` | Value Statics: Total count 284 - Distinct count 11 - Null count 0 ); CREATE TABLE CombinedShutouts ( foreign key (IDgoalie1) references Master (playerID) on update cascade on delete cascade, month INTEGER, -- Example Values: `3`, `2`, `11`, `1`, `12` | Value Statics: Total count 54 - Distinct count 8 - Null count 0 oppID TEXT, -- foreign key (IDgoalie2) references Master (playerID) on update cascade on delete cascade, "R/P" TEXT, -- Example Values: `R`, `P` | Value Statics: Total count 54 - Distinct count 2 - Null count 0 date INTEGER, -- tmID TEXT, -- IDgoalie1 TEXT, -- year INTEGER, -- IDgoalie2 TEXT, -- ); CREATE TABLE GoaliesSC ( GP INTEGER, -- Example Values: `3`, `5`, `6`, `4`, `1` | Value Statics: Total count 31 - Distinct count 6 - Null count 0 foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, tmID TEXT, -- Example Values: `OT1`, `OTS`, `MTM`, `TBS`, `SEA` | Value Statics: Total count 31 - Distinct count 17 - Null count 0 playerID TEXT not null, -- Example Values: `benedcl01`, `clancki01`, `holmeha01`, `lehmahu01`, `lindsbe01` | Value Statics: Total count 31 - Distinct count 11 - Null count 0 lgID TEXT, -- Example Values: `NHA`, `NHL`, `PCHA`, `WCHL` | Value Statics: Total count 31 - Distinct count 4 - Null count 0 foreign key (playerID) references Master (playerID) on update cascade on delete cascade, Min INTEGER, -- Example Values: `180`, `300`, `361`, `240`, `2` | Value Statics: Total count 31 - Distinct count 11 - Null count 0 SHO INTEGER, -- Example Values: `0`, `1`, `3`, `2` | Value Statics: Total count 31 - Distinct count 4 - Null count 0 W INTEGER, -- Example Values: `0`, `3`, `5`, `2`, `1` | Value Statics: Total count 31 - Distinct count 6 - Null count 0 GA INTEGER, -- Example Values: `26`, `11`, `12`, `8`, `3` | Value Statics: Total count 31 - Distinct count 17 - Null count 0 T INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 31 - Distinct count 2 - Null count 0 year INTEGER not null, -- Example Values: `1914`, `1919`, `1920`, `1922`, `1925` | Value Statics: Total count 31 - Distinct count 14 - Null count 0 primary key (playerID, year), L INTEGER, -- Example Values: `3`, `2`, `1`, `0` | Value Statics: Total count 31 - Distinct count 4 - Null count 0 ); CREATE TABLE Goalies ( PostT TEXT, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 106 - Distinct count 5 - Null count 4172 SHO TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 4257 - Distinct count 17 - Null count 21 L TEXT, -- PostMin TEXT, -- PostW TEXT, -- Example Values: `0`, `6`, `1`, `2`, `3` | Value Statics: Total count 1439 - Distinct count 17 - Null count 2839 Min TEXT, -- PostGA TEXT, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `NHA`, `WCHL`, `PCHA` | Value Statics: Total count 4278 - Distinct count 5 - Null count 0 ENG TEXT, -- Example Values: `0`, `1`, `3`, `4`, `5` | Value Statics: Total count 3533 - Distinct count 13 - Null count 745 GA TEXT, -- foreign key (playerID) references Master (playerID) on update cascade on delete cascade, PostSA TEXT, -- primary key (playerID, year, stint), playerID TEXT not null, -- "T/OL" TEXT, -- W TEXT, -- PostENG TEXT, -- Example Values: `0`, `1`, `2`, `3`, `5` | Value Statics: Total count 1187 - Distinct count 6 - Null count 3091 GP TEXT, -- PostSHO TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1439 - Distinct count 8 - Null count 2839 SA TEXT, -- stint INTEGER not null, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 4278 - Distinct count 3 - Null count 0 PostGP TEXT, -- tmID TEXT, -- year INTEGER not null, -- PostL TEXT, -- Example Values: `0`, `1`, `5`, `3`, `4` | Value Statics: Total count 1439 - Distinct count 12 - Null count 2839 foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, ); CREATE TABLE TeamsHalf ( GA INTEGER, -- year INTEGER not null, -- Example Values: `1916`, `1917`, `1918`, `1919`, `1920` | Value Statics: Total count 41 - Distinct count 5 - Null count 0 primary key (year, tmID, half), tmID TEXT not null, -- Example Values: `MOC`, `MOW`, `OT1`, `QU1`, `TBS` | Value Statics: Total count 41 - Distinct count 13 - Null count 0 rank INTEGER, -- Example Values: `1`, `3`, `5`, `4`, `2` | Value Statics: Total count 41 - Distinct count 6 - Null count 0 L INTEGER, -- Example Values: `3`, `7`, `8`, `2`, `5` | Value Statics: Total count 41 - Distinct count 11 - Null count 0 lgID TEXT, -- Example Values: `NHA`, `NHL` | Value Statics: Total count 41 - Distinct count 2 - Null count 0 half INTEGER not null, -- Example Values: `1`, `2` | Value Statics: Total count 41 - Distinct count 2 - Null count 0 GF INTEGER, -- T INTEGER, -- Example Values: `0` | Value Statics: Total count 41 - Distinct count 1 - Null count 0 foreign key (tmID, year) references Teams (tmID, year) on update cascade on delete cascade, G INTEGER, -- Example Values: `10`, `4`, `14`, `8`, `6` | Value Statics: Total count 41 - Distinct count 6 - Null count 0 W INTEGER, -- Example Values: `7`, `3`, `2`, `8`, `5` | Value Statics: Total count 41 - Distinct count 10 - Null count 0 ); CREATE TABLE ScoringSup ( SHA TEXT, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 41 - Distinct count 4 - Null count 96 year INTEGER, -- Example Values: `1988`, `1989`, `1987`, `1990` | Value Statics: Total count 137 - Distinct count 4 - Null count 0 playerID TEXT, -- PPA TEXT, -- foreign key (playerID) references Master (playerID) on update cascade on delete cascade, ); CREATE TABLE Coaches ( coachID TEXT not null, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `NHA`, `WCHL`, `PCHA` | Value Statics: Total count 1812 - Distinct count 5 - Null count 0 t INTEGER, -- l INTEGER, -- tmID TEXT not null, -- stint INTEGER not null, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 1812 - Distinct count 3 - Null count 0 postw TEXT, -- Example Values: `3`, `0`, `2`, `6`, `5` | Value Statics: Total count 927 - Distinct count 17 - Null count 885 w INTEGER, -- year INTEGER not null, -- notes TEXT, -- Example Values: `interim`, `co-coach with Barry Smith`, `co-coach with Dave Lewis` | Value Statics: Total count 11 - Distinct count 3 - Null count 1801 postg TEXT, -- foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, g INTEGER, -- postl TEXT, -- Example Values: `4`, `5`, `6`, `7`, `2` | Value Statics: Total count 927 - Distinct count 12 - Null count 885 postt TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 927 - Distinct count 5 - Null count 885 primary key (coachID, year, tmID, stint), ); CREATE TABLE TeamsSC ( GF INTEGER, -- Example Values: `12`, `16`, `13`, `8`, `26` | Value Statics: Total count 30 - Distinct count 17 - Null count 0 GA INTEGER, -- Example Values: `16`, `12`, `8`, `13`, `26` | Value Statics: Total count 30 - Distinct count 16 - Null count 0 G INTEGER, -- Example Values: `3`, `5`, `4`, `2`, `6` | Value Statics: Total count 30 - Distinct count 5 - Null count 0 W INTEGER, -- Example Values: `1`, `2`, `3`, `0`, `5` | Value Statics: Total count 30 - Distinct count 6 - Null count 0 T INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 30 - Distinct count 2 - Null count 0 L INTEGER, -- Example Values: `2`, `1`, `0`, `3` | Value Statics: Total count 30 - Distinct count 4 - Null count 0 foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, tmID TEXT not null, -- Example Values: `QU1`, `VA1`, `TBS`, `OT1`, `VML` | Value Statics: Total count 30 - Distinct count 17 - Null count 0 lgID TEXT, -- Example Values: `NHA`, `PCHA`, `NHL`, `WCHL` | Value Statics: Total count 30 - Distinct count 4 - Null count 0 PIM TEXT, -- Example Values: `24`, `20`, `75`, `53`, `50` | Value Statics: Total count 8 - Distinct count 7 - Null count 22 year INTEGER not null, -- Example Values: `1912`, `1913`, `1914`, `1915`, `1916` | Value Statics: Total count 30 - Distinct count 14 - Null count 0 primary key (year, tmID), );
synthea
What is the average body weight of Asian patients?
average = AVG(observations.VALUE WHERE observations.DESCRIPTION = 'Body Weight' AND observations.UNITS = 'kg'); body weight refers to observations.DESCRIPTION = 'Body Weight'; Asian refers to race = 'asian';
SELECT SUM(T2.VALUE) / COUNT(T1.patient) FROM patients AS T1 INNER JOIN observations AS T2 ON T1.patient = T2.PATIENT WHERE T1.race = 'asian' AND T2.DESCRIPTION = 'Body Weight' AND T2.UNITS = 'kg'
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE DATE, -- primary key (DATE, PATIENT, ENCOUNTER, CODE), DESCRIPTION TEXT, -- Example Values: `Influenza seasonal injectable preservative free`, `Td (adult) preservative free`, `meningococcal MCV4P`, `Tdap`, `HPV quadrivalent` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 ); CREATE TABLE allergies ( CODE INTEGER, -- Example Values: `232347008`, `300916003`, `419474003`, `424213003`, `300913006` | Value Statics: Total count 572 - Distinct count 15 - Null count 0 foreign key (ENCOUNTER) references encounters(ID), foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- primary key (PATIENT, ENCOUNTER, CODE), STOP TEXT, -- Example Values: `12/22/14`, `4/21/10`, `10/15/11`, `3/17/10`, `5/26/08` | Value Statics: Total count 16 - Distinct count 11 - Null count 556 START TEXT, -- DESCRIPTION TEXT, -- Example Values: `Allergy to dairy product`, `Allergy to tree pollen`, `Allergy to grass pollen`, `Dander (animal) allergy`, `House dust mite allergy` | Value Statics: Total count 572 - Distinct count 15 - Null count 0 ); CREATE TABLE observations ( DATE DATE, -- ENCOUNTER TEXT, -- VALUE REAL, -- UNITS TEXT, -- Example Values: `cm`, `kg`, `kg/m2`, `mmHg`, `Cel` | Value Statics: Total count 78444 - Distinct count 17 - Null count 455 DESCRIPTION TEXT, -- CODE TEXT, -- PATIENT TEXT, -- foreign key (PATIENT) references patients(patient), foreign key (ENCOUNTER) references encounters(ID), ); CREATE TABLE medications ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- PATIENT TEXT, -- STOP DATE, -- START DATE, -- REASONDESCRIPTION TEXT, -- DESCRIPTION TEXT, -- primary key (START, PATIENT, ENCOUNTER, CODE), foreign key (PATIENT) references patients(patient), REASONCODE INTEGER, -- ENCOUNTER TEXT, -- ); CREATE TABLE careplans ( START DATE, -- STOP DATE, -- ID TEXT, -- REASONCODE INTEGER, -- REASONDESCRIPTION TEXT, -- foreign key (PATIENT) references patients(patient), PATIENT TEXT, -- DESCRIPTION TEXT, -- CODE REAL, -- ENCOUNTER TEXT, -- foreign key (ENCOUNTER) references encounters(ID), ); CREATE TABLE encounters ( DATE DATE, -- REASONCODE INTEGER, -- CODE INTEGER, -- ID TEXT primary key, DESCRIPTION TEXT, -- foreign key (PATIENT) references patients(patient), PATIENT TEXT, -- REASONDESCRIPTION TEXT, -- ); CREATE TABLE procedures ( foreign key (PATIENT) references patients(patient), REASONDESCRIPTION TEXT, -- PATIENT TEXT, -- foreign key (ENCOUNTER) references encounters(ID), DATE DATE, -- DESCRIPTION TEXT, -- ENCOUNTER TEXT, -- CODE INTEGER, -- REASONCODE INTEGER, -- ); CREATE TABLE patients ( suffix TEXT, -- Example Values: `PhD`, `JD`, `MD` | Value Statics: Total count 45 - Distinct count 3 - Null count 1417 prefix TEXT, -- Example Values: `Mr.`, `Mrs.`, `Ms.` | Value Statics: Total count 1166 - Distinct count 3 - Null count 296 deathdate DATE, -- ethnicity TEXT, -- race TEXT, -- Example Values: `black`, `white`, `hispanic`, `asian` | Value Statics: Total count 1462 - Distinct count 4 - Null count 0 address TEXT, -- birthplace TEXT, -- passport TEXT, -- maiden TEXT, -- birthdate DATE, -- marital TEXT, -- Example Values: `S`, `M` | Value Statics: Total count 1033 - Distinct count 2 - Null count 429 gender TEXT, -- Example Values: `F`, `M` | Value Statics: Total count 1462 - Distinct count 2 - Null count 0 drivers TEXT, -- first TEXT, -- last TEXT, -- patient TEXT primary key, ssn TEXT, -- ); CREATE TABLE claims ( ENCOUNTER TEXT references encounters, -- PATIENT TEXT references patients, -- ORGANIZATION TEXT, -- Example Values: `temp organization` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0 TOTAL INTEGER, -- Example Values: `100` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0 BILLABLEPERIOD DATE, -- DIAGNOSIS TEXT, -- ID TEXT primary key, ); CREATE TABLE conditions ( START DATE, -- DESCRIPTION TEXT, -- foreign key (PATIENT) references patients(patient), PATIENT TEXT, -- CODE INTEGER, -- ENCOUNTER TEXT, -- STOP DATE, -- foreign key (ENCOUNTER) references encounters(ID), foreign key (DESCRIPTION) references all_prevalences(ITEM), ); CREATE TABLE all_prevalences ( "POPULATION TYPE" TEXT, -- Example Values: `LIVING` | Value Statics: Total count 244 - Distinct count 1 - Null count 0 "POPULATION COUNT" INTEGER, -- Example Values: `1000` | Value Statics: Total count 244 - Distinct count 1 - Null count 0 ITEM TEXT primary key, "PREVALENCE PERCENTAGE" REAL, -- "PREVALENCE RATE" REAL, -- OCCURRENCES INTEGER, -- );
cs_semester
List the course's name where students acquired a grade of D.
null
SELECT T1.name FROM course AS T1 INNER JOIN registration AS T2 ON T1.course_id = T2.course_id WHERE T2.grade = 'D'
CREATE TABLE prof ( teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0 gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `npigford0@hku.hk`, `zzhihua@hku.hk`, `ozywicki2@hku.hk`, `mconkay3@ucla.edu`, `bmolen4@hku.hk` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 first_name TEXT, -- Example Values: `Nathaniel`, `Zhihua`, `Ogdon`, `Merwyn`, `Bernhard` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 graduate_from TEXT, -- Example Values: `University of Washington`, `Beijing Polytechnic University`, `University of Boston`, `Carnegie Mellon University`, `Princeton University` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 last_name TEXT, -- Example Values: `Pigford`, `Zhou`, `Zywicki`, `Conkay`, `Molen` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 popularity INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 prof_id INTEGER constraint prof_pk primary key, ); CREATE TABLE student ( email TEXT, -- f_name TEXT, -- intelligence INTEGER, -- Example Values: `5`, `2`, `1`, `3`, `4` | Value Statics: Total count 38 - Distinct count 5 - Null count 0 l_name TEXT, -- type TEXT, -- Example Values: `RPG`, `TPG`, `UG` | Value Statics: Total count 38 - Distinct count 3 - Null count 0 student_id INTEGER primary key, gpa REAL, -- Example Values: `2.4`, `2.7`, `3.5`, `2.8`, `3.9` | Value Statics: Total count 38 - Distinct count 16 - Null count 0 phone_number TEXT, -- ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, name TEXT, -- Example Values: `Machine Learning Theory`, `Intro to Database 1`, `Intro to Database 2`, `Natural Language Processing`, `Intro to BlockChain` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 diff INTEGER, -- Example Values: `3`, `4`, `1`, `5`, `2` | Value Statics: Total count 13 - Distinct count 5 - Null count 0 credit INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 13 - Distinct count 2 - Null count 0 ); CREATE TABLE registration ( sat INTEGER, -- Example Values: `5`, `4`, `3`, `2`, `1` | Value Statics: Total count 101 - Distinct count 5 - Null count 0 course_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 101 - Distinct count 13 - Null count 0 foreign key (student_id) references student(student_id), primary key (course_id, student_id), foreign key (course_id) references course(course_id), student_id INTEGER, -- grade TEXT, -- Example Values: `A`, `B`, `C`, `D` | Value Statics: Total count 96 - Distinct count 4 - Null count 5 ); CREATE TABLE RA ( prof_id INTEGER, -- Example Values: `7`, `10`, `13`, `9`, `2` | Value Statics: Total count 35 - Distinct count 13 - Null count 0 salary TEXT, -- Example Values: `med`, `high`, `low`, `free` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 student_id INTEGER, -- capability INTEGER, -- Example Values: `2`, `5`, `4`, `3` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 foreign key (prof_id) references prof(prof_id), foreign key (student_id) references student(student_id), primary key (student_id, prof_id), );
human_resources
Write down the full name, performance status and located city of the employee who's social security number is "767-74-7373".
full name = firstname, lastname; ssn = '767-74-7373'
SELECT T1.firstname, T1.lastname, T2.state, T2.locationcity FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T1.ssn = '767-74-7373'
CREATE TABLE position ( minsalary TEXT, -- Example Values: `US$25,000.00`, `US$50,000.00`, `US$18,000.00`, `US$100,000.00` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 maxsalary TEXT, -- Example Values: `US$75,000.00`, `US$150,000.00`, `US$25,000.00`, `US$250,000.00` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 educationrequired TEXT, -- Example Values: `4 year degree`, `2 year degree`, `6 year degree` | Value Statics: Total count 4 - Distinct count 3 - Null count 0 positiontitle TEXT, -- Example Values: `Account Representative`, `Manager`, `Trainee`, `Regional Manager` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 positionID INTEGER constraint position_pk primary key, ); CREATE TABLE location ( officephone TEXT, -- Example Values: `(404)333-5555`, `(617)123-4444`, `(312)444-6666`, `(305)787-9999`, `(518)256-3100` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 locationcity TEXT, -- Example Values: `Atlanta`, `Boston`, `Chicago`, `Miami`, `New York City` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 zipcode INTEGER, -- Example Values: `30316`, `2190`, `60620`, `33103`, `15648` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 locationID INTEGER constraint location_pk primary key, address TEXT, -- Example Values: `450 Peachtree Rd`, `3 Commons Blvd`, `500 Loop Highway`, `210 Biscayne Blvd`, `1650 Washington Blvd` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 state TEXT, -- Example Values: `GA`, `MA`, `IL`, `FL`, `NY` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE employee ( positionID INTEGER, -- Example Values: `2`, `3`, `1`, `4` | Value Statics: Total count 25 - Distinct count 4 - Null count 0 performance TEXT, -- Example Values: `Average`, `Good`, `Poor` | Value Statics: Total count 23 - Distinct count 3 - Null count 2 lastname TEXT, -- foreign key (positionID) references position(positionID), firstname TEXT, -- Example Values: `Patricia`, `Sandy`, `Emily`, `Harold`, `James` | Value Statics: Total count 25 - Distinct count 19 - Null count 0 locationID INTEGER, -- Example Values: `2`, `1`, `5`, `3`, `4` | Value Statics: Total count 25 - Distinct count 7 - Null count 0 salary TEXT, -- ssn TEXT primary key, hiredate TEXT, -- gender TEXT, -- Example Values: `F`, `M` | Value Statics: Total count 24 - Distinct count 2 - Null count 1 foreign key (locationID) references location(locationID), );
hockey
Who are the players who were not in the Hall of Fame list.
not in the Hall of Fame refers to hofID IS NULL
SELECT firstName, lastName FROM Master WHERE hofID IS NULL
CREATE TABLE Scoring ( tmID TEXT, -- PIM INTEGER, -- PostA TEXT, -- GTG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 28106 - Distinct count 8 - Null count 17861 PostGP TEXT, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `PCHA`, `WCHL`, `NHA` | Value Statics: Total count 45967 - Distinct count 5 - Null count 0 PostG TEXT, -- PostSHG TEXT, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 14492 - Distinct count 4 - Null count 31475 "+/-" TEXT, -- "Post+/-" TEXT, -- PostSHA TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 8855 - Distinct count 5 - Null count 37112 PPA TEXT, -- SOG TEXT, -- PostSOG TEXT, -- foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, pos TEXT, -- foreign key (playerID) references Master (playerID) on update cascade on delete cascade, PostPPG TEXT, -- Example Values: `0`, `1`, `5`, `2`, `3` | Value Statics: Total count 14492 - Distinct count 10 - Null count 31475 SHA TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 23214 - Distinct count 11 - Null count 22753 SHG TEXT, -- Example Values: `0`, `2`, `1`, `5`, `7` | Value Statics: Total count 37744 - Distinct count 14 - Null count 8223 Pts INTEGER, -- A INTEGER, -- PostPIM TEXT, -- G INTEGER, -- PostGWG TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 15657 - Distinct count 8 - Null count 30310 PostPts TEXT, -- playerID TEXT, -- stint INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 45967 - Distinct count 4 - Null count 0 GWG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 36567 - Distinct count 16 - Null count 9400 PPG TEXT, -- PostPPA TEXT, -- Example Values: `0`, `1`, `3`, `2`, `4` | Value Statics: Total count 8854 - Distinct count 17 - Null count 37113 year INTEGER, -- ); CREATE TABLE AwardsCoaches ( coachID TEXT, -- foreign key (coachID) references Coaches (coachID), year INTEGER, -- note TEXT, -- award TEXT, -- Example Values: `First Team All-Star`, `Second Team All-Star`, `Jack Adams`, `Baldwin`, `Schmertz` | Value Statics: Total count 77 - Distinct count 5 - Null count 0 lgID TEXT, -- Example Values: `NHL`, `WHA` | Value Statics: Total count 77 - Distinct count 2 - Null count 0 ); CREATE TABLE HOF ( category TEXT, -- Example Values: `Player`, `Builder`, `Referee/Linesman` | Value Statics: Total count 365 - Distinct count 3 - Null count 0 hofID TEXT not null primary key, year INTEGER, -- name TEXT, -- ); CREATE TABLE SeriesPost ( GoalsLoser INTEGER, -- note TEXT, -- Example Values: `EX`, `TG`, `ND`, `DEF` | Value Statics: Total count 59 - Distinct count 4 - Null count 773 lgIDLoser TEXT, -- Example Values: `NHA`, `PCHA`, `NHL`, `WCHL`, `WHA` | Value Statics: Total count 832 - Distinct count 5 - Null count 0 tmIDWinner TEXT, -- series TEXT, -- Example Values: `A`, `B`, `C`, `D`, `E` | Value Statics: Total count 739 - Distinct count 15 - Null count 93 L INTEGER, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 832 - Distinct count 5 - Null count 0 tmIDLoser TEXT, -- foreign key (year, tmIDLoser) references Teams (year, tmID) on update cascade on delete cascade, year INTEGER, -- foreign key (year, tmIDWinner) references Teams (year, tmID) on update cascade on delete cascade, T INTEGER, -- Example Values: `0`, `1`, `2` | Value Statics: Total count 832 - Distinct count 3 - Null count 0 lgIDWinner TEXT, -- Example Values: `PCHA`, `NHA`, `NHL`, `WCHL`, `WHA` | Value Statics: Total count 832 - Distinct count 5 - Null count 0 round TEXT, -- Example Values: `SCF`, `F`, `SF`, `SCSF`, `WP` | Value Statics: Total count 832 - Distinct count 13 - Null count 0 GoalsWinner INTEGER, -- W INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `0` | Value Statics: Total count 832 - Distinct count 5 - Null count 0 ); CREATE TABLE abbrev ( Fullname TEXT, -- Code TEXT not null, -- primary key (Type, Code), Type TEXT not null, -- Example Values: `Conference`, `Division`, `Playoffs`, `Round` | Value Statics: Total count 58 - Distinct count 4 - Null count 0 ); CREATE TABLE AwardsMisc ( year INTEGER, -- lgID TEXT, -- Example Values: `NHL` | Value Statics: Total count 124 - Distinct count 1 - Null count 0 note TEXT, -- Example Values: `posthumous` | Value Statics: Total count 15 - Distinct count 1 - Null count 109 name TEXT not null primary key, ID TEXT, -- award TEXT, -- Example Values: `Patrick` | Value Statics: Total count 124 - Distinct count 1 - Null count 0 ); CREATE TABLE ScoringShootout ( year INTEGER, -- Example Values: `2006`, `2005`, `2007`, `2009`, `2008` | Value Statics: Total count 2072 - Distinct count 7 - Null count 0 foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, stint INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 2072 - Distinct count 3 - Null count 0 foreign key (playerID) references Master (playerID) on update cascade on delete cascade, G INTEGER, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 2072 - Distinct count 16 - Null count 0 tmID TEXT, -- GDG INTEGER, -- Example Values: `0`, `1`, `2`, `6`, `3` | Value Statics: Total count 2072 - Distinct count 8 - Null count 0 S INTEGER, -- Example Values: `1`, `2`, `5`, `6`, `3` | Value Statics: Total count 2072 - Distinct count 19 - Null count 0 playerID TEXT, -- ); CREATE TABLE TeamSplits ( OctOL TEXT, -- Example Values: `1`, `0`, `2`, `3`, `5` | Value Statics: Total count 358 - Distinct count 6 - Null count 1161 NovL TEXT, -- Example Values: `1`, `4`, `3`, `2`, `0` | Value Statics: Total count 1358 - Distinct count 14 - Null count 161 FebOL TEXT, -- Example Values: `0`, `1`, `4`, `2`, `3` | Value Statics: Total count 358 - Distinct count 6 - Null count 1161 NovW TEXT, -- Example Values: `5`, `1`, `2`, `0`, `4` | Value Statics: Total count 1358 - Distinct count 13 - Null count 161 primary key (year, tmID), JanT INTEGER, -- Example Values: `0`, `1`, `3`, `2`, `4` | Value Statics: Total count 1305 - Distinct count 9 - Null count 214 SepW TEXT, -- Example Values: `1` | Value Statics: Total count 2 - Distinct count 1 - Null count 1517 JanL INTEGER, -- Example Values: `1`, `3`, `2`, `0`, `6` | Value Statics: Total count 1515 - Distinct count 15 - Null count 4 lgID TEXT, -- Example Values: `NHA`, `PCHA`, `NHL`, `WCHL`, `WHA` | Value Statics: Total count 1519 - Distinct count 5 - Null count 0 OctW TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1199 - Distinct count 12 - Null count 320 AprW TEXT, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 1018 - Distinct count 11 - Null count 501 FebT INTEGER, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1300 - Distinct count 8 - Null count 219 JanW INTEGER, -- Example Values: `1`, `0`, `2`, `4`, `3` | Value Statics: Total count 1515 - Distinct count 14 - Null count 4 foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, rT INTEGER, -- Example Values: `0`, `1`, `2`, `3`, `6` | Value Statics: Total count 1309 - Distinct count 16 - Null count 210 tmID TEXT not null, -- DecW TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1473 - Distinct count 14 - Null count 46 year INTEGER not null, -- OctL TEXT, -- Example Values: `1`, `0`, `2`, `4`, `5` | Value Statics: Total count 1199 - Distinct count 13 - Null count 320 SepT TEXT, -- AprOL TEXT, -- Example Values: `1`, `0`, `2`, `3` | Value Statics: Total count 358 - Distinct count 4 - Null count 1161 NovOL TEXT, -- Example Values: `0`, `2`, `1`, `4`, `3` | Value Statics: Total count 358 - Distinct count 5 - Null count 1161 FebW INTEGER, -- Example Values: `2`, `1`, `6`, `5`, `4` | Value Statics: Total count 1510 - Distinct count 14 - Null count 9 MarOL TEXT, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 358 - Distinct count 7 - Null count 1161 hL INTEGER, -- MarL TEXT, -- Example Values: `4`, `0`, `2`, `1`, `3` | Value Statics: Total count 1485 - Distinct count 15 - Null count 34 hT INTEGER, -- Example Values: `0`, `1`, `2`, `4`, `3` | Value Statics: Total count 1309 - Distinct count 14 - Null count 210 JanOL TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 358 - Distinct count 6 - Null count 1161 rOTL TEXT, -- Example Values: `1`, `5`, `3`, `4`, `0` | Value Statics: Total count 358 - Distinct count 11 - Null count 1161 DecL TEXT, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 1473 - Distinct count 14 - Null count 46 MarT TEXT, -- Example Values: `0`, `1`, `2`, `4`, `3` | Value Statics: Total count 1275 - Distinct count 8 - Null count 244 FebL INTEGER, -- Example Values: `3`, `5`, `0`, `1`, `2` | Value Statics: Total count 1510 - Distinct count 13 - Null count 9 MarW TEXT, -- Example Values: `1`, `3`, `0`, `2`, `5` | Value Statics: Total count 1485 - Distinct count 14 - Null count 34 AprT TEXT, -- Example Values: `0`, `1`, `2`, `4`, `3` | Value Statics: Total count 808 - Distinct count 6 - Null count 711 OctT TEXT, -- Example Values: `0`, `1`, `4`, `2`, `3` | Value Statics: Total count 989 - Distinct count 7 - Null count 530 DecOL TEXT, -- Example Values: `0`, `2`, `1`, `3`, `4` | Value Statics: Total count 358 - Distinct count 6 - Null count 1161 DecT TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1263 - Distinct count 8 - Null count 256 NovT TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1148 - Distinct count 9 - Null count 371 hW INTEGER, -- AprL TEXT, -- Example Values: `0`, `2`, `1`, `3`, `4` | Value Statics: Total count 1018 - Distinct count 11 - Null count 501 SepOL TEXT, -- Example Values: `0` | Value Statics: Total count 2 - Distinct count 1 - Null count 1517 rW INTEGER, -- rL INTEGER, -- hOTL TEXT, -- Example Values: `2`, `3`, `1`, `0`, `4` | Value Statics: Total count 358 - Distinct count 12 - Null count 1161 SepL TEXT, -- Example Values: `1` | Value Statics: Total count 2 - Distinct count 1 - Null count 1517 ); CREATE TABLE Master ( lastNHL TEXT, -- deathMon TEXT, -- Example Values: `8`, `2`, `12`, `5`, `3` | Value Statics: Total count 1173 - Distinct count 12 - Null count 6588 birthCity TEXT, -- lastName TEXT not null, -- height TEXT, -- pos TEXT, -- Example Values: `C`, `D`, `G`, `L`, `R` | Value Statics: Total count 7447 - Distinct count 18 - Null count 314 nameGiven TEXT, -- playerID TEXT, -- deathDay TEXT, -- deathYear TEXT, -- hofID TEXT, -- deathCountry TEXT, -- Example Values: `USA`, `Canada`, `France`, `Belgium`, `Russia` | Value Statics: Total count 498 - Distinct count 14 - Null count 7263 deathState TEXT, -- firstNHL TEXT, -- birthCountry TEXT, -- birthDay TEXT, -- legendsID TEXT, -- hrefID TEXT, -- coachID TEXT, -- birthState TEXT, -- birthMon TEXT, -- Example Values: `3`, `8`, `2`, `5`, `12` | Value Statics: Total count 7506 - Distinct count 12 - Null count 255 deathCity TEXT, -- firstName TEXT, -- nameNick TEXT, -- firstWHA TEXT, -- Example Values: `1975`, `1976`, `1974`, `1973`, `1978` | Value Statics: Total count 903 - Distinct count 7 - Null count 6858 lastWHA TEXT, -- Example Values: `1975`, `1977`, `1976`, `1973`, `1978` | Value Statics: Total count 903 - Distinct count 7 - Null count 6858 foreign key (coachID) references Coaches (coachID) on update cascade on delete cascade, ihdbID TEXT, -- birthYear TEXT, -- weight TEXT, -- nameNote TEXT, -- Example Values: `also known as Bellehumeur`, `also listed as Bourdginon`, `born Bodnarchuk`, `also known as Bowcher`, `also known as Burmeister` | Value Statics: Total count 18 - Distinct count 18 - Null count 7743 shootCatch TEXT, -- Example Values: `L`, `R`, `B` | Value Statics: Total count 7048 - Distinct count 3 - Null count 713 ); CREATE TABLE TeamsPost ( year INTEGER not null, -- G INTEGER, -- PPG TEXT, -- L INTEGER, -- Example Values: `1`, `0`, `4`, `2`, `3` | Value Statics: Total count 927 - Distinct count 12 - Null count 0 BenchMinor TEXT, -- Example Values: `0`, `6`, `2`, `4`, `10` | Value Statics: Total count 572 - Distinct count 8 - Null count 355 PKC TEXT, -- SHA TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 604 - Distinct count 9 - Null count 323 tmID TEXT not null, -- foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, lgID TEXT, -- Example Values: `NHA`, `NHL`, `PCHA`, `WCHL`, `WHA` | Value Statics: Total count 927 - Distinct count 5 - Null count 0 PPC TEXT, -- PIM TEXT, -- GA INTEGER, -- GF INTEGER, -- SHF TEXT, -- Example Values: `0`, `1`, `3`, `5`, `2` | Value Statics: Total count 636 - Distinct count 11 - Null count 291 T INTEGER, -- Example Values: `0`, `1`, `2`, `4`, `3` | Value Statics: Total count 927 - Distinct count 5 - Null count 0 W INTEGER, -- Example Values: `1`, `0`, `4`, `2`, `3` | Value Statics: Total count 927 - Distinct count 17 - Null count 0 primary key (year, tmID), PKG TEXT, -- ); CREATE TABLE AwardsPlayers ( primary key (playerID, award, year), playerID TEXT not null, -- foreign key (playerID) references Master (playerID) on update cascade on delete cascade, award TEXT not null, -- year INTEGER not null, -- lgID TEXT, -- Example Values: `NHL`, `WHA` | Value Statics: Total count 2091 - Distinct count 2 - Null count 0 note TEXT, -- Example Values: `tie`, `shared`, `Most Gentlemanly`, `Rookie`, `Best Goaltender` | Value Statics: Total count 127 - Distinct count 8 - Null count 1964 pos TEXT, -- Example Values: `C`, `LW`, `F`, `RW`, `D` | Value Statics: Total count 1231 - Distinct count 7 - Null count 860 ); CREATE TABLE GoaliesShootout ( year INTEGER, -- Example Values: `2005`, `2006`, `2008`, `2009`, `2010` | Value Statics: Total count 480 - Distinct count 7 - Null count 0 stint INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 480 - Distinct count 2 - Null count 0 tmID TEXT, -- W INTEGER, -- Example Values: `2`, `0`, `1`, `7`, `6` | Value Statics: Total count 480 - Distinct count 11 - Null count 0 L INTEGER, -- Example Values: `1`, `2`, `3`, `0`, `4` | Value Statics: Total count 480 - Distinct count 10 - Null count 0 playerID TEXT, -- GA INTEGER, -- SA INTEGER, -- foreign key (playerID) references Master (playerID) on update cascade on delete cascade, foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, ); CREATE TABLE Teams ( L INTEGER, -- name TEXT, -- W INTEGER, -- confID TEXT, -- Example Values: `CC`, `WA`, `WC`, `EC` | Value Statics: Total count 902 - Distinct count 4 - Null count 617 GA INTEGER, -- SoL TEXT, -- Example Values: `7`, `5`, `8`, `2`, `3` | Value Statics: Total count 210 - Distinct count 12 - Null count 1309 BenchMinor TEXT, -- playoff TEXT, -- lgID TEXT, -- Example Values: `NHA`, `PCHA`, `NHL`, `WCHL`, `WHA` | Value Statics: Total count 1519 - Distinct count 5 - Null count 0 G INTEGER, -- GF INTEGER, -- OTL TEXT, -- Example Values: `3`, `4`, `6`, `5`, `0` | Value Statics: Total count 358 - Distinct count 18 - Null count 1161 tmID TEXT not null, -- franchID TEXT, -- primary key (year, tmID), PPC TEXT, -- SHF TEXT, -- T INTEGER, -- SoW TEXT, -- Example Values: `3`, `5`, `2`, `8`, `12` | Value Statics: Total count 210 - Distinct count 15 - Null count 1309 Pts INTEGER, -- PKG TEXT, -- PPG TEXT, -- PKC TEXT, -- divID TEXT, -- Example Values: `AM`, `CA`, `ED`, `WD`, `WW` | Value Statics: Total count 1171 - Distinct count 17 - Null count 348 PIM TEXT, -- rank INTEGER, -- Example Values: `4`, `5`, `7`, `6`, `1` | Value Statics: Total count 1519 - Distinct count 10 - Null count 0 SHA TEXT, -- year INTEGER not null, -- ); CREATE TABLE TeamVsTeam ( oppID TEXT not null, -- T INTEGER, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 19962 - Distinct count 9 - Null count 5640 foreign key (oppID, year) references Teams (tmID, year) on update cascade on delete cascade, OTL TEXT, -- Example Values: `0`, `1`, `3`, `2`, `4` | Value Statics: Total count 9874 - Distinct count 5 - Null count 15728 tmID TEXT not null, -- primary key (year, tmID, oppID), lgID TEXT, -- Example Values: `NHA`, `PCHA`, `NHL`, `WCHL`, `WHA` | Value Statics: Total count 25602 - Distinct count 5 - Null count 0 year INTEGER not null, -- L INTEGER, -- Example Values: `1`, `0`, `2`, `4`, `3` | Value Statics: Total count 25602 - Distinct count 14 - Null count 0 W INTEGER, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 25602 - Distinct count 14 - Null count 0 foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, ); CREATE TABLE ScoringSC ( foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, tmID TEXT, -- Example Values: `VML`, `CAT`, `VIC`, `TRS`, `MOC` | Value Statics: Total count 284 - Distinct count 17 - Null count 0 year INTEGER, -- Example Values: `1920`, `1921`, `1923`, `1924`, `1925` | Value Statics: Total count 284 - Distinct count 14 - Null count 0 playerID TEXT, -- G INTEGER, -- Example Values: `0`, `2`, `6`, `1`, `3` | Value Statics: Total count 284 - Distinct count 11 - Null count 0 foreign key (playerID) references Master (playerID) on update cascade on delete cascade, GP INTEGER, -- Example Values: `4`, `5`, `2`, `1`, `3` | Value Statics: Total count 284 - Distinct count 6 - Null count 0 A INTEGER, -- Example Values: `0`, `1`, `2`, `3`, `5` | Value Statics: Total count 284 - Distinct count 6 - Null count 0 PIM INTEGER, -- pos TEXT, -- Example Values: `R`, `C`, `L`, `F`, `G` | Value Statics: Total count 284 - Distinct count 11 - Null count 0 lgID TEXT, -- Example Values: `PCHA`, `WCHL`, `NHL`, `NHA` | Value Statics: Total count 284 - Distinct count 4 - Null count 0 Pts INTEGER, -- Example Values: `0`, `3`, `7`, `1`, `2` | Value Statics: Total count 284 - Distinct count 11 - Null count 0 ); CREATE TABLE CombinedShutouts ( foreign key (IDgoalie1) references Master (playerID) on update cascade on delete cascade, month INTEGER, -- Example Values: `3`, `2`, `11`, `1`, `12` | Value Statics: Total count 54 - Distinct count 8 - Null count 0 oppID TEXT, -- foreign key (IDgoalie2) references Master (playerID) on update cascade on delete cascade, "R/P" TEXT, -- Example Values: `R`, `P` | Value Statics: Total count 54 - Distinct count 2 - Null count 0 date INTEGER, -- tmID TEXT, -- IDgoalie1 TEXT, -- year INTEGER, -- IDgoalie2 TEXT, -- ); CREATE TABLE GoaliesSC ( GP INTEGER, -- Example Values: `3`, `5`, `6`, `4`, `1` | Value Statics: Total count 31 - Distinct count 6 - Null count 0 foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, tmID TEXT, -- Example Values: `OT1`, `OTS`, `MTM`, `TBS`, `SEA` | Value Statics: Total count 31 - Distinct count 17 - Null count 0 playerID TEXT not null, -- Example Values: `benedcl01`, `clancki01`, `holmeha01`, `lehmahu01`, `lindsbe01` | Value Statics: Total count 31 - Distinct count 11 - Null count 0 lgID TEXT, -- Example Values: `NHA`, `NHL`, `PCHA`, `WCHL` | Value Statics: Total count 31 - Distinct count 4 - Null count 0 foreign key (playerID) references Master (playerID) on update cascade on delete cascade, Min INTEGER, -- Example Values: `180`, `300`, `361`, `240`, `2` | Value Statics: Total count 31 - Distinct count 11 - Null count 0 SHO INTEGER, -- Example Values: `0`, `1`, `3`, `2` | Value Statics: Total count 31 - Distinct count 4 - Null count 0 W INTEGER, -- Example Values: `0`, `3`, `5`, `2`, `1` | Value Statics: Total count 31 - Distinct count 6 - Null count 0 GA INTEGER, -- Example Values: `26`, `11`, `12`, `8`, `3` | Value Statics: Total count 31 - Distinct count 17 - Null count 0 T INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 31 - Distinct count 2 - Null count 0 year INTEGER not null, -- Example Values: `1914`, `1919`, `1920`, `1922`, `1925` | Value Statics: Total count 31 - Distinct count 14 - Null count 0 primary key (playerID, year), L INTEGER, -- Example Values: `3`, `2`, `1`, `0` | Value Statics: Total count 31 - Distinct count 4 - Null count 0 ); CREATE TABLE Goalies ( PostT TEXT, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 106 - Distinct count 5 - Null count 4172 SHO TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 4257 - Distinct count 17 - Null count 21 L TEXT, -- PostMin TEXT, -- PostW TEXT, -- Example Values: `0`, `6`, `1`, `2`, `3` | Value Statics: Total count 1439 - Distinct count 17 - Null count 2839 Min TEXT, -- PostGA TEXT, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `NHA`, `WCHL`, `PCHA` | Value Statics: Total count 4278 - Distinct count 5 - Null count 0 ENG TEXT, -- Example Values: `0`, `1`, `3`, `4`, `5` | Value Statics: Total count 3533 - Distinct count 13 - Null count 745 GA TEXT, -- foreign key (playerID) references Master (playerID) on update cascade on delete cascade, PostSA TEXT, -- primary key (playerID, year, stint), playerID TEXT not null, -- "T/OL" TEXT, -- W TEXT, -- PostENG TEXT, -- Example Values: `0`, `1`, `2`, `3`, `5` | Value Statics: Total count 1187 - Distinct count 6 - Null count 3091 GP TEXT, -- PostSHO TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1439 - Distinct count 8 - Null count 2839 SA TEXT, -- stint INTEGER not null, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 4278 - Distinct count 3 - Null count 0 PostGP TEXT, -- tmID TEXT, -- year INTEGER not null, -- PostL TEXT, -- Example Values: `0`, `1`, `5`, `3`, `4` | Value Statics: Total count 1439 - Distinct count 12 - Null count 2839 foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, ); CREATE TABLE TeamsHalf ( GA INTEGER, -- year INTEGER not null, -- Example Values: `1916`, `1917`, `1918`, `1919`, `1920` | Value Statics: Total count 41 - Distinct count 5 - Null count 0 primary key (year, tmID, half), tmID TEXT not null, -- Example Values: `MOC`, `MOW`, `OT1`, `QU1`, `TBS` | Value Statics: Total count 41 - Distinct count 13 - Null count 0 rank INTEGER, -- Example Values: `1`, `3`, `5`, `4`, `2` | Value Statics: Total count 41 - Distinct count 6 - Null count 0 L INTEGER, -- Example Values: `3`, `7`, `8`, `2`, `5` | Value Statics: Total count 41 - Distinct count 11 - Null count 0 lgID TEXT, -- Example Values: `NHA`, `NHL` | Value Statics: Total count 41 - Distinct count 2 - Null count 0 half INTEGER not null, -- Example Values: `1`, `2` | Value Statics: Total count 41 - Distinct count 2 - Null count 0 GF INTEGER, -- T INTEGER, -- Example Values: `0` | Value Statics: Total count 41 - Distinct count 1 - Null count 0 foreign key (tmID, year) references Teams (tmID, year) on update cascade on delete cascade, G INTEGER, -- Example Values: `10`, `4`, `14`, `8`, `6` | Value Statics: Total count 41 - Distinct count 6 - Null count 0 W INTEGER, -- Example Values: `7`, `3`, `2`, `8`, `5` | Value Statics: Total count 41 - Distinct count 10 - Null count 0 ); CREATE TABLE ScoringSup ( SHA TEXT, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 41 - Distinct count 4 - Null count 96 year INTEGER, -- Example Values: `1988`, `1989`, `1987`, `1990` | Value Statics: Total count 137 - Distinct count 4 - Null count 0 playerID TEXT, -- PPA TEXT, -- foreign key (playerID) references Master (playerID) on update cascade on delete cascade, ); CREATE TABLE Coaches ( coachID TEXT not null, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `NHA`, `WCHL`, `PCHA` | Value Statics: Total count 1812 - Distinct count 5 - Null count 0 t INTEGER, -- l INTEGER, -- tmID TEXT not null, -- stint INTEGER not null, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 1812 - Distinct count 3 - Null count 0 postw TEXT, -- Example Values: `3`, `0`, `2`, `6`, `5` | Value Statics: Total count 927 - Distinct count 17 - Null count 885 w INTEGER, -- year INTEGER not null, -- notes TEXT, -- Example Values: `interim`, `co-coach with Barry Smith`, `co-coach with Dave Lewis` | Value Statics: Total count 11 - Distinct count 3 - Null count 1801 postg TEXT, -- foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, g INTEGER, -- postl TEXT, -- Example Values: `4`, `5`, `6`, `7`, `2` | Value Statics: Total count 927 - Distinct count 12 - Null count 885 postt TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 927 - Distinct count 5 - Null count 885 primary key (coachID, year, tmID, stint), ); CREATE TABLE TeamsSC ( GF INTEGER, -- Example Values: `12`, `16`, `13`, `8`, `26` | Value Statics: Total count 30 - Distinct count 17 - Null count 0 GA INTEGER, -- Example Values: `16`, `12`, `8`, `13`, `26` | Value Statics: Total count 30 - Distinct count 16 - Null count 0 G INTEGER, -- Example Values: `3`, `5`, `4`, `2`, `6` | Value Statics: Total count 30 - Distinct count 5 - Null count 0 W INTEGER, -- Example Values: `1`, `2`, `3`, `0`, `5` | Value Statics: Total count 30 - Distinct count 6 - Null count 0 T INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 30 - Distinct count 2 - Null count 0 L INTEGER, -- Example Values: `2`, `1`, `0`, `3` | Value Statics: Total count 30 - Distinct count 4 - Null count 0 foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, tmID TEXT not null, -- Example Values: `QU1`, `VA1`, `TBS`, `OT1`, `VML` | Value Statics: Total count 30 - Distinct count 17 - Null count 0 lgID TEXT, -- Example Values: `NHA`, `PCHA`, `NHL`, `WCHL` | Value Statics: Total count 30 - Distinct count 4 - Null count 0 PIM TEXT, -- Example Values: `24`, `20`, `75`, `53`, `50` | Value Statics: Total count 8 - Distinct count 7 - Null count 22 year INTEGER not null, -- Example Values: `1912`, `1913`, `1914`, `1915`, `1916` | Value Statics: Total count 30 - Distinct count 14 - Null count 0 primary key (year, tmID), );
human_resources
What is the education required to be account representative? Mention account representative full name and salary who got poor in performance status.
account representative is a position title; full name = firstname, lastname; poor performance refers to performance = 'Poor'
SELECT T2.educationrequired, T1.firstname, T1.lastname, T1.salary FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.performance = 'Poor' AND T2.positiontitle = 'Account Representative'
CREATE TABLE position ( minsalary TEXT, -- Example Values: `US$25,000.00`, `US$50,000.00`, `US$18,000.00`, `US$100,000.00` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 maxsalary TEXT, -- Example Values: `US$75,000.00`, `US$150,000.00`, `US$25,000.00`, `US$250,000.00` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 educationrequired TEXT, -- Example Values: `4 year degree`, `2 year degree`, `6 year degree` | Value Statics: Total count 4 - Distinct count 3 - Null count 0 positiontitle TEXT, -- Example Values: `Account Representative`, `Manager`, `Trainee`, `Regional Manager` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 positionID INTEGER constraint position_pk primary key, ); CREATE TABLE location ( officephone TEXT, -- Example Values: `(404)333-5555`, `(617)123-4444`, `(312)444-6666`, `(305)787-9999`, `(518)256-3100` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 locationcity TEXT, -- Example Values: `Atlanta`, `Boston`, `Chicago`, `Miami`, `New York City` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 zipcode INTEGER, -- Example Values: `30316`, `2190`, `60620`, `33103`, `15648` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 locationID INTEGER constraint location_pk primary key, address TEXT, -- Example Values: `450 Peachtree Rd`, `3 Commons Blvd`, `500 Loop Highway`, `210 Biscayne Blvd`, `1650 Washington Blvd` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 state TEXT, -- Example Values: `GA`, `MA`, `IL`, `FL`, `NY` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE employee ( positionID INTEGER, -- Example Values: `2`, `3`, `1`, `4` | Value Statics: Total count 25 - Distinct count 4 - Null count 0 performance TEXT, -- Example Values: `Average`, `Good`, `Poor` | Value Statics: Total count 23 - Distinct count 3 - Null count 2 lastname TEXT, -- foreign key (positionID) references position(positionID), firstname TEXT, -- Example Values: `Patricia`, `Sandy`, `Emily`, `Harold`, `James` | Value Statics: Total count 25 - Distinct count 19 - Null count 0 locationID INTEGER, -- Example Values: `2`, `1`, `5`, `3`, `4` | Value Statics: Total count 25 - Distinct count 7 - Null count 0 salary TEXT, -- ssn TEXT primary key, hiredate TEXT, -- gender TEXT, -- Example Values: `F`, `M` | Value Statics: Total count 24 - Distinct count 2 - Null count 1 foreign key (locationID) references location(locationID), );
hockey
List all players' given name who are good at both left and right hand and playing the forward position.
good at both left and right hand refers to shootCatch IS NULL;  playing the forward position refers to pos = 'F'
SELECT nameGiven FROM Master WHERE shootCatch IS NULL AND pos = 'F'
CREATE TABLE Scoring ( tmID TEXT, -- PIM INTEGER, -- PostA TEXT, -- GTG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 28106 - Distinct count 8 - Null count 17861 PostGP TEXT, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `PCHA`, `WCHL`, `NHA` | Value Statics: Total count 45967 - Distinct count 5 - Null count 0 PostG TEXT, -- PostSHG TEXT, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 14492 - Distinct count 4 - Null count 31475 "+/-" TEXT, -- "Post+/-" TEXT, -- PostSHA TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 8855 - Distinct count 5 - Null count 37112 PPA TEXT, -- SOG TEXT, -- PostSOG TEXT, -- foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, pos TEXT, -- foreign key (playerID) references Master (playerID) on update cascade on delete cascade, PostPPG TEXT, -- Example Values: `0`, `1`, `5`, `2`, `3` | Value Statics: Total count 14492 - Distinct count 10 - Null count 31475 SHA TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 23214 - Distinct count 11 - Null count 22753 SHG TEXT, -- Example Values: `0`, `2`, `1`, `5`, `7` | Value Statics: Total count 37744 - Distinct count 14 - Null count 8223 Pts INTEGER, -- A INTEGER, -- PostPIM TEXT, -- G INTEGER, -- PostGWG TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 15657 - Distinct count 8 - Null count 30310 PostPts TEXT, -- playerID TEXT, -- stint INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 45967 - Distinct count 4 - Null count 0 GWG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 36567 - Distinct count 16 - Null count 9400 PPG TEXT, -- PostPPA TEXT, -- Example Values: `0`, `1`, `3`, `2`, `4` | Value Statics: Total count 8854 - Distinct count 17 - Null count 37113 year INTEGER, -- ); CREATE TABLE AwardsCoaches ( coachID TEXT, -- foreign key (coachID) references Coaches (coachID), year INTEGER, -- note TEXT, -- award TEXT, -- Example Values: `First Team All-Star`, `Second Team All-Star`, `Jack Adams`, `Baldwin`, `Schmertz` | Value Statics: Total count 77 - Distinct count 5 - Null count 0 lgID TEXT, -- Example Values: `NHL`, `WHA` | Value Statics: Total count 77 - Distinct count 2 - Null count 0 ); CREATE TABLE HOF ( category TEXT, -- Example Values: `Player`, `Builder`, `Referee/Linesman` | Value Statics: Total count 365 - Distinct count 3 - Null count 0 hofID TEXT not null primary key, year INTEGER, -- name TEXT, -- ); CREATE TABLE SeriesPost ( GoalsLoser INTEGER, -- note TEXT, -- Example Values: `EX`, `TG`, `ND`, `DEF` | Value Statics: Total count 59 - Distinct count 4 - Null count 773 lgIDLoser TEXT, -- Example Values: `NHA`, `PCHA`, `NHL`, `WCHL`, `WHA` | Value Statics: Total count 832 - Distinct count 5 - Null count 0 tmIDWinner TEXT, -- series TEXT, -- Example Values: `A`, `B`, `C`, `D`, `E` | Value Statics: Total count 739 - Distinct count 15 - Null count 93 L INTEGER, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 832 - Distinct count 5 - Null count 0 tmIDLoser TEXT, -- foreign key (year, tmIDLoser) references Teams (year, tmID) on update cascade on delete cascade, year INTEGER, -- foreign key (year, tmIDWinner) references Teams (year, tmID) on update cascade on delete cascade, T INTEGER, -- Example Values: `0`, `1`, `2` | Value Statics: Total count 832 - Distinct count 3 - Null count 0 lgIDWinner TEXT, -- Example Values: `PCHA`, `NHA`, `NHL`, `WCHL`, `WHA` | Value Statics: Total count 832 - Distinct count 5 - Null count 0 round TEXT, -- Example Values: `SCF`, `F`, `SF`, `SCSF`, `WP` | Value Statics: Total count 832 - Distinct count 13 - Null count 0 GoalsWinner INTEGER, -- W INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `0` | Value Statics: Total count 832 - Distinct count 5 - Null count 0 ); CREATE TABLE abbrev ( Fullname TEXT, -- Code TEXT not null, -- primary key (Type, Code), Type TEXT not null, -- Example Values: `Conference`, `Division`, `Playoffs`, `Round` | Value Statics: Total count 58 - Distinct count 4 - Null count 0 ); CREATE TABLE AwardsMisc ( year INTEGER, -- lgID TEXT, -- Example Values: `NHL` | Value Statics: Total count 124 - Distinct count 1 - Null count 0 note TEXT, -- Example Values: `posthumous` | Value Statics: Total count 15 - Distinct count 1 - Null count 109 name TEXT not null primary key, ID TEXT, -- award TEXT, -- Example Values: `Patrick` | Value Statics: Total count 124 - Distinct count 1 - Null count 0 ); CREATE TABLE ScoringShootout ( year INTEGER, -- Example Values: `2006`, `2005`, `2007`, `2009`, `2008` | Value Statics: Total count 2072 - Distinct count 7 - Null count 0 foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, stint INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 2072 - Distinct count 3 - Null count 0 foreign key (playerID) references Master (playerID) on update cascade on delete cascade, G INTEGER, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 2072 - Distinct count 16 - Null count 0 tmID TEXT, -- GDG INTEGER, -- Example Values: `0`, `1`, `2`, `6`, `3` | Value Statics: Total count 2072 - Distinct count 8 - Null count 0 S INTEGER, -- Example Values: `1`, `2`, `5`, `6`, `3` | Value Statics: Total count 2072 - Distinct count 19 - Null count 0 playerID TEXT, -- ); CREATE TABLE TeamSplits ( OctOL TEXT, -- Example Values: `1`, `0`, `2`, `3`, `5` | Value Statics: Total count 358 - Distinct count 6 - Null count 1161 NovL TEXT, -- Example Values: `1`, `4`, `3`, `2`, `0` | Value Statics: Total count 1358 - Distinct count 14 - Null count 161 FebOL TEXT, -- Example Values: `0`, `1`, `4`, `2`, `3` | Value Statics: Total count 358 - Distinct count 6 - Null count 1161 NovW TEXT, -- Example Values: `5`, `1`, `2`, `0`, `4` | Value Statics: Total count 1358 - Distinct count 13 - Null count 161 primary key (year, tmID), JanT INTEGER, -- Example Values: `0`, `1`, `3`, `2`, `4` | Value Statics: Total count 1305 - Distinct count 9 - Null count 214 SepW TEXT, -- Example Values: `1` | Value Statics: Total count 2 - Distinct count 1 - Null count 1517 JanL INTEGER, -- Example Values: `1`, `3`, `2`, `0`, `6` | Value Statics: Total count 1515 - Distinct count 15 - Null count 4 lgID TEXT, -- Example Values: `NHA`, `PCHA`, `NHL`, `WCHL`, `WHA` | Value Statics: Total count 1519 - Distinct count 5 - Null count 0 OctW TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1199 - Distinct count 12 - Null count 320 AprW TEXT, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 1018 - Distinct count 11 - Null count 501 FebT INTEGER, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1300 - Distinct count 8 - Null count 219 JanW INTEGER, -- Example Values: `1`, `0`, `2`, `4`, `3` | Value Statics: Total count 1515 - Distinct count 14 - Null count 4 foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, rT INTEGER, -- Example Values: `0`, `1`, `2`, `3`, `6` | Value Statics: Total count 1309 - Distinct count 16 - Null count 210 tmID TEXT not null, -- DecW TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1473 - Distinct count 14 - Null count 46 year INTEGER not null, -- OctL TEXT, -- Example Values: `1`, `0`, `2`, `4`, `5` | Value Statics: Total count 1199 - Distinct count 13 - Null count 320 SepT TEXT, -- AprOL TEXT, -- Example Values: `1`, `0`, `2`, `3` | Value Statics: Total count 358 - Distinct count 4 - Null count 1161 NovOL TEXT, -- Example Values: `0`, `2`, `1`, `4`, `3` | Value Statics: Total count 358 - Distinct count 5 - Null count 1161 FebW INTEGER, -- Example Values: `2`, `1`, `6`, `5`, `4` | Value Statics: Total count 1510 - Distinct count 14 - Null count 9 MarOL TEXT, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 358 - Distinct count 7 - Null count 1161 hL INTEGER, -- MarL TEXT, -- Example Values: `4`, `0`, `2`, `1`, `3` | Value Statics: Total count 1485 - Distinct count 15 - Null count 34 hT INTEGER, -- Example Values: `0`, `1`, `2`, `4`, `3` | Value Statics: Total count 1309 - Distinct count 14 - Null count 210 JanOL TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 358 - Distinct count 6 - Null count 1161 rOTL TEXT, -- Example Values: `1`, `5`, `3`, `4`, `0` | Value Statics: Total count 358 - Distinct count 11 - Null count 1161 DecL TEXT, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 1473 - Distinct count 14 - Null count 46 MarT TEXT, -- Example Values: `0`, `1`, `2`, `4`, `3` | Value Statics: Total count 1275 - Distinct count 8 - Null count 244 FebL INTEGER, -- Example Values: `3`, `5`, `0`, `1`, `2` | Value Statics: Total count 1510 - Distinct count 13 - Null count 9 MarW TEXT, -- Example Values: `1`, `3`, `0`, `2`, `5` | Value Statics: Total count 1485 - Distinct count 14 - Null count 34 AprT TEXT, -- Example Values: `0`, `1`, `2`, `4`, `3` | Value Statics: Total count 808 - Distinct count 6 - Null count 711 OctT TEXT, -- Example Values: `0`, `1`, `4`, `2`, `3` | Value Statics: Total count 989 - Distinct count 7 - Null count 530 DecOL TEXT, -- Example Values: `0`, `2`, `1`, `3`, `4` | Value Statics: Total count 358 - Distinct count 6 - Null count 1161 DecT TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1263 - Distinct count 8 - Null count 256 NovT TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1148 - Distinct count 9 - Null count 371 hW INTEGER, -- AprL TEXT, -- Example Values: `0`, `2`, `1`, `3`, `4` | Value Statics: Total count 1018 - Distinct count 11 - Null count 501 SepOL TEXT, -- Example Values: `0` | Value Statics: Total count 2 - Distinct count 1 - Null count 1517 rW INTEGER, -- rL INTEGER, -- hOTL TEXT, -- Example Values: `2`, `3`, `1`, `0`, `4` | Value Statics: Total count 358 - Distinct count 12 - Null count 1161 SepL TEXT, -- Example Values: `1` | Value Statics: Total count 2 - Distinct count 1 - Null count 1517 ); CREATE TABLE Master ( lastNHL TEXT, -- deathMon TEXT, -- Example Values: `8`, `2`, `12`, `5`, `3` | Value Statics: Total count 1173 - Distinct count 12 - Null count 6588 birthCity TEXT, -- lastName TEXT not null, -- height TEXT, -- pos TEXT, -- Example Values: `C`, `D`, `G`, `L`, `R` | Value Statics: Total count 7447 - Distinct count 18 - Null count 314 nameGiven TEXT, -- playerID TEXT, -- deathDay TEXT, -- deathYear TEXT, -- hofID TEXT, -- deathCountry TEXT, -- Example Values: `USA`, `Canada`, `France`, `Belgium`, `Russia` | Value Statics: Total count 498 - Distinct count 14 - Null count 7263 deathState TEXT, -- firstNHL TEXT, -- birthCountry TEXT, -- birthDay TEXT, -- legendsID TEXT, -- hrefID TEXT, -- coachID TEXT, -- birthState TEXT, -- birthMon TEXT, -- Example Values: `3`, `8`, `2`, `5`, `12` | Value Statics: Total count 7506 - Distinct count 12 - Null count 255 deathCity TEXT, -- firstName TEXT, -- nameNick TEXT, -- firstWHA TEXT, -- Example Values: `1975`, `1976`, `1974`, `1973`, `1978` | Value Statics: Total count 903 - Distinct count 7 - Null count 6858 lastWHA TEXT, -- Example Values: `1975`, `1977`, `1976`, `1973`, `1978` | Value Statics: Total count 903 - Distinct count 7 - Null count 6858 foreign key (coachID) references Coaches (coachID) on update cascade on delete cascade, ihdbID TEXT, -- birthYear TEXT, -- weight TEXT, -- nameNote TEXT, -- Example Values: `also known as Bellehumeur`, `also listed as Bourdginon`, `born Bodnarchuk`, `also known as Bowcher`, `also known as Burmeister` | Value Statics: Total count 18 - Distinct count 18 - Null count 7743 shootCatch TEXT, -- Example Values: `L`, `R`, `B` | Value Statics: Total count 7048 - Distinct count 3 - Null count 713 ); CREATE TABLE TeamsPost ( year INTEGER not null, -- G INTEGER, -- PPG TEXT, -- L INTEGER, -- Example Values: `1`, `0`, `4`, `2`, `3` | Value Statics: Total count 927 - Distinct count 12 - Null count 0 BenchMinor TEXT, -- Example Values: `0`, `6`, `2`, `4`, `10` | Value Statics: Total count 572 - Distinct count 8 - Null count 355 PKC TEXT, -- SHA TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 604 - Distinct count 9 - Null count 323 tmID TEXT not null, -- foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, lgID TEXT, -- Example Values: `NHA`, `NHL`, `PCHA`, `WCHL`, `WHA` | Value Statics: Total count 927 - Distinct count 5 - Null count 0 PPC TEXT, -- PIM TEXT, -- GA INTEGER, -- GF INTEGER, -- SHF TEXT, -- Example Values: `0`, `1`, `3`, `5`, `2` | Value Statics: Total count 636 - Distinct count 11 - Null count 291 T INTEGER, -- Example Values: `0`, `1`, `2`, `4`, `3` | Value Statics: Total count 927 - Distinct count 5 - Null count 0 W INTEGER, -- Example Values: `1`, `0`, `4`, `2`, `3` | Value Statics: Total count 927 - Distinct count 17 - Null count 0 primary key (year, tmID), PKG TEXT, -- ); CREATE TABLE AwardsPlayers ( primary key (playerID, award, year), playerID TEXT not null, -- foreign key (playerID) references Master (playerID) on update cascade on delete cascade, award TEXT not null, -- year INTEGER not null, -- lgID TEXT, -- Example Values: `NHL`, `WHA` | Value Statics: Total count 2091 - Distinct count 2 - Null count 0 note TEXT, -- Example Values: `tie`, `shared`, `Most Gentlemanly`, `Rookie`, `Best Goaltender` | Value Statics: Total count 127 - Distinct count 8 - Null count 1964 pos TEXT, -- Example Values: `C`, `LW`, `F`, `RW`, `D` | Value Statics: Total count 1231 - Distinct count 7 - Null count 860 ); CREATE TABLE GoaliesShootout ( year INTEGER, -- Example Values: `2005`, `2006`, `2008`, `2009`, `2010` | Value Statics: Total count 480 - Distinct count 7 - Null count 0 stint INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 480 - Distinct count 2 - Null count 0 tmID TEXT, -- W INTEGER, -- Example Values: `2`, `0`, `1`, `7`, `6` | Value Statics: Total count 480 - Distinct count 11 - Null count 0 L INTEGER, -- Example Values: `1`, `2`, `3`, `0`, `4` | Value Statics: Total count 480 - Distinct count 10 - Null count 0 playerID TEXT, -- GA INTEGER, -- SA INTEGER, -- foreign key (playerID) references Master (playerID) on update cascade on delete cascade, foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, ); CREATE TABLE Teams ( L INTEGER, -- name TEXT, -- W INTEGER, -- confID TEXT, -- Example Values: `CC`, `WA`, `WC`, `EC` | Value Statics: Total count 902 - Distinct count 4 - Null count 617 GA INTEGER, -- SoL TEXT, -- Example Values: `7`, `5`, `8`, `2`, `3` | Value Statics: Total count 210 - Distinct count 12 - Null count 1309 BenchMinor TEXT, -- playoff TEXT, -- lgID TEXT, -- Example Values: `NHA`, `PCHA`, `NHL`, `WCHL`, `WHA` | Value Statics: Total count 1519 - Distinct count 5 - Null count 0 G INTEGER, -- GF INTEGER, -- OTL TEXT, -- Example Values: `3`, `4`, `6`, `5`, `0` | Value Statics: Total count 358 - Distinct count 18 - Null count 1161 tmID TEXT not null, -- franchID TEXT, -- primary key (year, tmID), PPC TEXT, -- SHF TEXT, -- T INTEGER, -- SoW TEXT, -- Example Values: `3`, `5`, `2`, `8`, `12` | Value Statics: Total count 210 - Distinct count 15 - Null count 1309 Pts INTEGER, -- PKG TEXT, -- PPG TEXT, -- PKC TEXT, -- divID TEXT, -- Example Values: `AM`, `CA`, `ED`, `WD`, `WW` | Value Statics: Total count 1171 - Distinct count 17 - Null count 348 PIM TEXT, -- rank INTEGER, -- Example Values: `4`, `5`, `7`, `6`, `1` | Value Statics: Total count 1519 - Distinct count 10 - Null count 0 SHA TEXT, -- year INTEGER not null, -- ); CREATE TABLE TeamVsTeam ( oppID TEXT not null, -- T INTEGER, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 19962 - Distinct count 9 - Null count 5640 foreign key (oppID, year) references Teams (tmID, year) on update cascade on delete cascade, OTL TEXT, -- Example Values: `0`, `1`, `3`, `2`, `4` | Value Statics: Total count 9874 - Distinct count 5 - Null count 15728 tmID TEXT not null, -- primary key (year, tmID, oppID), lgID TEXT, -- Example Values: `NHA`, `PCHA`, `NHL`, `WCHL`, `WHA` | Value Statics: Total count 25602 - Distinct count 5 - Null count 0 year INTEGER not null, -- L INTEGER, -- Example Values: `1`, `0`, `2`, `4`, `3` | Value Statics: Total count 25602 - Distinct count 14 - Null count 0 W INTEGER, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 25602 - Distinct count 14 - Null count 0 foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, ); CREATE TABLE ScoringSC ( foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, tmID TEXT, -- Example Values: `VML`, `CAT`, `VIC`, `TRS`, `MOC` | Value Statics: Total count 284 - Distinct count 17 - Null count 0 year INTEGER, -- Example Values: `1920`, `1921`, `1923`, `1924`, `1925` | Value Statics: Total count 284 - Distinct count 14 - Null count 0 playerID TEXT, -- G INTEGER, -- Example Values: `0`, `2`, `6`, `1`, `3` | Value Statics: Total count 284 - Distinct count 11 - Null count 0 foreign key (playerID) references Master (playerID) on update cascade on delete cascade, GP INTEGER, -- Example Values: `4`, `5`, `2`, `1`, `3` | Value Statics: Total count 284 - Distinct count 6 - Null count 0 A INTEGER, -- Example Values: `0`, `1`, `2`, `3`, `5` | Value Statics: Total count 284 - Distinct count 6 - Null count 0 PIM INTEGER, -- pos TEXT, -- Example Values: `R`, `C`, `L`, `F`, `G` | Value Statics: Total count 284 - Distinct count 11 - Null count 0 lgID TEXT, -- Example Values: `PCHA`, `WCHL`, `NHL`, `NHA` | Value Statics: Total count 284 - Distinct count 4 - Null count 0 Pts INTEGER, -- Example Values: `0`, `3`, `7`, `1`, `2` | Value Statics: Total count 284 - Distinct count 11 - Null count 0 ); CREATE TABLE CombinedShutouts ( foreign key (IDgoalie1) references Master (playerID) on update cascade on delete cascade, month INTEGER, -- Example Values: `3`, `2`, `11`, `1`, `12` | Value Statics: Total count 54 - Distinct count 8 - Null count 0 oppID TEXT, -- foreign key (IDgoalie2) references Master (playerID) on update cascade on delete cascade, "R/P" TEXT, -- Example Values: `R`, `P` | Value Statics: Total count 54 - Distinct count 2 - Null count 0 date INTEGER, -- tmID TEXT, -- IDgoalie1 TEXT, -- year INTEGER, -- IDgoalie2 TEXT, -- ); CREATE TABLE GoaliesSC ( GP INTEGER, -- Example Values: `3`, `5`, `6`, `4`, `1` | Value Statics: Total count 31 - Distinct count 6 - Null count 0 foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, tmID TEXT, -- Example Values: `OT1`, `OTS`, `MTM`, `TBS`, `SEA` | Value Statics: Total count 31 - Distinct count 17 - Null count 0 playerID TEXT not null, -- Example Values: `benedcl01`, `clancki01`, `holmeha01`, `lehmahu01`, `lindsbe01` | Value Statics: Total count 31 - Distinct count 11 - Null count 0 lgID TEXT, -- Example Values: `NHA`, `NHL`, `PCHA`, `WCHL` | Value Statics: Total count 31 - Distinct count 4 - Null count 0 foreign key (playerID) references Master (playerID) on update cascade on delete cascade, Min INTEGER, -- Example Values: `180`, `300`, `361`, `240`, `2` | Value Statics: Total count 31 - Distinct count 11 - Null count 0 SHO INTEGER, -- Example Values: `0`, `1`, `3`, `2` | Value Statics: Total count 31 - Distinct count 4 - Null count 0 W INTEGER, -- Example Values: `0`, `3`, `5`, `2`, `1` | Value Statics: Total count 31 - Distinct count 6 - Null count 0 GA INTEGER, -- Example Values: `26`, `11`, `12`, `8`, `3` | Value Statics: Total count 31 - Distinct count 17 - Null count 0 T INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 31 - Distinct count 2 - Null count 0 year INTEGER not null, -- Example Values: `1914`, `1919`, `1920`, `1922`, `1925` | Value Statics: Total count 31 - Distinct count 14 - Null count 0 primary key (playerID, year), L INTEGER, -- Example Values: `3`, `2`, `1`, `0` | Value Statics: Total count 31 - Distinct count 4 - Null count 0 ); CREATE TABLE Goalies ( PostT TEXT, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 106 - Distinct count 5 - Null count 4172 SHO TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 4257 - Distinct count 17 - Null count 21 L TEXT, -- PostMin TEXT, -- PostW TEXT, -- Example Values: `0`, `6`, `1`, `2`, `3` | Value Statics: Total count 1439 - Distinct count 17 - Null count 2839 Min TEXT, -- PostGA TEXT, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `NHA`, `WCHL`, `PCHA` | Value Statics: Total count 4278 - Distinct count 5 - Null count 0 ENG TEXT, -- Example Values: `0`, `1`, `3`, `4`, `5` | Value Statics: Total count 3533 - Distinct count 13 - Null count 745 GA TEXT, -- foreign key (playerID) references Master (playerID) on update cascade on delete cascade, PostSA TEXT, -- primary key (playerID, year, stint), playerID TEXT not null, -- "T/OL" TEXT, -- W TEXT, -- PostENG TEXT, -- Example Values: `0`, `1`, `2`, `3`, `5` | Value Statics: Total count 1187 - Distinct count 6 - Null count 3091 GP TEXT, -- PostSHO TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1439 - Distinct count 8 - Null count 2839 SA TEXT, -- stint INTEGER not null, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 4278 - Distinct count 3 - Null count 0 PostGP TEXT, -- tmID TEXT, -- year INTEGER not null, -- PostL TEXT, -- Example Values: `0`, `1`, `5`, `3`, `4` | Value Statics: Total count 1439 - Distinct count 12 - Null count 2839 foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, ); CREATE TABLE TeamsHalf ( GA INTEGER, -- year INTEGER not null, -- Example Values: `1916`, `1917`, `1918`, `1919`, `1920` | Value Statics: Total count 41 - Distinct count 5 - Null count 0 primary key (year, tmID, half), tmID TEXT not null, -- Example Values: `MOC`, `MOW`, `OT1`, `QU1`, `TBS` | Value Statics: Total count 41 - Distinct count 13 - Null count 0 rank INTEGER, -- Example Values: `1`, `3`, `5`, `4`, `2` | Value Statics: Total count 41 - Distinct count 6 - Null count 0 L INTEGER, -- Example Values: `3`, `7`, `8`, `2`, `5` | Value Statics: Total count 41 - Distinct count 11 - Null count 0 lgID TEXT, -- Example Values: `NHA`, `NHL` | Value Statics: Total count 41 - Distinct count 2 - Null count 0 half INTEGER not null, -- Example Values: `1`, `2` | Value Statics: Total count 41 - Distinct count 2 - Null count 0 GF INTEGER, -- T INTEGER, -- Example Values: `0` | Value Statics: Total count 41 - Distinct count 1 - Null count 0 foreign key (tmID, year) references Teams (tmID, year) on update cascade on delete cascade, G INTEGER, -- Example Values: `10`, `4`, `14`, `8`, `6` | Value Statics: Total count 41 - Distinct count 6 - Null count 0 W INTEGER, -- Example Values: `7`, `3`, `2`, `8`, `5` | Value Statics: Total count 41 - Distinct count 10 - Null count 0 ); CREATE TABLE ScoringSup ( SHA TEXT, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 41 - Distinct count 4 - Null count 96 year INTEGER, -- Example Values: `1988`, `1989`, `1987`, `1990` | Value Statics: Total count 137 - Distinct count 4 - Null count 0 playerID TEXT, -- PPA TEXT, -- foreign key (playerID) references Master (playerID) on update cascade on delete cascade, ); CREATE TABLE Coaches ( coachID TEXT not null, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `NHA`, `WCHL`, `PCHA` | Value Statics: Total count 1812 - Distinct count 5 - Null count 0 t INTEGER, -- l INTEGER, -- tmID TEXT not null, -- stint INTEGER not null, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 1812 - Distinct count 3 - Null count 0 postw TEXT, -- Example Values: `3`, `0`, `2`, `6`, `5` | Value Statics: Total count 927 - Distinct count 17 - Null count 885 w INTEGER, -- year INTEGER not null, -- notes TEXT, -- Example Values: `interim`, `co-coach with Barry Smith`, `co-coach with Dave Lewis` | Value Statics: Total count 11 - Distinct count 3 - Null count 1801 postg TEXT, -- foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, g INTEGER, -- postl TEXT, -- Example Values: `4`, `5`, `6`, `7`, `2` | Value Statics: Total count 927 - Distinct count 12 - Null count 885 postt TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 927 - Distinct count 5 - Null count 885 primary key (coachID, year, tmID, stint), ); CREATE TABLE TeamsSC ( GF INTEGER, -- Example Values: `12`, `16`, `13`, `8`, `26` | Value Statics: Total count 30 - Distinct count 17 - Null count 0 GA INTEGER, -- Example Values: `16`, `12`, `8`, `13`, `26` | Value Statics: Total count 30 - Distinct count 16 - Null count 0 G INTEGER, -- Example Values: `3`, `5`, `4`, `2`, `6` | Value Statics: Total count 30 - Distinct count 5 - Null count 0 W INTEGER, -- Example Values: `1`, `2`, `3`, `0`, `5` | Value Statics: Total count 30 - Distinct count 6 - Null count 0 T INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 30 - Distinct count 2 - Null count 0 L INTEGER, -- Example Values: `2`, `1`, `0`, `3` | Value Statics: Total count 30 - Distinct count 4 - Null count 0 foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, tmID TEXT not null, -- Example Values: `QU1`, `VA1`, `TBS`, `OT1`, `VML` | Value Statics: Total count 30 - Distinct count 17 - Null count 0 lgID TEXT, -- Example Values: `NHA`, `PCHA`, `NHL`, `WCHL` | Value Statics: Total count 30 - Distinct count 4 - Null count 0 PIM TEXT, -- Example Values: `24`, `20`, `75`, `53`, `50` | Value Statics: Total count 8 - Distinct count 7 - Null count 22 year INTEGER not null, -- Example Values: `1912`, `1913`, `1914`, `1915`, `1916` | Value Statics: Total count 30 - Distinct count 14 - Null count 0 primary key (year, tmID), );
cs_semester
What is the average teaching ability of the most popular professors?
average = AVG(teachingability); most popular professor refers to MAX(popularity);
SELECT CAST(SUM(teachingability) AS REAL) / COUNT(prof_id) FROM prof WHERE popularity = ( SELECT MAX(popularity) FROM prof )
CREATE TABLE prof ( teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0 gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `npigford0@hku.hk`, `zzhihua@hku.hk`, `ozywicki2@hku.hk`, `mconkay3@ucla.edu`, `bmolen4@hku.hk` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 first_name TEXT, -- Example Values: `Nathaniel`, `Zhihua`, `Ogdon`, `Merwyn`, `Bernhard` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 graduate_from TEXT, -- Example Values: `University of Washington`, `Beijing Polytechnic University`, `University of Boston`, `Carnegie Mellon University`, `Princeton University` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 last_name TEXT, -- Example Values: `Pigford`, `Zhou`, `Zywicki`, `Conkay`, `Molen` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 popularity INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 prof_id INTEGER constraint prof_pk primary key, ); CREATE TABLE student ( email TEXT, -- f_name TEXT, -- intelligence INTEGER, -- Example Values: `5`, `2`, `1`, `3`, `4` | Value Statics: Total count 38 - Distinct count 5 - Null count 0 l_name TEXT, -- type TEXT, -- Example Values: `RPG`, `TPG`, `UG` | Value Statics: Total count 38 - Distinct count 3 - Null count 0 student_id INTEGER primary key, gpa REAL, -- Example Values: `2.4`, `2.7`, `3.5`, `2.8`, `3.9` | Value Statics: Total count 38 - Distinct count 16 - Null count 0 phone_number TEXT, -- ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, name TEXT, -- Example Values: `Machine Learning Theory`, `Intro to Database 1`, `Intro to Database 2`, `Natural Language Processing`, `Intro to BlockChain` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 diff INTEGER, -- Example Values: `3`, `4`, `1`, `5`, `2` | Value Statics: Total count 13 - Distinct count 5 - Null count 0 credit INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 13 - Distinct count 2 - Null count 0 ); CREATE TABLE registration ( sat INTEGER, -- Example Values: `5`, `4`, `3`, `2`, `1` | Value Statics: Total count 101 - Distinct count 5 - Null count 0 course_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 101 - Distinct count 13 - Null count 0 foreign key (student_id) references student(student_id), primary key (course_id, student_id), foreign key (course_id) references course(course_id), student_id INTEGER, -- grade TEXT, -- Example Values: `A`, `B`, `C`, `D` | Value Statics: Total count 96 - Distinct count 4 - Null count 5 ); CREATE TABLE RA ( prof_id INTEGER, -- Example Values: `7`, `10`, `13`, `9`, `2` | Value Statics: Total count 35 - Distinct count 13 - Null count 0 salary TEXT, -- Example Values: `med`, `high`, `low`, `free` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 student_id INTEGER, -- capability INTEGER, -- Example Values: `2`, `5`, `4`, `3` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 foreign key (prof_id) references prof(prof_id), foreign key (student_id) references student(student_id), primary key (student_id, prof_id), );
human_resources
Among the employees with poor performance, provide the managers' full names, location city, address and its zip code.
poor performance refers to performance = 'Poor'; full name = firstname, lastname; managers is a position title
SELECT T1.firstname, T1.lastname, T2.locationcity, T2.address, T2.zipcode FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID INNER JOIN position AS T3 ON T3.positionID = T1.positionID WHERE T3.positiontitle = 'Manager' AND T1.performance = 'Poor'
CREATE TABLE position ( minsalary TEXT, -- Example Values: `US$25,000.00`, `US$50,000.00`, `US$18,000.00`, `US$100,000.00` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 maxsalary TEXT, -- Example Values: `US$75,000.00`, `US$150,000.00`, `US$25,000.00`, `US$250,000.00` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 educationrequired TEXT, -- Example Values: `4 year degree`, `2 year degree`, `6 year degree` | Value Statics: Total count 4 - Distinct count 3 - Null count 0 positiontitle TEXT, -- Example Values: `Account Representative`, `Manager`, `Trainee`, `Regional Manager` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 positionID INTEGER constraint position_pk primary key, ); CREATE TABLE location ( officephone TEXT, -- Example Values: `(404)333-5555`, `(617)123-4444`, `(312)444-6666`, `(305)787-9999`, `(518)256-3100` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 locationcity TEXT, -- Example Values: `Atlanta`, `Boston`, `Chicago`, `Miami`, `New York City` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 zipcode INTEGER, -- Example Values: `30316`, `2190`, `60620`, `33103`, `15648` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 locationID INTEGER constraint location_pk primary key, address TEXT, -- Example Values: `450 Peachtree Rd`, `3 Commons Blvd`, `500 Loop Highway`, `210 Biscayne Blvd`, `1650 Washington Blvd` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 state TEXT, -- Example Values: `GA`, `MA`, `IL`, `FL`, `NY` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE employee ( positionID INTEGER, -- Example Values: `2`, `3`, `1`, `4` | Value Statics: Total count 25 - Distinct count 4 - Null count 0 performance TEXT, -- Example Values: `Average`, `Good`, `Poor` | Value Statics: Total count 23 - Distinct count 3 - Null count 2 lastname TEXT, -- foreign key (positionID) references position(positionID), firstname TEXT, -- Example Values: `Patricia`, `Sandy`, `Emily`, `Harold`, `James` | Value Statics: Total count 25 - Distinct count 19 - Null count 0 locationID INTEGER, -- Example Values: `2`, `1`, `5`, `3`, `4` | Value Statics: Total count 25 - Distinct count 7 - Null count 0 salary TEXT, -- ssn TEXT primary key, hiredate TEXT, -- gender TEXT, -- Example Values: `F`, `M` | Value Statics: Total count 24 - Distinct count 2 - Null count 1 foreign key (locationID) references location(locationID), );
hockey
List the first Name and last name of all players not from USA and who are born in 1990 .
Not from USA refers to birthCountry! = 'USA'; born in 1990 refers to birthYear = 1990
SELECT firstName, lastName FROM Master WHERE birthYear = 1990 AND birthCountry != 'USA'
CREATE TABLE Scoring ( tmID TEXT, -- PIM INTEGER, -- PostA TEXT, -- GTG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 28106 - Distinct count 8 - Null count 17861 PostGP TEXT, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `PCHA`, `WCHL`, `NHA` | Value Statics: Total count 45967 - Distinct count 5 - Null count 0 PostG TEXT, -- PostSHG TEXT, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 14492 - Distinct count 4 - Null count 31475 "+/-" TEXT, -- "Post+/-" TEXT, -- PostSHA TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 8855 - Distinct count 5 - Null count 37112 PPA TEXT, -- SOG TEXT, -- PostSOG TEXT, -- foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, pos TEXT, -- foreign key (playerID) references Master (playerID) on update cascade on delete cascade, PostPPG TEXT, -- Example Values: `0`, `1`, `5`, `2`, `3` | Value Statics: Total count 14492 - Distinct count 10 - Null count 31475 SHA TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 23214 - Distinct count 11 - Null count 22753 SHG TEXT, -- Example Values: `0`, `2`, `1`, `5`, `7` | Value Statics: Total count 37744 - Distinct count 14 - Null count 8223 Pts INTEGER, -- A INTEGER, -- PostPIM TEXT, -- G INTEGER, -- PostGWG TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 15657 - Distinct count 8 - Null count 30310 PostPts TEXT, -- playerID TEXT, -- stint INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 45967 - Distinct count 4 - Null count 0 GWG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 36567 - Distinct count 16 - Null count 9400 PPG TEXT, -- PostPPA TEXT, -- Example Values: `0`, `1`, `3`, `2`, `4` | Value Statics: Total count 8854 - Distinct count 17 - Null count 37113 year INTEGER, -- ); CREATE TABLE AwardsCoaches ( coachID TEXT, -- foreign key (coachID) references Coaches (coachID), year INTEGER, -- note TEXT, -- award TEXT, -- Example Values: `First Team All-Star`, `Second Team All-Star`, `Jack Adams`, `Baldwin`, `Schmertz` | Value Statics: Total count 77 - Distinct count 5 - Null count 0 lgID TEXT, -- Example Values: `NHL`, `WHA` | Value Statics: Total count 77 - Distinct count 2 - Null count 0 ); CREATE TABLE HOF ( category TEXT, -- Example Values: `Player`, `Builder`, `Referee/Linesman` | Value Statics: Total count 365 - Distinct count 3 - Null count 0 hofID TEXT not null primary key, year INTEGER, -- name TEXT, -- ); CREATE TABLE SeriesPost ( GoalsLoser INTEGER, -- note TEXT, -- Example Values: `EX`, `TG`, `ND`, `DEF` | Value Statics: Total count 59 - Distinct count 4 - Null count 773 lgIDLoser TEXT, -- Example Values: `NHA`, `PCHA`, `NHL`, `WCHL`, `WHA` | Value Statics: Total count 832 - Distinct count 5 - Null count 0 tmIDWinner TEXT, -- series TEXT, -- Example Values: `A`, `B`, `C`, `D`, `E` | Value Statics: Total count 739 - Distinct count 15 - Null count 93 L INTEGER, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 832 - Distinct count 5 - Null count 0 tmIDLoser TEXT, -- foreign key (year, tmIDLoser) references Teams (year, tmID) on update cascade on delete cascade, year INTEGER, -- foreign key (year, tmIDWinner) references Teams (year, tmID) on update cascade on delete cascade, T INTEGER, -- Example Values: `0`, `1`, `2` | Value Statics: Total count 832 - Distinct count 3 - Null count 0 lgIDWinner TEXT, -- Example Values: `PCHA`, `NHA`, `NHL`, `WCHL`, `WHA` | Value Statics: Total count 832 - Distinct count 5 - Null count 0 round TEXT, -- Example Values: `SCF`, `F`, `SF`, `SCSF`, `WP` | Value Statics: Total count 832 - Distinct count 13 - Null count 0 GoalsWinner INTEGER, -- W INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `0` | Value Statics: Total count 832 - Distinct count 5 - Null count 0 ); CREATE TABLE abbrev ( Fullname TEXT, -- Code TEXT not null, -- primary key (Type, Code), Type TEXT not null, -- Example Values: `Conference`, `Division`, `Playoffs`, `Round` | Value Statics: Total count 58 - Distinct count 4 - Null count 0 ); CREATE TABLE AwardsMisc ( year INTEGER, -- lgID TEXT, -- Example Values: `NHL` | Value Statics: Total count 124 - Distinct count 1 - Null count 0 note TEXT, -- Example Values: `posthumous` | Value Statics: Total count 15 - Distinct count 1 - Null count 109 name TEXT not null primary key, ID TEXT, -- award TEXT, -- Example Values: `Patrick` | Value Statics: Total count 124 - Distinct count 1 - Null count 0 ); CREATE TABLE ScoringShootout ( year INTEGER, -- Example Values: `2006`, `2005`, `2007`, `2009`, `2008` | Value Statics: Total count 2072 - Distinct count 7 - Null count 0 foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, stint INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 2072 - Distinct count 3 - Null count 0 foreign key (playerID) references Master (playerID) on update cascade on delete cascade, G INTEGER, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 2072 - Distinct count 16 - Null count 0 tmID TEXT, -- GDG INTEGER, -- Example Values: `0`, `1`, `2`, `6`, `3` | Value Statics: Total count 2072 - Distinct count 8 - Null count 0 S INTEGER, -- Example Values: `1`, `2`, `5`, `6`, `3` | Value Statics: Total count 2072 - Distinct count 19 - Null count 0 playerID TEXT, -- ); CREATE TABLE TeamSplits ( OctOL TEXT, -- Example Values: `1`, `0`, `2`, `3`, `5` | Value Statics: Total count 358 - Distinct count 6 - Null count 1161 NovL TEXT, -- Example Values: `1`, `4`, `3`, `2`, `0` | Value Statics: Total count 1358 - Distinct count 14 - Null count 161 FebOL TEXT, -- Example Values: `0`, `1`, `4`, `2`, `3` | Value Statics: Total count 358 - Distinct count 6 - Null count 1161 NovW TEXT, -- Example Values: `5`, `1`, `2`, `0`, `4` | Value Statics: Total count 1358 - Distinct count 13 - Null count 161 primary key (year, tmID), JanT INTEGER, -- Example Values: `0`, `1`, `3`, `2`, `4` | Value Statics: Total count 1305 - Distinct count 9 - Null count 214 SepW TEXT, -- Example Values: `1` | Value Statics: Total count 2 - Distinct count 1 - Null count 1517 JanL INTEGER, -- Example Values: `1`, `3`, `2`, `0`, `6` | Value Statics: Total count 1515 - Distinct count 15 - Null count 4 lgID TEXT, -- Example Values: `NHA`, `PCHA`, `NHL`, `WCHL`, `WHA` | Value Statics: Total count 1519 - Distinct count 5 - Null count 0 OctW TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1199 - Distinct count 12 - Null count 320 AprW TEXT, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 1018 - Distinct count 11 - Null count 501 FebT INTEGER, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1300 - Distinct count 8 - Null count 219 JanW INTEGER, -- Example Values: `1`, `0`, `2`, `4`, `3` | Value Statics: Total count 1515 - Distinct count 14 - Null count 4 foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, rT INTEGER, -- Example Values: `0`, `1`, `2`, `3`, `6` | Value Statics: Total count 1309 - Distinct count 16 - Null count 210 tmID TEXT not null, -- DecW TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1473 - Distinct count 14 - Null count 46 year INTEGER not null, -- OctL TEXT, -- Example Values: `1`, `0`, `2`, `4`, `5` | Value Statics: Total count 1199 - Distinct count 13 - Null count 320 SepT TEXT, -- AprOL TEXT, -- Example Values: `1`, `0`, `2`, `3` | Value Statics: Total count 358 - Distinct count 4 - Null count 1161 NovOL TEXT, -- Example Values: `0`, `2`, `1`, `4`, `3` | Value Statics: Total count 358 - Distinct count 5 - Null count 1161 FebW INTEGER, -- Example Values: `2`, `1`, `6`, `5`, `4` | Value Statics: Total count 1510 - Distinct count 14 - Null count 9 MarOL TEXT, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 358 - Distinct count 7 - Null count 1161 hL INTEGER, -- MarL TEXT, -- Example Values: `4`, `0`, `2`, `1`, `3` | Value Statics: Total count 1485 - Distinct count 15 - Null count 34 hT INTEGER, -- Example Values: `0`, `1`, `2`, `4`, `3` | Value Statics: Total count 1309 - Distinct count 14 - Null count 210 JanOL TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 358 - Distinct count 6 - Null count 1161 rOTL TEXT, -- Example Values: `1`, `5`, `3`, `4`, `0` | Value Statics: Total count 358 - Distinct count 11 - Null count 1161 DecL TEXT, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 1473 - Distinct count 14 - Null count 46 MarT TEXT, -- Example Values: `0`, `1`, `2`, `4`, `3` | Value Statics: Total count 1275 - Distinct count 8 - Null count 244 FebL INTEGER, -- Example Values: `3`, `5`, `0`, `1`, `2` | Value Statics: Total count 1510 - Distinct count 13 - Null count 9 MarW TEXT, -- Example Values: `1`, `3`, `0`, `2`, `5` | Value Statics: Total count 1485 - Distinct count 14 - Null count 34 AprT TEXT, -- Example Values: `0`, `1`, `2`, `4`, `3` | Value Statics: Total count 808 - Distinct count 6 - Null count 711 OctT TEXT, -- Example Values: `0`, `1`, `4`, `2`, `3` | Value Statics: Total count 989 - Distinct count 7 - Null count 530 DecOL TEXT, -- Example Values: `0`, `2`, `1`, `3`, `4` | Value Statics: Total count 358 - Distinct count 6 - Null count 1161 DecT TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1263 - Distinct count 8 - Null count 256 NovT TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1148 - Distinct count 9 - Null count 371 hW INTEGER, -- AprL TEXT, -- Example Values: `0`, `2`, `1`, `3`, `4` | Value Statics: Total count 1018 - Distinct count 11 - Null count 501 SepOL TEXT, -- Example Values: `0` | Value Statics: Total count 2 - Distinct count 1 - Null count 1517 rW INTEGER, -- rL INTEGER, -- hOTL TEXT, -- Example Values: `2`, `3`, `1`, `0`, `4` | Value Statics: Total count 358 - Distinct count 12 - Null count 1161 SepL TEXT, -- Example Values: `1` | Value Statics: Total count 2 - Distinct count 1 - Null count 1517 ); CREATE TABLE Master ( lastNHL TEXT, -- deathMon TEXT, -- Example Values: `8`, `2`, `12`, `5`, `3` | Value Statics: Total count 1173 - Distinct count 12 - Null count 6588 birthCity TEXT, -- lastName TEXT not null, -- height TEXT, -- pos TEXT, -- Example Values: `C`, `D`, `G`, `L`, `R` | Value Statics: Total count 7447 - Distinct count 18 - Null count 314 nameGiven TEXT, -- playerID TEXT, -- deathDay TEXT, -- deathYear TEXT, -- hofID TEXT, -- deathCountry TEXT, -- Example Values: `USA`, `Canada`, `France`, `Belgium`, `Russia` | Value Statics: Total count 498 - Distinct count 14 - Null count 7263 deathState TEXT, -- firstNHL TEXT, -- birthCountry TEXT, -- birthDay TEXT, -- legendsID TEXT, -- hrefID TEXT, -- coachID TEXT, -- birthState TEXT, -- birthMon TEXT, -- Example Values: `3`, `8`, `2`, `5`, `12` | Value Statics: Total count 7506 - Distinct count 12 - Null count 255 deathCity TEXT, -- firstName TEXT, -- nameNick TEXT, -- firstWHA TEXT, -- Example Values: `1975`, `1976`, `1974`, `1973`, `1978` | Value Statics: Total count 903 - Distinct count 7 - Null count 6858 lastWHA TEXT, -- Example Values: `1975`, `1977`, `1976`, `1973`, `1978` | Value Statics: Total count 903 - Distinct count 7 - Null count 6858 foreign key (coachID) references Coaches (coachID) on update cascade on delete cascade, ihdbID TEXT, -- birthYear TEXT, -- weight TEXT, -- nameNote TEXT, -- Example Values: `also known as Bellehumeur`, `also listed as Bourdginon`, `born Bodnarchuk`, `also known as Bowcher`, `also known as Burmeister` | Value Statics: Total count 18 - Distinct count 18 - Null count 7743 shootCatch TEXT, -- Example Values: `L`, `R`, `B` | Value Statics: Total count 7048 - Distinct count 3 - Null count 713 ); CREATE TABLE TeamsPost ( year INTEGER not null, -- G INTEGER, -- PPG TEXT, -- L INTEGER, -- Example Values: `1`, `0`, `4`, `2`, `3` | Value Statics: Total count 927 - Distinct count 12 - Null count 0 BenchMinor TEXT, -- Example Values: `0`, `6`, `2`, `4`, `10` | Value Statics: Total count 572 - Distinct count 8 - Null count 355 PKC TEXT, -- SHA TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 604 - Distinct count 9 - Null count 323 tmID TEXT not null, -- foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, lgID TEXT, -- Example Values: `NHA`, `NHL`, `PCHA`, `WCHL`, `WHA` | Value Statics: Total count 927 - Distinct count 5 - Null count 0 PPC TEXT, -- PIM TEXT, -- GA INTEGER, -- GF INTEGER, -- SHF TEXT, -- Example Values: `0`, `1`, `3`, `5`, `2` | Value Statics: Total count 636 - Distinct count 11 - Null count 291 T INTEGER, -- Example Values: `0`, `1`, `2`, `4`, `3` | Value Statics: Total count 927 - Distinct count 5 - Null count 0 W INTEGER, -- Example Values: `1`, `0`, `4`, `2`, `3` | Value Statics: Total count 927 - Distinct count 17 - Null count 0 primary key (year, tmID), PKG TEXT, -- ); CREATE TABLE AwardsPlayers ( primary key (playerID, award, year), playerID TEXT not null, -- foreign key (playerID) references Master (playerID) on update cascade on delete cascade, award TEXT not null, -- year INTEGER not null, -- lgID TEXT, -- Example Values: `NHL`, `WHA` | Value Statics: Total count 2091 - Distinct count 2 - Null count 0 note TEXT, -- Example Values: `tie`, `shared`, `Most Gentlemanly`, `Rookie`, `Best Goaltender` | Value Statics: Total count 127 - Distinct count 8 - Null count 1964 pos TEXT, -- Example Values: `C`, `LW`, `F`, `RW`, `D` | Value Statics: Total count 1231 - Distinct count 7 - Null count 860 ); CREATE TABLE GoaliesShootout ( year INTEGER, -- Example Values: `2005`, `2006`, `2008`, `2009`, `2010` | Value Statics: Total count 480 - Distinct count 7 - Null count 0 stint INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 480 - Distinct count 2 - Null count 0 tmID TEXT, -- W INTEGER, -- Example Values: `2`, `0`, `1`, `7`, `6` | Value Statics: Total count 480 - Distinct count 11 - Null count 0 L INTEGER, -- Example Values: `1`, `2`, `3`, `0`, `4` | Value Statics: Total count 480 - Distinct count 10 - Null count 0 playerID TEXT, -- GA INTEGER, -- SA INTEGER, -- foreign key (playerID) references Master (playerID) on update cascade on delete cascade, foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, ); CREATE TABLE Teams ( L INTEGER, -- name TEXT, -- W INTEGER, -- confID TEXT, -- Example Values: `CC`, `WA`, `WC`, `EC` | Value Statics: Total count 902 - Distinct count 4 - Null count 617 GA INTEGER, -- SoL TEXT, -- Example Values: `7`, `5`, `8`, `2`, `3` | Value Statics: Total count 210 - Distinct count 12 - Null count 1309 BenchMinor TEXT, -- playoff TEXT, -- lgID TEXT, -- Example Values: `NHA`, `PCHA`, `NHL`, `WCHL`, `WHA` | Value Statics: Total count 1519 - Distinct count 5 - Null count 0 G INTEGER, -- GF INTEGER, -- OTL TEXT, -- Example Values: `3`, `4`, `6`, `5`, `0` | Value Statics: Total count 358 - Distinct count 18 - Null count 1161 tmID TEXT not null, -- franchID TEXT, -- primary key (year, tmID), PPC TEXT, -- SHF TEXT, -- T INTEGER, -- SoW TEXT, -- Example Values: `3`, `5`, `2`, `8`, `12` | Value Statics: Total count 210 - Distinct count 15 - Null count 1309 Pts INTEGER, -- PKG TEXT, -- PPG TEXT, -- PKC TEXT, -- divID TEXT, -- Example Values: `AM`, `CA`, `ED`, `WD`, `WW` | Value Statics: Total count 1171 - Distinct count 17 - Null count 348 PIM TEXT, -- rank INTEGER, -- Example Values: `4`, `5`, `7`, `6`, `1` | Value Statics: Total count 1519 - Distinct count 10 - Null count 0 SHA TEXT, -- year INTEGER not null, -- ); CREATE TABLE TeamVsTeam ( oppID TEXT not null, -- T INTEGER, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 19962 - Distinct count 9 - Null count 5640 foreign key (oppID, year) references Teams (tmID, year) on update cascade on delete cascade, OTL TEXT, -- Example Values: `0`, `1`, `3`, `2`, `4` | Value Statics: Total count 9874 - Distinct count 5 - Null count 15728 tmID TEXT not null, -- primary key (year, tmID, oppID), lgID TEXT, -- Example Values: `NHA`, `PCHA`, `NHL`, `WCHL`, `WHA` | Value Statics: Total count 25602 - Distinct count 5 - Null count 0 year INTEGER not null, -- L INTEGER, -- Example Values: `1`, `0`, `2`, `4`, `3` | Value Statics: Total count 25602 - Distinct count 14 - Null count 0 W INTEGER, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 25602 - Distinct count 14 - Null count 0 foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, ); CREATE TABLE ScoringSC ( foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, tmID TEXT, -- Example Values: `VML`, `CAT`, `VIC`, `TRS`, `MOC` | Value Statics: Total count 284 - Distinct count 17 - Null count 0 year INTEGER, -- Example Values: `1920`, `1921`, `1923`, `1924`, `1925` | Value Statics: Total count 284 - Distinct count 14 - Null count 0 playerID TEXT, -- G INTEGER, -- Example Values: `0`, `2`, `6`, `1`, `3` | Value Statics: Total count 284 - Distinct count 11 - Null count 0 foreign key (playerID) references Master (playerID) on update cascade on delete cascade, GP INTEGER, -- Example Values: `4`, `5`, `2`, `1`, `3` | Value Statics: Total count 284 - Distinct count 6 - Null count 0 A INTEGER, -- Example Values: `0`, `1`, `2`, `3`, `5` | Value Statics: Total count 284 - Distinct count 6 - Null count 0 PIM INTEGER, -- pos TEXT, -- Example Values: `R`, `C`, `L`, `F`, `G` | Value Statics: Total count 284 - Distinct count 11 - Null count 0 lgID TEXT, -- Example Values: `PCHA`, `WCHL`, `NHL`, `NHA` | Value Statics: Total count 284 - Distinct count 4 - Null count 0 Pts INTEGER, -- Example Values: `0`, `3`, `7`, `1`, `2` | Value Statics: Total count 284 - Distinct count 11 - Null count 0 ); CREATE TABLE CombinedShutouts ( foreign key (IDgoalie1) references Master (playerID) on update cascade on delete cascade, month INTEGER, -- Example Values: `3`, `2`, `11`, `1`, `12` | Value Statics: Total count 54 - Distinct count 8 - Null count 0 oppID TEXT, -- foreign key (IDgoalie2) references Master (playerID) on update cascade on delete cascade, "R/P" TEXT, -- Example Values: `R`, `P` | Value Statics: Total count 54 - Distinct count 2 - Null count 0 date INTEGER, -- tmID TEXT, -- IDgoalie1 TEXT, -- year INTEGER, -- IDgoalie2 TEXT, -- ); CREATE TABLE GoaliesSC ( GP INTEGER, -- Example Values: `3`, `5`, `6`, `4`, `1` | Value Statics: Total count 31 - Distinct count 6 - Null count 0 foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, tmID TEXT, -- Example Values: `OT1`, `OTS`, `MTM`, `TBS`, `SEA` | Value Statics: Total count 31 - Distinct count 17 - Null count 0 playerID TEXT not null, -- Example Values: `benedcl01`, `clancki01`, `holmeha01`, `lehmahu01`, `lindsbe01` | Value Statics: Total count 31 - Distinct count 11 - Null count 0 lgID TEXT, -- Example Values: `NHA`, `NHL`, `PCHA`, `WCHL` | Value Statics: Total count 31 - Distinct count 4 - Null count 0 foreign key (playerID) references Master (playerID) on update cascade on delete cascade, Min INTEGER, -- Example Values: `180`, `300`, `361`, `240`, `2` | Value Statics: Total count 31 - Distinct count 11 - Null count 0 SHO INTEGER, -- Example Values: `0`, `1`, `3`, `2` | Value Statics: Total count 31 - Distinct count 4 - Null count 0 W INTEGER, -- Example Values: `0`, `3`, `5`, `2`, `1` | Value Statics: Total count 31 - Distinct count 6 - Null count 0 GA INTEGER, -- Example Values: `26`, `11`, `12`, `8`, `3` | Value Statics: Total count 31 - Distinct count 17 - Null count 0 T INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 31 - Distinct count 2 - Null count 0 year INTEGER not null, -- Example Values: `1914`, `1919`, `1920`, `1922`, `1925` | Value Statics: Total count 31 - Distinct count 14 - Null count 0 primary key (playerID, year), L INTEGER, -- Example Values: `3`, `2`, `1`, `0` | Value Statics: Total count 31 - Distinct count 4 - Null count 0 ); CREATE TABLE Goalies ( PostT TEXT, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 106 - Distinct count 5 - Null count 4172 SHO TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 4257 - Distinct count 17 - Null count 21 L TEXT, -- PostMin TEXT, -- PostW TEXT, -- Example Values: `0`, `6`, `1`, `2`, `3` | Value Statics: Total count 1439 - Distinct count 17 - Null count 2839 Min TEXT, -- PostGA TEXT, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `NHA`, `WCHL`, `PCHA` | Value Statics: Total count 4278 - Distinct count 5 - Null count 0 ENG TEXT, -- Example Values: `0`, `1`, `3`, `4`, `5` | Value Statics: Total count 3533 - Distinct count 13 - Null count 745 GA TEXT, -- foreign key (playerID) references Master (playerID) on update cascade on delete cascade, PostSA TEXT, -- primary key (playerID, year, stint), playerID TEXT not null, -- "T/OL" TEXT, -- W TEXT, -- PostENG TEXT, -- Example Values: `0`, `1`, `2`, `3`, `5` | Value Statics: Total count 1187 - Distinct count 6 - Null count 3091 GP TEXT, -- PostSHO TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1439 - Distinct count 8 - Null count 2839 SA TEXT, -- stint INTEGER not null, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 4278 - Distinct count 3 - Null count 0 PostGP TEXT, -- tmID TEXT, -- year INTEGER not null, -- PostL TEXT, -- Example Values: `0`, `1`, `5`, `3`, `4` | Value Statics: Total count 1439 - Distinct count 12 - Null count 2839 foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, ); CREATE TABLE TeamsHalf ( GA INTEGER, -- year INTEGER not null, -- Example Values: `1916`, `1917`, `1918`, `1919`, `1920` | Value Statics: Total count 41 - Distinct count 5 - Null count 0 primary key (year, tmID, half), tmID TEXT not null, -- Example Values: `MOC`, `MOW`, `OT1`, `QU1`, `TBS` | Value Statics: Total count 41 - Distinct count 13 - Null count 0 rank INTEGER, -- Example Values: `1`, `3`, `5`, `4`, `2` | Value Statics: Total count 41 - Distinct count 6 - Null count 0 L INTEGER, -- Example Values: `3`, `7`, `8`, `2`, `5` | Value Statics: Total count 41 - Distinct count 11 - Null count 0 lgID TEXT, -- Example Values: `NHA`, `NHL` | Value Statics: Total count 41 - Distinct count 2 - Null count 0 half INTEGER not null, -- Example Values: `1`, `2` | Value Statics: Total count 41 - Distinct count 2 - Null count 0 GF INTEGER, -- T INTEGER, -- Example Values: `0` | Value Statics: Total count 41 - Distinct count 1 - Null count 0 foreign key (tmID, year) references Teams (tmID, year) on update cascade on delete cascade, G INTEGER, -- Example Values: `10`, `4`, `14`, `8`, `6` | Value Statics: Total count 41 - Distinct count 6 - Null count 0 W INTEGER, -- Example Values: `7`, `3`, `2`, `8`, `5` | Value Statics: Total count 41 - Distinct count 10 - Null count 0 ); CREATE TABLE ScoringSup ( SHA TEXT, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 41 - Distinct count 4 - Null count 96 year INTEGER, -- Example Values: `1988`, `1989`, `1987`, `1990` | Value Statics: Total count 137 - Distinct count 4 - Null count 0 playerID TEXT, -- PPA TEXT, -- foreign key (playerID) references Master (playerID) on update cascade on delete cascade, ); CREATE TABLE Coaches ( coachID TEXT not null, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `NHA`, `WCHL`, `PCHA` | Value Statics: Total count 1812 - Distinct count 5 - Null count 0 t INTEGER, -- l INTEGER, -- tmID TEXT not null, -- stint INTEGER not null, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 1812 - Distinct count 3 - Null count 0 postw TEXT, -- Example Values: `3`, `0`, `2`, `6`, `5` | Value Statics: Total count 927 - Distinct count 17 - Null count 885 w INTEGER, -- year INTEGER not null, -- notes TEXT, -- Example Values: `interim`, `co-coach with Barry Smith`, `co-coach with Dave Lewis` | Value Statics: Total count 11 - Distinct count 3 - Null count 1801 postg TEXT, -- foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, g INTEGER, -- postl TEXT, -- Example Values: `4`, `5`, `6`, `7`, `2` | Value Statics: Total count 927 - Distinct count 12 - Null count 885 postt TEXT, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 927 - Distinct count 5 - Null count 885 primary key (coachID, year, tmID, stint), ); CREATE TABLE TeamsSC ( GF INTEGER, -- Example Values: `12`, `16`, `13`, `8`, `26` | Value Statics: Total count 30 - Distinct count 17 - Null count 0 GA INTEGER, -- Example Values: `16`, `12`, `8`, `13`, `26` | Value Statics: Total count 30 - Distinct count 16 - Null count 0 G INTEGER, -- Example Values: `3`, `5`, `4`, `2`, `6` | Value Statics: Total count 30 - Distinct count 5 - Null count 0 W INTEGER, -- Example Values: `1`, `2`, `3`, `0`, `5` | Value Statics: Total count 30 - Distinct count 6 - Null count 0 T INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 30 - Distinct count 2 - Null count 0 L INTEGER, -- Example Values: `2`, `1`, `0`, `3` | Value Statics: Total count 30 - Distinct count 4 - Null count 0 foreign key (year, tmID) references Teams (year, tmID) on update cascade on delete cascade, tmID TEXT not null, -- Example Values: `QU1`, `VA1`, `TBS`, `OT1`, `VML` | Value Statics: Total count 30 - Distinct count 17 - Null count 0 lgID TEXT, -- Example Values: `NHA`, `PCHA`, `NHL`, `WCHL` | Value Statics: Total count 30 - Distinct count 4 - Null count 0 PIM TEXT, -- Example Values: `24`, `20`, `75`, `53`, `50` | Value Statics: Total count 8 - Distinct count 7 - Null count 22 year INTEGER not null, -- Example Values: `1912`, `1913`, `1914`, `1915`, `1916` | Value Statics: Total count 30 - Distinct count 14 - Null count 0 primary key (year, tmID), );
synthea
Who is the patient with a body weight of 61.97 kg?
body weight of 61.97 kg refers to observations.DESCRIPTION = 'Body Weight' AND observations.VALUE = 61.97; observations.UNITS = 'kg'
SELECT T2.first, T2.last FROM observations AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T1.DESCRIPTION = 'Body Weight' AND T1.UNITS = 'kg' AND T1.VALUE = 61.97
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE DATE, -- primary key (DATE, PATIENT, ENCOUNTER, CODE), DESCRIPTION TEXT, -- Example Values: `Influenza seasonal injectable preservative free`, `Td (adult) preservative free`, `meningococcal MCV4P`, `Tdap`, `HPV quadrivalent` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 ); CREATE TABLE allergies ( CODE INTEGER, -- Example Values: `232347008`, `300916003`, `419474003`, `424213003`, `300913006` | Value Statics: Total count 572 - Distinct count 15 - Null count 0 foreign key (ENCOUNTER) references encounters(ID), foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- primary key (PATIENT, ENCOUNTER, CODE), STOP TEXT, -- Example Values: `12/22/14`, `4/21/10`, `10/15/11`, `3/17/10`, `5/26/08` | Value Statics: Total count 16 - Distinct count 11 - Null count 556 START TEXT, -- DESCRIPTION TEXT, -- Example Values: `Allergy to dairy product`, `Allergy to tree pollen`, `Allergy to grass pollen`, `Dander (animal) allergy`, `House dust mite allergy` | Value Statics: Total count 572 - Distinct count 15 - Null count 0 ); CREATE TABLE observations ( DATE DATE, -- ENCOUNTER TEXT, -- VALUE REAL, -- UNITS TEXT, -- Example Values: `cm`, `kg`, `kg/m2`, `mmHg`, `Cel` | Value Statics: Total count 78444 - Distinct count 17 - Null count 455 DESCRIPTION TEXT, -- CODE TEXT, -- PATIENT TEXT, -- foreign key (PATIENT) references patients(patient), foreign key (ENCOUNTER) references encounters(ID), ); CREATE TABLE medications ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- PATIENT TEXT, -- STOP DATE, -- START DATE, -- REASONDESCRIPTION TEXT, -- DESCRIPTION TEXT, -- primary key (START, PATIENT, ENCOUNTER, CODE), foreign key (PATIENT) references patients(patient), REASONCODE INTEGER, -- ENCOUNTER TEXT, -- ); CREATE TABLE careplans ( START DATE, -- STOP DATE, -- ID TEXT, -- REASONCODE INTEGER, -- REASONDESCRIPTION TEXT, -- foreign key (PATIENT) references patients(patient), PATIENT TEXT, -- DESCRIPTION TEXT, -- CODE REAL, -- ENCOUNTER TEXT, -- foreign key (ENCOUNTER) references encounters(ID), ); CREATE TABLE encounters ( DATE DATE, -- REASONCODE INTEGER, -- CODE INTEGER, -- ID TEXT primary key, DESCRIPTION TEXT, -- foreign key (PATIENT) references patients(patient), PATIENT TEXT, -- REASONDESCRIPTION TEXT, -- ); CREATE TABLE procedures ( foreign key (PATIENT) references patients(patient), REASONDESCRIPTION TEXT, -- PATIENT TEXT, -- foreign key (ENCOUNTER) references encounters(ID), DATE DATE, -- DESCRIPTION TEXT, -- ENCOUNTER TEXT, -- CODE INTEGER, -- REASONCODE INTEGER, -- ); CREATE TABLE patients ( suffix TEXT, -- Example Values: `PhD`, `JD`, `MD` | Value Statics: Total count 45 - Distinct count 3 - Null count 1417 prefix TEXT, -- Example Values: `Mr.`, `Mrs.`, `Ms.` | Value Statics: Total count 1166 - Distinct count 3 - Null count 296 deathdate DATE, -- ethnicity TEXT, -- race TEXT, -- Example Values: `black`, `white`, `hispanic`, `asian` | Value Statics: Total count 1462 - Distinct count 4 - Null count 0 address TEXT, -- birthplace TEXT, -- passport TEXT, -- maiden TEXT, -- birthdate DATE, -- marital TEXT, -- Example Values: `S`, `M` | Value Statics: Total count 1033 - Distinct count 2 - Null count 429 gender TEXT, -- Example Values: `F`, `M` | Value Statics: Total count 1462 - Distinct count 2 - Null count 0 drivers TEXT, -- first TEXT, -- last TEXT, -- patient TEXT primary key, ssn TEXT, -- ); CREATE TABLE claims ( ENCOUNTER TEXT references encounters, -- PATIENT TEXT references patients, -- ORGANIZATION TEXT, -- Example Values: `temp organization` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0 TOTAL INTEGER, -- Example Values: `100` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0 BILLABLEPERIOD DATE, -- DIAGNOSIS TEXT, -- ID TEXT primary key, ); CREATE TABLE conditions ( START DATE, -- DESCRIPTION TEXT, -- foreign key (PATIENT) references patients(patient), PATIENT TEXT, -- CODE INTEGER, -- ENCOUNTER TEXT, -- STOP DATE, -- foreign key (ENCOUNTER) references encounters(ID), foreign key (DESCRIPTION) references all_prevalences(ITEM), ); CREATE TABLE all_prevalences ( "POPULATION TYPE" TEXT, -- Example Values: `LIVING` | Value Statics: Total count 244 - Distinct count 1 - Null count 0 "POPULATION COUNT" INTEGER, -- Example Values: `1000` | Value Statics: Total count 244 - Distinct count 1 - Null count 0 ITEM TEXT primary key, "PREVALENCE PERCENTAGE" REAL, -- "PREVALENCE RATE" REAL, -- OCCURRENCES INTEGER, -- );
cs_semester
Among students with low salary, how many of them have a gpa of 3.5?
low salary refers to salary = 'low';
SELECT COUNT(T1.student_id) FROM RA AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T2.gpa = 3.5 AND T1.salary = 'low'
CREATE TABLE prof ( teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0 gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `npigford0@hku.hk`, `zzhihua@hku.hk`, `ozywicki2@hku.hk`, `mconkay3@ucla.edu`, `bmolen4@hku.hk` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 first_name TEXT, -- Example Values: `Nathaniel`, `Zhihua`, `Ogdon`, `Merwyn`, `Bernhard` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 graduate_from TEXT, -- Example Values: `University of Washington`, `Beijing Polytechnic University`, `University of Boston`, `Carnegie Mellon University`, `Princeton University` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 last_name TEXT, -- Example Values: `Pigford`, `Zhou`, `Zywicki`, `Conkay`, `Molen` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 popularity INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 prof_id INTEGER constraint prof_pk primary key, ); CREATE TABLE student ( email TEXT, -- f_name TEXT, -- intelligence INTEGER, -- Example Values: `5`, `2`, `1`, `3`, `4` | Value Statics: Total count 38 - Distinct count 5 - Null count 0 l_name TEXT, -- type TEXT, -- Example Values: `RPG`, `TPG`, `UG` | Value Statics: Total count 38 - Distinct count 3 - Null count 0 student_id INTEGER primary key, gpa REAL, -- Example Values: `2.4`, `2.7`, `3.5`, `2.8`, `3.9` | Value Statics: Total count 38 - Distinct count 16 - Null count 0 phone_number TEXT, -- ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, name TEXT, -- Example Values: `Machine Learning Theory`, `Intro to Database 1`, `Intro to Database 2`, `Natural Language Processing`, `Intro to BlockChain` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 diff INTEGER, -- Example Values: `3`, `4`, `1`, `5`, `2` | Value Statics: Total count 13 - Distinct count 5 - Null count 0 credit INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 13 - Distinct count 2 - Null count 0 ); CREATE TABLE registration ( sat INTEGER, -- Example Values: `5`, `4`, `3`, `2`, `1` | Value Statics: Total count 101 - Distinct count 5 - Null count 0 course_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 101 - Distinct count 13 - Null count 0 foreign key (student_id) references student(student_id), primary key (course_id, student_id), foreign key (course_id) references course(course_id), student_id INTEGER, -- grade TEXT, -- Example Values: `A`, `B`, `C`, `D` | Value Statics: Total count 96 - Distinct count 4 - Null count 5 ); CREATE TABLE RA ( prof_id INTEGER, -- Example Values: `7`, `10`, `13`, `9`, `2` | Value Statics: Total count 35 - Distinct count 13 - Null count 0 salary TEXT, -- Example Values: `med`, `high`, `low`, `free` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 student_id INTEGER, -- capability INTEGER, -- Example Values: `2`, `5`, `4`, `3` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 foreign key (prof_id) references prof(prof_id), foreign key (student_id) references student(student_id), primary key (student_id, prof_id), );
human_resources
Mention the full name, hired date and performance status of the employee whose location is in Utah state.
full name = firstname, lastname; Utah refers to state = 'UT'
SELECT T1.firstname, T1.lastname, T1.hiredate, T1.performance FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T2.state = 'UT'
CREATE TABLE position ( minsalary TEXT, -- Example Values: `US$25,000.00`, `US$50,000.00`, `US$18,000.00`, `US$100,000.00` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 maxsalary TEXT, -- Example Values: `US$75,000.00`, `US$150,000.00`, `US$25,000.00`, `US$250,000.00` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 educationrequired TEXT, -- Example Values: `4 year degree`, `2 year degree`, `6 year degree` | Value Statics: Total count 4 - Distinct count 3 - Null count 0 positiontitle TEXT, -- Example Values: `Account Representative`, `Manager`, `Trainee`, `Regional Manager` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 positionID INTEGER constraint position_pk primary key, ); CREATE TABLE location ( officephone TEXT, -- Example Values: `(404)333-5555`, `(617)123-4444`, `(312)444-6666`, `(305)787-9999`, `(518)256-3100` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 locationcity TEXT, -- Example Values: `Atlanta`, `Boston`, `Chicago`, `Miami`, `New York City` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 zipcode INTEGER, -- Example Values: `30316`, `2190`, `60620`, `33103`, `15648` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 locationID INTEGER constraint location_pk primary key, address TEXT, -- Example Values: `450 Peachtree Rd`, `3 Commons Blvd`, `500 Loop Highway`, `210 Biscayne Blvd`, `1650 Washington Blvd` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 state TEXT, -- Example Values: `GA`, `MA`, `IL`, `FL`, `NY` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE employee ( positionID INTEGER, -- Example Values: `2`, `3`, `1`, `4` | Value Statics: Total count 25 - Distinct count 4 - Null count 0 performance TEXT, -- Example Values: `Average`, `Good`, `Poor` | Value Statics: Total count 23 - Distinct count 3 - Null count 2 lastname TEXT, -- foreign key (positionID) references position(positionID), firstname TEXT, -- Example Values: `Patricia`, `Sandy`, `Emily`, `Harold`, `James` | Value Statics: Total count 25 - Distinct count 19 - Null count 0 locationID INTEGER, -- Example Values: `2`, `1`, `5`, `3`, `4` | Value Statics: Total count 25 - Distinct count 7 - Null count 0 salary TEXT, -- ssn TEXT primary key, hiredate TEXT, -- gender TEXT, -- Example Values: `F`, `M` | Value Statics: Total count 24 - Distinct count 2 - Null count 1 foreign key (locationID) references location(locationID), );
image_and_language
What is the average width and height of the objects in image ID 47? List their object classes as well.
The bounding box's W and H abbreviations stand for the object's width and height in which average width and height refer to AVG(W) and AVG(H) respectively; image ID 47 refers to IMG_ID = 47; object classes refer to OBJ_CLASS;
SELECT T2.OBJ_CLASS, AVG(T1.W), AVG(T1.H) FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T1.IMG_ID = 47 GROUP BY T2.OBJ_CLASS
CREATE TABLE OBJ_CLASSES ( OBJ_CLASS TEXT not null, -- OBJ_CLASS_ID INTEGER default 0 not null primary key, ); CREATE TABLE ATT_CLASSES ( ATT_CLASS TEXT not null, -- ATT_CLASS_ID INTEGER default 0 not null primary key, ); CREATE TABLE IMG_OBJ_ATT ( IMG_ID INTEGER default 0 not null, -- foreign key (IMG_ID, OBJ_SAMPLE_ID) references IMG_OBJ (IMG_ID, OBJ_SAMPLE_ID), ATT_CLASS_ID INTEGER default 0 not null, -- primary key (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID), OBJ_SAMPLE_ID INTEGER default 0 not null, -- foreign key (ATT_CLASS_ID) references ATT_CLASSES (ATT_CLASS_ID), ); CREATE TABLE IMG_OBJ ( H INTEGER null, -- W INTEGER null, -- primary key (IMG_ID, OBJ_SAMPLE_ID), X INTEGER null, -- OBJ_SAMPLE_ID INTEGER default 0 not null, -- Y INTEGER null, -- OBJ_CLASS_ID INTEGER null, -- foreign key (OBJ_CLASS_ID) references OBJ_CLASSES (OBJ_CLASS_ID), IMG_ID INTEGER default 0 not null, -- ); CREATE TABLE PRED_CLASSES ( PRED_CLASS TEXT not null, -- PRED_CLASS_ID INTEGER default 0 not null primary key, ); CREATE TABLE IMG_REL ( foreign key (IMG_ID, OBJ2_SAMPLE_ID) references IMG_OBJ (IMG_ID, OBJ_SAMPLE_ID), IMG_ID INTEGER default 0 not null, -- foreign key (IMG_ID, OBJ1_SAMPLE_ID) references IMG_OBJ (IMG_ID, OBJ_SAMPLE_ID), OBJ2_SAMPLE_ID INTEGER default 0 not null, -- PRED_CLASS_ID INTEGER default 0 not null, -- primary key (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID), foreign key (PRED_CLASS_ID) references PRED_CLASSES (PRED_CLASS_ID), OBJ1_SAMPLE_ID INTEGER default 0 not null, -- );
synthea
List 5 patients' name that need medication due to streptococcal sore throat disorder.
patients name = first, last; streptococcal sore throat disorder refers to medications.REASONDESCRIPTION = 'Streptococcal sore throat (disorder)';
SELECT DISTINCT T2.first, T2.last FROM medications AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T1.REASONDESCRIPTION = 'Streptococcal sore throat (disorder)' LIMIT 5
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE DATE, -- primary key (DATE, PATIENT, ENCOUNTER, CODE), DESCRIPTION TEXT, -- Example Values: `Influenza seasonal injectable preservative free`, `Td (adult) preservative free`, `meningococcal MCV4P`, `Tdap`, `HPV quadrivalent` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 ); CREATE TABLE allergies ( CODE INTEGER, -- Example Values: `232347008`, `300916003`, `419474003`, `424213003`, `300913006` | Value Statics: Total count 572 - Distinct count 15 - Null count 0 foreign key (ENCOUNTER) references encounters(ID), foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- primary key (PATIENT, ENCOUNTER, CODE), STOP TEXT, -- Example Values: `12/22/14`, `4/21/10`, `10/15/11`, `3/17/10`, `5/26/08` | Value Statics: Total count 16 - Distinct count 11 - Null count 556 START TEXT, -- DESCRIPTION TEXT, -- Example Values: `Allergy to dairy product`, `Allergy to tree pollen`, `Allergy to grass pollen`, `Dander (animal) allergy`, `House dust mite allergy` | Value Statics: Total count 572 - Distinct count 15 - Null count 0 ); CREATE TABLE observations ( DATE DATE, -- ENCOUNTER TEXT, -- VALUE REAL, -- UNITS TEXT, -- Example Values: `cm`, `kg`, `kg/m2`, `mmHg`, `Cel` | Value Statics: Total count 78444 - Distinct count 17 - Null count 455 DESCRIPTION TEXT, -- CODE TEXT, -- PATIENT TEXT, -- foreign key (PATIENT) references patients(patient), foreign key (ENCOUNTER) references encounters(ID), ); CREATE TABLE medications ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- PATIENT TEXT, -- STOP DATE, -- START DATE, -- REASONDESCRIPTION TEXT, -- DESCRIPTION TEXT, -- primary key (START, PATIENT, ENCOUNTER, CODE), foreign key (PATIENT) references patients(patient), REASONCODE INTEGER, -- ENCOUNTER TEXT, -- ); CREATE TABLE careplans ( START DATE, -- STOP DATE, -- ID TEXT, -- REASONCODE INTEGER, -- REASONDESCRIPTION TEXT, -- foreign key (PATIENT) references patients(patient), PATIENT TEXT, -- DESCRIPTION TEXT, -- CODE REAL, -- ENCOUNTER TEXT, -- foreign key (ENCOUNTER) references encounters(ID), ); CREATE TABLE encounters ( DATE DATE, -- REASONCODE INTEGER, -- CODE INTEGER, -- ID TEXT primary key, DESCRIPTION TEXT, -- foreign key (PATIENT) references patients(patient), PATIENT TEXT, -- REASONDESCRIPTION TEXT, -- ); CREATE TABLE procedures ( foreign key (PATIENT) references patients(patient), REASONDESCRIPTION TEXT, -- PATIENT TEXT, -- foreign key (ENCOUNTER) references encounters(ID), DATE DATE, -- DESCRIPTION TEXT, -- ENCOUNTER TEXT, -- CODE INTEGER, -- REASONCODE INTEGER, -- ); CREATE TABLE patients ( suffix TEXT, -- Example Values: `PhD`, `JD`, `MD` | Value Statics: Total count 45 - Distinct count 3 - Null count 1417 prefix TEXT, -- Example Values: `Mr.`, `Mrs.`, `Ms.` | Value Statics: Total count 1166 - Distinct count 3 - Null count 296 deathdate DATE, -- ethnicity TEXT, -- race TEXT, -- Example Values: `black`, `white`, `hispanic`, `asian` | Value Statics: Total count 1462 - Distinct count 4 - Null count 0 address TEXT, -- birthplace TEXT, -- passport TEXT, -- maiden TEXT, -- birthdate DATE, -- marital TEXT, -- Example Values: `S`, `M` | Value Statics: Total count 1033 - Distinct count 2 - Null count 429 gender TEXT, -- Example Values: `F`, `M` | Value Statics: Total count 1462 - Distinct count 2 - Null count 0 drivers TEXT, -- first TEXT, -- last TEXT, -- patient TEXT primary key, ssn TEXT, -- ); CREATE TABLE claims ( ENCOUNTER TEXT references encounters, -- PATIENT TEXT references patients, -- ORGANIZATION TEXT, -- Example Values: `temp organization` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0 TOTAL INTEGER, -- Example Values: `100` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0 BILLABLEPERIOD DATE, -- DIAGNOSIS TEXT, -- ID TEXT primary key, ); CREATE TABLE conditions ( START DATE, -- DESCRIPTION TEXT, -- foreign key (PATIENT) references patients(patient), PATIENT TEXT, -- CODE INTEGER, -- ENCOUNTER TEXT, -- STOP DATE, -- foreign key (ENCOUNTER) references encounters(ID), foreign key (DESCRIPTION) references all_prevalences(ITEM), ); CREATE TABLE all_prevalences ( "POPULATION TYPE" TEXT, -- Example Values: `LIVING` | Value Statics: Total count 244 - Distinct count 1 - Null count 0 "POPULATION COUNT" INTEGER, -- Example Values: `1000` | Value Statics: Total count 244 - Distinct count 1 - Null count 0 ITEM TEXT primary key, "PREVALENCE PERCENTAGE" REAL, -- "PREVALENCE RATE" REAL, -- OCCURRENCES INTEGER, -- );
cs_semester
Find the most important and most difficult courses.
most important refers to MAX(credit); most difficult refers to MAX(diff);
SELECT name FROM course WHERE credit = ( SELECT MAX(credit) FROM course ) AND diff = ( SELECT MAX(diff) FROM course )
CREATE TABLE prof ( teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0 gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `npigford0@hku.hk`, `zzhihua@hku.hk`, `ozywicki2@hku.hk`, `mconkay3@ucla.edu`, `bmolen4@hku.hk` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 first_name TEXT, -- Example Values: `Nathaniel`, `Zhihua`, `Ogdon`, `Merwyn`, `Bernhard` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 graduate_from TEXT, -- Example Values: `University of Washington`, `Beijing Polytechnic University`, `University of Boston`, `Carnegie Mellon University`, `Princeton University` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 last_name TEXT, -- Example Values: `Pigford`, `Zhou`, `Zywicki`, `Conkay`, `Molen` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 popularity INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 prof_id INTEGER constraint prof_pk primary key, ); CREATE TABLE student ( email TEXT, -- f_name TEXT, -- intelligence INTEGER, -- Example Values: `5`, `2`, `1`, `3`, `4` | Value Statics: Total count 38 - Distinct count 5 - Null count 0 l_name TEXT, -- type TEXT, -- Example Values: `RPG`, `TPG`, `UG` | Value Statics: Total count 38 - Distinct count 3 - Null count 0 student_id INTEGER primary key, gpa REAL, -- Example Values: `2.4`, `2.7`, `3.5`, `2.8`, `3.9` | Value Statics: Total count 38 - Distinct count 16 - Null count 0 phone_number TEXT, -- ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, name TEXT, -- Example Values: `Machine Learning Theory`, `Intro to Database 1`, `Intro to Database 2`, `Natural Language Processing`, `Intro to BlockChain` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 diff INTEGER, -- Example Values: `3`, `4`, `1`, `5`, `2` | Value Statics: Total count 13 - Distinct count 5 - Null count 0 credit INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 13 - Distinct count 2 - Null count 0 ); CREATE TABLE registration ( sat INTEGER, -- Example Values: `5`, `4`, `3`, `2`, `1` | Value Statics: Total count 101 - Distinct count 5 - Null count 0 course_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 101 - Distinct count 13 - Null count 0 foreign key (student_id) references student(student_id), primary key (course_id, student_id), foreign key (course_id) references course(course_id), student_id INTEGER, -- grade TEXT, -- Example Values: `A`, `B`, `C`, `D` | Value Statics: Total count 96 - Distinct count 4 - Null count 5 ); CREATE TABLE RA ( prof_id INTEGER, -- Example Values: `7`, `10`, `13`, `9`, `2` | Value Statics: Total count 35 - Distinct count 13 - Null count 0 salary TEXT, -- Example Values: `med`, `high`, `low`, `free` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 student_id INTEGER, -- capability INTEGER, -- Example Values: `2`, `5`, `4`, `3` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 foreign key (prof_id) references prof(prof_id), foreign key (student_id) references student(student_id), primary key (student_id, prof_id), );
human_resources
List the full names, gender and positions who's location is in New York city.
full name = firstname, lastname; New York city refers to locationcity = 'New York City'
SELECT T1.firstname, T1.lastname, T1.gender, T3.positiontitle FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID INNER JOIN position AS T3 ON T3.positionID = T1.positionID WHERE T2.locationcity = 'New York City'
CREATE TABLE position ( minsalary TEXT, -- Example Values: `US$25,000.00`, `US$50,000.00`, `US$18,000.00`, `US$100,000.00` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 maxsalary TEXT, -- Example Values: `US$75,000.00`, `US$150,000.00`, `US$25,000.00`, `US$250,000.00` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 educationrequired TEXT, -- Example Values: `4 year degree`, `2 year degree`, `6 year degree` | Value Statics: Total count 4 - Distinct count 3 - Null count 0 positiontitle TEXT, -- Example Values: `Account Representative`, `Manager`, `Trainee`, `Regional Manager` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 positionID INTEGER constraint position_pk primary key, ); CREATE TABLE location ( officephone TEXT, -- Example Values: `(404)333-5555`, `(617)123-4444`, `(312)444-6666`, `(305)787-9999`, `(518)256-3100` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 locationcity TEXT, -- Example Values: `Atlanta`, `Boston`, `Chicago`, `Miami`, `New York City` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 zipcode INTEGER, -- Example Values: `30316`, `2190`, `60620`, `33103`, `15648` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 locationID INTEGER constraint location_pk primary key, address TEXT, -- Example Values: `450 Peachtree Rd`, `3 Commons Blvd`, `500 Loop Highway`, `210 Biscayne Blvd`, `1650 Washington Blvd` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 state TEXT, -- Example Values: `GA`, `MA`, `IL`, `FL`, `NY` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE employee ( positionID INTEGER, -- Example Values: `2`, `3`, `1`, `4` | Value Statics: Total count 25 - Distinct count 4 - Null count 0 performance TEXT, -- Example Values: `Average`, `Good`, `Poor` | Value Statics: Total count 23 - Distinct count 3 - Null count 2 lastname TEXT, -- foreign key (positionID) references position(positionID), firstname TEXT, -- Example Values: `Patricia`, `Sandy`, `Emily`, `Harold`, `James` | Value Statics: Total count 25 - Distinct count 19 - Null count 0 locationID INTEGER, -- Example Values: `2`, `1`, `5`, `3`, `4` | Value Statics: Total count 25 - Distinct count 7 - Null count 0 salary TEXT, -- ssn TEXT primary key, hiredate TEXT, -- gender TEXT, -- Example Values: `F`, `M` | Value Statics: Total count 24 - Distinct count 2 - Null count 1 foreign key (locationID) references location(locationID), );
image_and_language
How many 'blue' attribute classes are there on image ID 2355735?
blue' attribute classes on image ID 2355735 refer to ATT_CLASS = 'blue' where IMG_ID = 2355735;
SELECT COUNT(T1.ATT_CLASS) FROM ATT_CLASSES AS T1 INNER JOIN IMG_OBJ_ATT AS T2 ON T1.ATT_CLASS_ID = T2.ATT_CLASS_ID WHERE T2.IMG_ID = 2355735 AND T1.ATT_CLASS = 'blue'
CREATE TABLE OBJ_CLASSES ( OBJ_CLASS TEXT not null, -- OBJ_CLASS_ID INTEGER default 0 not null primary key, ); CREATE TABLE ATT_CLASSES ( ATT_CLASS TEXT not null, -- ATT_CLASS_ID INTEGER default 0 not null primary key, ); CREATE TABLE IMG_OBJ_ATT ( IMG_ID INTEGER default 0 not null, -- foreign key (IMG_ID, OBJ_SAMPLE_ID) references IMG_OBJ (IMG_ID, OBJ_SAMPLE_ID), ATT_CLASS_ID INTEGER default 0 not null, -- primary key (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID), OBJ_SAMPLE_ID INTEGER default 0 not null, -- foreign key (ATT_CLASS_ID) references ATT_CLASSES (ATT_CLASS_ID), ); CREATE TABLE IMG_OBJ ( H INTEGER null, -- W INTEGER null, -- primary key (IMG_ID, OBJ_SAMPLE_ID), X INTEGER null, -- OBJ_SAMPLE_ID INTEGER default 0 not null, -- Y INTEGER null, -- OBJ_CLASS_ID INTEGER null, -- foreign key (OBJ_CLASS_ID) references OBJ_CLASSES (OBJ_CLASS_ID), IMG_ID INTEGER default 0 not null, -- ); CREATE TABLE PRED_CLASSES ( PRED_CLASS TEXT not null, -- PRED_CLASS_ID INTEGER default 0 not null primary key, ); CREATE TABLE IMG_REL ( foreign key (IMG_ID, OBJ2_SAMPLE_ID) references IMG_OBJ (IMG_ID, OBJ_SAMPLE_ID), IMG_ID INTEGER default 0 not null, -- foreign key (IMG_ID, OBJ1_SAMPLE_ID) references IMG_OBJ (IMG_ID, OBJ_SAMPLE_ID), OBJ2_SAMPLE_ID INTEGER default 0 not null, -- PRED_CLASS_ID INTEGER default 0 not null, -- primary key (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID), foreign key (PRED_CLASS_ID) references PRED_CLASSES (PRED_CLASS_ID), OBJ1_SAMPLE_ID INTEGER default 0 not null, -- );
olympics
What is the percentage of female competitors whose heights are over 170 that participated in the game in 1988?
DIVIDE(COUNT(person_id where gender = 'F' and height > 170), COUNT(person_id)) as percentage where games_year = 1988;
SELECT CAST(COUNT(CASE WHEN T3.gender = 'F' AND T3.height > 170 THEN 1 END) AS REAL) * 100 / COUNT(T2.person_id) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.games_year = 1988
CREATE TABLE event ( event_name TEXT default NULL, -- sport_id INTEGER default NULL, -- foreign key (sport_id) references sport(id), id INTEGER not null primary key, ); CREATE TABLE sport ( id INTEGER not null primary key, sport_name TEXT default NULL, -- ); CREATE TABLE city ( city_name TEXT default NULL, -- id INTEGER not null primary key, ); CREATE TABLE games_city ( city_id INTEGER default NULL, -- foreign key (games_id) references games(id), games_id INTEGER default NULL, -- foreign key (city_id) references city(id), ); CREATE TABLE competitor_event ( foreign key (event_id) references event(id), foreign key (competitor_id) references games_competitor(id), foreign key (competitor_id) references games_competitor(id), foreign key (medal_id) references medal(id), medal_id INTEGER default NULL, -- Example Values: `4`, `1`, `3`, `2` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 event_id INTEGER default NULL, -- competitor_id INTEGER default NULL, -- ); CREATE TABLE person ( weight INTEGER default NULL, -- height INTEGER default NULL, -- id INTEGER not null primary key, full_name TEXT default NULL, -- gender TEXT default NULL, -- Example Values: `M`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 ); CREATE TABLE noc_region ( region_name TEXT default NULL, -- id INTEGER not null primary key, noc TEXT default NULL, -- ); CREATE TABLE medal ( id INTEGER not null primary key, medal_name TEXT default NULL, -- Example Values: `Gold`, `Silver`, `Bronze`, `NA` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE person_region ( foreign key (region_id) references noc_region(id), region_id INTEGER default NULL, -- foreign key (person_id) references person(id), person_id INTEGER default NULL, -- ); CREATE TABLE games ( season TEXT default NULL, -- Example Values: `Summer`, `Winter` | Value Statics: Total count 51 - Distinct count 2 - Null count 0 id INTEGER not null primary key, games_name TEXT default NULL, -- games_year INTEGER default NULL, -- ); CREATE TABLE games_competitor ( id INTEGER not null primary key, foreign key (games_id) references games(id), games_id INTEGER default NULL, -- age INTEGER default NULL, -- foreign key (person_id) references person(id), person_id INTEGER default NULL, -- );
cs_semester
Among the students with less than four intelligence, list the full name and phone number of students with a greater than 3 GPA.
intelligence < 4; full name = f_name, l_name; gpa > 3;
SELECT f_name, l_name, phone_number FROM student WHERE gpa > 3 AND intelligence < 4
CREATE TABLE prof ( teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0 gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `npigford0@hku.hk`, `zzhihua@hku.hk`, `ozywicki2@hku.hk`, `mconkay3@ucla.edu`, `bmolen4@hku.hk` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 first_name TEXT, -- Example Values: `Nathaniel`, `Zhihua`, `Ogdon`, `Merwyn`, `Bernhard` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 graduate_from TEXT, -- Example Values: `University of Washington`, `Beijing Polytechnic University`, `University of Boston`, `Carnegie Mellon University`, `Princeton University` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 last_name TEXT, -- Example Values: `Pigford`, `Zhou`, `Zywicki`, `Conkay`, `Molen` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 popularity INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 prof_id INTEGER constraint prof_pk primary key, ); CREATE TABLE student ( email TEXT, -- f_name TEXT, -- intelligence INTEGER, -- Example Values: `5`, `2`, `1`, `3`, `4` | Value Statics: Total count 38 - Distinct count 5 - Null count 0 l_name TEXT, -- type TEXT, -- Example Values: `RPG`, `TPG`, `UG` | Value Statics: Total count 38 - Distinct count 3 - Null count 0 student_id INTEGER primary key, gpa REAL, -- Example Values: `2.4`, `2.7`, `3.5`, `2.8`, `3.9` | Value Statics: Total count 38 - Distinct count 16 - Null count 0 phone_number TEXT, -- ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, name TEXT, -- Example Values: `Machine Learning Theory`, `Intro to Database 1`, `Intro to Database 2`, `Natural Language Processing`, `Intro to BlockChain` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 diff INTEGER, -- Example Values: `3`, `4`, `1`, `5`, `2` | Value Statics: Total count 13 - Distinct count 5 - Null count 0 credit INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 13 - Distinct count 2 - Null count 0 ); CREATE TABLE registration ( sat INTEGER, -- Example Values: `5`, `4`, `3`, `2`, `1` | Value Statics: Total count 101 - Distinct count 5 - Null count 0 course_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 101 - Distinct count 13 - Null count 0 foreign key (student_id) references student(student_id), primary key (course_id, student_id), foreign key (course_id) references course(course_id), student_id INTEGER, -- grade TEXT, -- Example Values: `A`, `B`, `C`, `D` | Value Statics: Total count 96 - Distinct count 4 - Null count 5 ); CREATE TABLE RA ( prof_id INTEGER, -- Example Values: `7`, `10`, `13`, `9`, `2` | Value Statics: Total count 35 - Distinct count 13 - Null count 0 salary TEXT, -- Example Values: `med`, `high`, `low`, `free` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 student_id INTEGER, -- capability INTEGER, -- Example Values: `2`, `5`, `4`, `3` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 foreign key (prof_id) references prof(prof_id), foreign key (student_id) references student(student_id), primary key (student_id, prof_id), );
human_resources
What are the maximum and minimum salary range and position title of Bill Marlin?
Bill Marlin is the full name of an employee; full name = firstname, lastname; maximum salary refers to maxsalary; minimum salary refers to minsalary
SELECT T2.maxsalary, T2.minsalary, T2.positiontitle FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.firstname = 'Bill' AND T1.lastname = 'Marlin'
CREATE TABLE position ( minsalary TEXT, -- Example Values: `US$25,000.00`, `US$50,000.00`, `US$18,000.00`, `US$100,000.00` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 maxsalary TEXT, -- Example Values: `US$75,000.00`, `US$150,000.00`, `US$25,000.00`, `US$250,000.00` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 educationrequired TEXT, -- Example Values: `4 year degree`, `2 year degree`, `6 year degree` | Value Statics: Total count 4 - Distinct count 3 - Null count 0 positiontitle TEXT, -- Example Values: `Account Representative`, `Manager`, `Trainee`, `Regional Manager` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 positionID INTEGER constraint position_pk primary key, ); CREATE TABLE location ( officephone TEXT, -- Example Values: `(404)333-5555`, `(617)123-4444`, `(312)444-6666`, `(305)787-9999`, `(518)256-3100` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 locationcity TEXT, -- Example Values: `Atlanta`, `Boston`, `Chicago`, `Miami`, `New York City` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 zipcode INTEGER, -- Example Values: `30316`, `2190`, `60620`, `33103`, `15648` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 locationID INTEGER constraint location_pk primary key, address TEXT, -- Example Values: `450 Peachtree Rd`, `3 Commons Blvd`, `500 Loop Highway`, `210 Biscayne Blvd`, `1650 Washington Blvd` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 state TEXT, -- Example Values: `GA`, `MA`, `IL`, `FL`, `NY` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE employee ( positionID INTEGER, -- Example Values: `2`, `3`, `1`, `4` | Value Statics: Total count 25 - Distinct count 4 - Null count 0 performance TEXT, -- Example Values: `Average`, `Good`, `Poor` | Value Statics: Total count 23 - Distinct count 3 - Null count 2 lastname TEXT, -- foreign key (positionID) references position(positionID), firstname TEXT, -- Example Values: `Patricia`, `Sandy`, `Emily`, `Harold`, `James` | Value Statics: Total count 25 - Distinct count 19 - Null count 0 locationID INTEGER, -- Example Values: `2`, `1`, `5`, `3`, `4` | Value Statics: Total count 25 - Distinct count 7 - Null count 0 salary TEXT, -- ssn TEXT primary key, hiredate TEXT, -- gender TEXT, -- Example Values: `F`, `M` | Value Statics: Total count 24 - Distinct count 2 - Null count 1 foreign key (locationID) references location(locationID), );
image_and_language
Give the X and Y coordinates of the sample object of image ID 23 that has the 'cast' attribute class.
X and Y refer to coordinates of the bounding box; image ID 23 refers to IMG_ID = 23; 'cast' attribute class refers to ATT_CLASS = 'cast';
SELECT T3.OBJ_SAMPLE_ID, T3.X, T3.Y FROM ATT_CLASSES AS T1 INNER JOIN IMG_OBJ_ATT AS T2 ON T1.ATT_CLASS_ID = T2.ATT_CLASS_ID INNER JOIN IMG_OBJ AS T3 ON T2.IMG_ID = T3.IMG_ID WHERE T3.IMG_ID = 23 AND T1.ATT_CLASS = 'cast'
CREATE TABLE OBJ_CLASSES ( OBJ_CLASS TEXT not null, -- OBJ_CLASS_ID INTEGER default 0 not null primary key, ); CREATE TABLE ATT_CLASSES ( ATT_CLASS TEXT not null, -- ATT_CLASS_ID INTEGER default 0 not null primary key, ); CREATE TABLE IMG_OBJ_ATT ( IMG_ID INTEGER default 0 not null, -- foreign key (IMG_ID, OBJ_SAMPLE_ID) references IMG_OBJ (IMG_ID, OBJ_SAMPLE_ID), ATT_CLASS_ID INTEGER default 0 not null, -- primary key (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID), OBJ_SAMPLE_ID INTEGER default 0 not null, -- foreign key (ATT_CLASS_ID) references ATT_CLASSES (ATT_CLASS_ID), ); CREATE TABLE IMG_OBJ ( H INTEGER null, -- W INTEGER null, -- primary key (IMG_ID, OBJ_SAMPLE_ID), X INTEGER null, -- OBJ_SAMPLE_ID INTEGER default 0 not null, -- Y INTEGER null, -- OBJ_CLASS_ID INTEGER null, -- foreign key (OBJ_CLASS_ID) references OBJ_CLASSES (OBJ_CLASS_ID), IMG_ID INTEGER default 0 not null, -- ); CREATE TABLE PRED_CLASSES ( PRED_CLASS TEXT not null, -- PRED_CLASS_ID INTEGER default 0 not null primary key, ); CREATE TABLE IMG_REL ( foreign key (IMG_ID, OBJ2_SAMPLE_ID) references IMG_OBJ (IMG_ID, OBJ_SAMPLE_ID), IMG_ID INTEGER default 0 not null, -- foreign key (IMG_ID, OBJ1_SAMPLE_ID) references IMG_OBJ (IMG_ID, OBJ_SAMPLE_ID), OBJ2_SAMPLE_ID INTEGER default 0 not null, -- PRED_CLASS_ID INTEGER default 0 not null, -- primary key (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID), foreign key (PRED_CLASS_ID) references PRED_CLASSES (PRED_CLASS_ID), OBJ1_SAMPLE_ID INTEGER default 0 not null, -- );
synthea
Among the male patients, list down 5 birth dates of patients taking the medication "Penicillin V Potassium 250 MG".
male patients refers to gender = 'M'; Penicillin V Potassium 250 MG refers to medications.DESCRIPTION = 'Penicillin V Potassium 250 MG';
SELECT DISTINCT T2.birthdate FROM medications AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T1.DESCRIPTION = 'Penicillin V Potassium 250 MG' AND T2.gender = 'M' LIMIT 5
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE DATE, -- primary key (DATE, PATIENT, ENCOUNTER, CODE), DESCRIPTION TEXT, -- Example Values: `Influenza seasonal injectable preservative free`, `Td (adult) preservative free`, `meningococcal MCV4P`, `Tdap`, `HPV quadrivalent` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 ); CREATE TABLE allergies ( CODE INTEGER, -- Example Values: `232347008`, `300916003`, `419474003`, `424213003`, `300913006` | Value Statics: Total count 572 - Distinct count 15 - Null count 0 foreign key (ENCOUNTER) references encounters(ID), foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- primary key (PATIENT, ENCOUNTER, CODE), STOP TEXT, -- Example Values: `12/22/14`, `4/21/10`, `10/15/11`, `3/17/10`, `5/26/08` | Value Statics: Total count 16 - Distinct count 11 - Null count 556 START TEXT, -- DESCRIPTION TEXT, -- Example Values: `Allergy to dairy product`, `Allergy to tree pollen`, `Allergy to grass pollen`, `Dander (animal) allergy`, `House dust mite allergy` | Value Statics: Total count 572 - Distinct count 15 - Null count 0 ); CREATE TABLE observations ( DATE DATE, -- ENCOUNTER TEXT, -- VALUE REAL, -- UNITS TEXT, -- Example Values: `cm`, `kg`, `kg/m2`, `mmHg`, `Cel` | Value Statics: Total count 78444 - Distinct count 17 - Null count 455 DESCRIPTION TEXT, -- CODE TEXT, -- PATIENT TEXT, -- foreign key (PATIENT) references patients(patient), foreign key (ENCOUNTER) references encounters(ID), ); CREATE TABLE medications ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- PATIENT TEXT, -- STOP DATE, -- START DATE, -- REASONDESCRIPTION TEXT, -- DESCRIPTION TEXT, -- primary key (START, PATIENT, ENCOUNTER, CODE), foreign key (PATIENT) references patients(patient), REASONCODE INTEGER, -- ENCOUNTER TEXT, -- ); CREATE TABLE careplans ( START DATE, -- STOP DATE, -- ID TEXT, -- REASONCODE INTEGER, -- REASONDESCRIPTION TEXT, -- foreign key (PATIENT) references patients(patient), PATIENT TEXT, -- DESCRIPTION TEXT, -- CODE REAL, -- ENCOUNTER TEXT, -- foreign key (ENCOUNTER) references encounters(ID), ); CREATE TABLE encounters ( DATE DATE, -- REASONCODE INTEGER, -- CODE INTEGER, -- ID TEXT primary key, DESCRIPTION TEXT, -- foreign key (PATIENT) references patients(patient), PATIENT TEXT, -- REASONDESCRIPTION TEXT, -- ); CREATE TABLE procedures ( foreign key (PATIENT) references patients(patient), REASONDESCRIPTION TEXT, -- PATIENT TEXT, -- foreign key (ENCOUNTER) references encounters(ID), DATE DATE, -- DESCRIPTION TEXT, -- ENCOUNTER TEXT, -- CODE INTEGER, -- REASONCODE INTEGER, -- ); CREATE TABLE patients ( suffix TEXT, -- Example Values: `PhD`, `JD`, `MD` | Value Statics: Total count 45 - Distinct count 3 - Null count 1417 prefix TEXT, -- Example Values: `Mr.`, `Mrs.`, `Ms.` | Value Statics: Total count 1166 - Distinct count 3 - Null count 296 deathdate DATE, -- ethnicity TEXT, -- race TEXT, -- Example Values: `black`, `white`, `hispanic`, `asian` | Value Statics: Total count 1462 - Distinct count 4 - Null count 0 address TEXT, -- birthplace TEXT, -- passport TEXT, -- maiden TEXT, -- birthdate DATE, -- marital TEXT, -- Example Values: `S`, `M` | Value Statics: Total count 1033 - Distinct count 2 - Null count 429 gender TEXT, -- Example Values: `F`, `M` | Value Statics: Total count 1462 - Distinct count 2 - Null count 0 drivers TEXT, -- first TEXT, -- last TEXT, -- patient TEXT primary key, ssn TEXT, -- ); CREATE TABLE claims ( ENCOUNTER TEXT references encounters, -- PATIENT TEXT references patients, -- ORGANIZATION TEXT, -- Example Values: `temp organization` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0 TOTAL INTEGER, -- Example Values: `100` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0 BILLABLEPERIOD DATE, -- DIAGNOSIS TEXT, -- ID TEXT primary key, ); CREATE TABLE conditions ( START DATE, -- DESCRIPTION TEXT, -- foreign key (PATIENT) references patients(patient), PATIENT TEXT, -- CODE INTEGER, -- ENCOUNTER TEXT, -- STOP DATE, -- foreign key (ENCOUNTER) references encounters(ID), foreign key (DESCRIPTION) references all_prevalences(ITEM), ); CREATE TABLE all_prevalences ( "POPULATION TYPE" TEXT, -- Example Values: `LIVING` | Value Statics: Total count 244 - Distinct count 1 - Null count 0 "POPULATION COUNT" INTEGER, -- Example Values: `1000` | Value Statics: Total count 244 - Distinct count 1 - Null count 0 ITEM TEXT primary key, "PREVALENCE PERCENTAGE" REAL, -- "PREVALENCE RATE" REAL, -- OCCURRENCES INTEGER, -- );
cs_semester
Among the professors with a teachability of 3 and below, what is the percentage of their student advisees with a low salary?
teachability < = 3; percentage = MULTIPLY(DIVIDE(COUNT(salary = 'low'), COUNT(salary)), 1.0);
SELECT CAST(SUM(CASE WHEN T1.salary = 'low' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.salary) FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id WHERE T2.teachingability < 3
CREATE TABLE prof ( teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0 gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `npigford0@hku.hk`, `zzhihua@hku.hk`, `ozywicki2@hku.hk`, `mconkay3@ucla.edu`, `bmolen4@hku.hk` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 first_name TEXT, -- Example Values: `Nathaniel`, `Zhihua`, `Ogdon`, `Merwyn`, `Bernhard` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 graduate_from TEXT, -- Example Values: `University of Washington`, `Beijing Polytechnic University`, `University of Boston`, `Carnegie Mellon University`, `Princeton University` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 last_name TEXT, -- Example Values: `Pigford`, `Zhou`, `Zywicki`, `Conkay`, `Molen` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 popularity INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 prof_id INTEGER constraint prof_pk primary key, ); CREATE TABLE student ( email TEXT, -- f_name TEXT, -- intelligence INTEGER, -- Example Values: `5`, `2`, `1`, `3`, `4` | Value Statics: Total count 38 - Distinct count 5 - Null count 0 l_name TEXT, -- type TEXT, -- Example Values: `RPG`, `TPG`, `UG` | Value Statics: Total count 38 - Distinct count 3 - Null count 0 student_id INTEGER primary key, gpa REAL, -- Example Values: `2.4`, `2.7`, `3.5`, `2.8`, `3.9` | Value Statics: Total count 38 - Distinct count 16 - Null count 0 phone_number TEXT, -- ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, name TEXT, -- Example Values: `Machine Learning Theory`, `Intro to Database 1`, `Intro to Database 2`, `Natural Language Processing`, `Intro to BlockChain` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 diff INTEGER, -- Example Values: `3`, `4`, `1`, `5`, `2` | Value Statics: Total count 13 - Distinct count 5 - Null count 0 credit INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 13 - Distinct count 2 - Null count 0 ); CREATE TABLE registration ( sat INTEGER, -- Example Values: `5`, `4`, `3`, `2`, `1` | Value Statics: Total count 101 - Distinct count 5 - Null count 0 course_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 101 - Distinct count 13 - Null count 0 foreign key (student_id) references student(student_id), primary key (course_id, student_id), foreign key (course_id) references course(course_id), student_id INTEGER, -- grade TEXT, -- Example Values: `A`, `B`, `C`, `D` | Value Statics: Total count 96 - Distinct count 4 - Null count 5 ); CREATE TABLE RA ( prof_id INTEGER, -- Example Values: `7`, `10`, `13`, `9`, `2` | Value Statics: Total count 35 - Distinct count 13 - Null count 0 salary TEXT, -- Example Values: `med`, `high`, `low`, `free` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 student_id INTEGER, -- capability INTEGER, -- Example Values: `2`, `5`, `4`, `3` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 foreign key (prof_id) references prof(prof_id), foreign key (student_id) references student(student_id), primary key (student_id, prof_id), );
human_resources
When was Emily Wood hired? Mention her position and salary.
Emily Wood is the full name of an employee; full name = firstname, lastname; when was she hired refers to hiredate
SELECT T1.hiredate, T2.positiontitle, T1.salary FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.firstname = 'Emily' AND T1.lastname = 'Wood'
CREATE TABLE position ( minsalary TEXT, -- Example Values: `US$25,000.00`, `US$50,000.00`, `US$18,000.00`, `US$100,000.00` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 maxsalary TEXT, -- Example Values: `US$75,000.00`, `US$150,000.00`, `US$25,000.00`, `US$250,000.00` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 educationrequired TEXT, -- Example Values: `4 year degree`, `2 year degree`, `6 year degree` | Value Statics: Total count 4 - Distinct count 3 - Null count 0 positiontitle TEXT, -- Example Values: `Account Representative`, `Manager`, `Trainee`, `Regional Manager` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 positionID INTEGER constraint position_pk primary key, ); CREATE TABLE location ( officephone TEXT, -- Example Values: `(404)333-5555`, `(617)123-4444`, `(312)444-6666`, `(305)787-9999`, `(518)256-3100` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 locationcity TEXT, -- Example Values: `Atlanta`, `Boston`, `Chicago`, `Miami`, `New York City` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 zipcode INTEGER, -- Example Values: `30316`, `2190`, `60620`, `33103`, `15648` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 locationID INTEGER constraint location_pk primary key, address TEXT, -- Example Values: `450 Peachtree Rd`, `3 Commons Blvd`, `500 Loop Highway`, `210 Biscayne Blvd`, `1650 Washington Blvd` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 state TEXT, -- Example Values: `GA`, `MA`, `IL`, `FL`, `NY` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE employee ( positionID INTEGER, -- Example Values: `2`, `3`, `1`, `4` | Value Statics: Total count 25 - Distinct count 4 - Null count 0 performance TEXT, -- Example Values: `Average`, `Good`, `Poor` | Value Statics: Total count 23 - Distinct count 3 - Null count 2 lastname TEXT, -- foreign key (positionID) references position(positionID), firstname TEXT, -- Example Values: `Patricia`, `Sandy`, `Emily`, `Harold`, `James` | Value Statics: Total count 25 - Distinct count 19 - Null count 0 locationID INTEGER, -- Example Values: `2`, `1`, `5`, `3`, `4` | Value Statics: Total count 25 - Distinct count 7 - Null count 0 salary TEXT, -- ssn TEXT primary key, hiredate TEXT, -- gender TEXT, -- Example Values: `F`, `M` | Value Statics: Total count 24 - Distinct count 2 - Null count 1 foreign key (locationID) references location(locationID), );
image_and_language
Count the number of 'dress' object classes and include their X and Y coordinates in image ID 1764.
dress' object classes refer to OBJ_CLASS = 'dress'; image ID 1764 refers to IMG_ID = 1764; X and Y refer to coordinates of the bounding box;
SELECT T1.X, T1.Y FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T1.IMG_ID = 1764 AND T2.OBJ_CLASS = 'dress'
CREATE TABLE OBJ_CLASSES ( OBJ_CLASS TEXT not null, -- OBJ_CLASS_ID INTEGER default 0 not null primary key, ); CREATE TABLE ATT_CLASSES ( ATT_CLASS TEXT not null, -- ATT_CLASS_ID INTEGER default 0 not null primary key, ); CREATE TABLE IMG_OBJ_ATT ( IMG_ID INTEGER default 0 not null, -- foreign key (IMG_ID, OBJ_SAMPLE_ID) references IMG_OBJ (IMG_ID, OBJ_SAMPLE_ID), ATT_CLASS_ID INTEGER default 0 not null, -- primary key (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID), OBJ_SAMPLE_ID INTEGER default 0 not null, -- foreign key (ATT_CLASS_ID) references ATT_CLASSES (ATT_CLASS_ID), ); CREATE TABLE IMG_OBJ ( H INTEGER null, -- W INTEGER null, -- primary key (IMG_ID, OBJ_SAMPLE_ID), X INTEGER null, -- OBJ_SAMPLE_ID INTEGER default 0 not null, -- Y INTEGER null, -- OBJ_CLASS_ID INTEGER null, -- foreign key (OBJ_CLASS_ID) references OBJ_CLASSES (OBJ_CLASS_ID), IMG_ID INTEGER default 0 not null, -- ); CREATE TABLE PRED_CLASSES ( PRED_CLASS TEXT not null, -- PRED_CLASS_ID INTEGER default 0 not null primary key, ); CREATE TABLE IMG_REL ( foreign key (IMG_ID, OBJ2_SAMPLE_ID) references IMG_OBJ (IMG_ID, OBJ_SAMPLE_ID), IMG_ID INTEGER default 0 not null, -- foreign key (IMG_ID, OBJ1_SAMPLE_ID) references IMG_OBJ (IMG_ID, OBJ_SAMPLE_ID), OBJ2_SAMPLE_ID INTEGER default 0 not null, -- PRED_CLASS_ID INTEGER default 0 not null, -- primary key (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID), foreign key (PRED_CLASS_ID) references PRED_CLASSES (PRED_CLASS_ID), OBJ1_SAMPLE_ID INTEGER default 0 not null, -- );
cs_semester
Calculate the average satisfaction of the good students with their courses.
average satisfaction = DIVIDE(SUM(sat), COUNT(course_id)); satisfaction refers to sat; good student refers to grade = 'B';
SELECT CAST(SUM(sat) AS REAL) / COUNT(course_id) FROM registration WHERE grade = 'B'
CREATE TABLE prof ( teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0 gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `npigford0@hku.hk`, `zzhihua@hku.hk`, `ozywicki2@hku.hk`, `mconkay3@ucla.edu`, `bmolen4@hku.hk` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 first_name TEXT, -- Example Values: `Nathaniel`, `Zhihua`, `Ogdon`, `Merwyn`, `Bernhard` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 graduate_from TEXT, -- Example Values: `University of Washington`, `Beijing Polytechnic University`, `University of Boston`, `Carnegie Mellon University`, `Princeton University` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 last_name TEXT, -- Example Values: `Pigford`, `Zhou`, `Zywicki`, `Conkay`, `Molen` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 popularity INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 prof_id INTEGER constraint prof_pk primary key, ); CREATE TABLE student ( email TEXT, -- f_name TEXT, -- intelligence INTEGER, -- Example Values: `5`, `2`, `1`, `3`, `4` | Value Statics: Total count 38 - Distinct count 5 - Null count 0 l_name TEXT, -- type TEXT, -- Example Values: `RPG`, `TPG`, `UG` | Value Statics: Total count 38 - Distinct count 3 - Null count 0 student_id INTEGER primary key, gpa REAL, -- Example Values: `2.4`, `2.7`, `3.5`, `2.8`, `3.9` | Value Statics: Total count 38 - Distinct count 16 - Null count 0 phone_number TEXT, -- ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, name TEXT, -- Example Values: `Machine Learning Theory`, `Intro to Database 1`, `Intro to Database 2`, `Natural Language Processing`, `Intro to BlockChain` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 diff INTEGER, -- Example Values: `3`, `4`, `1`, `5`, `2` | Value Statics: Total count 13 - Distinct count 5 - Null count 0 credit INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 13 - Distinct count 2 - Null count 0 ); CREATE TABLE registration ( sat INTEGER, -- Example Values: `5`, `4`, `3`, `2`, `1` | Value Statics: Total count 101 - Distinct count 5 - Null count 0 course_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 101 - Distinct count 13 - Null count 0 foreign key (student_id) references student(student_id), primary key (course_id, student_id), foreign key (course_id) references course(course_id), student_id INTEGER, -- grade TEXT, -- Example Values: `A`, `B`, `C`, `D` | Value Statics: Total count 96 - Distinct count 4 - Null count 5 ); CREATE TABLE RA ( prof_id INTEGER, -- Example Values: `7`, `10`, `13`, `9`, `2` | Value Statics: Total count 35 - Distinct count 13 - Null count 0 salary TEXT, -- Example Values: `med`, `high`, `low`, `free` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 student_id INTEGER, -- capability INTEGER, -- Example Values: `2`, `5`, `4`, `3` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 foreign key (prof_id) references prof(prof_id), foreign key (student_id) references student(student_id), primary key (student_id, prof_id), );
mondial_geo
Where country does Baghdad belongs to?
Baghdad is one of provinces
SELECT Name FROM country WHERE Province = 'Baghdad'
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200 ); CREATE TABLE river ( River TEXT, -- Mountains TEXT, -- SourceAltitude REAL, -- Length REAL, -- EstuaryLatitude REAL, -- SourceLongitude REAL, -- Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, -- EstuaryLongitude REAL, -- Sea TEXT, -- Name TEXT default '' not null primary key, SourceLatitude REAL, -- ); CREATE TABLE mountainOnIsland ( Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, -- primary key (Mountain, Island), Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, -- ); CREATE TABLE organization ( City TEXT, -- constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, -- constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, Abbreviation TEXT not null primary key, Province TEXT, -- Name TEXT not null constraint ix_organization_OrgNameUnique unique, -- Established DATE, -- ); CREATE TABLE geo_desert ( Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, -- Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, -- constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, Desert), ); CREATE TABLE geo_source ( River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, -- constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, -- Province TEXT default '' not null, -- primary key (Province, Country, River), ); CREATE TABLE geo_sea ( Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, -- Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, -- constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, Sea), Province TEXT default '' not null, -- ); CREATE TABLE geo_estuary ( primary key (Province, Country, River), River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, -- constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, -- ); CREATE TABLE located ( River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, -- constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, -- Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, -- Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, -- constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, City TEXT, -- Province TEXT, -- ); CREATE TABLE lake ( Depth REAL, -- Altitude REAL, -- Name TEXT default '' not null primary key, Longitude REAL, -- Latitude REAL, -- Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74 River TEXT, -- Area REAL, -- ); CREATE TABLE desert ( Longitude REAL, -- Area REAL, -- Name TEXT default '' not null primary key, Latitude REAL, -- ); CREATE TABLE geo_mountain ( Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, -- primary key (Province, Country, Mountain), Province TEXT default '' not null, -- constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, -- ); CREATE TABLE ethnicGroup ( primary key (Name, Country), Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, -- Name TEXT default '' not null, -- Percentage REAL, -- ); CREATE TABLE economy ( Industry REAL, -- GDP REAL, -- Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade, Inflation REAL, -- Service REAL, -- Agriculture REAL, -- ); CREATE TABLE borders ( primary key (Country1, Country2), Country2 TEXT default '' not null constraint borders_ibfk_2 references country, -- Length REAL, -- Country1 TEXT default '' not null constraint borders_ibfk_1 references country, -- ); CREATE TABLE language ( primary key (Name, Country), Name TEXT default '' not null, -- Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- ); CREATE TABLE islandIn ( Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, -- River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349 Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, -- Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344 ); CREATE TABLE country ( Area REAL, -- Capital TEXT, -- Population INTEGER, -- Name TEXT not null constraint ix_county_Name unique, -- Province TEXT, -- Code TEXT default '' not null primary key, ); CREATE TABLE city ( Longitude REAL, -- constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Population INTEGER, -- Province TEXT default '' not null, -- primary key (Name, Province), Name TEXT default '' not null, -- Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, -- Latitude REAL, -- ); CREATE TABLE island ( Name TEXT default '' not null primary key, Islands TEXT, -- Area REAL, -- Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185 Longitude REAL, -- Height REAL, -- Latitude REAL, -- ); CREATE TABLE geo_lake ( constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, -- Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, -- primary key (Province, Country, Lake), Province TEXT default '' not null, -- ); CREATE TABLE mountain ( Longitude REAL, -- Name TEXT default '' not null primary key, Latitude REAL, -- Type TEXT, -- Height REAL, -- Mountains TEXT, -- ); CREATE TABLE province ( Capital TEXT, -- Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, -- primary key (Name, Country), Population INTEGER, -- Area REAL, -- Name TEXT not null, -- CapProv TEXT, -- ); CREATE TABLE population ( Infant_Mortality REAL, -- Population_Growth REAL, -- Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade, ); CREATE TABLE isMember ( primary key (Country, Organization), Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, -- Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, -- Type TEXT default 'member', -- ); CREATE TABLE locatedOn ( Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, -- Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, -- Province TEXT default '' not null, -- primary key (City, Province, Country, Island), constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, City TEXT default '' not null, -- ); CREATE TABLE mergesWith ( Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, -- Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, -- primary key (Sea1, Sea2), ); CREATE TABLE encompasses ( Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0 Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0 primary key (Country, Continent), ); CREATE TABLE continent ( Name TEXT default '' not null primary key, Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 ); CREATE TABLE religion ( primary key (Name, Country), Name TEXT default '' not null, -- Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- ); CREATE TABLE geo_river ( constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, River), Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, -- River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, -- ); CREATE TABLE sea ( Depth REAL, -- Name TEXT default '' not null primary key, ); CREATE TABLE target ( Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade, Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0 ); CREATE TABLE geo_island ( Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, -- primary key (Province, Country, Island), Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, -- constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, );
retail_world
What is the average quantity of Ikura ordered in one order?
average = AVG(Quantity); Ikura refers to ProductName = 'Ikura';
SELECT CAST(SUM(T2.Quantity) AS REAL) / COUNT(T2.OrderID) FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductName = 'Ikura'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
video_games
How many games are not of the genres 'Role-Playing', 'Shooter' and 'Simulation'?
not of the genres 'Role-Playing', 'Shooter' and 'Simulation' refers to genre_name NOT IN ('Role-Playing', 'Shooter', 'Simulation');
SELECT COUNT(T2.id) FROM genre AS T1 INNER JOIN game AS T2 ON T1.id = T2.genre_id WHERE T1.genre_name NOT IN ('Role-Playing', 'Shooter', 'Simulation')
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
soccer_2016
Provide the names and birthdates of players who have left-arm fast skills.
player's name refers to Player_Name; birthdate refers to DOB; have left-arm fast skills refers to Bowling_skill = 'Left-arm fast'
SELECT T1.Player_Name, T1.DOB FROM Player AS T1 INNER JOIN Bowling_Style AS T2 ON T2.Bowling_Id = T1.Bowling_skill WHERE T2.Bowling_skill = 'Left-arm fast'
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
mondial_geo
Please list the names of the countries with an inflation rate that's 30% above the average.
Average inflation rate = [sum(inflation) / count(countries)]; 30% above average implies inflation > 1.3 average inflation rate
SELECT T1.Name FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country GROUP BY T1.Name, T2.Inflation HAVING T2.Inflation > AVG(T2.Inflation) * 1.3
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200 ); CREATE TABLE river ( River TEXT, -- Mountains TEXT, -- SourceAltitude REAL, -- Length REAL, -- EstuaryLatitude REAL, -- SourceLongitude REAL, -- Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, -- EstuaryLongitude REAL, -- Sea TEXT, -- Name TEXT default '' not null primary key, SourceLatitude REAL, -- ); CREATE TABLE mountainOnIsland ( Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, -- primary key (Mountain, Island), Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, -- ); CREATE TABLE organization ( City TEXT, -- constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, -- constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, Abbreviation TEXT not null primary key, Province TEXT, -- Name TEXT not null constraint ix_organization_OrgNameUnique unique, -- Established DATE, -- ); CREATE TABLE geo_desert ( Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, -- Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, -- constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, Desert), ); CREATE TABLE geo_source ( River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, -- constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, -- Province TEXT default '' not null, -- primary key (Province, Country, River), ); CREATE TABLE geo_sea ( Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, -- Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, -- constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, Sea), Province TEXT default '' not null, -- ); CREATE TABLE geo_estuary ( primary key (Province, Country, River), River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, -- constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, -- ); CREATE TABLE located ( River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, -- constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, -- Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, -- Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, -- constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, City TEXT, -- Province TEXT, -- ); CREATE TABLE lake ( Depth REAL, -- Altitude REAL, -- Name TEXT default '' not null primary key, Longitude REAL, -- Latitude REAL, -- Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74 River TEXT, -- Area REAL, -- ); CREATE TABLE desert ( Longitude REAL, -- Area REAL, -- Name TEXT default '' not null primary key, Latitude REAL, -- ); CREATE TABLE geo_mountain ( Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, -- primary key (Province, Country, Mountain), Province TEXT default '' not null, -- constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, -- ); CREATE TABLE ethnicGroup ( primary key (Name, Country), Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, -- Name TEXT default '' not null, -- Percentage REAL, -- ); CREATE TABLE economy ( Industry REAL, -- GDP REAL, -- Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade, Inflation REAL, -- Service REAL, -- Agriculture REAL, -- ); CREATE TABLE borders ( primary key (Country1, Country2), Country2 TEXT default '' not null constraint borders_ibfk_2 references country, -- Length REAL, -- Country1 TEXT default '' not null constraint borders_ibfk_1 references country, -- ); CREATE TABLE language ( primary key (Name, Country), Name TEXT default '' not null, -- Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- ); CREATE TABLE islandIn ( Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, -- River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349 Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, -- Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344 ); CREATE TABLE country ( Area REAL, -- Capital TEXT, -- Population INTEGER, -- Name TEXT not null constraint ix_county_Name unique, -- Province TEXT, -- Code TEXT default '' not null primary key, ); CREATE TABLE city ( Longitude REAL, -- constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Population INTEGER, -- Province TEXT default '' not null, -- primary key (Name, Province), Name TEXT default '' not null, -- Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, -- Latitude REAL, -- ); CREATE TABLE island ( Name TEXT default '' not null primary key, Islands TEXT, -- Area REAL, -- Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185 Longitude REAL, -- Height REAL, -- Latitude REAL, -- ); CREATE TABLE geo_lake ( constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, -- Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, -- primary key (Province, Country, Lake), Province TEXT default '' not null, -- ); CREATE TABLE mountain ( Longitude REAL, -- Name TEXT default '' not null primary key, Latitude REAL, -- Type TEXT, -- Height REAL, -- Mountains TEXT, -- ); CREATE TABLE province ( Capital TEXT, -- Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, -- primary key (Name, Country), Population INTEGER, -- Area REAL, -- Name TEXT not null, -- CapProv TEXT, -- ); CREATE TABLE population ( Infant_Mortality REAL, -- Population_Growth REAL, -- Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade, ); CREATE TABLE isMember ( primary key (Country, Organization), Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, -- Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, -- Type TEXT default 'member', -- ); CREATE TABLE locatedOn ( Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, -- Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, -- Province TEXT default '' not null, -- primary key (City, Province, Country, Island), constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, City TEXT default '' not null, -- ); CREATE TABLE mergesWith ( Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, -- Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, -- primary key (Sea1, Sea2), ); CREATE TABLE encompasses ( Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0 Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0 primary key (Country, Continent), ); CREATE TABLE continent ( Name TEXT default '' not null primary key, Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 ); CREATE TABLE religion ( primary key (Name, Country), Name TEXT default '' not null, -- Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- ); CREATE TABLE geo_river ( constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, River), Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, -- River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, -- ); CREATE TABLE sea ( Depth REAL, -- Name TEXT default '' not null primary key, ); CREATE TABLE target ( Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade, Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0 ); CREATE TABLE geo_island ( Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, -- primary key (Province, Country, Island), Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, -- constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, );
retail_world
How much lower in percentage is the unit price of Ikura in order no. 10273 than its standard unit price?
how much lower in percentage = MULTIPLY(DIVIDE(SUBTRACT(Products.UnitPrice, Order Details.UnitPrice), Products.UnitPrice), 100); Ikura refers to ProductName = 'Ikura'; order no. refers to OrderID;
SELECT CAST((T1.UnitPrice - T2.UnitPrice) AS REAL) * 100 / T1.UnitPrice FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T2.OrderID = 10273 AND T1.ProductName = 'Ikura'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
shakespeare
In "Twelfth Night, Or What You Will", what is the description of the chapter in 2nd scene, Act 2?
"Twelfth Night, Or What You Will"  refers to LongTitle = 'Twelfth Night, Or What You Will'; 2nd scene refers to Scene = 2
SELECT T2.Description FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id WHERE T1.LongTitle = 'Twelfth Night, Or What You Will' AND T2.Scene = 2 AND T2.Act = 2
CREATE TABLE characters ( CharName TEXT not null, -- Abbrev TEXT not null, -- Description TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE paragraphs ( chapter_id INTEGER default 0 not null references chapters, -- character_id INTEGER not null references characters, -- ParagraphNum INTEGER not null, -- PlainText TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE works ( GenreType TEXT not null, -- Example Values: `Comedy`, `Tragedy`, `History`, `Poem`, `Sonnet` | Value Statics: Total count 43 - Distinct count 5 - Null count 0 Title TEXT not null, -- Date INTEGER not null, -- id INTEGER primary key autoincrement, LongTitle TEXT not null, -- ); CREATE TABLE chapters ( work_id INTEGER not null references works, -- Act INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 945 - Distinct count 6 - Null count 0 Description TEXT not null, -- id INTEGER primary key autoincrement, Scene INTEGER not null, -- );
soccer_2016
Among the matches held in Mumbai, how many percent of them were held in Wankhede Stadium?
Mumbai refers to City_Name = 'Mumbai'; Wankhede Stadium refers to Venue_Name = 'Wankhede Stadium'; percent = divide(count(Match_Id where Venue_Name = 'Wankhede Stadium'), count(Match_Id)) * 100% where City_Name = 'Mumbai'
SELECT CAST(SUM(CASE WHEN T2.Venue_Name = 'Wankhede Stadium' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T3.Match_Id) FROM City AS T1 INNER JOIN Venue AS T2 ON T2.City_Id = T1.City_Id INNER JOIN Match AS T3 ON T3.Venue_Id = T2.Venue_Id WHERE T1.City_Name = 'Mumbai'
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
mondial_geo
What is the average population growth rate of countries where more than 3 languages are used?
null
SELECT SUM(T3.Population_Growth) / COUNT(T3.Country) FROM country AS T1 INNER JOIN language AS T2 ON T1.Code = T2.Country INNER JOIN population AS T3 ON T3.Country = T2.Country WHERE T2.Country IN ( SELECT Country FROM language GROUP BY Country HAVING COUNT(Country) > 3 ) GROUP BY T3.Country
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200 ); CREATE TABLE river ( River TEXT, -- Mountains TEXT, -- SourceAltitude REAL, -- Length REAL, -- EstuaryLatitude REAL, -- SourceLongitude REAL, -- Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, -- EstuaryLongitude REAL, -- Sea TEXT, -- Name TEXT default '' not null primary key, SourceLatitude REAL, -- ); CREATE TABLE mountainOnIsland ( Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, -- primary key (Mountain, Island), Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, -- ); CREATE TABLE organization ( City TEXT, -- constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, -- constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, Abbreviation TEXT not null primary key, Province TEXT, -- Name TEXT not null constraint ix_organization_OrgNameUnique unique, -- Established DATE, -- ); CREATE TABLE geo_desert ( Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, -- Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, -- constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, Desert), ); CREATE TABLE geo_source ( River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, -- constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, -- Province TEXT default '' not null, -- primary key (Province, Country, River), ); CREATE TABLE geo_sea ( Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, -- Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, -- constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, Sea), Province TEXT default '' not null, -- ); CREATE TABLE geo_estuary ( primary key (Province, Country, River), River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, -- constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, -- ); CREATE TABLE located ( River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, -- constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, -- Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, -- Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, -- constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, City TEXT, -- Province TEXT, -- ); CREATE TABLE lake ( Depth REAL, -- Altitude REAL, -- Name TEXT default '' not null primary key, Longitude REAL, -- Latitude REAL, -- Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74 River TEXT, -- Area REAL, -- ); CREATE TABLE desert ( Longitude REAL, -- Area REAL, -- Name TEXT default '' not null primary key, Latitude REAL, -- ); CREATE TABLE geo_mountain ( Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, -- primary key (Province, Country, Mountain), Province TEXT default '' not null, -- constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, -- ); CREATE TABLE ethnicGroup ( primary key (Name, Country), Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, -- Name TEXT default '' not null, -- Percentage REAL, -- ); CREATE TABLE economy ( Industry REAL, -- GDP REAL, -- Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade, Inflation REAL, -- Service REAL, -- Agriculture REAL, -- ); CREATE TABLE borders ( primary key (Country1, Country2), Country2 TEXT default '' not null constraint borders_ibfk_2 references country, -- Length REAL, -- Country1 TEXT default '' not null constraint borders_ibfk_1 references country, -- ); CREATE TABLE language ( primary key (Name, Country), Name TEXT default '' not null, -- Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- ); CREATE TABLE islandIn ( Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, -- River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349 Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, -- Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344 ); CREATE TABLE country ( Area REAL, -- Capital TEXT, -- Population INTEGER, -- Name TEXT not null constraint ix_county_Name unique, -- Province TEXT, -- Code TEXT default '' not null primary key, ); CREATE TABLE city ( Longitude REAL, -- constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Population INTEGER, -- Province TEXT default '' not null, -- primary key (Name, Province), Name TEXT default '' not null, -- Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, -- Latitude REAL, -- ); CREATE TABLE island ( Name TEXT default '' not null primary key, Islands TEXT, -- Area REAL, -- Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185 Longitude REAL, -- Height REAL, -- Latitude REAL, -- ); CREATE TABLE geo_lake ( constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, -- Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, -- primary key (Province, Country, Lake), Province TEXT default '' not null, -- ); CREATE TABLE mountain ( Longitude REAL, -- Name TEXT default '' not null primary key, Latitude REAL, -- Type TEXT, -- Height REAL, -- Mountains TEXT, -- ); CREATE TABLE province ( Capital TEXT, -- Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, -- primary key (Name, Country), Population INTEGER, -- Area REAL, -- Name TEXT not null, -- CapProv TEXT, -- ); CREATE TABLE population ( Infant_Mortality REAL, -- Population_Growth REAL, -- Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade, ); CREATE TABLE isMember ( primary key (Country, Organization), Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, -- Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, -- Type TEXT default 'member', -- ); CREATE TABLE locatedOn ( Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, -- Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, -- Province TEXT default '' not null, -- primary key (City, Province, Country, Island), constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, City TEXT default '' not null, -- ); CREATE TABLE mergesWith ( Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, -- Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, -- primary key (Sea1, Sea2), ); CREATE TABLE encompasses ( Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0 Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0 primary key (Country, Continent), ); CREATE TABLE continent ( Name TEXT default '' not null primary key, Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 ); CREATE TABLE religion ( primary key (Name, Country), Name TEXT default '' not null, -- Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- ); CREATE TABLE geo_river ( constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, River), Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, -- River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, -- ); CREATE TABLE sea ( Depth REAL, -- Name TEXT default '' not null primary key, ); CREATE TABLE target ( Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade, Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0 ); CREATE TABLE geo_island ( Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, -- primary key (Province, Country, Island), Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, -- constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, );
retail_world
What is the average salary of the employees who takes charge of the sales of over 4 territories?
average salary = DIVIDE(SUM(Salary), COUNT(EmployeeID)); employees who takes charge of over 4 territories refers to EmployeeID WHERE COUNT(TerritoryID) > 4;
SELECT AVG(T1.Salary) FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID GROUP BY T1.EmployeeID HAVING COUNT(T2.TerritoryID) > 4
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
video_games
How many different publishers have published a game that starts with "Marvel"?
game that starts with "Marvel" refers to game_name LIKE 'Marvel%';
SELECT COUNT(DISTINCT T1.publisher_id) FROM game_publisher AS T1 INNER JOIN game AS T2 ON T1.game_id = T2.id WHERE T2.game_name LIKE 'Marvel%'
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
soccer_2016
Where did BR Doctrove come from?
the country the umpire comes from refers to Country_Name; BR Doctrove refers to Umpire_Name = 'BR Doctrove'
SELECT T1.Country_Name FROM Country AS T1 INNER JOIN Umpire AS T2 ON T2.Umpire_Country = T1.Country_Id WHERE T2.Umpire_Name = 'BR Doctrove'
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
mondial_geo
What is the highest lake area coverage of a country?
Lake area coverage = [sum(area of the lakes in the country) / (area of the country)] * 100%
SELECT T2.Area * 100 / T3.Area FROM located AS T1 INNER JOIN lake AS T2 ON T1.Lake = T2.Name INNER JOIN country AS T3 ON T3.Code = T1.Country ORDER BY T2.Longitude DESC LIMIT 1
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200 ); CREATE TABLE river ( River TEXT, -- Mountains TEXT, -- SourceAltitude REAL, -- Length REAL, -- EstuaryLatitude REAL, -- SourceLongitude REAL, -- Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, -- EstuaryLongitude REAL, -- Sea TEXT, -- Name TEXT default '' not null primary key, SourceLatitude REAL, -- ); CREATE TABLE mountainOnIsland ( Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, -- primary key (Mountain, Island), Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, -- ); CREATE TABLE organization ( City TEXT, -- constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, -- constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, Abbreviation TEXT not null primary key, Province TEXT, -- Name TEXT not null constraint ix_organization_OrgNameUnique unique, -- Established DATE, -- ); CREATE TABLE geo_desert ( Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, -- Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, -- constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, Desert), ); CREATE TABLE geo_source ( River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, -- constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, -- Province TEXT default '' not null, -- primary key (Province, Country, River), ); CREATE TABLE geo_sea ( Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, -- Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, -- constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, Sea), Province TEXT default '' not null, -- ); CREATE TABLE geo_estuary ( primary key (Province, Country, River), River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, -- constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, -- ); CREATE TABLE located ( River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, -- constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, -- Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, -- Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, -- constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, City TEXT, -- Province TEXT, -- ); CREATE TABLE lake ( Depth REAL, -- Altitude REAL, -- Name TEXT default '' not null primary key, Longitude REAL, -- Latitude REAL, -- Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74 River TEXT, -- Area REAL, -- ); CREATE TABLE desert ( Longitude REAL, -- Area REAL, -- Name TEXT default '' not null primary key, Latitude REAL, -- ); CREATE TABLE geo_mountain ( Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, -- primary key (Province, Country, Mountain), Province TEXT default '' not null, -- constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, -- ); CREATE TABLE ethnicGroup ( primary key (Name, Country), Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, -- Name TEXT default '' not null, -- Percentage REAL, -- ); CREATE TABLE economy ( Industry REAL, -- GDP REAL, -- Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade, Inflation REAL, -- Service REAL, -- Agriculture REAL, -- ); CREATE TABLE borders ( primary key (Country1, Country2), Country2 TEXT default '' not null constraint borders_ibfk_2 references country, -- Length REAL, -- Country1 TEXT default '' not null constraint borders_ibfk_1 references country, -- ); CREATE TABLE language ( primary key (Name, Country), Name TEXT default '' not null, -- Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- ); CREATE TABLE islandIn ( Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, -- River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349 Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, -- Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344 ); CREATE TABLE country ( Area REAL, -- Capital TEXT, -- Population INTEGER, -- Name TEXT not null constraint ix_county_Name unique, -- Province TEXT, -- Code TEXT default '' not null primary key, ); CREATE TABLE city ( Longitude REAL, -- constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Population INTEGER, -- Province TEXT default '' not null, -- primary key (Name, Province), Name TEXT default '' not null, -- Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, -- Latitude REAL, -- ); CREATE TABLE island ( Name TEXT default '' not null primary key, Islands TEXT, -- Area REAL, -- Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185 Longitude REAL, -- Height REAL, -- Latitude REAL, -- ); CREATE TABLE geo_lake ( constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, -- Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, -- primary key (Province, Country, Lake), Province TEXT default '' not null, -- ); CREATE TABLE mountain ( Longitude REAL, -- Name TEXT default '' not null primary key, Latitude REAL, -- Type TEXT, -- Height REAL, -- Mountains TEXT, -- ); CREATE TABLE province ( Capital TEXT, -- Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, -- primary key (Name, Country), Population INTEGER, -- Area REAL, -- Name TEXT not null, -- CapProv TEXT, -- ); CREATE TABLE population ( Infant_Mortality REAL, -- Population_Growth REAL, -- Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade, ); CREATE TABLE isMember ( primary key (Country, Organization), Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, -- Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, -- Type TEXT default 'member', -- ); CREATE TABLE locatedOn ( Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, -- Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, -- Province TEXT default '' not null, -- primary key (City, Province, Country, Island), constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, City TEXT default '' not null, -- ); CREATE TABLE mergesWith ( Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, -- Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, -- primary key (Sea1, Sea2), ); CREATE TABLE encompasses ( Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0 Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0 primary key (Country, Continent), ); CREATE TABLE continent ( Name TEXT default '' not null primary key, Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 ); CREATE TABLE religion ( primary key (Name, Country), Name TEXT default '' not null, -- Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- ); CREATE TABLE geo_river ( constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, River), Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, -- River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, -- ); CREATE TABLE sea ( Depth REAL, -- Name TEXT default '' not null primary key, ); CREATE TABLE target ( Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade, Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0 ); CREATE TABLE geo_island ( Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, -- primary key (Province, Country, Island), Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, -- constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, );
retail_world
Who is the supplier of the product with the highest unit price?
supplier of the product refers to CompanyName; highest unit price refers to MAX(UnitPrice);
SELECT T2.CompanyName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.UnitPrice = ( SELECT MAX(UnitPrice) FROM Products )
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
soccer_2016
Which team did CK Kapugedera belong to? How many matches did he play?
team refers to Team_Name; CK Kapugedera refers to Player_Name = 'CK Kapugedera'
SELECT T3.Team_Name, COUNT(T2.Match_Id) FROM Player AS T1 INNER JOIN Player_Match AS T2 ON T2.Player_Id = T1.Player_Id INNER JOIN Team AS T3 ON T3.Team_Id = T2.Team_Id WHERE T1.Player_Name = 'CK Kapugedera'
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
mondial_geo
Which country has the highest GDP per capita?
GDP per capita = GDP / population
SELECT T1.Name FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country ORDER BY T2.GDP / T1.Population DESC LIMIT 1
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200 ); CREATE TABLE river ( River TEXT, -- Mountains TEXT, -- SourceAltitude REAL, -- Length REAL, -- EstuaryLatitude REAL, -- SourceLongitude REAL, -- Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, -- EstuaryLongitude REAL, -- Sea TEXT, -- Name TEXT default '' not null primary key, SourceLatitude REAL, -- ); CREATE TABLE mountainOnIsland ( Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, -- primary key (Mountain, Island), Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, -- ); CREATE TABLE organization ( City TEXT, -- constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, -- constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, Abbreviation TEXT not null primary key, Province TEXT, -- Name TEXT not null constraint ix_organization_OrgNameUnique unique, -- Established DATE, -- ); CREATE TABLE geo_desert ( Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, -- Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, -- constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, Desert), ); CREATE TABLE geo_source ( River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, -- constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, -- Province TEXT default '' not null, -- primary key (Province, Country, River), ); CREATE TABLE geo_sea ( Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, -- Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, -- constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, Sea), Province TEXT default '' not null, -- ); CREATE TABLE geo_estuary ( primary key (Province, Country, River), River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, -- constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, -- ); CREATE TABLE located ( River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, -- constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, -- Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, -- Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, -- constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, City TEXT, -- Province TEXT, -- ); CREATE TABLE lake ( Depth REAL, -- Altitude REAL, -- Name TEXT default '' not null primary key, Longitude REAL, -- Latitude REAL, -- Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74 River TEXT, -- Area REAL, -- ); CREATE TABLE desert ( Longitude REAL, -- Area REAL, -- Name TEXT default '' not null primary key, Latitude REAL, -- ); CREATE TABLE geo_mountain ( Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, -- primary key (Province, Country, Mountain), Province TEXT default '' not null, -- constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, -- ); CREATE TABLE ethnicGroup ( primary key (Name, Country), Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, -- Name TEXT default '' not null, -- Percentage REAL, -- ); CREATE TABLE economy ( Industry REAL, -- GDP REAL, -- Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade, Inflation REAL, -- Service REAL, -- Agriculture REAL, -- ); CREATE TABLE borders ( primary key (Country1, Country2), Country2 TEXT default '' not null constraint borders_ibfk_2 references country, -- Length REAL, -- Country1 TEXT default '' not null constraint borders_ibfk_1 references country, -- ); CREATE TABLE language ( primary key (Name, Country), Name TEXT default '' not null, -- Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- ); CREATE TABLE islandIn ( Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, -- River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349 Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, -- Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344 ); CREATE TABLE country ( Area REAL, -- Capital TEXT, -- Population INTEGER, -- Name TEXT not null constraint ix_county_Name unique, -- Province TEXT, -- Code TEXT default '' not null primary key, ); CREATE TABLE city ( Longitude REAL, -- constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Population INTEGER, -- Province TEXT default '' not null, -- primary key (Name, Province), Name TEXT default '' not null, -- Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, -- Latitude REAL, -- ); CREATE TABLE island ( Name TEXT default '' not null primary key, Islands TEXT, -- Area REAL, -- Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185 Longitude REAL, -- Height REAL, -- Latitude REAL, -- ); CREATE TABLE geo_lake ( constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, -- Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, -- primary key (Province, Country, Lake), Province TEXT default '' not null, -- ); CREATE TABLE mountain ( Longitude REAL, -- Name TEXT default '' not null primary key, Latitude REAL, -- Type TEXT, -- Height REAL, -- Mountains TEXT, -- ); CREATE TABLE province ( Capital TEXT, -- Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, -- primary key (Name, Country), Population INTEGER, -- Area REAL, -- Name TEXT not null, -- CapProv TEXT, -- ); CREATE TABLE population ( Infant_Mortality REAL, -- Population_Growth REAL, -- Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade, ); CREATE TABLE isMember ( primary key (Country, Organization), Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, -- Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, -- Type TEXT default 'member', -- ); CREATE TABLE locatedOn ( Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, -- Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, -- Province TEXT default '' not null, -- primary key (City, Province, Country, Island), constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, City TEXT default '' not null, -- ); CREATE TABLE mergesWith ( Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, -- Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, -- primary key (Sea1, Sea2), ); CREATE TABLE encompasses ( Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0 Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0 primary key (Country, Continent), ); CREATE TABLE continent ( Name TEXT default '' not null primary key, Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 ); CREATE TABLE religion ( primary key (Name, Country), Name TEXT default '' not null, -- Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- ); CREATE TABLE geo_river ( constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, River), Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, -- River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, -- ); CREATE TABLE sea ( Depth REAL, -- Name TEXT default '' not null primary key, ); CREATE TABLE target ( Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade, Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0 ); CREATE TABLE geo_island ( Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, -- primary key (Province, Country, Island), Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, -- constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, );
retail_world
Among the products that are no longer in continuous production, how many of them have their supplier in the USA?
no longer continuous refers to Discontinued = 1; USA refers to Country = 'USA';
SELECT COUNT(T1.Discontinued) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.Country = 'USA' AND T1.Discontinued = 1
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
video_games
List the name of all games published in Japan.
name of games refers to game_name; Japan refers to region_name = 'Japan';
SELECT T1.game_name FROM game AS T1 INNER JOIN game_publisher AS T2 ON T1.id = T2.game_id INNER JOIN game_platform AS T3 ON T2.id = T3.game_publisher_id INNER JOIN region_sales AS T4 ON T3.id = T4.game_platform_id INNER JOIN region AS T5 ON T4.region_id = T5.id WHERE T5.region_name = 'Japan'
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
shakespeare
Which of Shakespeare's work has chapter description of "A field near Windsor"?
null
SELECT T2.Title FROM chapters AS T1 INNER JOIN works AS T2 ON T1.work_id = T2.id WHERE T1.Description = 'A field near Windsor.'
CREATE TABLE characters ( CharName TEXT not null, -- Abbrev TEXT not null, -- Description TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE paragraphs ( chapter_id INTEGER default 0 not null references chapters, -- character_id INTEGER not null references characters, -- ParagraphNum INTEGER not null, -- PlainText TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE works ( GenreType TEXT not null, -- Example Values: `Comedy`, `Tragedy`, `History`, `Poem`, `Sonnet` | Value Statics: Total count 43 - Distinct count 5 - Null count 0 Title TEXT not null, -- Date INTEGER not null, -- id INTEGER primary key autoincrement, LongTitle TEXT not null, -- ); CREATE TABLE chapters ( work_id INTEGER not null references works, -- Act INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 945 - Distinct count 6 - Null count 0 Description TEXT not null, -- id INTEGER primary key autoincrement, Scene INTEGER not null, -- );
mondial_geo
Among the countries whose GDP is over 1000000, how many of them have a population groth rate of over 3%?
population growth rate of over 3% means population_growth > 3
SELECT COUNT(T1.Country) FROM economy AS T1 INNER JOIN population AS T2 ON T1.Country = T2.Country WHERE T1.GDP > 1000000 AND T2.Population_Growth > 3
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200 ); CREATE TABLE river ( River TEXT, -- Mountains TEXT, -- SourceAltitude REAL, -- Length REAL, -- EstuaryLatitude REAL, -- SourceLongitude REAL, -- Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, -- EstuaryLongitude REAL, -- Sea TEXT, -- Name TEXT default '' not null primary key, SourceLatitude REAL, -- ); CREATE TABLE mountainOnIsland ( Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, -- primary key (Mountain, Island), Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, -- ); CREATE TABLE organization ( City TEXT, -- constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, -- constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, Abbreviation TEXT not null primary key, Province TEXT, -- Name TEXT not null constraint ix_organization_OrgNameUnique unique, -- Established DATE, -- ); CREATE TABLE geo_desert ( Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, -- Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, -- constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, Desert), ); CREATE TABLE geo_source ( River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, -- constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, -- Province TEXT default '' not null, -- primary key (Province, Country, River), ); CREATE TABLE geo_sea ( Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, -- Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, -- constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, Sea), Province TEXT default '' not null, -- ); CREATE TABLE geo_estuary ( primary key (Province, Country, River), River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, -- constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, -- ); CREATE TABLE located ( River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, -- constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, -- Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, -- Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, -- constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, City TEXT, -- Province TEXT, -- ); CREATE TABLE lake ( Depth REAL, -- Altitude REAL, -- Name TEXT default '' not null primary key, Longitude REAL, -- Latitude REAL, -- Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74 River TEXT, -- Area REAL, -- ); CREATE TABLE desert ( Longitude REAL, -- Area REAL, -- Name TEXT default '' not null primary key, Latitude REAL, -- ); CREATE TABLE geo_mountain ( Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, -- primary key (Province, Country, Mountain), Province TEXT default '' not null, -- constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, -- ); CREATE TABLE ethnicGroup ( primary key (Name, Country), Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, -- Name TEXT default '' not null, -- Percentage REAL, -- ); CREATE TABLE economy ( Industry REAL, -- GDP REAL, -- Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade, Inflation REAL, -- Service REAL, -- Agriculture REAL, -- ); CREATE TABLE borders ( primary key (Country1, Country2), Country2 TEXT default '' not null constraint borders_ibfk_2 references country, -- Length REAL, -- Country1 TEXT default '' not null constraint borders_ibfk_1 references country, -- ); CREATE TABLE language ( primary key (Name, Country), Name TEXT default '' not null, -- Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- ); CREATE TABLE islandIn ( Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, -- River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349 Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, -- Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344 ); CREATE TABLE country ( Area REAL, -- Capital TEXT, -- Population INTEGER, -- Name TEXT not null constraint ix_county_Name unique, -- Province TEXT, -- Code TEXT default '' not null primary key, ); CREATE TABLE city ( Longitude REAL, -- constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Population INTEGER, -- Province TEXT default '' not null, -- primary key (Name, Province), Name TEXT default '' not null, -- Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, -- Latitude REAL, -- ); CREATE TABLE island ( Name TEXT default '' not null primary key, Islands TEXT, -- Area REAL, -- Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185 Longitude REAL, -- Height REAL, -- Latitude REAL, -- ); CREATE TABLE geo_lake ( constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, -- Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, -- primary key (Province, Country, Lake), Province TEXT default '' not null, -- ); CREATE TABLE mountain ( Longitude REAL, -- Name TEXT default '' not null primary key, Latitude REAL, -- Type TEXT, -- Height REAL, -- Mountains TEXT, -- ); CREATE TABLE province ( Capital TEXT, -- Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, -- primary key (Name, Country), Population INTEGER, -- Area REAL, -- Name TEXT not null, -- CapProv TEXT, -- ); CREATE TABLE population ( Infant_Mortality REAL, -- Population_Growth REAL, -- Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade, ); CREATE TABLE isMember ( primary key (Country, Organization), Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, -- Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, -- Type TEXT default 'member', -- ); CREATE TABLE locatedOn ( Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, -- Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, -- Province TEXT default '' not null, -- primary key (City, Province, Country, Island), constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, City TEXT default '' not null, -- ); CREATE TABLE mergesWith ( Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, -- Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, -- primary key (Sea1, Sea2), ); CREATE TABLE encompasses ( Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0 Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0 primary key (Country, Continent), ); CREATE TABLE continent ( Name TEXT default '' not null primary key, Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 ); CREATE TABLE religion ( primary key (Name, Country), Name TEXT default '' not null, -- Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- ); CREATE TABLE geo_river ( constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, River), Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, -- River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, -- ); CREATE TABLE sea ( Depth REAL, -- Name TEXT default '' not null primary key, ); CREATE TABLE target ( Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade, Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0 ); CREATE TABLE geo_island ( Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, -- primary key (Province, Country, Island), Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, -- constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, );
retail_world
Please list the phone numbers of the suppliers of the products that have a higher units on order than units in stock.
UnitsInStock < UnitsOnOrder;
SELECT DISTINCT T2.Phone FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.UnitsInStock < T1.UnitsOnOrder
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
soccer_2016
List the names and countries of the players from Gujarat Lions who played in the match held on 11th April 2016.
player's name refers to Player_Name; country refers to Country_Name; Gujarat Lions refers to Team_Name = 'Gujarat Lions'; on 11th April 2016 refers to Match_Date = '2016-04-11'
SELECT T4.Player_Name, T5.Country_Name FROM Player_Match AS T1 INNER JOIN Team AS T2 ON T2.Team_Id = T1.Team_Id INNER JOIN Match AS T3 ON T3.Match_Id = T1.Match_Id INNER JOIN Player AS T4 ON T4.Player_Id = T1.Player_Id INNER JOIN Country AS T5 ON T5.Country_Id = T4.Country_Name WHERE T2.Team_Name = 'Gujarat Lions' AND T3.Match_Date = '2016-04-11'
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
mondial_geo
What is the highest infant mortality rate per thousand of the countries whose inflation is under 3?
null
SELECT MAX(T2.Infant_Mortality) FROM economy AS T1 INNER JOIN population AS T2 ON T1.Country = T2.Country WHERE T1.Inflation < 3
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200 ); CREATE TABLE river ( River TEXT, -- Mountains TEXT, -- SourceAltitude REAL, -- Length REAL, -- EstuaryLatitude REAL, -- SourceLongitude REAL, -- Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, -- EstuaryLongitude REAL, -- Sea TEXT, -- Name TEXT default '' not null primary key, SourceLatitude REAL, -- ); CREATE TABLE mountainOnIsland ( Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, -- primary key (Mountain, Island), Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, -- ); CREATE TABLE organization ( City TEXT, -- constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, -- constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, Abbreviation TEXT not null primary key, Province TEXT, -- Name TEXT not null constraint ix_organization_OrgNameUnique unique, -- Established DATE, -- ); CREATE TABLE geo_desert ( Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, -- Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, -- constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, Desert), ); CREATE TABLE geo_source ( River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, -- constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, -- Province TEXT default '' not null, -- primary key (Province, Country, River), ); CREATE TABLE geo_sea ( Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, -- Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, -- constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, Sea), Province TEXT default '' not null, -- ); CREATE TABLE geo_estuary ( primary key (Province, Country, River), River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, -- constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, -- ); CREATE TABLE located ( River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, -- constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, -- Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, -- Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, -- constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, City TEXT, -- Province TEXT, -- ); CREATE TABLE lake ( Depth REAL, -- Altitude REAL, -- Name TEXT default '' not null primary key, Longitude REAL, -- Latitude REAL, -- Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74 River TEXT, -- Area REAL, -- ); CREATE TABLE desert ( Longitude REAL, -- Area REAL, -- Name TEXT default '' not null primary key, Latitude REAL, -- ); CREATE TABLE geo_mountain ( Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, -- primary key (Province, Country, Mountain), Province TEXT default '' not null, -- constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, -- ); CREATE TABLE ethnicGroup ( primary key (Name, Country), Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, -- Name TEXT default '' not null, -- Percentage REAL, -- ); CREATE TABLE economy ( Industry REAL, -- GDP REAL, -- Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade, Inflation REAL, -- Service REAL, -- Agriculture REAL, -- ); CREATE TABLE borders ( primary key (Country1, Country2), Country2 TEXT default '' not null constraint borders_ibfk_2 references country, -- Length REAL, -- Country1 TEXT default '' not null constraint borders_ibfk_1 references country, -- ); CREATE TABLE language ( primary key (Name, Country), Name TEXT default '' not null, -- Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- ); CREATE TABLE islandIn ( Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, -- River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349 Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, -- Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344 ); CREATE TABLE country ( Area REAL, -- Capital TEXT, -- Population INTEGER, -- Name TEXT not null constraint ix_county_Name unique, -- Province TEXT, -- Code TEXT default '' not null primary key, ); CREATE TABLE city ( Longitude REAL, -- constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Population INTEGER, -- Province TEXT default '' not null, -- primary key (Name, Province), Name TEXT default '' not null, -- Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, -- Latitude REAL, -- ); CREATE TABLE island ( Name TEXT default '' not null primary key, Islands TEXT, -- Area REAL, -- Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185 Longitude REAL, -- Height REAL, -- Latitude REAL, -- ); CREATE TABLE geo_lake ( constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, -- Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, -- primary key (Province, Country, Lake), Province TEXT default '' not null, -- ); CREATE TABLE mountain ( Longitude REAL, -- Name TEXT default '' not null primary key, Latitude REAL, -- Type TEXT, -- Height REAL, -- Mountains TEXT, -- ); CREATE TABLE province ( Capital TEXT, -- Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, -- primary key (Name, Country), Population INTEGER, -- Area REAL, -- Name TEXT not null, -- CapProv TEXT, -- ); CREATE TABLE population ( Infant_Mortality REAL, -- Population_Growth REAL, -- Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade, ); CREATE TABLE isMember ( primary key (Country, Organization), Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, -- Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, -- Type TEXT default 'member', -- ); CREATE TABLE locatedOn ( Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, -- Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, -- Province TEXT default '' not null, -- primary key (City, Province, Country, Island), constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, City TEXT default '' not null, -- ); CREATE TABLE mergesWith ( Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, -- Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, -- primary key (Sea1, Sea2), ); CREATE TABLE encompasses ( Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0 Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0 primary key (Country, Continent), ); CREATE TABLE continent ( Name TEXT default '' not null primary key, Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 ); CREATE TABLE religion ( primary key (Name, Country), Name TEXT default '' not null, -- Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- ); CREATE TABLE geo_river ( constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, River), Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, -- River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, -- ); CREATE TABLE sea ( Depth REAL, -- Name TEXT default '' not null primary key, ); CREATE TABLE target ( Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade, Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0 ); CREATE TABLE geo_island ( Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, -- primary key (Province, Country, Island), Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, -- constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, );
retail_world
Please list the names of all the products whose supplier is in Japan.
names of the products refers to ProductName; Japan refers to Country = 'Japan';
SELECT T1.ProductName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.Country = 'Japan'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
video_games
What genres are the games published by 'Agatsuma Entertainment'?
genres refers to genre_name; 'Agatsuma Entertainment' refers to publisher_name = 'Agatsuma Entertainment';
SELECT T4.genre_name FROM publisher AS T1 INNER JOIN game_publisher AS T2 ON T1.id = T2.publisher_id INNER JOIN game AS T3 ON T2.game_id = T3.id INNER JOIN genre AS T4 ON T3.genre_id = T4.id WHERE T1.publisher_name = 'Agatsuma Entertainment'
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
shakespeare
How many paragraphs are there in the chapter with the highest amount of scenes in act 1?
How many paragraphs refers to ParagraphNum; highest amount of scenes refers to max(count(Scene))
SELECT T1.ParagraphNum FROM paragraphs AS T1 INNER JOIN chapters AS T2 ON T1.chapter_id = T2.id WHERE T2.Act = 1 ORDER BY T2.Scene DESC LIMIT 1
CREATE TABLE characters ( CharName TEXT not null, -- Abbrev TEXT not null, -- Description TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE paragraphs ( chapter_id INTEGER default 0 not null references chapters, -- character_id INTEGER not null references characters, -- ParagraphNum INTEGER not null, -- PlainText TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE works ( GenreType TEXT not null, -- Example Values: `Comedy`, `Tragedy`, `History`, `Poem`, `Sonnet` | Value Statics: Total count 43 - Distinct count 5 - Null count 0 Title TEXT not null, -- Date INTEGER not null, -- id INTEGER primary key autoincrement, LongTitle TEXT not null, -- ); CREATE TABLE chapters ( work_id INTEGER not null references works, -- Act INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 945 - Distinct count 6 - Null count 0 Description TEXT not null, -- id INTEGER primary key autoincrement, Scene INTEGER not null, -- );
mondial_geo
How many organizations are established in countries where people speak Bosnian?
Bosnian is one of language
SELECT COUNT(T2.Name) FROM language AS T1 INNER JOIN organization AS T2 ON T1.Country = T2.Country WHERE T1.Name = 'Bosnian'
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200 ); CREATE TABLE river ( River TEXT, -- Mountains TEXT, -- SourceAltitude REAL, -- Length REAL, -- EstuaryLatitude REAL, -- SourceLongitude REAL, -- Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, -- EstuaryLongitude REAL, -- Sea TEXT, -- Name TEXT default '' not null primary key, SourceLatitude REAL, -- ); CREATE TABLE mountainOnIsland ( Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, -- primary key (Mountain, Island), Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, -- ); CREATE TABLE organization ( City TEXT, -- constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, -- constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, Abbreviation TEXT not null primary key, Province TEXT, -- Name TEXT not null constraint ix_organization_OrgNameUnique unique, -- Established DATE, -- ); CREATE TABLE geo_desert ( Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, -- Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, -- constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, Desert), ); CREATE TABLE geo_source ( River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, -- constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, -- Province TEXT default '' not null, -- primary key (Province, Country, River), ); CREATE TABLE geo_sea ( Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, -- Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, -- constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, Sea), Province TEXT default '' not null, -- ); CREATE TABLE geo_estuary ( primary key (Province, Country, River), River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, -- constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, -- ); CREATE TABLE located ( River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, -- constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, -- Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, -- Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, -- constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, City TEXT, -- Province TEXT, -- ); CREATE TABLE lake ( Depth REAL, -- Altitude REAL, -- Name TEXT default '' not null primary key, Longitude REAL, -- Latitude REAL, -- Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74 River TEXT, -- Area REAL, -- ); CREATE TABLE desert ( Longitude REAL, -- Area REAL, -- Name TEXT default '' not null primary key, Latitude REAL, -- ); CREATE TABLE geo_mountain ( Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, -- primary key (Province, Country, Mountain), Province TEXT default '' not null, -- constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, -- ); CREATE TABLE ethnicGroup ( primary key (Name, Country), Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, -- Name TEXT default '' not null, -- Percentage REAL, -- ); CREATE TABLE economy ( Industry REAL, -- GDP REAL, -- Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade, Inflation REAL, -- Service REAL, -- Agriculture REAL, -- ); CREATE TABLE borders ( primary key (Country1, Country2), Country2 TEXT default '' not null constraint borders_ibfk_2 references country, -- Length REAL, -- Country1 TEXT default '' not null constraint borders_ibfk_1 references country, -- ); CREATE TABLE language ( primary key (Name, Country), Name TEXT default '' not null, -- Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- ); CREATE TABLE islandIn ( Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, -- River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349 Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, -- Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344 ); CREATE TABLE country ( Area REAL, -- Capital TEXT, -- Population INTEGER, -- Name TEXT not null constraint ix_county_Name unique, -- Province TEXT, -- Code TEXT default '' not null primary key, ); CREATE TABLE city ( Longitude REAL, -- constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Population INTEGER, -- Province TEXT default '' not null, -- primary key (Name, Province), Name TEXT default '' not null, -- Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, -- Latitude REAL, -- ); CREATE TABLE island ( Name TEXT default '' not null primary key, Islands TEXT, -- Area REAL, -- Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185 Longitude REAL, -- Height REAL, -- Latitude REAL, -- ); CREATE TABLE geo_lake ( constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, -- Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, -- primary key (Province, Country, Lake), Province TEXT default '' not null, -- ); CREATE TABLE mountain ( Longitude REAL, -- Name TEXT default '' not null primary key, Latitude REAL, -- Type TEXT, -- Height REAL, -- Mountains TEXT, -- ); CREATE TABLE province ( Capital TEXT, -- Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, -- primary key (Name, Country), Population INTEGER, -- Area REAL, -- Name TEXT not null, -- CapProv TEXT, -- ); CREATE TABLE population ( Infant_Mortality REAL, -- Population_Growth REAL, -- Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade, ); CREATE TABLE isMember ( primary key (Country, Organization), Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, -- Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, -- Type TEXT default 'member', -- ); CREATE TABLE locatedOn ( Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, -- Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, -- Province TEXT default '' not null, -- primary key (City, Province, Country, Island), constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, City TEXT default '' not null, -- ); CREATE TABLE mergesWith ( Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, -- Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, -- primary key (Sea1, Sea2), ); CREATE TABLE encompasses ( Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0 Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0 primary key (Country, Continent), ); CREATE TABLE continent ( Name TEXT default '' not null primary key, Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 ); CREATE TABLE religion ( primary key (Name, Country), Name TEXT default '' not null, -- Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- ); CREATE TABLE geo_river ( constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, River), Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, -- River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, -- ); CREATE TABLE sea ( Depth REAL, -- Name TEXT default '' not null primary key, ); CREATE TABLE target ( Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade, Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0 ); CREATE TABLE geo_island ( Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, -- primary key (Province, Country, Island), Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, -- constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, );
retail_world
What is the name of the supplier company for Aniseed Syrup?
name of the supplier refers to CompanyName; Aniseed Syrup refers to ProductName = 'Aniseed Syrup';
SELECT T2.CompanyName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.ProductName = 'Aniseed Syrup'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
video_games
List the name of all games published by 'Pioneer LDC'.
name of games refers to game_name; 'Pioneer LDC' refers to publisher_name = 'Pioneer LDC';
SELECT T3.game_name FROM publisher AS T1 INNER JOIN game_publisher AS T2 ON T1.id = T2.publisher_id INNER JOIN game AS T3 ON T2.game_id = T3.id WHERE T1.publisher_name = 'Pioneer LDC'
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
shakespeare
Please list all of the paragraphs that have the character name Aedile.
paragraphs  refers to ParagraphNum; character name Aedile refers to CharName = 'Aedile'
SELECT T2.ParagraphNum FROM characters AS T1 INNER JOIN paragraphs AS T2 ON T1.id = T2.character_id WHERE T1.CharName = 'Aedile'
CREATE TABLE characters ( CharName TEXT not null, -- Abbrev TEXT not null, -- Description TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE paragraphs ( chapter_id INTEGER default 0 not null references chapters, -- character_id INTEGER not null references characters, -- ParagraphNum INTEGER not null, -- PlainText TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE works ( GenreType TEXT not null, -- Example Values: `Comedy`, `Tragedy`, `History`, `Poem`, `Sonnet` | Value Statics: Total count 43 - Distinct count 5 - Null count 0 Title TEXT not null, -- Date INTEGER not null, -- id INTEGER primary key autoincrement, LongTitle TEXT not null, -- ); CREATE TABLE chapters ( work_id INTEGER not null references works, -- Act INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 945 - Distinct count 6 - Null count 0 Description TEXT not null, -- id INTEGER primary key autoincrement, Scene INTEGER not null, -- );
soccer_2016
How many percent of the toss-winners decided to bowl first on the pitch from 2010 to 2016?
decide to bowl first refers to Toss_Name = 'field'; from 2010 to 2016 refers to Match_Date BETWEEN '2010-01-01' AND '2016-12-31'; percent = divide(count(Toss_Id where Toss_Name = 'field'), count(Toss_Id)) * 100% where Match_Date BETWEEN '2010-01-01' AND '2016-12-31'
SELECT CAST(SUM(CASE WHEN T2.Toss_Name = 'field' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.Toss_Id) FROM Match AS T1 INNER JOIN Toss_Decision AS T2 ON T2.Toss_Id = T1.Toss_Decide WHERE T1.Match_Date BETWEEN '2010-01-01' AND '2016-12-31'
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
mondial_geo
Please list the organization names established in the countries where Dutch is spoken.
Dutch is one of language
SELECT T2.Name FROM language AS T1 INNER JOIN organization AS T2 ON T1.Country = T2.Country WHERE T1.Name = 'Dutch'
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200 ); CREATE TABLE river ( River TEXT, -- Mountains TEXT, -- SourceAltitude REAL, -- Length REAL, -- EstuaryLatitude REAL, -- SourceLongitude REAL, -- Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, -- EstuaryLongitude REAL, -- Sea TEXT, -- Name TEXT default '' not null primary key, SourceLatitude REAL, -- ); CREATE TABLE mountainOnIsland ( Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, -- primary key (Mountain, Island), Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, -- ); CREATE TABLE organization ( City TEXT, -- constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, -- constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, Abbreviation TEXT not null primary key, Province TEXT, -- Name TEXT not null constraint ix_organization_OrgNameUnique unique, -- Established DATE, -- ); CREATE TABLE geo_desert ( Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, -- Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, -- constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, Desert), ); CREATE TABLE geo_source ( River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, -- constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, -- Province TEXT default '' not null, -- primary key (Province, Country, River), ); CREATE TABLE geo_sea ( Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, -- Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, -- constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, Sea), Province TEXT default '' not null, -- ); CREATE TABLE geo_estuary ( primary key (Province, Country, River), River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, -- constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, -- ); CREATE TABLE located ( River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, -- constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, -- Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, -- Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, -- constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, City TEXT, -- Province TEXT, -- ); CREATE TABLE lake ( Depth REAL, -- Altitude REAL, -- Name TEXT default '' not null primary key, Longitude REAL, -- Latitude REAL, -- Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74 River TEXT, -- Area REAL, -- ); CREATE TABLE desert ( Longitude REAL, -- Area REAL, -- Name TEXT default '' not null primary key, Latitude REAL, -- ); CREATE TABLE geo_mountain ( Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, -- primary key (Province, Country, Mountain), Province TEXT default '' not null, -- constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, -- ); CREATE TABLE ethnicGroup ( primary key (Name, Country), Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, -- Name TEXT default '' not null, -- Percentage REAL, -- ); CREATE TABLE economy ( Industry REAL, -- GDP REAL, -- Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade, Inflation REAL, -- Service REAL, -- Agriculture REAL, -- ); CREATE TABLE borders ( primary key (Country1, Country2), Country2 TEXT default '' not null constraint borders_ibfk_2 references country, -- Length REAL, -- Country1 TEXT default '' not null constraint borders_ibfk_1 references country, -- ); CREATE TABLE language ( primary key (Name, Country), Name TEXT default '' not null, -- Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- ); CREATE TABLE islandIn ( Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, -- River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349 Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, -- Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344 ); CREATE TABLE country ( Area REAL, -- Capital TEXT, -- Population INTEGER, -- Name TEXT not null constraint ix_county_Name unique, -- Province TEXT, -- Code TEXT default '' not null primary key, ); CREATE TABLE city ( Longitude REAL, -- constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Population INTEGER, -- Province TEXT default '' not null, -- primary key (Name, Province), Name TEXT default '' not null, -- Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, -- Latitude REAL, -- ); CREATE TABLE island ( Name TEXT default '' not null primary key, Islands TEXT, -- Area REAL, -- Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185 Longitude REAL, -- Height REAL, -- Latitude REAL, -- ); CREATE TABLE geo_lake ( constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, -- Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, -- primary key (Province, Country, Lake), Province TEXT default '' not null, -- ); CREATE TABLE mountain ( Longitude REAL, -- Name TEXT default '' not null primary key, Latitude REAL, -- Type TEXT, -- Height REAL, -- Mountains TEXT, -- ); CREATE TABLE province ( Capital TEXT, -- Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, -- primary key (Name, Country), Population INTEGER, -- Area REAL, -- Name TEXT not null, -- CapProv TEXT, -- ); CREATE TABLE population ( Infant_Mortality REAL, -- Population_Growth REAL, -- Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade, ); CREATE TABLE isMember ( primary key (Country, Organization), Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, -- Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, -- Type TEXT default 'member', -- ); CREATE TABLE locatedOn ( Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, -- Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, -- Province TEXT default '' not null, -- primary key (City, Province, Country, Island), constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, City TEXT default '' not null, -- ); CREATE TABLE mergesWith ( Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, -- Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, -- primary key (Sea1, Sea2), ); CREATE TABLE encompasses ( Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0 Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0 primary key (Country, Continent), ); CREATE TABLE continent ( Name TEXT default '' not null primary key, Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 ); CREATE TABLE religion ( primary key (Name, Country), Name TEXT default '' not null, -- Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- ); CREATE TABLE geo_river ( constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, River), Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, -- River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, -- ); CREATE TABLE sea ( Depth REAL, -- Name TEXT default '' not null primary key, ); CREATE TABLE target ( Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade, Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0 ); CREATE TABLE geo_island ( Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, -- primary key (Province, Country, Island), Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, -- constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, );
retail_world
Of all the orders that have ordered Ikura, how many of them enjoys a unit price that's lower than its standard unit price?
Ikura refers to ProductName = 'Ikura'; ordered unit price that's lower than its standard unit price refers to "Order Details".UnitPrice < "Product".UnitPrice;
SELECT COUNT(T2.OrderID) FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductName = 'Ikura' AND T2.UnitPrice < T1.UnitPrice
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
video_games
Indicate the name of all the games published for the 'SCD' platform.
name of games refers to game_name;  'SCD' platform refers to platform_name = 'SCD';
SELECT T1.game_name FROM game AS T1 INNER JOIN game_publisher AS T2 ON T1.id = T2.game_id INNER JOIN game_platform AS T3 ON T2.id = T3.game_publisher_id INNER JOIN platform AS T4 ON T3.platform_id = T4.id WHERE T4.platform_name = 'SCD'
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
shakespeare
What are the descriptions of the short chapters?
short chapters refers to ParagraphNum < 150
SELECT DISTINCT T2.Description FROM paragraphs AS T1 INNER JOIN chapters AS T2 ON T1.chapter_id = T2.id WHERE T1.ParagraphNum < 150
CREATE TABLE characters ( CharName TEXT not null, -- Abbrev TEXT not null, -- Description TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE paragraphs ( chapter_id INTEGER default 0 not null references chapters, -- character_id INTEGER not null references characters, -- ParagraphNum INTEGER not null, -- PlainText TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE works ( GenreType TEXT not null, -- Example Values: `Comedy`, `Tragedy`, `History`, `Poem`, `Sonnet` | Value Statics: Total count 43 - Distinct count 5 - Null count 0 Title TEXT not null, -- Date INTEGER not null, -- id INTEGER primary key autoincrement, LongTitle TEXT not null, -- ); CREATE TABLE chapters ( work_id INTEGER not null references works, -- Act INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 945 - Distinct count 6 - Null count 0 Description TEXT not null, -- id INTEGER primary key autoincrement, Scene INTEGER not null, -- );
mondial_geo
How many organizations are established in the country with the most ethnic groups?
null
SELECT COUNT(T2.Province) FROM country AS T1 INNER JOIN organization AS T2 ON T1.Code = T2.Country INNER JOIN ethnicGroup AS T3 ON T3.Country = T2.Country GROUP BY T1.Name ORDER BY COUNT(T3.Name) DESC LIMIT 1
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200 ); CREATE TABLE river ( River TEXT, -- Mountains TEXT, -- SourceAltitude REAL, -- Length REAL, -- EstuaryLatitude REAL, -- SourceLongitude REAL, -- Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, -- EstuaryLongitude REAL, -- Sea TEXT, -- Name TEXT default '' not null primary key, SourceLatitude REAL, -- ); CREATE TABLE mountainOnIsland ( Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, -- primary key (Mountain, Island), Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, -- ); CREATE TABLE organization ( City TEXT, -- constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, -- constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, Abbreviation TEXT not null primary key, Province TEXT, -- Name TEXT not null constraint ix_organization_OrgNameUnique unique, -- Established DATE, -- ); CREATE TABLE geo_desert ( Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, -- Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, -- constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, Desert), ); CREATE TABLE geo_source ( River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, -- constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, -- Province TEXT default '' not null, -- primary key (Province, Country, River), ); CREATE TABLE geo_sea ( Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, -- Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, -- constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, Sea), Province TEXT default '' not null, -- ); CREATE TABLE geo_estuary ( primary key (Province, Country, River), River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, -- constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, -- ); CREATE TABLE located ( River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, -- constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, -- Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, -- Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, -- constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, City TEXT, -- Province TEXT, -- ); CREATE TABLE lake ( Depth REAL, -- Altitude REAL, -- Name TEXT default '' not null primary key, Longitude REAL, -- Latitude REAL, -- Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74 River TEXT, -- Area REAL, -- ); CREATE TABLE desert ( Longitude REAL, -- Area REAL, -- Name TEXT default '' not null primary key, Latitude REAL, -- ); CREATE TABLE geo_mountain ( Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, -- primary key (Province, Country, Mountain), Province TEXT default '' not null, -- constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, -- ); CREATE TABLE ethnicGroup ( primary key (Name, Country), Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, -- Name TEXT default '' not null, -- Percentage REAL, -- ); CREATE TABLE economy ( Industry REAL, -- GDP REAL, -- Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade, Inflation REAL, -- Service REAL, -- Agriculture REAL, -- ); CREATE TABLE borders ( primary key (Country1, Country2), Country2 TEXT default '' not null constraint borders_ibfk_2 references country, -- Length REAL, -- Country1 TEXT default '' not null constraint borders_ibfk_1 references country, -- ); CREATE TABLE language ( primary key (Name, Country), Name TEXT default '' not null, -- Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- ); CREATE TABLE islandIn ( Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, -- River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349 Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, -- Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344 ); CREATE TABLE country ( Area REAL, -- Capital TEXT, -- Population INTEGER, -- Name TEXT not null constraint ix_county_Name unique, -- Province TEXT, -- Code TEXT default '' not null primary key, ); CREATE TABLE city ( Longitude REAL, -- constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Population INTEGER, -- Province TEXT default '' not null, -- primary key (Name, Province), Name TEXT default '' not null, -- Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, -- Latitude REAL, -- ); CREATE TABLE island ( Name TEXT default '' not null primary key, Islands TEXT, -- Area REAL, -- Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185 Longitude REAL, -- Height REAL, -- Latitude REAL, -- ); CREATE TABLE geo_lake ( constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, -- Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, -- primary key (Province, Country, Lake), Province TEXT default '' not null, -- ); CREATE TABLE mountain ( Longitude REAL, -- Name TEXT default '' not null primary key, Latitude REAL, -- Type TEXT, -- Height REAL, -- Mountains TEXT, -- ); CREATE TABLE province ( Capital TEXT, -- Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, -- primary key (Name, Country), Population INTEGER, -- Area REAL, -- Name TEXT not null, -- CapProv TEXT, -- ); CREATE TABLE population ( Infant_Mortality REAL, -- Population_Growth REAL, -- Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade, ); CREATE TABLE isMember ( primary key (Country, Organization), Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, -- Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, -- Type TEXT default 'member', -- ); CREATE TABLE locatedOn ( Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, -- Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, -- Province TEXT default '' not null, -- primary key (City, Province, Country, Island), constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, City TEXT default '' not null, -- ); CREATE TABLE mergesWith ( Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, -- Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, -- primary key (Sea1, Sea2), ); CREATE TABLE encompasses ( Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0 Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0 primary key (Country, Continent), ); CREATE TABLE continent ( Name TEXT default '' not null primary key, Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 ); CREATE TABLE religion ( primary key (Name, Country), Name TEXT default '' not null, -- Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- ); CREATE TABLE geo_river ( constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, River), Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, -- River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, -- ); CREATE TABLE sea ( Depth REAL, -- Name TEXT default '' not null primary key, ); CREATE TABLE target ( Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade, Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0 ); CREATE TABLE geo_island ( Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, -- primary key (Province, Country, Island), Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, -- constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, );
retail_world
Please list the IDs of the orders with a product whose production is not continuous.
IDs of the orders refers to OrderID; production is not continuous refers to Discontinued = 1;
SELECT T2.OrderID FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Discontinued = 1
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
shakespeare
How many acts can be found in the comedy "Two Gentlemen of Verona"?
comedy refers to GenreType = 'comedy'; "Two Gentlemen of Verona" refers to Title = 'Two Gentlemen of Verona'
SELECT COUNT(T1.ACT) FROM chapters AS T1 LEFT JOIN works AS T2 ON T1.work_id = T2.id WHERE T2.GenreType = 'Comedy' AND T2.Title = 'Two Gentlemen of Verona'
CREATE TABLE characters ( CharName TEXT not null, -- Abbrev TEXT not null, -- Description TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE paragraphs ( chapter_id INTEGER default 0 not null references chapters, -- character_id INTEGER not null references characters, -- ParagraphNum INTEGER not null, -- PlainText TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE works ( GenreType TEXT not null, -- Example Values: `Comedy`, `Tragedy`, `History`, `Poem`, `Sonnet` | Value Statics: Total count 43 - Distinct count 5 - Null count 0 Title TEXT not null, -- Date INTEGER not null, -- id INTEGER primary key autoincrement, LongTitle TEXT not null, -- ); CREATE TABLE chapters ( work_id INTEGER not null references works, -- Act INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 945 - Distinct count 6 - Null count 0 Description TEXT not null, -- id INTEGER primary key autoincrement, Scene INTEGER not null, -- );
soccer_2016
Who was the captain of the winning team in the match held on 1st June 2008?
player's name refers to Player_Name; captain refers to Role_Desc = 'Captain'; the winning team refers to Match_Winner = Team_Id; on 1st June 2008 refers to Match_Date = '2008-06-01'
SELECT T3.Player_Name FROM Player_Match AS T1 INNER JOIN Match AS T2 ON T2.Match_Id = T1.Match_Id INNER JOIN Player AS T3 ON T3.Player_Id = T1.Player_Id INNER JOIN Rolee AS T4 ON T4.Role_Id = T1.Role_Id WHERE T2.Match_Date = '2008-06-01' AND T4.Role_Desc = 'Captain' AND T2.Match_Winner = T1.Team_Id
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
mondial_geo
Among the countries with over 3 organizations, how many of them have an inflation rate of over 5%?
null
SELECT COUNT(T2.Country) FROM economy AS T1 INNER JOIN organization AS T2 ON T1.Country = T2.Country WHERE T2.Country IN ( SELECT Country FROM organization GROUP BY Country HAVING COUNT(Country) > 3 ) AND T1.Inflation > 5
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200 ); CREATE TABLE river ( River TEXT, -- Mountains TEXT, -- SourceAltitude REAL, -- Length REAL, -- EstuaryLatitude REAL, -- SourceLongitude REAL, -- Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, -- EstuaryLongitude REAL, -- Sea TEXT, -- Name TEXT default '' not null primary key, SourceLatitude REAL, -- ); CREATE TABLE mountainOnIsland ( Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, -- primary key (Mountain, Island), Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, -- ); CREATE TABLE organization ( City TEXT, -- constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, -- constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, Abbreviation TEXT not null primary key, Province TEXT, -- Name TEXT not null constraint ix_organization_OrgNameUnique unique, -- Established DATE, -- ); CREATE TABLE geo_desert ( Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, -- Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, -- constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, Desert), ); CREATE TABLE geo_source ( River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, -- constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, -- Province TEXT default '' not null, -- primary key (Province, Country, River), ); CREATE TABLE geo_sea ( Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, -- Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, -- constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, Sea), Province TEXT default '' not null, -- ); CREATE TABLE geo_estuary ( primary key (Province, Country, River), River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, -- constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, -- ); CREATE TABLE located ( River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, -- constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, -- Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, -- Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, -- constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, City TEXT, -- Province TEXT, -- ); CREATE TABLE lake ( Depth REAL, -- Altitude REAL, -- Name TEXT default '' not null primary key, Longitude REAL, -- Latitude REAL, -- Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74 River TEXT, -- Area REAL, -- ); CREATE TABLE desert ( Longitude REAL, -- Area REAL, -- Name TEXT default '' not null primary key, Latitude REAL, -- ); CREATE TABLE geo_mountain ( Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, -- primary key (Province, Country, Mountain), Province TEXT default '' not null, -- constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, -- ); CREATE TABLE ethnicGroup ( primary key (Name, Country), Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, -- Name TEXT default '' not null, -- Percentage REAL, -- ); CREATE TABLE economy ( Industry REAL, -- GDP REAL, -- Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade, Inflation REAL, -- Service REAL, -- Agriculture REAL, -- ); CREATE TABLE borders ( primary key (Country1, Country2), Country2 TEXT default '' not null constraint borders_ibfk_2 references country, -- Length REAL, -- Country1 TEXT default '' not null constraint borders_ibfk_1 references country, -- ); CREATE TABLE language ( primary key (Name, Country), Name TEXT default '' not null, -- Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- ); CREATE TABLE islandIn ( Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, -- River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349 Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, -- Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344 ); CREATE TABLE country ( Area REAL, -- Capital TEXT, -- Population INTEGER, -- Name TEXT not null constraint ix_county_Name unique, -- Province TEXT, -- Code TEXT default '' not null primary key, ); CREATE TABLE city ( Longitude REAL, -- constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Population INTEGER, -- Province TEXT default '' not null, -- primary key (Name, Province), Name TEXT default '' not null, -- Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, -- Latitude REAL, -- ); CREATE TABLE island ( Name TEXT default '' not null primary key, Islands TEXT, -- Area REAL, -- Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185 Longitude REAL, -- Height REAL, -- Latitude REAL, -- ); CREATE TABLE geo_lake ( constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, -- Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, -- primary key (Province, Country, Lake), Province TEXT default '' not null, -- ); CREATE TABLE mountain ( Longitude REAL, -- Name TEXT default '' not null primary key, Latitude REAL, -- Type TEXT, -- Height REAL, -- Mountains TEXT, -- ); CREATE TABLE province ( Capital TEXT, -- Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, -- primary key (Name, Country), Population INTEGER, -- Area REAL, -- Name TEXT not null, -- CapProv TEXT, -- ); CREATE TABLE population ( Infant_Mortality REAL, -- Population_Growth REAL, -- Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade, ); CREATE TABLE isMember ( primary key (Country, Organization), Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, -- Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, -- Type TEXT default 'member', -- ); CREATE TABLE locatedOn ( Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, -- Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, -- Province TEXT default '' not null, -- primary key (City, Province, Country, Island), constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, City TEXT default '' not null, -- ); CREATE TABLE mergesWith ( Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, -- Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, -- primary key (Sea1, Sea2), ); CREATE TABLE encompasses ( Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0 Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0 primary key (Country, Continent), ); CREATE TABLE continent ( Name TEXT default '' not null primary key, Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 ); CREATE TABLE religion ( primary key (Name, Country), Name TEXT default '' not null, -- Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- ); CREATE TABLE geo_river ( constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, River), Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, -- River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, -- ); CREATE TABLE sea ( Depth REAL, -- Name TEXT default '' not null primary key, ); CREATE TABLE target ( Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade, Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0 ); CREATE TABLE geo_island ( Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, -- primary key (Province, Country, Island), Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, -- constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, );
retail_world
How many orders have asked for the product Tofu?
product refers to ProductName;
SELECT COUNT(T2.OrderID) FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductName = 'Tofu'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
video_games
What publishers have the word 'Entertainment' in their name?
publishers that have the word 'Entertainment' in their name refers to publisher_name LIKE '%Entertainment%';
SELECT T.publisher_name FROM publisher AS T WHERE T.publisher_name LIKE '%Entertainment%'
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
shakespeare
What are the character names in paragraph 3?
character names refers to CharName; paragraph 3 refers to ParagraphNum = 3
SELECT DISTINCT T1.CharName FROM characters AS T1 INNER JOIN paragraphs AS T2 ON T1.id = T2.character_id WHERE T2.ParagraphNum = 3
CREATE TABLE characters ( CharName TEXT not null, -- Abbrev TEXT not null, -- Description TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE paragraphs ( chapter_id INTEGER default 0 not null references chapters, -- character_id INTEGER not null references characters, -- ParagraphNum INTEGER not null, -- PlainText TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE works ( GenreType TEXT not null, -- Example Values: `Comedy`, `Tragedy`, `History`, `Poem`, `Sonnet` | Value Statics: Total count 43 - Distinct count 5 - Null count 0 Title TEXT not null, -- Date INTEGER not null, -- id INTEGER primary key autoincrement, LongTitle TEXT not null, -- ); CREATE TABLE chapters ( work_id INTEGER not null references works, -- Act INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 945 - Distinct count 6 - Null count 0 Description TEXT not null, -- id INTEGER primary key autoincrement, Scene INTEGER not null, -- );
mondial_geo
How many organizations are established after 1999/1/1 in a country whose GDP is under 500000?
null
SELECT T1.Country, COUNT(T1.Country) FROM economy AS T1 INNER JOIN organization AS T2 ON T1.Country = T2.Country WHERE T1.GDP < 500000 AND STRFTIME('%Y', T2.Established) < '1999' GROUP BY T1.Country
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200 ); CREATE TABLE river ( River TEXT, -- Mountains TEXT, -- SourceAltitude REAL, -- Length REAL, -- EstuaryLatitude REAL, -- SourceLongitude REAL, -- Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, -- EstuaryLongitude REAL, -- Sea TEXT, -- Name TEXT default '' not null primary key, SourceLatitude REAL, -- ); CREATE TABLE mountainOnIsland ( Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, -- primary key (Mountain, Island), Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, -- ); CREATE TABLE organization ( City TEXT, -- constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, -- constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, Abbreviation TEXT not null primary key, Province TEXT, -- Name TEXT not null constraint ix_organization_OrgNameUnique unique, -- Established DATE, -- ); CREATE TABLE geo_desert ( Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, -- Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, -- constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, Desert), ); CREATE TABLE geo_source ( River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, -- constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, -- Province TEXT default '' not null, -- primary key (Province, Country, River), ); CREATE TABLE geo_sea ( Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, -- Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, -- constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, Sea), Province TEXT default '' not null, -- ); CREATE TABLE geo_estuary ( primary key (Province, Country, River), River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, -- constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, -- ); CREATE TABLE located ( River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, -- constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, -- Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, -- Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, -- constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, City TEXT, -- Province TEXT, -- ); CREATE TABLE lake ( Depth REAL, -- Altitude REAL, -- Name TEXT default '' not null primary key, Longitude REAL, -- Latitude REAL, -- Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74 River TEXT, -- Area REAL, -- ); CREATE TABLE desert ( Longitude REAL, -- Area REAL, -- Name TEXT default '' not null primary key, Latitude REAL, -- ); CREATE TABLE geo_mountain ( Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, -- primary key (Province, Country, Mountain), Province TEXT default '' not null, -- constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, -- ); CREATE TABLE ethnicGroup ( primary key (Name, Country), Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, -- Name TEXT default '' not null, -- Percentage REAL, -- ); CREATE TABLE economy ( Industry REAL, -- GDP REAL, -- Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade, Inflation REAL, -- Service REAL, -- Agriculture REAL, -- ); CREATE TABLE borders ( primary key (Country1, Country2), Country2 TEXT default '' not null constraint borders_ibfk_2 references country, -- Length REAL, -- Country1 TEXT default '' not null constraint borders_ibfk_1 references country, -- ); CREATE TABLE language ( primary key (Name, Country), Name TEXT default '' not null, -- Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- ); CREATE TABLE islandIn ( Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, -- River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349 Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, -- Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344 ); CREATE TABLE country ( Area REAL, -- Capital TEXT, -- Population INTEGER, -- Name TEXT not null constraint ix_county_Name unique, -- Province TEXT, -- Code TEXT default '' not null primary key, ); CREATE TABLE city ( Longitude REAL, -- constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Population INTEGER, -- Province TEXT default '' not null, -- primary key (Name, Province), Name TEXT default '' not null, -- Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, -- Latitude REAL, -- ); CREATE TABLE island ( Name TEXT default '' not null primary key, Islands TEXT, -- Area REAL, -- Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185 Longitude REAL, -- Height REAL, -- Latitude REAL, -- ); CREATE TABLE geo_lake ( constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, -- Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, -- primary key (Province, Country, Lake), Province TEXT default '' not null, -- ); CREATE TABLE mountain ( Longitude REAL, -- Name TEXT default '' not null primary key, Latitude REAL, -- Type TEXT, -- Height REAL, -- Mountains TEXT, -- ); CREATE TABLE province ( Capital TEXT, -- Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, -- primary key (Name, Country), Population INTEGER, -- Area REAL, -- Name TEXT not null, -- CapProv TEXT, -- ); CREATE TABLE population ( Infant_Mortality REAL, -- Population_Growth REAL, -- Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade, ); CREATE TABLE isMember ( primary key (Country, Organization), Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, -- Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, -- Type TEXT default 'member', -- ); CREATE TABLE locatedOn ( Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, -- Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, -- Province TEXT default '' not null, -- primary key (City, Province, Country, Island), constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, City TEXT default '' not null, -- ); CREATE TABLE mergesWith ( Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, -- Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, -- primary key (Sea1, Sea2), ); CREATE TABLE encompasses ( Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0 Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0 primary key (Country, Continent), ); CREATE TABLE continent ( Name TEXT default '' not null primary key, Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 ); CREATE TABLE religion ( primary key (Name, Country), Name TEXT default '' not null, -- Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- ); CREATE TABLE geo_river ( constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, River), Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, -- River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, -- ); CREATE TABLE sea ( Depth REAL, -- Name TEXT default '' not null primary key, ); CREATE TABLE target ( Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade, Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0 ); CREATE TABLE geo_island ( Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, -- primary key (Province, Country, Island), Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, -- constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, );
retail_world
Of all the products ordered in order no. 10248, which product has the highest user satisfaction?
order no. refers to OrderID; highest user satisfaction refers to MAX(ReorderLevel);
SELECT T1.ProductName FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T2.OrderID = 10248 ORDER BY T1.ReorderLevel DESC LIMIT 1
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
video_games
Which game has sold the fewest units?
which game refers to game_name; sold the fewest units refers to MIN(num_sales);
SELECT T.game_name FROM ( SELECT T1.game_name FROM game AS T1 INNER JOIN game_publisher AS T2 ON T1.id = T2.game_id INNER JOIN game_platform AS T3 ON T2.id = T3.game_publisher_id INNER JOIN region_sales AS T4 ON T3.id = T4.game_platform_id ORDER BY T4.num_sales LIMIT 1 ) t
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
shakespeare
What is the percentage of act number 5 in Titus Andronicus?
act number 5 refers to Act = 5; Titus Andronicus refers to Title = 'Titus Andronicus'; percentage = divide(sum(Act = 5), count(Act)) as percentage
SELECT CAST(SUM(IIF(T2.act = 5, 1, 0)) AS REAL) * 100 / COUNT(T2.act) FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id WHERE T1.Title = 'Titus Andronicus'
CREATE TABLE characters ( CharName TEXT not null, -- Abbrev TEXT not null, -- Description TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE paragraphs ( chapter_id INTEGER default 0 not null references chapters, -- character_id INTEGER not null references characters, -- ParagraphNum INTEGER not null, -- PlainText TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE works ( GenreType TEXT not null, -- Example Values: `Comedy`, `Tragedy`, `History`, `Poem`, `Sonnet` | Value Statics: Total count 43 - Distinct count 5 - Null count 0 Title TEXT not null, -- Date INTEGER not null, -- id INTEGER primary key autoincrement, LongTitle TEXT not null, -- ); CREATE TABLE chapters ( work_id INTEGER not null references works, -- Act INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 945 - Distinct count 6 - Null count 0 Description TEXT not null, -- id INTEGER primary key autoincrement, Scene INTEGER not null, -- );
soccer_2016
List down the DOB of players who received the "man of the match" award.
null
SELECT T2.DOB FROM Match AS T1 INNER JOIN Player AS T2 ON T2.Player_Id = T1.Man_of_the_Match
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
mondial_geo
How many organizations are founded in countries with a population of under 1000000?
null
SELECT COUNT(T2.Name) FROM country AS T1 INNER JOIN organization AS T2 ON T1.Code = T2.Country WHERE T1.Population < 1000000
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200 ); CREATE TABLE river ( River TEXT, -- Mountains TEXT, -- SourceAltitude REAL, -- Length REAL, -- EstuaryLatitude REAL, -- SourceLongitude REAL, -- Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, -- EstuaryLongitude REAL, -- Sea TEXT, -- Name TEXT default '' not null primary key, SourceLatitude REAL, -- ); CREATE TABLE mountainOnIsland ( Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, -- primary key (Mountain, Island), Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, -- ); CREATE TABLE organization ( City TEXT, -- constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, -- constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, Abbreviation TEXT not null primary key, Province TEXT, -- Name TEXT not null constraint ix_organization_OrgNameUnique unique, -- Established DATE, -- ); CREATE TABLE geo_desert ( Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, -- Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, -- constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, Desert), ); CREATE TABLE geo_source ( River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, -- constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, -- Province TEXT default '' not null, -- primary key (Province, Country, River), ); CREATE TABLE geo_sea ( Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, -- Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, -- constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, Sea), Province TEXT default '' not null, -- ); CREATE TABLE geo_estuary ( primary key (Province, Country, River), River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, -- constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, -- ); CREATE TABLE located ( River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, -- constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, -- Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, -- Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, -- constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, City TEXT, -- Province TEXT, -- ); CREATE TABLE lake ( Depth REAL, -- Altitude REAL, -- Name TEXT default '' not null primary key, Longitude REAL, -- Latitude REAL, -- Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74 River TEXT, -- Area REAL, -- ); CREATE TABLE desert ( Longitude REAL, -- Area REAL, -- Name TEXT default '' not null primary key, Latitude REAL, -- ); CREATE TABLE geo_mountain ( Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, -- primary key (Province, Country, Mountain), Province TEXT default '' not null, -- constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, -- ); CREATE TABLE ethnicGroup ( primary key (Name, Country), Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, -- Name TEXT default '' not null, -- Percentage REAL, -- ); CREATE TABLE economy ( Industry REAL, -- GDP REAL, -- Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade, Inflation REAL, -- Service REAL, -- Agriculture REAL, -- ); CREATE TABLE borders ( primary key (Country1, Country2), Country2 TEXT default '' not null constraint borders_ibfk_2 references country, -- Length REAL, -- Country1 TEXT default '' not null constraint borders_ibfk_1 references country, -- ); CREATE TABLE language ( primary key (Name, Country), Name TEXT default '' not null, -- Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- ); CREATE TABLE islandIn ( Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, -- River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349 Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, -- Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344 ); CREATE TABLE country ( Area REAL, -- Capital TEXT, -- Population INTEGER, -- Name TEXT not null constraint ix_county_Name unique, -- Province TEXT, -- Code TEXT default '' not null primary key, ); CREATE TABLE city ( Longitude REAL, -- constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Population INTEGER, -- Province TEXT default '' not null, -- primary key (Name, Province), Name TEXT default '' not null, -- Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, -- Latitude REAL, -- ); CREATE TABLE island ( Name TEXT default '' not null primary key, Islands TEXT, -- Area REAL, -- Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185 Longitude REAL, -- Height REAL, -- Latitude REAL, -- ); CREATE TABLE geo_lake ( constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, -- Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, -- primary key (Province, Country, Lake), Province TEXT default '' not null, -- ); CREATE TABLE mountain ( Longitude REAL, -- Name TEXT default '' not null primary key, Latitude REAL, -- Type TEXT, -- Height REAL, -- Mountains TEXT, -- ); CREATE TABLE province ( Capital TEXT, -- Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, -- primary key (Name, Country), Population INTEGER, -- Area REAL, -- Name TEXT not null, -- CapProv TEXT, -- ); CREATE TABLE population ( Infant_Mortality REAL, -- Population_Growth REAL, -- Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade, ); CREATE TABLE isMember ( primary key (Country, Organization), Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, -- Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, -- Type TEXT default 'member', -- ); CREATE TABLE locatedOn ( Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, -- Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, -- Province TEXT default '' not null, -- primary key (City, Province, Country, Island), constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, City TEXT default '' not null, -- ); CREATE TABLE mergesWith ( Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, -- Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, -- primary key (Sea1, Sea2), ); CREATE TABLE encompasses ( Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0 Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0 primary key (Country, Continent), ); CREATE TABLE continent ( Name TEXT default '' not null primary key, Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 ); CREATE TABLE religion ( primary key (Name, Country), Name TEXT default '' not null, -- Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- ); CREATE TABLE geo_river ( constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, River), Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, -- River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, -- ); CREATE TABLE sea ( Depth REAL, -- Name TEXT default '' not null primary key, ); CREATE TABLE target ( Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade, Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0 ); CREATE TABLE geo_island ( Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, -- primary key (Province, Country, Island), Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, -- constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, );
retail_world
What is the total production of the product that is ordered in the highest quantity in order no. 10248?
total production of the product = SUM(units in stock, units on order); order no. refers to OrderID;
SELECT T1.UnitsInStock + T1.UnitsOnOrder FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T2.OrderID = 10248 ORDER BY T2.Quantity DESC LIMIT 1
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
video_games
Which publisher has published the most number of Action games?
which publisher refers to publisher_name; publisher that has published the most number of Action games refers to MAX(COUNT(publisher_name)) WHERE genre_name = 'Action'; Action games refers to game_name WHERE genre_name = 'Action';
SELECT T.publisher_name FROM ( SELECT T4.publisher_name, COUNT(DISTINCT T2.id) FROM genre AS T1 INNER JOIN game AS T2 ON T1.id = T2.genre_id INNER JOIN game_publisher AS T3 ON T2.id = T3.game_id INNER JOIN publisher AS T4 ON T3.publisher_id = T4.id WHERE T1.genre_name = 'Action' GROUP BY T4.publisher_name ORDER BY COUNT(DISTINCT T2.id) DESC LIMIT 1 ) t
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
shakespeare
Please list any two character names in chapter 18708.
character names refers to CharName; chapter 18708 refers to chapter_id = 18708
SELECT T1.CharName FROM characters AS T1 INNER JOIN paragraphs AS T2 ON T1.id = T2.character_id WHERE T2.chapter_id = 18708 LIMIT 2
CREATE TABLE characters ( CharName TEXT not null, -- Abbrev TEXT not null, -- Description TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE paragraphs ( chapter_id INTEGER default 0 not null references chapters, -- character_id INTEGER not null references characters, -- ParagraphNum INTEGER not null, -- PlainText TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE works ( GenreType TEXT not null, -- Example Values: `Comedy`, `Tragedy`, `History`, `Poem`, `Sonnet` | Value Statics: Total count 43 - Distinct count 5 - Null count 0 Title TEXT not null, -- Date INTEGER not null, -- id INTEGER primary key autoincrement, LongTitle TEXT not null, -- ); CREATE TABLE chapters ( work_id INTEGER not null references works, -- Act INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 945 - Distinct count 6 - Null count 0 Description TEXT not null, -- id INTEGER primary key autoincrement, Scene INTEGER not null, -- );
soccer_2016
Among the players out in match ID 392187, calculate the percentage of players out by bowl.
out by bowl refers to Out_Name = 'bowled'; percentage = divide(count(Player_Out where Out_Name = 'bowled'), count(Player_Out)) * 100% where Match_Id = 392187
SELECT CAST(SUM(CASE WHEN T2.Out_Name = 'bowled' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.Player_Out) FROM Wicket_Taken AS T1 INNER JOIN Out_Type AS T2 ON T2.Out_Id = T1.Kind_Out WHERE T1.Match_Id = 392187
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
mondial_geo
Among the countries with a population of under 1000000, how many of them have over 2 languages?
null
SELECT T2.Country FROM country AS T1 INNER JOIN language AS T2 ON T1.Code = T2.Country WHERE T1.Population < 1000000 GROUP BY T2.Country HAVING COUNT(T1.Name) > 2
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200 ); CREATE TABLE river ( River TEXT, -- Mountains TEXT, -- SourceAltitude REAL, -- Length REAL, -- EstuaryLatitude REAL, -- SourceLongitude REAL, -- Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, -- EstuaryLongitude REAL, -- Sea TEXT, -- Name TEXT default '' not null primary key, SourceLatitude REAL, -- ); CREATE TABLE mountainOnIsland ( Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, -- primary key (Mountain, Island), Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, -- ); CREATE TABLE organization ( City TEXT, -- constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, -- constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, Abbreviation TEXT not null primary key, Province TEXT, -- Name TEXT not null constraint ix_organization_OrgNameUnique unique, -- Established DATE, -- ); CREATE TABLE geo_desert ( Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, -- Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, -- constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, Desert), ); CREATE TABLE geo_source ( River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, -- constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, -- Province TEXT default '' not null, -- primary key (Province, Country, River), ); CREATE TABLE geo_sea ( Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, -- Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, -- constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, Sea), Province TEXT default '' not null, -- ); CREATE TABLE geo_estuary ( primary key (Province, Country, River), River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, -- constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, -- ); CREATE TABLE located ( River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, -- constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, -- Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, -- Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, -- constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, City TEXT, -- Province TEXT, -- ); CREATE TABLE lake ( Depth REAL, -- Altitude REAL, -- Name TEXT default '' not null primary key, Longitude REAL, -- Latitude REAL, -- Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74 River TEXT, -- Area REAL, -- ); CREATE TABLE desert ( Longitude REAL, -- Area REAL, -- Name TEXT default '' not null primary key, Latitude REAL, -- ); CREATE TABLE geo_mountain ( Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, -- primary key (Province, Country, Mountain), Province TEXT default '' not null, -- constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, -- ); CREATE TABLE ethnicGroup ( primary key (Name, Country), Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, -- Name TEXT default '' not null, -- Percentage REAL, -- ); CREATE TABLE economy ( Industry REAL, -- GDP REAL, -- Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade, Inflation REAL, -- Service REAL, -- Agriculture REAL, -- ); CREATE TABLE borders ( primary key (Country1, Country2), Country2 TEXT default '' not null constraint borders_ibfk_2 references country, -- Length REAL, -- Country1 TEXT default '' not null constraint borders_ibfk_1 references country, -- ); CREATE TABLE language ( primary key (Name, Country), Name TEXT default '' not null, -- Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- ); CREATE TABLE islandIn ( Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, -- River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349 Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, -- Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344 ); CREATE TABLE country ( Area REAL, -- Capital TEXT, -- Population INTEGER, -- Name TEXT not null constraint ix_county_Name unique, -- Province TEXT, -- Code TEXT default '' not null primary key, ); CREATE TABLE city ( Longitude REAL, -- constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Population INTEGER, -- Province TEXT default '' not null, -- primary key (Name, Province), Name TEXT default '' not null, -- Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, -- Latitude REAL, -- ); CREATE TABLE island ( Name TEXT default '' not null primary key, Islands TEXT, -- Area REAL, -- Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185 Longitude REAL, -- Height REAL, -- Latitude REAL, -- ); CREATE TABLE geo_lake ( constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, -- Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, -- primary key (Province, Country, Lake), Province TEXT default '' not null, -- ); CREATE TABLE mountain ( Longitude REAL, -- Name TEXT default '' not null primary key, Latitude REAL, -- Type TEXT, -- Height REAL, -- Mountains TEXT, -- ); CREATE TABLE province ( Capital TEXT, -- Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, -- primary key (Name, Country), Population INTEGER, -- Area REAL, -- Name TEXT not null, -- CapProv TEXT, -- ); CREATE TABLE population ( Infant_Mortality REAL, -- Population_Growth REAL, -- Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade, ); CREATE TABLE isMember ( primary key (Country, Organization), Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, -- Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, -- Type TEXT default 'member', -- ); CREATE TABLE locatedOn ( Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, -- Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, -- Province TEXT default '' not null, -- primary key (City, Province, Country, Island), constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, City TEXT default '' not null, -- ); CREATE TABLE mergesWith ( Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, -- Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, -- primary key (Sea1, Sea2), ); CREATE TABLE encompasses ( Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0 Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0 primary key (Country, Continent), ); CREATE TABLE continent ( Name TEXT default '' not null primary key, Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 ); CREATE TABLE religion ( primary key (Name, Country), Name TEXT default '' not null, -- Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- ); CREATE TABLE geo_river ( constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, River), Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, -- River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, -- ); CREATE TABLE sea ( Depth REAL, -- Name TEXT default '' not null primary key, ); CREATE TABLE target ( Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade, Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0 ); CREATE TABLE geo_island ( Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, -- primary key (Province, Country, Island), Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, -- constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, );
retail_world
What is the total price of Ikura ordered in order no. 10273?
total price = MULTIPLY(UnitPrice, Quantity); Ikura refers to ProductName = 'Ikura'; order no. refers to OrderID;
SELECT T2.UnitPrice * T2.Quantity FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T2.OrderID = 10273 AND T1.ProductName = 'Ikura'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
video_games
Which publisher has published the most games in the 'Puzzle' genre?
which publisher refers to publisher_name; publisher that has published the most games refers to MAX(COUNT(publisher_name)); puzzle genre refers to genre_name = 'Puzzle';
SELECT T.publisher_name FROM ( SELECT T1.publisher_name, COUNT(T3.id) FROM publisher AS T1 INNER JOIN game_publisher AS T2 ON T1.id = T2.publisher_id INNER JOIN game AS T3 ON T2.game_id = T3.id INNER JOIN genre AS T4 ON T3.genre_id = T4.id WHERE T4.genre_name = 'Puzzle' GROUP BY T1.publisher_name ORDER BY COUNT(T3.id) DESC LIMIT 1 ) t
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
mondial_geo
What is the capital city of the country that has the percentage of Armenian speakers over 90%?
Percentage of country > 90% refers to percentage > 90; America is one of country names
SELECT T1.Capital FROM country AS T1 INNER JOIN language AS T2 ON T1.Code = T2.Country WHERE T2.Name = 'Armenian' AND T2.Percentage > 90
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200 ); CREATE TABLE river ( River TEXT, -- Mountains TEXT, -- SourceAltitude REAL, -- Length REAL, -- EstuaryLatitude REAL, -- SourceLongitude REAL, -- Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, -- EstuaryLongitude REAL, -- Sea TEXT, -- Name TEXT default '' not null primary key, SourceLatitude REAL, -- ); CREATE TABLE mountainOnIsland ( Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, -- primary key (Mountain, Island), Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, -- ); CREATE TABLE organization ( City TEXT, -- constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, -- constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, Abbreviation TEXT not null primary key, Province TEXT, -- Name TEXT not null constraint ix_organization_OrgNameUnique unique, -- Established DATE, -- ); CREATE TABLE geo_desert ( Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, -- Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, -- constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, Desert), ); CREATE TABLE geo_source ( River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, -- constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, -- Province TEXT default '' not null, -- primary key (Province, Country, River), ); CREATE TABLE geo_sea ( Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, -- Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, -- constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, Sea), Province TEXT default '' not null, -- ); CREATE TABLE geo_estuary ( primary key (Province, Country, River), River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, -- constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, -- ); CREATE TABLE located ( River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, -- constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, -- Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, -- Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, -- constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, City TEXT, -- Province TEXT, -- ); CREATE TABLE lake ( Depth REAL, -- Altitude REAL, -- Name TEXT default '' not null primary key, Longitude REAL, -- Latitude REAL, -- Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74 River TEXT, -- Area REAL, -- ); CREATE TABLE desert ( Longitude REAL, -- Area REAL, -- Name TEXT default '' not null primary key, Latitude REAL, -- ); CREATE TABLE geo_mountain ( Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, -- primary key (Province, Country, Mountain), Province TEXT default '' not null, -- constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, -- ); CREATE TABLE ethnicGroup ( primary key (Name, Country), Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, -- Name TEXT default '' not null, -- Percentage REAL, -- ); CREATE TABLE economy ( Industry REAL, -- GDP REAL, -- Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade, Inflation REAL, -- Service REAL, -- Agriculture REAL, -- ); CREATE TABLE borders ( primary key (Country1, Country2), Country2 TEXT default '' not null constraint borders_ibfk_2 references country, -- Length REAL, -- Country1 TEXT default '' not null constraint borders_ibfk_1 references country, -- ); CREATE TABLE language ( primary key (Name, Country), Name TEXT default '' not null, -- Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- ); CREATE TABLE islandIn ( Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, -- River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349 Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, -- Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344 ); CREATE TABLE country ( Area REAL, -- Capital TEXT, -- Population INTEGER, -- Name TEXT not null constraint ix_county_Name unique, -- Province TEXT, -- Code TEXT default '' not null primary key, ); CREATE TABLE city ( Longitude REAL, -- constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Population INTEGER, -- Province TEXT default '' not null, -- primary key (Name, Province), Name TEXT default '' not null, -- Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, -- Latitude REAL, -- ); CREATE TABLE island ( Name TEXT default '' not null primary key, Islands TEXT, -- Area REAL, -- Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185 Longitude REAL, -- Height REAL, -- Latitude REAL, -- ); CREATE TABLE geo_lake ( constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, -- Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, -- primary key (Province, Country, Lake), Province TEXT default '' not null, -- ); CREATE TABLE mountain ( Longitude REAL, -- Name TEXT default '' not null primary key, Latitude REAL, -- Type TEXT, -- Height REAL, -- Mountains TEXT, -- ); CREATE TABLE province ( Capital TEXT, -- Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, -- primary key (Name, Country), Population INTEGER, -- Area REAL, -- Name TEXT not null, -- CapProv TEXT, -- ); CREATE TABLE population ( Infant_Mortality REAL, -- Population_Growth REAL, -- Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade, ); CREATE TABLE isMember ( primary key (Country, Organization), Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, -- Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, -- Type TEXT default 'member', -- ); CREATE TABLE locatedOn ( Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, -- Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, -- Province TEXT default '' not null, -- primary key (City, Province, Country, Island), constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, City TEXT default '' not null, -- ); CREATE TABLE mergesWith ( Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, -- Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, -- primary key (Sea1, Sea2), ); CREATE TABLE encompasses ( Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0 Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0 primary key (Country, Continent), ); CREATE TABLE continent ( Name TEXT default '' not null primary key, Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 ); CREATE TABLE religion ( primary key (Name, Country), Name TEXT default '' not null, -- Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- ); CREATE TABLE geo_river ( constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, River), Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, -- River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, -- ); CREATE TABLE sea ( Depth REAL, -- Name TEXT default '' not null primary key, ); CREATE TABLE target ( Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade, Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0 ); CREATE TABLE geo_island ( Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, -- primary key (Province, Country, Island), Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, -- constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, );
retail_world
What is the quantity of Ikura ordered in order no. 10273?
Ikura refers to ProductName = 'Ikura'; order no. refers to OrderID;
SELECT T2.Quantity FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T2.OrderID = 10273 AND T1.ProductName = 'Ikura'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
shakespeare
Among the works of Shakespeare, how many of them have the word "Henry" on its title?
works refers to Title; have the word "Henry" on its title refers to Title = '%Henry%'
SELECT COUNT(id) FROM works WHERE Title LIKE '%Henry%'
CREATE TABLE characters ( CharName TEXT not null, -- Abbrev TEXT not null, -- Description TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE paragraphs ( chapter_id INTEGER default 0 not null references chapters, -- character_id INTEGER not null references characters, -- ParagraphNum INTEGER not null, -- PlainText TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE works ( GenreType TEXT not null, -- Example Values: `Comedy`, `Tragedy`, `History`, `Poem`, `Sonnet` | Value Statics: Total count 43 - Distinct count 5 - Null count 0 Title TEXT not null, -- Date INTEGER not null, -- id INTEGER primary key autoincrement, LongTitle TEXT not null, -- ); CREATE TABLE chapters ( work_id INTEGER not null references works, -- Act INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 945 - Distinct count 6 - Null count 0 Description TEXT not null, -- id INTEGER primary key autoincrement, Scene INTEGER not null, -- );
soccer_2016
List down the match ID of matches that the "man of the match" award was given to BB McCullum.
null
SELECT T1.Match_Id FROM Match AS T1 INNER JOIN Player AS T2 ON T2.Player_Id = T1.Man_of_the_Match WHERE T2.Player_Name = 'BB McCullum'
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
mondial_geo
Which country has the most languages spoken?
null
SELECT T1.Name FROM country AS T1 INNER JOIN language AS T2 ON T1.Code = T2.Country GROUP BY T1.Name ORDER BY COUNT(T2.Name) DESC LIMIT 1
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200 ); CREATE TABLE river ( River TEXT, -- Mountains TEXT, -- SourceAltitude REAL, -- Length REAL, -- EstuaryLatitude REAL, -- SourceLongitude REAL, -- Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, -- EstuaryLongitude REAL, -- Sea TEXT, -- Name TEXT default '' not null primary key, SourceLatitude REAL, -- ); CREATE TABLE mountainOnIsland ( Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, -- primary key (Mountain, Island), Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, -- ); CREATE TABLE organization ( City TEXT, -- constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, -- constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, Abbreviation TEXT not null primary key, Province TEXT, -- Name TEXT not null constraint ix_organization_OrgNameUnique unique, -- Established DATE, -- ); CREATE TABLE geo_desert ( Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, -- Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, -- constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, Desert), ); CREATE TABLE geo_source ( River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, -- constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, -- Province TEXT default '' not null, -- primary key (Province, Country, River), ); CREATE TABLE geo_sea ( Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, -- Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, -- constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, Sea), Province TEXT default '' not null, -- ); CREATE TABLE geo_estuary ( primary key (Province, Country, River), River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, -- constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, -- ); CREATE TABLE located ( River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, -- constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, -- Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, -- Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, -- constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, City TEXT, -- Province TEXT, -- ); CREATE TABLE lake ( Depth REAL, -- Altitude REAL, -- Name TEXT default '' not null primary key, Longitude REAL, -- Latitude REAL, -- Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74 River TEXT, -- Area REAL, -- ); CREATE TABLE desert ( Longitude REAL, -- Area REAL, -- Name TEXT default '' not null primary key, Latitude REAL, -- ); CREATE TABLE geo_mountain ( Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, -- primary key (Province, Country, Mountain), Province TEXT default '' not null, -- constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, -- ); CREATE TABLE ethnicGroup ( primary key (Name, Country), Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, -- Name TEXT default '' not null, -- Percentage REAL, -- ); CREATE TABLE economy ( Industry REAL, -- GDP REAL, -- Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade, Inflation REAL, -- Service REAL, -- Agriculture REAL, -- ); CREATE TABLE borders ( primary key (Country1, Country2), Country2 TEXT default '' not null constraint borders_ibfk_2 references country, -- Length REAL, -- Country1 TEXT default '' not null constraint borders_ibfk_1 references country, -- ); CREATE TABLE language ( primary key (Name, Country), Name TEXT default '' not null, -- Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- ); CREATE TABLE islandIn ( Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, -- River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349 Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, -- Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344 ); CREATE TABLE country ( Area REAL, -- Capital TEXT, -- Population INTEGER, -- Name TEXT not null constraint ix_county_Name unique, -- Province TEXT, -- Code TEXT default '' not null primary key, ); CREATE TABLE city ( Longitude REAL, -- constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Population INTEGER, -- Province TEXT default '' not null, -- primary key (Name, Province), Name TEXT default '' not null, -- Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, -- Latitude REAL, -- ); CREATE TABLE island ( Name TEXT default '' not null primary key, Islands TEXT, -- Area REAL, -- Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185 Longitude REAL, -- Height REAL, -- Latitude REAL, -- ); CREATE TABLE geo_lake ( constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, -- Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, -- primary key (Province, Country, Lake), Province TEXT default '' not null, -- ); CREATE TABLE mountain ( Longitude REAL, -- Name TEXT default '' not null primary key, Latitude REAL, -- Type TEXT, -- Height REAL, -- Mountains TEXT, -- ); CREATE TABLE province ( Capital TEXT, -- Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, -- primary key (Name, Country), Population INTEGER, -- Area REAL, -- Name TEXT not null, -- CapProv TEXT, -- ); CREATE TABLE population ( Infant_Mortality REAL, -- Population_Growth REAL, -- Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade, ); CREATE TABLE isMember ( primary key (Country, Organization), Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, -- Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, -- Type TEXT default 'member', -- ); CREATE TABLE locatedOn ( Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, -- Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, -- Province TEXT default '' not null, -- primary key (City, Province, Country, Island), constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, City TEXT default '' not null, -- ); CREATE TABLE mergesWith ( Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, -- Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, -- primary key (Sea1, Sea2), ); CREATE TABLE encompasses ( Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0 Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0 primary key (Country, Continent), ); CREATE TABLE continent ( Name TEXT default '' not null primary key, Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 ); CREATE TABLE religion ( primary key (Name, Country), Name TEXT default '' not null, -- Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- ); CREATE TABLE geo_river ( constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, River), Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, -- River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, -- ); CREATE TABLE sea ( Depth REAL, -- Name TEXT default '' not null primary key, ); CREATE TABLE target ( Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade, Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0 ); CREATE TABLE geo_island ( Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, -- primary key (Province, Country, Island), Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, -- constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, );
retail_world
Please list the names of all the products ordered in order no. 10248.
names of the products refers to ProductName; order no. refers to OrderID;
SELECT T1.ProductName FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T2.OrderID = 10248
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
video_games
Indicate, by region, which platform has sold the most games.
region refers to region_name; platform refers to game_platform; sold the most games refers to MAX(SUM(num_sales));
SELECT T.region_name FROM ( SELECT T1.platform_name, T4.region_name, SUM(T3.num_sales) FROM platform AS T1 INNER JOIN game_platform AS T2 ON T1.id = T2.platform_id INNER JOIN region_sales AS T3 ON T1.id = T3.game_platform_id INNER JOIN region AS T4 ON T3.region_id = T4.id GROUP BY T1.platform_name, T4.region_name ORDER BY SUM(T3.num_sales) DESC LIMIT 1 ) t
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
shakespeare
What is the percentage of historical works that have not fewer than five scenes in the 1500s?
historical works refers to GenreType = 'history'; have not fewer than five scenes in the 1500s refers to count(Scene) > = 5 and DATE > = 1500 AND DATE < = 1599; percentage = divide(count(works.id) where GenreType = 'history' and count(Scene) > = 5, count(works.id) ) as percentage
SELECT CAST(( SELECT COUNT(T1.id) FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id WHERE T1.GenreType = 'History' AND T1.DATE BETWEEN 1500 AND 1599 GROUP BY T1.id HAVING COUNT(T2.Scene) >= 5 ) AS REAL) * 100 / COUNT(id) FROM works WHERE GenreType = 'History' AND DATE BETWEEN 1500 AND 1599
CREATE TABLE characters ( CharName TEXT not null, -- Abbrev TEXT not null, -- Description TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE paragraphs ( chapter_id INTEGER default 0 not null references chapters, -- character_id INTEGER not null references characters, -- ParagraphNum INTEGER not null, -- PlainText TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE works ( GenreType TEXT not null, -- Example Values: `Comedy`, `Tragedy`, `History`, `Poem`, `Sonnet` | Value Statics: Total count 43 - Distinct count 5 - Null count 0 Title TEXT not null, -- Date INTEGER not null, -- id INTEGER primary key autoincrement, LongTitle TEXT not null, -- ); CREATE TABLE chapters ( work_id INTEGER not null references works, -- Act INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 945 - Distinct count 6 - Null count 0 Description TEXT not null, -- id INTEGER primary key autoincrement, Scene INTEGER not null, -- );
soccer_2016
How many players got out in the first inning of match ID "548335"?
got out refers to Player_Out; the first inning refers to Innings_No = 1; match ID "548335" refers to Match_Id = 548335
SELECT SUM(CASE WHEN Match_Id = 548335 THEN 1 ELSE 0 END) FROM Wicket_Taken WHERE Innings_No = 1
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
mondial_geo
How many lakes in the Canary Islands cover an area of over 1000000?
null
SELECT COUNT(T2.Name) FROM located AS T1 INNER JOIN lake AS T2 ON T1.Lake = T2.Name WHERE T1.Province = 'Canary Islands' AND T2.Area > 1000000
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200 ); CREATE TABLE river ( River TEXT, -- Mountains TEXT, -- SourceAltitude REAL, -- Length REAL, -- EstuaryLatitude REAL, -- SourceLongitude REAL, -- Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, -- EstuaryLongitude REAL, -- Sea TEXT, -- Name TEXT default '' not null primary key, SourceLatitude REAL, -- ); CREATE TABLE mountainOnIsland ( Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, -- primary key (Mountain, Island), Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, -- ); CREATE TABLE organization ( City TEXT, -- constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, -- constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, Abbreviation TEXT not null primary key, Province TEXT, -- Name TEXT not null constraint ix_organization_OrgNameUnique unique, -- Established DATE, -- ); CREATE TABLE geo_desert ( Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, -- Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, -- constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, Desert), ); CREATE TABLE geo_source ( River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, -- constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, -- Province TEXT default '' not null, -- primary key (Province, Country, River), ); CREATE TABLE geo_sea ( Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, -- Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, -- constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, Sea), Province TEXT default '' not null, -- ); CREATE TABLE geo_estuary ( primary key (Province, Country, River), River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, -- constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, -- ); CREATE TABLE located ( River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, -- constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, -- Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, -- Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, -- constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, City TEXT, -- Province TEXT, -- ); CREATE TABLE lake ( Depth REAL, -- Altitude REAL, -- Name TEXT default '' not null primary key, Longitude REAL, -- Latitude REAL, -- Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74 River TEXT, -- Area REAL, -- ); CREATE TABLE desert ( Longitude REAL, -- Area REAL, -- Name TEXT default '' not null primary key, Latitude REAL, -- ); CREATE TABLE geo_mountain ( Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, -- primary key (Province, Country, Mountain), Province TEXT default '' not null, -- constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, -- ); CREATE TABLE ethnicGroup ( primary key (Name, Country), Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, -- Name TEXT default '' not null, -- Percentage REAL, -- ); CREATE TABLE economy ( Industry REAL, -- GDP REAL, -- Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade, Inflation REAL, -- Service REAL, -- Agriculture REAL, -- ); CREATE TABLE borders ( primary key (Country1, Country2), Country2 TEXT default '' not null constraint borders_ibfk_2 references country, -- Length REAL, -- Country1 TEXT default '' not null constraint borders_ibfk_1 references country, -- ); CREATE TABLE language ( primary key (Name, Country), Name TEXT default '' not null, -- Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- ); CREATE TABLE islandIn ( Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, -- River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349 Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, -- Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344 ); CREATE TABLE country ( Area REAL, -- Capital TEXT, -- Population INTEGER, -- Name TEXT not null constraint ix_county_Name unique, -- Province TEXT, -- Code TEXT default '' not null primary key, ); CREATE TABLE city ( Longitude REAL, -- constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Population INTEGER, -- Province TEXT default '' not null, -- primary key (Name, Province), Name TEXT default '' not null, -- Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, -- Latitude REAL, -- ); CREATE TABLE island ( Name TEXT default '' not null primary key, Islands TEXT, -- Area REAL, -- Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185 Longitude REAL, -- Height REAL, -- Latitude REAL, -- ); CREATE TABLE geo_lake ( constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, -- Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, -- primary key (Province, Country, Lake), Province TEXT default '' not null, -- ); CREATE TABLE mountain ( Longitude REAL, -- Name TEXT default '' not null primary key, Latitude REAL, -- Type TEXT, -- Height REAL, -- Mountains TEXT, -- ); CREATE TABLE province ( Capital TEXT, -- Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, -- primary key (Name, Country), Population INTEGER, -- Area REAL, -- Name TEXT not null, -- CapProv TEXT, -- ); CREATE TABLE population ( Infant_Mortality REAL, -- Population_Growth REAL, -- Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade, ); CREATE TABLE isMember ( primary key (Country, Organization), Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, -- Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, -- Type TEXT default 'member', -- ); CREATE TABLE locatedOn ( Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, -- Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, -- Province TEXT default '' not null, -- primary key (City, Province, Country, Island), constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, City TEXT default '' not null, -- ); CREATE TABLE mergesWith ( Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, -- Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, -- primary key (Sea1, Sea2), ); CREATE TABLE encompasses ( Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0 Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0 primary key (Country, Continent), ); CREATE TABLE continent ( Name TEXT default '' not null primary key, Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 ); CREATE TABLE religion ( primary key (Name, Country), Name TEXT default '' not null, -- Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- ); CREATE TABLE geo_river ( constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, River), Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, -- River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, -- ); CREATE TABLE sea ( Depth REAL, -- Name TEXT default '' not null primary key, ); CREATE TABLE target ( Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade, Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0 ); CREATE TABLE geo_island ( Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, -- primary key (Province, Country, Island), Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, -- constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, );
retail_world
How many more territories are there in than Eastern Region than in the Southern Region?
how many more = SUBTRACT(SUM(RegionDescription = 'Eastern'), SUM(RegionDescription = 'Southern')); Eastern Region refers to RegionDescription = 'Eastern'; Southern Region refers to RegionDescription = 'Southern';
SELECT ( SELECT COUNT(T1.TerritoryID) FROM Territories AS T1 INNER JOIN Region AS T2 ON T1.RegionID = T2.RegionID WHERE T2.RegionDescription = 'Eastern' ) - ( SELECT COUNT(T1.TerritoryID) FROM Territories AS T1 INNER JOIN Region AS T2 ON T1.RegionID = T2.RegionID WHERE T2.RegionDescription = 'Southern' ) AS Calu
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
video_games
What is the genre of the game '2 Games in 1: Sonic Advance & ChuChu Rocket!'?
genre refers to genre_name; '2 Games in 1: Sonic Advance & ChuChu Rocket!' is a game name;
SELECT T2.genre_name FROM game AS T1 INNER JOIN genre AS T2 ON T1.genre_id = T2.id WHERE T1.game_name = '2 Games in 1: Sonic Advance & ChuChu Rocket!'
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
shakespeare
List the paragraph number and paragraphs said by the character named "Sir Andrew Aguecheek".
paragraph number refers to ParagraphNum; character named "Sir Andrew Aguecheek" refers to CharName = 'Sir Andrew Aguecheek'
SELECT T2.ParagraphNum, T2.id FROM characters AS T1 INNER JOIN paragraphs AS T2 ON T1.id = T2.character_id WHERE T1.CharName = 'Sir Andrew Aguecheek'
CREATE TABLE characters ( CharName TEXT not null, -- Abbrev TEXT not null, -- Description TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE paragraphs ( chapter_id INTEGER default 0 not null references chapters, -- character_id INTEGER not null references characters, -- ParagraphNum INTEGER not null, -- PlainText TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE works ( GenreType TEXT not null, -- Example Values: `Comedy`, `Tragedy`, `History`, `Poem`, `Sonnet` | Value Statics: Total count 43 - Distinct count 5 - Null count 0 Title TEXT not null, -- Date INTEGER not null, -- id INTEGER primary key autoincrement, LongTitle TEXT not null, -- ); CREATE TABLE chapters ( work_id INTEGER not null references works, -- Act INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 945 - Distinct count 6 - Null count 0 Description TEXT not null, -- id INTEGER primary key autoincrement, Scene INTEGER not null, -- );
soccer_2016
Describe any five matches IDs that reached over ID 20.
reached over ID 20 refers to Over_Id = 20
SELECT Match_Id FROM Ball_by_Ball WHERE Over_Id = 20 GROUP BY Match_Id LIMIT 5
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );