db_id
stringclasses 142
values | schema
stringclasses 142
values | schemaComEx
stringclasses 142
values | question
stringlengths 3
224
| query
stringlengths 18
523
| answer
stringlengths 13
498k
| complexity
stringclasses 4
values | distinct
bool 2
classes | like
bool 2
classes | between
bool 2
classes | order_by
bool 2
classes | limit
bool 2
classes | grouby_by
bool 2
classes | having
bool 2
classes | single_join
bool 2
classes | multiple_join
bool 2
classes | multiple_select
bool 2
classes | intersect
bool 2
classes | except
bool 2
classes | union
bool 2
classes | sql_example_80
stringclasses 658
values | sql_example_85
stringclasses 728
values | sql_example_90
stringclasses 804
values | sql_example_95
stringclasses 875
values |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
music_2 |
CREATE TABLE "Albums" (
"AId" INTEGER,
"Title" TEXT,
"Year" INTEGER,
"Label" TEXT,
"Type" TEXT,
PRIMARY KEY ("AId")
)
CREATE TABLE "Band" (
"Id" INTEGER,
"Firstname" TEXT,
"Lastname" TEXT,
PRIMARY KEY ("Id")
)
CREATE TABLE "Instruments" (
"SongId" INTEGER,
"BandmateId" INTEGER,
"Instrument" TEXT,
PRIMARY KEY ("SongId", "BandmateId", "Instrument"),
FOREIGN KEY("SongId") REFERENCES "Songs" ("SongId"),
FOREIGN KEY("BandmateId") REFERENCES "Band" ("Id")
)
CREATE TABLE "Performance" (
"SongId" INTEGER,
"Bandmate" INTEGER,
"StagePosition" TEXT,
PRIMARY KEY ("SongId", "Bandmate"),
FOREIGN KEY("SongId") REFERENCES "Songs" ("SongId"),
FOREIGN KEY("Bandmate") REFERENCES "Band" ("Id")
)
CREATE TABLE "Songs" (
"SongId" INTEGER,
"Title" TEXT,
PRIMARY KEY ("SongId")
)
CREATE TABLE "Tracklists" (
"AlbumId" INTEGER,
"Position" INTEGER,
"SongId" INTEGER,
PRIMARY KEY ("AlbumId", "Position"),
FOREIGN KEY("SongId") REFERENCES "Songs" ("SongId"),
FOREIGN KEY("AlbumId") REFERENCES "Albums" ("AId")
)
CREATE TABLE "Vocals" (
"SongId" INTEGER,
"Bandmate" INTEGER,
"Type" TEXT,
PRIMARY KEY ("SongId", "Bandmate"),
FOREIGN KEY("SongId") REFERENCES "Songs" ("SongId"),
FOREIGN KEY("Bandmate") REFERENCES "Band" ("Id")
) |
CREATE TABLE "Albums" (
"AId" INTEGER,
"Title" TEXT,
"Year" INTEGER,
"Label" TEXT,
"Type" TEXT,
PRIMARY KEY ("AId")
)
/*
2 rows from Albums table:
AId Title Year Label Type
*/
CREATE TABLE "Band" (
"Id" INTEGER,
"Firstname" TEXT,
"Lastname" TEXT,
PRIMARY KEY ("Id")
)
/*
2 rows from Band table:
Id Firstname Lastname
*/
CREATE TABLE "Instruments" (
"SongId" INTEGER,
"BandmateId" INTEGER,
"Instrument" TEXT,
PRIMARY KEY ("SongId", "BandmateId", "Instrument"),
FOREIGN KEY("SongId") REFERENCES "Songs" ("SongId"),
FOREIGN KEY("BandmateId") REFERENCES "Band" ("Id")
)
/*
2 rows from Instruments table:
SongId BandmateId Instrument
*/
CREATE TABLE "Performance" (
"SongId" INTEGER,
"Bandmate" INTEGER,
"StagePosition" TEXT,
PRIMARY KEY ("SongId", "Bandmate"),
FOREIGN KEY("SongId") REFERENCES "Songs" ("SongId"),
FOREIGN KEY("Bandmate") REFERENCES "Band" ("Id")
)
/*
2 rows from Performance table:
SongId Bandmate StagePosition
*/
CREATE TABLE "Songs" (
"SongId" INTEGER,
"Title" TEXT,
PRIMARY KEY ("SongId")
)
/*
2 rows from Songs table:
SongId Title
*/
CREATE TABLE "Tracklists" (
"AlbumId" INTEGER,
"Position" INTEGER,
"SongId" INTEGER,
PRIMARY KEY ("AlbumId", "Position"),
FOREIGN KEY("SongId") REFERENCES "Songs" ("SongId"),
FOREIGN KEY("AlbumId") REFERENCES "Albums" ("AId")
)
/*
2 rows from Tracklists table:
AlbumId Position SongId
*/
CREATE TABLE "Vocals" (
"SongId" INTEGER,
"Bandmate" INTEGER,
"Type" TEXT,
PRIMARY KEY ("SongId", "Bandmate"),
FOREIGN KEY("SongId") REFERENCES "Songs" ("SongId"),
FOREIGN KEY("Bandmate") REFERENCES "Band" ("Id")
)
/*
2 rows from Vocals table:
SongId Bandmate Type
*/ | What is the most used instrument? | SELECT instrument FROM instruments GROUP BY instrument ORDER BY count(*) DESC LIMIT 1 | [{'Nenhum': 'Nenhum resultado encontrado'}] | Easy | false | false | false | true | true | true | false | false | false | false | false | false | false | ||||
music_2 |
CREATE TABLE "Albums" (
"AId" INTEGER,
"Title" TEXT,
"Year" INTEGER,
"Label" TEXT,
"Type" TEXT,
PRIMARY KEY ("AId")
)
CREATE TABLE "Band" (
"Id" INTEGER,
"Firstname" TEXT,
"Lastname" TEXT,
PRIMARY KEY ("Id")
)
CREATE TABLE "Instruments" (
"SongId" INTEGER,
"BandmateId" INTEGER,
"Instrument" TEXT,
PRIMARY KEY ("SongId", "BandmateId", "Instrument"),
FOREIGN KEY("SongId") REFERENCES "Songs" ("SongId"),
FOREIGN KEY("BandmateId") REFERENCES "Band" ("Id")
)
CREATE TABLE "Performance" (
"SongId" INTEGER,
"Bandmate" INTEGER,
"StagePosition" TEXT,
PRIMARY KEY ("SongId", "Bandmate"),
FOREIGN KEY("SongId") REFERENCES "Songs" ("SongId"),
FOREIGN KEY("Bandmate") REFERENCES "Band" ("Id")
)
CREATE TABLE "Songs" (
"SongId" INTEGER,
"Title" TEXT,
PRIMARY KEY ("SongId")
)
CREATE TABLE "Tracklists" (
"AlbumId" INTEGER,
"Position" INTEGER,
"SongId" INTEGER,
PRIMARY KEY ("AlbumId", "Position"),
FOREIGN KEY("SongId") REFERENCES "Songs" ("SongId"),
FOREIGN KEY("AlbumId") REFERENCES "Albums" ("AId")
)
CREATE TABLE "Vocals" (
"SongId" INTEGER,
"Bandmate" INTEGER,
"Type" TEXT,
PRIMARY KEY ("SongId", "Bandmate"),
FOREIGN KEY("SongId") REFERENCES "Songs" ("SongId"),
FOREIGN KEY("Bandmate") REFERENCES "Band" ("Id")
) |
CREATE TABLE "Albums" (
"AId" INTEGER,
"Title" TEXT,
"Year" INTEGER,
"Label" TEXT,
"Type" TEXT,
PRIMARY KEY ("AId")
)
/*
2 rows from Albums table:
AId Title Year Label Type
*/
CREATE TABLE "Band" (
"Id" INTEGER,
"Firstname" TEXT,
"Lastname" TEXT,
PRIMARY KEY ("Id")
)
/*
2 rows from Band table:
Id Firstname Lastname
*/
CREATE TABLE "Instruments" (
"SongId" INTEGER,
"BandmateId" INTEGER,
"Instrument" TEXT,
PRIMARY KEY ("SongId", "BandmateId", "Instrument"),
FOREIGN KEY("SongId") REFERENCES "Songs" ("SongId"),
FOREIGN KEY("BandmateId") REFERENCES "Band" ("Id")
)
/*
2 rows from Instruments table:
SongId BandmateId Instrument
*/
CREATE TABLE "Performance" (
"SongId" INTEGER,
"Bandmate" INTEGER,
"StagePosition" TEXT,
PRIMARY KEY ("SongId", "Bandmate"),
FOREIGN KEY("SongId") REFERENCES "Songs" ("SongId"),
FOREIGN KEY("Bandmate") REFERENCES "Band" ("Id")
)
/*
2 rows from Performance table:
SongId Bandmate StagePosition
*/
CREATE TABLE "Songs" (
"SongId" INTEGER,
"Title" TEXT,
PRIMARY KEY ("SongId")
)
/*
2 rows from Songs table:
SongId Title
*/
CREATE TABLE "Tracklists" (
"AlbumId" INTEGER,
"Position" INTEGER,
"SongId" INTEGER,
PRIMARY KEY ("AlbumId", "Position"),
FOREIGN KEY("SongId") REFERENCES "Songs" ("SongId"),
FOREIGN KEY("AlbumId") REFERENCES "Albums" ("AId")
)
/*
2 rows from Tracklists table:
AlbumId Position SongId
*/
CREATE TABLE "Vocals" (
"SongId" INTEGER,
"Bandmate" INTEGER,
"Type" TEXT,
PRIMARY KEY ("SongId", "Bandmate"),
FOREIGN KEY("SongId") REFERENCES "Songs" ("SongId"),
FOREIGN KEY("Bandmate") REFERENCES "Band" ("Id")
)
/*
2 rows from Vocals table:
SongId Bandmate Type
*/ | What is the last name of the musician that has been at the back position the most? | SELECT T2.lastname FROM Performance AS T1 JOIN Band AS T2 ON T1.bandmate = T2.id WHERE stageposition = "back" GROUP BY lastname ORDER BY count(*) DESC LIMIT 1 | [{'Nenhum': 'Nenhum resultado encontrado'}] | Medium | false | false | false | true | true | true | false | true | false | false | false | false | false | [QUESTION]What is the name of the singer who is worth the most?[/QUESTION]
[SQL]SELECT Name FROM singer ORDER BY Net_Worth_Millions DESC LIMIT 1[/SQL] | [QUESTION]What is the name of the singer who is worth the most?[/QUESTION]
[SQL]SELECT Name FROM singer ORDER BY Net_Worth_Millions DESC LIMIT 1[/SQL] |
||
scholar |
CREATE TABLE "paperDataset" (
"paperId" INTEGER DEFAULT NULL,
"datasetId" INTEGER DEFAULT NULL,
PRIMARY KEY ("datasetId", "paperId")
)
CREATE TABLE "paperKeyphrase" (
"paperId" INTEGER DEFAULT NULL,
"keyphraseId" INTEGER DEFAULT NULL,
PRIMARY KEY ("keyphraseId", "paperId"),
FOREIGN KEY("keyphraseId") REFERENCES keyphrase ("keyphraseId"),
FOREIGN KEY("paperId") REFERENCES paper ("paperId")
)
CREATE TABLE author (
"authorId" INTEGER NOT NULL,
"authorName" VARCHAR(50) DEFAULT NULL,
PRIMARY KEY ("authorId")
)
CREATE TABLE cite (
"citingPaperId" INTEGER NOT NULL,
"citedPaperId" INTEGER NOT NULL,
PRIMARY KEY ("citingPaperId", "citedPaperId"),
FOREIGN KEY("citingPaperId") REFERENCES paper ("paperId"),
FOREIGN KEY("citedPaperId") REFERENCES paper ("paperId")
)
CREATE TABLE dataset (
"datasetId" INTEGER NOT NULL,
"datasetName" VARCHAR(50) DEFAULT NULL,
PRIMARY KEY ("datasetId")
)
CREATE TABLE journal (
"journalId" INTEGER NOT NULL,
"journalName" VARCHAR(100) DEFAULT NULL,
PRIMARY KEY ("journalId")
)
CREATE TABLE keyphrase (
"keyphraseId" INTEGER NOT NULL,
"keyphraseName" VARCHAR(50) DEFAULT NULL,
PRIMARY KEY ("keyphraseId")
)
CREATE TABLE paper (
"paperId" INTEGER NOT NULL,
title VARCHAR(300) DEFAULT NULL,
"venueId" INTEGER DEFAULT NULL,
year INTEGER DEFAULT NULL,
"numCiting" INTEGER DEFAULT NULL,
"numCitedBy" INTEGER DEFAULT NULL,
"journalId" INTEGER DEFAULT NULL,
PRIMARY KEY ("paperId"),
FOREIGN KEY("venueId") REFERENCES venue ("venueId"),
FOREIGN KEY("journalId") REFERENCES journal ("journalId")
)
CREATE TABLE venue (
"venueId" INTEGER NOT NULL,
"venueName" VARCHAR(100) DEFAULT NULL,
PRIMARY KEY ("venueId")
)
CREATE TABLE writes (
"paperId" INTEGER DEFAULT NULL,
"authorId" INTEGER DEFAULT NULL,
PRIMARY KEY ("paperId", "authorId"),
FOREIGN KEY("authorId") REFERENCES author ("authorId"),
FOREIGN KEY("paperId") REFERENCES paper ("paperId")
) |
CREATE TABLE "paperDataset" (
"paperId" INTEGER DEFAULT NULL,
"datasetId" INTEGER DEFAULT NULL,
PRIMARY KEY ("datasetId", "paperId")
)
/*
2 rows from paperDataset table:
paperId datasetId
*/
CREATE TABLE "paperKeyphrase" (
"paperId" INTEGER DEFAULT NULL,
"keyphraseId" INTEGER DEFAULT NULL,
PRIMARY KEY ("keyphraseId", "paperId"),
FOREIGN KEY("keyphraseId") REFERENCES keyphrase ("keyphraseId"),
FOREIGN KEY("paperId") REFERENCES paper ("paperId")
)
/*
2 rows from paperKeyphrase table:
paperId keyphraseId
*/
CREATE TABLE author (
"authorId" INTEGER NOT NULL,
"authorName" VARCHAR(50) DEFAULT NULL,
PRIMARY KEY ("authorId")
)
/*
2 rows from author table:
authorId authorName
*/
CREATE TABLE cite (
"citingPaperId" INTEGER NOT NULL,
"citedPaperId" INTEGER NOT NULL,
PRIMARY KEY ("citingPaperId", "citedPaperId"),
FOREIGN KEY("citingPaperId") REFERENCES paper ("paperId"),
FOREIGN KEY("citedPaperId") REFERENCES paper ("paperId")
)
/*
2 rows from cite table:
citingPaperId citedPaperId
*/
CREATE TABLE dataset (
"datasetId" INTEGER NOT NULL,
"datasetName" VARCHAR(50) DEFAULT NULL,
PRIMARY KEY ("datasetId")
)
/*
2 rows from dataset table:
datasetId datasetName
*/
CREATE TABLE journal (
"journalId" INTEGER NOT NULL,
"journalName" VARCHAR(100) DEFAULT NULL,
PRIMARY KEY ("journalId")
)
/*
2 rows from journal table:
journalId journalName
*/
CREATE TABLE keyphrase (
"keyphraseId" INTEGER NOT NULL,
"keyphraseName" VARCHAR(50) DEFAULT NULL,
PRIMARY KEY ("keyphraseId")
)
/*
2 rows from keyphrase table:
keyphraseId keyphraseName
*/
CREATE TABLE paper (
"paperId" INTEGER NOT NULL,
title VARCHAR(300) DEFAULT NULL,
"venueId" INTEGER DEFAULT NULL,
year INTEGER DEFAULT NULL,
"numCiting" INTEGER DEFAULT NULL,
"numCitedBy" INTEGER DEFAULT NULL,
"journalId" INTEGER DEFAULT NULL,
PRIMARY KEY ("paperId"),
FOREIGN KEY("venueId") REFERENCES venue ("venueId"),
FOREIGN KEY("journalId") REFERENCES journal ("journalId")
)
/*
2 rows from paper table:
paperId title venueId year numCiting numCitedBy journalId
*/
CREATE TABLE venue (
"venueId" INTEGER NOT NULL,
"venueName" VARCHAR(100) DEFAULT NULL,
PRIMARY KEY ("venueId")
)
/*
2 rows from venue table:
venueId venueName
*/
CREATE TABLE writes (
"paperId" INTEGER DEFAULT NULL,
"authorId" INTEGER DEFAULT NULL,
PRIMARY KEY ("paperId", "authorId"),
FOREIGN KEY("authorId") REFERENCES author ("authorId"),
FOREIGN KEY("paperId") REFERENCES paper ("paperId")
)
/*
2 rows from writes table:
paperId authorId
*/ | ACL papers in 2016 with neural attention in the title | SELECT DISTINCT t1.paperid FROM venue AS t2 JOIN paper AS t1 ON t2.venueid = t1.venueid WHERE t1.title LIKE "neural attention" AND t1.year = 2016 AND t2.venuename = "ACL"; | [{'Nenhum': 'Nenhum resultado encontrado'}] | Medium | true | true | false | false | false | false | false | true | false | false | false | false | false | ||||
manufacturer |
CREATE TABLE furniture (
"Furniture_ID" INTEGER,
"Name" TEXT,
"Num_of_Component" INTEGER,
"Market_Rate" REAL,
PRIMARY KEY ("Furniture_ID")
)
CREATE TABLE furniture_manufacte (
"Manufacturer_ID" INTEGER,
"Furniture_ID" INTEGER,
"Price_in_Dollar" REAL,
PRIMARY KEY ("Manufacturer_ID", "Furniture_ID"),
FOREIGN KEY("Furniture_ID") REFERENCES furniture ("Furniture_ID"),
FOREIGN KEY("Manufacturer_ID") REFERENCES manufacturer ("Manufacturer_ID")
)
CREATE TABLE manufacturer (
"Manufacturer_ID" INTEGER,
"Open_Year" REAL,
"Name" TEXT,
"Num_of_Factories" INTEGER,
"Num_of_Shops" INTEGER,
PRIMARY KEY ("Manufacturer_ID")
) |
CREATE TABLE furniture (
"Furniture_ID" INTEGER,
"Name" TEXT,
"Num_of_Component" INTEGER,
"Market_Rate" REAL,
PRIMARY KEY ("Furniture_ID")
)
/*
2 rows from furniture table:
Furniture_ID Name Num_of_Component Market_Rate
1 Billiard table 14 52.5
2 Chabudai 4 40.0
*/
CREATE TABLE furniture_manufacte (
"Manufacturer_ID" INTEGER,
"Furniture_ID" INTEGER,
"Price_in_Dollar" REAL,
PRIMARY KEY ("Manufacturer_ID", "Furniture_ID"),
FOREIGN KEY("Furniture_ID") REFERENCES furniture ("Furniture_ID"),
FOREIGN KEY("Manufacturer_ID") REFERENCES manufacturer ("Manufacturer_ID")
)
/*
2 rows from furniture_manufacte table:
Manufacturer_ID Furniture_ID Price_in_Dollar
1 3 239.0
4 2 450.0
*/
CREATE TABLE manufacturer (
"Manufacturer_ID" INTEGER,
"Open_Year" REAL,
"Name" TEXT,
"Num_of_Factories" INTEGER,
"Num_of_Shops" INTEGER,
PRIMARY KEY ("Manufacturer_ID")
)
/*
2 rows from manufacturer table:
Manufacturer_ID Open_Year Name Num_of_Factories Num_of_Shops
1 1980.0 Chevrolet House 36 8
2 1990.0 IKEA 21 19
*/ | Find the name of the company that produces both furnitures with less than 6 components and furnitures with more than 10 components. | SELECT t3.name FROM furniture AS t1 JOIN furniture_manufacte AS t2 ON t1.Furniture_ID = t2.Furniture_ID JOIN manufacturer AS t3 ON t2.manufacturer_id = t3.manufacturer_id WHERE t1.num_of_component < 6 INTERSECT SELECT t3.name FROM furniture AS t1 JOIN furniture_manufacte AS t2 ON t1.Furniture_ID = t2.Furniture_ID JOIN manufacturer AS t3 ON t2.manufacturer_id = t3.manufacturer_id WHERE t1.num_of_component > 10 | [{'Name': 'Tomorrow'}] | Hard | false | false | false | false | false | false | false | false | true | false | true | false | false | ||||
school_player |
CREATE TABLE player (
"Player_ID" INTEGER,
"Player" TEXT,
"Team" TEXT,
"Age" INTEGER,
"Position" TEXT,
"School_ID" INTEGER,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY("School_ID") REFERENCES school ("School_ID")
)
CREATE TABLE school (
"School_ID" INTEGER,
"School" TEXT,
"Location" TEXT,
"Enrollment" REAL,
"Founded" REAL,
"Denomination" TEXT,
"Boys_or_Girls" TEXT,
"Day_or_Boarding" TEXT,
"Year_Entered_Competition" REAL,
"School_Colors" TEXT,
PRIMARY KEY ("School_ID")
)
CREATE TABLE school_details (
"School_ID" INTEGER,
"Nickname" TEXT,
"Colors" TEXT,
"League" TEXT,
"Class" TEXT,
"Division" TEXT,
PRIMARY KEY ("School_ID"),
FOREIGN KEY("School_ID") REFERENCES school ("School_ID")
)
CREATE TABLE school_performance (
"School_Id" INTEGER,
"School_Year" TEXT,
"Class_A" TEXT,
"Class_AA" TEXT,
PRIMARY KEY ("School_Id", "School_Year"),
FOREIGN KEY("School_Id") REFERENCES school ("School_ID")
) |
CREATE TABLE player (
"Player_ID" INTEGER,
"Player" TEXT,
"Team" TEXT,
"Age" INTEGER,
"Position" TEXT,
"School_ID" INTEGER,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY("School_ID") REFERENCES school ("School_ID")
)
/*
2 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
*/
CREATE TABLE school (
"School_ID" INTEGER,
"School" TEXT,
"Location" TEXT,
"Enrollment" REAL,
"Founded" REAL,
"Denomination" TEXT,
"Boys_or_Girls" TEXT,
"Day_or_Boarding" TEXT,
"Year_Entered_Competition" REAL,
"School_Colors" TEXT,
PRIMARY KEY ("School_ID")
)
/*
2 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
*/
CREATE TABLE school_details (
"School_ID" INTEGER,
"Nickname" TEXT,
"Colors" TEXT,
"League" TEXT,
"Class" TEXT,
"Division" TEXT,
PRIMARY KEY ("School_ID"),
FOREIGN KEY("School_ID") REFERENCES school ("School_ID")
)
/*
2 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
*/
CREATE TABLE school_performance (
"School_Id" INTEGER,
"School_Year" TEXT,
"Class_A" TEXT,
"Class_AA" TEXT,
PRIMARY KEY ("School_Id", "School_Year"),
FOREIGN KEY("School_Id") REFERENCES school ("School_ID")
)
/*
2 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
*/ | What are the teams of the players, sorted in ascending alphabetical order? | SELECT Team FROM player ORDER BY Team ASC | [{'Team': 'Baltimore Orioles'}, {'Team': 'Chicago Cubs'}, {'Team': 'Chicago White Sox'}, {'Team': 'Cincinnati Reds'}, {'Team': 'Detroit Tigers'}, {'Team': 'Florida Marlins'}, {'Team': 'Houston Astros'}, {'Team': 'Kansas City Royals'}, {'Team': 'Los Angeles Dodgers'}, {'Team': 'Milwaukee Brewers'}, {'Team': 'Minnesota Twins'}, {'Team': 'New York Mets'}, {'Team': 'New York Mets'}, {'Team': 'Oakland Athletics'}, {'Team': 'Pittsburgh Pirates'}, {'Team': 'San Diego Padres'}, {'Team': 'San Francisco Giants'}, {'Team': 'Seattle Mariners'}, {'Team': 'St. Louis Cardinals'}, {'Team': 'Tampa Bay Devil Rays'}, {'Team': 'Texas Rangers'}, {'Team': 'Toronto Blue Jays'}, {'Team': 'Washington Nationals'}] | Easy | false | false | false | true | false | false | false | false | false | false | false | false | false | [QUESTION]What are the full names of all players, sorted by birth date?[/QUESTION]
[SQL]SELECT first_name , last_name FROM players ORDER BY birth_date[/SQL] | [QUESTION]What are the full names of all players, sorted by birth date?[/QUESTION]
[SQL]SELECT first_name , last_name FROM players ORDER BY birth_date[/SQL] | [QUESTION]What are the full names of all players, sorted by birth date?[/QUESTION]
[SQL]SELECT first_name , last_name FROM players ORDER BY birth_date[/SQL] | [QUESTION]What are the full names of all players, sorted by birth date?[/QUESTION]
[SQL]SELECT first_name , last_name FROM players ORDER BY birth_date[/SQL] |
document_management |
CREATE TABLE "Document_Functional_Areas" (
document_code VARCHAR(15) NOT NULL,
functional_area_code VARCHAR(15) NOT NULL,
FOREIGN KEY(functional_area_code) REFERENCES "Functional_Areas" (functional_area_code),
FOREIGN KEY(document_code) REFERENCES "Documents" (document_code)
)
CREATE TABLE "Document_Sections" (
section_id INTEGER,
document_code VARCHAR(15) NOT NULL,
section_sequence INTEGER,
section_code VARCHAR(20),
section_title VARCHAR(80),
PRIMARY KEY (section_id),
FOREIGN KEY(document_code) REFERENCES "Documents" (document_code)
)
CREATE TABLE "Document_Sections_Images" (
section_id INTEGER NOT NULL,
image_id INTEGER NOT NULL,
PRIMARY KEY (section_id, image_id),
FOREIGN KEY(image_id) REFERENCES "Images" (image_id),
FOREIGN KEY(section_id) REFERENCES "Document_Sections" (section_id)
)
CREATE TABLE "Document_Structures" (
document_structure_code VARCHAR(15),
parent_document_structure_code VARCHAR(15),
document_structure_description VARCHAR(80),
PRIMARY KEY (document_structure_code)
)
CREATE TABLE "Documents" (
document_code VARCHAR(15),
document_structure_code VARCHAR(15) NOT NULL,
document_type_code VARCHAR(15) NOT NULL,
access_count INTEGER,
document_name VARCHAR(80),
PRIMARY KEY (document_code),
FOREIGN KEY(document_structure_code) REFERENCES "Document_Structures" (document_structure_code)
)
CREATE TABLE "Functional_Areas" (
functional_area_code VARCHAR(15),
parent_functional_area_code VARCHAR(15),
functional_area_description VARCHAR(80) NOT NULL,
PRIMARY KEY (functional_area_code)
)
CREATE TABLE "Images" (
image_id INTEGER,
image_alt_text VARCHAR(80),
image_name VARCHAR(40),
image_url VARCHAR(255),
PRIMARY KEY (image_id)
)
CREATE TABLE "Roles" (
role_code VARCHAR(15),
role_description VARCHAR(80),
PRIMARY KEY (role_code)
)
CREATE TABLE "Users" (
user_id INTEGER,
role_code VARCHAR(15) NOT NULL,
user_name VARCHAR(40),
user_login VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (user_id),
FOREIGN KEY(role_code) REFERENCES "Roles" (role_code)
) |
CREATE TABLE "Document_Functional_Areas" (
document_code VARCHAR(15) NOT NULL,
functional_area_code VARCHAR(15) NOT NULL,
FOREIGN KEY(functional_area_code) REFERENCES "Functional_Areas" (functional_area_code),
FOREIGN KEY(document_code) REFERENCES "Documents" (document_code)
)
/*
2 rows from Document_Functional_Areas table:
document_code functional_area_code
675 9
930 1
*/
CREATE TABLE "Document_Sections" (
section_id INTEGER,
document_code VARCHAR(15) NOT NULL,
section_sequence INTEGER,
section_code VARCHAR(20),
section_title VARCHAR(80),
PRIMARY KEY (section_id),
FOREIGN KEY(document_code) REFERENCES "Documents" (document_code)
)
/*
2 rows from Document_Sections table:
section_id document_code section_sequence section_code section_title
12 714 6072 70 after
15 217 4510 14 after
*/
CREATE TABLE "Document_Sections_Images" (
section_id INTEGER NOT NULL,
image_id INTEGER NOT NULL,
PRIMARY KEY (section_id, image_id),
FOREIGN KEY(image_id) REFERENCES "Images" (image_id),
FOREIGN KEY(section_id) REFERENCES "Document_Sections" (section_id)
)
/*
2 rows from Document_Sections_Images table:
section_id image_id
93 6
86 2
*/
CREATE TABLE "Document_Structures" (
document_structure_code VARCHAR(15),
parent_document_structure_code VARCHAR(15),
document_structure_description VARCHAR(80),
PRIMARY KEY (document_structure_code)
)
/*
2 rows from Document_Structures table:
document_structure_code parent_document_structure_code document_structure_description
1 1 Header
6 1 Main section
*/
CREATE TABLE "Documents" (
document_code VARCHAR(15),
document_structure_code VARCHAR(15) NOT NULL,
document_type_code VARCHAR(15) NOT NULL,
access_count INTEGER,
document_name VARCHAR(80),
PRIMARY KEY (document_code),
FOREIGN KEY(document_structure_code) REFERENCES "Document_Structures" (document_structure_code)
)
/*
2 rows from Documents table:
document_code document_structure_code document_type_code access_count document_name
217 8 Book 1864 Learning English
621 1 Paper 8208 Research about Art history
*/
CREATE TABLE "Functional_Areas" (
functional_area_code VARCHAR(15),
parent_functional_area_code VARCHAR(15),
functional_area_description VARCHAR(80) NOT NULL,
PRIMARY KEY (functional_area_code)
)
/*
2 rows from Functional_Areas table:
functional_area_code parent_functional_area_code functional_area_description
8 8 Signature
1 8 Acknowledgement
*/
CREATE TABLE "Images" (
image_id INTEGER,
image_alt_text VARCHAR(80),
image_name VARCHAR(40),
image_url VARCHAR(255),
PRIMARY KEY (image_id)
)
/*
2 rows from Images table:
image_id image_alt_text image_name image_url
1 Lea top1 http://www.rempelnader.com/1.jpg
2 Arden top2 http://connellykertzmann.org/1.jpg
*/
CREATE TABLE "Roles" (
role_code VARCHAR(15),
role_description VARCHAR(80),
PRIMARY KEY (role_code)
)
/*
2 rows from Roles table:
role_code role_description
DBA Database Administrator
PROJ-MGR Project Manager
*/
CREATE TABLE "Users" (
user_id INTEGER,
role_code VARCHAR(15) NOT NULL,
user_name VARCHAR(40),
user_login VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (user_id),
FOREIGN KEY(role_code) REFERENCES "Roles" (role_code)
)
/*
2 rows from Users table:
user_id role_code user_name user_login password
1 PROJ-MGR dickens.elta 0 e72b5a2d50b39a8760764a5f7a9d68ca2f076877
2 DBA tremblay.raheem 1 9bc25a040d5647ced5ec32e1a455e90fafc10bcb
*/ | Return the name of the document that has the most sections. | SELECT t1.document_name FROM documents AS t1 JOIN document_sections AS t2 ON t1.document_code = t2.document_code GROUP BY t1.document_code ORDER BY count(*) DESC LIMIT 1 | [{'document_name': 'Fall Sails'}] | Medium | false | false | false | true | true | true | false | true | false | false | false | false | false | [QUESTION]Return the id and name of the document with the most paragraphs.[/QUESTION]
[SQL]SELECT T1.document_id , T2.document_name FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_id = T2.document_id GROUP BY T1.document_id ORDER BY count(*) DESC LIMIT 1[/SQL] | [QUESTION]Return the id and name of the document with the most paragraphs.[/QUESTION]
[SQL]SELECT T1.document_id , T2.document_name FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_id = T2.document_id GROUP BY T1.document_id ORDER BY count(*) DESC LIMIT 1[/SQL] | [QUESTION]Return the id and name of the document with the most paragraphs.[/QUESTION]
[SQL]SELECT T1.document_id , T2.document_name FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_id = T2.document_id GROUP BY T1.document_id ORDER BY count(*) DESC LIMIT 1[/SQL] | [QUESTION]Return the id and name of the document with the most paragraphs.[/QUESTION]
[SQL]SELECT T1.document_id , T2.document_name FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_id = T2.document_id GROUP BY T1.document_id ORDER BY count(*) DESC LIMIT 1[/SQL] |
medicine_enzyme_interaction |
CREATE TABLE enzyme (
id INTEGER,
name TEXT,
"Location" TEXT,
"Product" TEXT,
"Chromosome" TEXT,
"OMIM" INTEGER,
"Porphyria" TEXT,
PRIMARY KEY (id)
)
CREATE TABLE medicine (
id INTEGER,
name TEXT,
"Trade_Name" TEXT,
"FDA_approved" TEXT,
PRIMARY KEY (id)
)
CREATE TABLE medicine_enzyme_interaction (
enzyme_id INTEGER,
medicine_id INTEGER,
interaction_type TEXT,
PRIMARY KEY (enzyme_id, medicine_id),
FOREIGN KEY(medicine_id) REFERENCES medicine (id),
FOREIGN KEY(enzyme_id) REFERENCES enzyme (id)
) |
CREATE TABLE enzyme (
id INTEGER,
name TEXT,
"Location" TEXT,
"Product" TEXT,
"Chromosome" TEXT,
"OMIM" INTEGER,
"Porphyria" TEXT,
PRIMARY KEY (id)
)
/*
2 rows from enzyme table:
id name Location Product Chromosome OMIM Porphyria
1 ALA synthase Mitochondrion δ-Aminolevulinic acid 3p21.1 125290 none
2 ALA dehydratase Cytosol Porphobilinogen 9q34 125270 ALA-Dehydratase deficiency
*/
CREATE TABLE medicine (
id INTEGER,
name TEXT,
"Trade_Name" TEXT,
"FDA_approved" TEXT,
PRIMARY KEY (id)
)
/*
2 rows from medicine table:
id name Trade_Name FDA_approved
1 Amisulpride Solian No
2 Aripiprazole Abilify Yes
*/
CREATE TABLE medicine_enzyme_interaction (
enzyme_id INTEGER,
medicine_id INTEGER,
interaction_type TEXT,
PRIMARY KEY (enzyme_id, medicine_id),
FOREIGN KEY(medicine_id) REFERENCES medicine (id),
FOREIGN KEY(enzyme_id) REFERENCES enzyme (id)
)
/*
2 rows from medicine_enzyme_interaction table:
enzyme_id medicine_id interaction_type
1 1 inhibitor
1 2 inhibitor
*/ | What are the names and locations of all enzymes listed? | SELECT name , LOCATION FROM enzyme | [{'name': 'ALA synthase', 'Location': 'Mitochondrion'}, {'name': 'ALA dehydratase', 'Location': 'Cytosol'}, {'name': 'PBG deaminase', 'Location': 'Cytosol'}, {'name': 'Uroporphyrinogen III synthase', 'Location': 'Cytosol'}, {'name': 'Uroporphyrinogen III decarboxylase', 'Location': 'Cytosol'}, {'name': 'Coproporphyrinogen III oxidase', 'Location': 'Mitochondrion'}, {'name': 'Protoporphyrinogen oxidase', 'Location': 'Mitochondrion'}, {'name': 'Ferrochelatase', 'Location': 'Mitochondrion'}] | Easy | false | false | false | false | false | false | false | false | false | false | false | false | false | ||||
program_share |
CREATE TABLE broadcast (
"Channel_ID" INTEGER,
"Program_ID" INTEGER,
"Time_of_day" TEXT,
PRIMARY KEY ("Channel_ID", "Program_ID"),
FOREIGN KEY("Program_ID") REFERENCES program ("Program_ID"),
FOREIGN KEY("Channel_ID") REFERENCES channel ("Channel_ID")
)
CREATE TABLE broadcast_share (
"Channel_ID" INTEGER,
"Program_ID" INTEGER,
"Date" TEXT,
"Share_in_percent" REAL,
PRIMARY KEY ("Channel_ID", "Program_ID"),
FOREIGN KEY("Program_ID") REFERENCES program ("Program_ID"),
FOREIGN KEY("Channel_ID") REFERENCES channel ("Channel_ID")
)
CREATE TABLE channel (
"Channel_ID" INTEGER,
"Name" TEXT,
"Owner" TEXT,
"Share_in_percent" REAL,
"Rating_in_percent" REAL,
PRIMARY KEY ("Channel_ID")
)
CREATE TABLE program (
"Program_ID" INTEGER,
"Name" TEXT,
"Origin" TEXT,
"Launch" REAL,
"Owner" TEXT,
PRIMARY KEY ("Program_ID")
) |
CREATE TABLE broadcast (
"Channel_ID" INTEGER,
"Program_ID" INTEGER,
"Time_of_day" TEXT,
PRIMARY KEY ("Channel_ID", "Program_ID"),
FOREIGN KEY("Program_ID") REFERENCES program ("Program_ID"),
FOREIGN KEY("Channel_ID") REFERENCES channel ("Channel_ID")
)
/*
2 rows from broadcast table:
Channel_ID Program_ID Time_of_day
1 1 Morning
2 1 Night
*/
CREATE TABLE broadcast_share (
"Channel_ID" INTEGER,
"Program_ID" INTEGER,
"Date" TEXT,
"Share_in_percent" REAL,
PRIMARY KEY ("Channel_ID", "Program_ID"),
FOREIGN KEY("Program_ID") REFERENCES program ("Program_ID"),
FOREIGN KEY("Channel_ID") REFERENCES channel ("Channel_ID")
)
/*
2 rows from broadcast_share table:
Channel_ID Program_ID Date Share_in_percent
1 1 01,May 3.1
2 1 02,May 1.8
*/
CREATE TABLE channel (
"Channel_ID" INTEGER,
"Name" TEXT,
"Owner" TEXT,
"Share_in_percent" REAL,
"Rating_in_percent" REAL,
PRIMARY KEY ("Channel_ID")
)
/*
2 rows from channel table:
Channel_ID Name Owner Share_in_percent Rating_in_percent
1 CCTV-1 CCTV 4.9 0.54
2 Hunan Satellite TV HBS 4.81 0.53
*/
CREATE TABLE program (
"Program_ID" INTEGER,
"Name" TEXT,
"Origin" TEXT,
"Launch" REAL,
"Owner" TEXT,
PRIMARY KEY ("Program_ID")
)
/*
2 rows from program table:
Program_ID Name Origin Launch Owner
1 Aniworld Hunan 2005.0 Hunan Broadcasting System (HBS)
2 Kaku Beijing 2004.0 Beijing Television (BTV)
*/ | what are the names of the channels that broadcast in both morning and night? | SELECT t1.name FROM channel AS t1 JOIN broadcast AS t2 ON t1.channel_id = t2.channel_id WHERE t2.time_of_day = 'Morning' INTERSECT SELECT t1.name FROM channel AS t1 JOIN broadcast AS t2 ON t1.channel_id = t2.channel_id WHERE t2.time_of_day = 'Night' | [{'Name': 'CCTV-1'}] | Hard | false | false | false | false | false | false | false | false | true | false | true | false | false | [QUESTION]What are the Package Options of the TV Channels whose series names are Sky Radio?[/QUESTION]
[SQL]SELECT Package_Option FROM TV_Channel WHERE series_name = "Sky Radio";[/SQL] | [QUESTION]What are the Package Options of the TV Channels whose series names are Sky Radio?[/QUESTION]
[SQL]SELECT Package_Option FROM TV_Channel WHERE series_name = "Sky Radio";[/SQL] | [QUESTION]What are the Package Options of the TV Channels whose series names are Sky Radio?[/QUESTION]
[SQL]SELECT Package_Option FROM TV_Channel WHERE series_name = "Sky Radio";[/SQL] | [QUESTION]What are the Package Options of the TV Channels whose series names are Sky Radio?[/QUESTION]
[SQL]SELECT Package_Option FROM TV_Channel WHERE series_name = "Sky Radio";[/SQL] |
performance_attendance |
CREATE TABLE member (
"Member_ID" TEXT,
"Name" TEXT,
"Nationality" TEXT,
"Role" TEXT,
PRIMARY KEY ("Member_ID")
)
CREATE TABLE member_attendance (
"Member_ID" INTEGER,
"Performance_ID" INTEGER,
"Num_of_Pieces" INTEGER,
PRIMARY KEY ("Member_ID", "Performance_ID"),
FOREIGN KEY("Performance_ID") REFERENCES performance ("Performance_ID"),
FOREIGN KEY("Member_ID") REFERENCES member ("Member_ID")
)
CREATE TABLE performance (
"Performance_ID" REAL,
"Date" TEXT,
"Host" TEXT,
"Location" TEXT,
"Attendance" INTEGER,
PRIMARY KEY ("Performance_ID")
) |
CREATE TABLE member (
"Member_ID" TEXT,
"Name" TEXT,
"Nationality" TEXT,
"Role" TEXT,
PRIMARY KEY ("Member_ID")
)
/*
2 rows from member table:
Member_ID Name Nationality Role
1 Wilfredo Ruiz Uruguay Prime Violin
2 Luis González Argentina Violin
*/
CREATE TABLE member_attendance (
"Member_ID" INTEGER,
"Performance_ID" INTEGER,
"Num_of_Pieces" INTEGER,
PRIMARY KEY ("Member_ID", "Performance_ID"),
FOREIGN KEY("Performance_ID") REFERENCES performance ("Performance_ID"),
FOREIGN KEY("Member_ID") REFERENCES member ("Member_ID")
)
/*
2 rows from member_attendance table:
Member_ID Performance_ID Num_of_Pieces
11 3 2
7 2 3
*/
CREATE TABLE performance (
"Performance_ID" REAL,
"Date" TEXT,
"Host" TEXT,
"Location" TEXT,
"Attendance" INTEGER,
PRIMARY KEY ("Performance_ID")
)
/*
2 rows from performance table:
Performance_ID Date Host Location Attendance
1.0 February 2 Boston Bruins TD Garden 165
2.0 February 4 New York Rangers Madison Square Garden 1820
*/ | What are the dates and locations of performances? | SELECT Date , LOCATION FROM performance | [{'Date': 'February 2', 'Location': 'TD Garden'}, {'Date': 'February 4', 'Location': 'Madison Square Garden'}, {'Date': 'February 5', 'Location': 'Verizon Center'}, {'Date': 'February 7', 'Location': 'Verizon Center'}, {'Date': 'February 10', 'Location': 'Bell Centre'}, {'Date': 'February 11', 'Location': 'Scotiabank Place'}] | Easy | false | false | false | false | false | false | false | false | false | false | false | false | false | [QUESTION]What are years of founding for orchestras that have had more than a single performance?[/QUESTION]
[SQL]SELECT Year_of_Founded FROM orchestra AS T1 JOIN performance AS T2 ON T1.Orchestra_ID = T2.Orchestra_ID GROUP BY T2.Orchestra_ID HAVING COUNT(*) > 1[/SQL] | [QUESTION]What are years of founding for orchestras that have had more than a single performance?[/QUESTION]
[SQL]SELECT Year_of_Founded FROM orchestra AS T1 JOIN performance AS T2 ON T1.Orchestra_ID = T2.Orchestra_ID GROUP BY T2.Orchestra_ID HAVING COUNT(*) > 1[/SQL] | [QUESTION]What are years of founding for orchestras that have had more than a single performance?[/QUESTION]
[SQL]SELECT Year_of_Founded FROM orchestra AS T1 JOIN performance AS T2 ON T1.Orchestra_ID = T2.Orchestra_ID GROUP BY T2.Orchestra_ID HAVING COUNT(*) > 1[/SQL] | [QUESTION]What are years of founding for orchestras that have had more than a single performance?[/QUESTION]
[SQL]SELECT Year_of_Founded FROM orchestra AS T1 JOIN performance AS T2 ON T1.Orchestra_ID = T2.Orchestra_ID GROUP BY T2.Orchestra_ID HAVING COUNT(*) > 1[/SQL] |
products_gen_characteristics |
CREATE TABLE "Characteristics" (
characteristic_id INTEGER,
characteristic_type_code VARCHAR(15) NOT NULL,
characteristic_data_type VARCHAR(10),
characteristic_name VARCHAR(80),
other_characteristic_details VARCHAR(255),
PRIMARY KEY (characteristic_id),
FOREIGN KEY(characteristic_type_code) REFERENCES "Ref_Characteristic_Types" (characteristic_type_code)
)
CREATE TABLE "Product_Characteristics" (
product_id INTEGER NOT NULL,
characteristic_id INTEGER NOT NULL,
product_characteristic_value VARCHAR(50),
FOREIGN KEY(product_id) REFERENCES "Products" (product_id),
FOREIGN KEY(characteristic_id) REFERENCES "Characteristics" (characteristic_id)
)
CREATE TABLE "Products" (
product_id INTEGER,
color_code VARCHAR(15) NOT NULL,
product_category_code VARCHAR(15) NOT NULL,
product_name VARCHAR(80),
typical_buying_price VARCHAR(20),
typical_selling_price VARCHAR(20),
product_description VARCHAR(255),
other_product_details VARCHAR(255),
PRIMARY KEY (product_id),
FOREIGN KEY(color_code) REFERENCES "Ref_Colors" (color_code),
FOREIGN KEY(product_category_code) REFERENCES "Ref_Product_Categories" (product_category_code)
)
CREATE TABLE "Ref_Characteristic_Types" (
characteristic_type_code VARCHAR(15),
characteristic_type_description VARCHAR(80),
PRIMARY KEY (characteristic_type_code)
)
CREATE TABLE "Ref_Colors" (
color_code VARCHAR(15),
color_description VARCHAR(80),
PRIMARY KEY (color_code)
)
CREATE TABLE "Ref_Product_Categories" (
product_category_code VARCHAR(15),
product_category_description VARCHAR(80),
unit_of_measure VARCHAR(20),
PRIMARY KEY (product_category_code)
) |
CREATE TABLE "Characteristics" (
characteristic_id INTEGER,
characteristic_type_code VARCHAR(15) NOT NULL,
characteristic_data_type VARCHAR(10),
characteristic_name VARCHAR(80),
other_characteristic_details VARCHAR(255),
PRIMARY KEY (characteristic_id),
FOREIGN KEY(characteristic_type_code) REFERENCES "Ref_Characteristic_Types" (characteristic_type_code)
)
/*
2 rows from Characteristics table:
characteristic_id characteristic_type_code characteristic_data_type characteristic_name other_characteristic_details
1 Grade numquam slow None
2 Grade doloribus fast None
*/
CREATE TABLE "Product_Characteristics" (
product_id INTEGER NOT NULL,
characteristic_id INTEGER NOT NULL,
product_characteristic_value VARCHAR(50),
FOREIGN KEY(product_id) REFERENCES "Products" (product_id),
FOREIGN KEY(characteristic_id) REFERENCES "Characteristics" (characteristic_id)
)
/*
2 rows from Product_Characteristics table:
product_id characteristic_id product_characteristic_value
13 13 low
11 2 low
*/
CREATE TABLE "Products" (
product_id INTEGER,
color_code VARCHAR(15) NOT NULL,
product_category_code VARCHAR(15) NOT NULL,
product_name VARCHAR(80),
typical_buying_price VARCHAR(20),
typical_selling_price VARCHAR(20),
product_description VARCHAR(255),
other_product_details VARCHAR(255),
PRIMARY KEY (product_id),
FOREIGN KEY(color_code) REFERENCES "Ref_Colors" (color_code),
FOREIGN KEY(product_category_code) REFERENCES "Ref_Product_Categories" (product_category_code)
)
/*
2 rows from Products table:
product_id color_code product_category_code product_name typical_buying_price typical_selling_price product_description other_product_details
1 4 Spices cumin 2878.3 et None
2 2 Spices peper 352447.2874677 1892070.2803543 rerum None
*/
CREATE TABLE "Ref_Characteristic_Types" (
characteristic_type_code VARCHAR(15),
characteristic_type_description VARCHAR(80),
PRIMARY KEY (characteristic_type_code)
)
/*
2 rows from Ref_Characteristic_Types table:
characteristic_type_code characteristic_type_description
Grade Grade
Purity Purity
*/
CREATE TABLE "Ref_Colors" (
color_code VARCHAR(15),
color_description VARCHAR(80),
PRIMARY KEY (color_code)
)
/*
2 rows from Ref_Colors table:
color_code color_description
9 red
5 green
*/
CREATE TABLE "Ref_Product_Categories" (
product_category_code VARCHAR(15),
product_category_description VARCHAR(80),
unit_of_measure VARCHAR(20),
PRIMARY KEY (product_category_code)
)
/*
2 rows from Ref_Product_Categories table:
product_category_code product_category_description unit_of_measure
Herbs Herbs Handful
Seeds Seeds Weight - pound,kilo.
*/ | What are the names and data types of the characteristics of the 'cumin' product? | SELECT t3.characteristic_name , t3.characteristic_data_type FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = "cumin" | [{'characteristic_name': 'slow', 'characteristic_data_type': 'mollitia'}] | Hard | false | false | false | false | false | false | false | false | true | false | false | false | false | ||||
network_2 |
CREATE TABLE "Person" (
name VARCHAR(20),
age INTEGER,
city TEXT,
gender TEXT,
job TEXT,
PRIMARY KEY (name)
)
CREATE TABLE "PersonFriend" (
name VARCHAR(20),
friend VARCHAR(20),
year INTEGER,
FOREIGN KEY(name) REFERENCES "Person" (name),
FOREIGN KEY(friend) REFERENCES "Person" (name)
) |
CREATE TABLE "Person" (
name VARCHAR(20),
age INTEGER,
city TEXT,
gender TEXT,
job TEXT,
PRIMARY KEY (name)
)
/*
2 rows from Person table:
name age city gender job
Alice 25 new york city female student
Bob 35 salt lake city male engineer
*/
CREATE TABLE "PersonFriend" (
name VARCHAR(20),
friend VARCHAR(20),
year INTEGER,
FOREIGN KEY(name) REFERENCES "Person" (name),
FOREIGN KEY(friend) REFERENCES "Person" (name)
)
/*
2 rows from PersonFriend table:
name friend year
Alice Bob 10
Zach Dan 12
*/ | Whare the names, friends, and ages of all people who are older than the average age of a person? | SELECT DISTINCT T2.name , T2.friend , T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T1.age > (SELECT avg(age) FROM person) | [{'name': 'Alice', 'friend': 'Bob', 'age': 35}, {'name': 'Bob', 'friend': 'Zach', 'age': 45}] | Medium | true | false | false | false | false | false | false | true | false | false | false | false | false | [QUESTION]What are the names of high schoolers who have a grade of over 5 and have 2 or more friends?[/QUESTION]
[SQL]SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id WHERE T2.grade > 5 GROUP BY T1.student_id HAVING count(*) >= 2[/SQL] | [QUESTION]What are the names of high schoolers who have a grade of over 5 and have 2 or more friends?[/QUESTION]
[SQL]SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id WHERE T2.grade > 5 GROUP BY T1.student_id HAVING count(*) >= 2[/SQL] | [QUESTION]What are the names of high schoolers who have a grade of over 5 and have 2 or more friends?[/QUESTION]
[SQL]SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id WHERE T2.grade > 5 GROUP BY T1.student_id HAVING count(*) >= 2[/SQL] | [QUESTION]What are the names of high schoolers who have a grade of over 5 and have 2 or more friends?[/QUESTION]
[SQL]SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id WHERE T2.grade > 5 GROUP BY T1.student_id HAVING count(*) >= 2[/SQL] |
cre_Doc_Control_Systems |
CREATE TABLE "Addresses" (
address_id INTEGER NOT NULL,
address_details VARCHAR(255),
PRIMARY KEY (address_id)
)
CREATE TABLE "Circulation_History" (
document_id INTEGER NOT NULL,
draft_number INTEGER NOT NULL,
copy_number INTEGER NOT NULL,
employee_id INTEGER NOT NULL,
PRIMARY KEY (document_id, draft_number, copy_number, employee_id),
FOREIGN KEY(document_id, draft_number, copy_number) REFERENCES "Draft_Copies" (document_id, draft_number, copy_number),
FOREIGN KEY(employee_id) REFERENCES "Employees" (employee_id)
)
CREATE TABLE "Document_Drafts" (
document_id INTEGER NOT NULL,
draft_number INTEGER NOT NULL,
draft_details VARCHAR(255),
PRIMARY KEY (document_id, draft_number),
FOREIGN KEY(document_id) REFERENCES "Documents" (document_id)
)
CREATE TABLE "Documents" (
document_id INTEGER NOT NULL,
document_status_code CHAR(15) NOT NULL,
document_type_code CHAR(15) NOT NULL,
shipping_agent_code CHAR(15),
receipt_date DATETIME,
receipt_number VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (document_id),
FOREIGN KEY(document_type_code) REFERENCES "Ref_Document_Types" (document_type_code),
FOREIGN KEY(document_status_code) REFERENCES "Ref_Document_Status" (document_status_code),
FOREIGN KEY(shipping_agent_code) REFERENCES "Ref_Shipping_Agents" (shipping_agent_code)
)
CREATE TABLE "Documents_Mailed" (
document_id INTEGER NOT NULL,
mailed_to_address_id INTEGER NOT NULL,
mailing_date DATETIME,
PRIMARY KEY (document_id, mailed_to_address_id),
FOREIGN KEY(document_id) REFERENCES "Documents" (document_id),
FOREIGN KEY(mailed_to_address_id) REFERENCES "Addresses" (address_id)
)
CREATE TABLE "Draft_Copies" (
document_id INTEGER NOT NULL,
draft_number INTEGER NOT NULL,
copy_number INTEGER NOT NULL,
PRIMARY KEY (document_id, draft_number, copy_number),
FOREIGN KEY(document_id, draft_number) REFERENCES "Document_Drafts" (document_id, draft_number)
)
CREATE TABLE "Employees" (
employee_id INTEGER NOT NULL,
role_code CHAR(15) NOT NULL,
employee_name VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (employee_id),
FOREIGN KEY(role_code) REFERENCES "Roles" (role_code)
)
CREATE TABLE "Ref_Document_Status" (
document_status_code CHAR(15) NOT NULL,
document_status_description VARCHAR(255) NOT NULL,
PRIMARY KEY (document_status_code)
)
CREATE TABLE "Ref_Document_Types" (
document_type_code CHAR(15) NOT NULL,
document_type_description VARCHAR(255) NOT NULL,
PRIMARY KEY (document_type_code)
)
CREATE TABLE "Ref_Shipping_Agents" (
shipping_agent_code CHAR(15) NOT NULL,
shipping_agent_name VARCHAR(255) NOT NULL,
shipping_agent_description VARCHAR(255) NOT NULL,
PRIMARY KEY (shipping_agent_code)
)
CREATE TABLE "Roles" (
role_code CHAR(15) NOT NULL,
role_description VARCHAR(255),
PRIMARY KEY (role_code)
) |
CREATE TABLE "Addresses" (
address_id INTEGER NOT NULL,
address_details VARCHAR(255),
PRIMARY KEY (address_id)
)
/*
2 rows from Addresses table:
address_id address_details
0 IT
1 MX
*/
CREATE TABLE "Circulation_History" (
document_id INTEGER NOT NULL,
draft_number INTEGER NOT NULL,
copy_number INTEGER NOT NULL,
employee_id INTEGER NOT NULL,
PRIMARY KEY (document_id, draft_number, copy_number, employee_id),
FOREIGN KEY(document_id, draft_number, copy_number) REFERENCES "Draft_Copies" (document_id, draft_number, copy_number),
FOREIGN KEY(employee_id) REFERENCES "Employees" (employee_id)
)
/*
2 rows from Circulation_History table:
document_id draft_number copy_number employee_id
20 17 15 8
1 2 5 1
*/
CREATE TABLE "Document_Drafts" (
document_id INTEGER NOT NULL,
draft_number INTEGER NOT NULL,
draft_details VARCHAR(255),
PRIMARY KEY (document_id, draft_number),
FOREIGN KEY(document_id) REFERENCES "Documents" (document_id)
)
/*
2 rows from Document_Drafts table:
document_id draft_number draft_details
1 0 e
1 2 k
*/
CREATE TABLE "Documents" (
document_id INTEGER NOT NULL,
document_status_code CHAR(15) NOT NULL,
document_type_code CHAR(15) NOT NULL,
shipping_agent_code CHAR(15),
receipt_date DATETIME,
receipt_number VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (document_id),
FOREIGN KEY(document_type_code) REFERENCES "Ref_Document_Types" (document_type_code),
FOREIGN KEY(document_status_code) REFERENCES "Ref_Document_Status" (document_status_code),
FOREIGN KEY(shipping_agent_code) REFERENCES "Ref_Shipping_Agents" (shipping_agent_code)
)
/*
2 rows from Documents table:
document_id document_status_code document_type_code shipping_agent_code receipt_date receipt_number other_details
1 working CD UP 2008-04-21 20:42:25 19 z
2 done Paper US 1974-05-08 00:00:46 34 h
*/
CREATE TABLE "Documents_Mailed" (
document_id INTEGER NOT NULL,
mailed_to_address_id INTEGER NOT NULL,
mailing_date DATETIME,
PRIMARY KEY (document_id, mailed_to_address_id),
FOREIGN KEY(document_id) REFERENCES "Documents" (document_id),
FOREIGN KEY(mailed_to_address_id) REFERENCES "Addresses" (address_id)
)
/*
2 rows from Documents_Mailed table:
document_id mailed_to_address_id mailing_date
2 8 1977-04-01 17:03:50
4 3 1992-11-07 15:03:41
*/
CREATE TABLE "Draft_Copies" (
document_id INTEGER NOT NULL,
draft_number INTEGER NOT NULL,
copy_number INTEGER NOT NULL,
PRIMARY KEY (document_id, draft_number, copy_number),
FOREIGN KEY(document_id, draft_number) REFERENCES "Document_Drafts" (document_id, draft_number)
)
/*
2 rows from Draft_Copies table:
document_id draft_number copy_number
2 8 5
4 9 6
*/
CREATE TABLE "Employees" (
employee_id INTEGER NOT NULL,
role_code CHAR(15) NOT NULL,
employee_name VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (employee_id),
FOREIGN KEY(role_code) REFERENCES "Roles" (role_code)
)
/*
2 rows from Employees table:
employee_id role_code employee_name other_details
1 ED Koby h
2 ED Kenyon f
*/
CREATE TABLE "Ref_Document_Status" (
document_status_code CHAR(15) NOT NULL,
document_status_description VARCHAR(255) NOT NULL,
PRIMARY KEY (document_status_code)
)
/*
2 rows from Ref_Document_Status table:
document_status_code document_status_description
working currently working on
done mailed
*/
CREATE TABLE "Ref_Document_Types" (
document_type_code CHAR(15) NOT NULL,
document_type_description VARCHAR(255) NOT NULL,
PRIMARY KEY (document_type_code)
)
/*
2 rows from Ref_Document_Types table:
document_type_code document_type_description
CD b
Paper u
*/
CREATE TABLE "Ref_Shipping_Agents" (
shipping_agent_code CHAR(15) NOT NULL,
shipping_agent_name VARCHAR(255) NOT NULL,
shipping_agent_description VARCHAR(255) NOT NULL,
PRIMARY KEY (shipping_agent_code)
)
/*
2 rows from Ref_Shipping_Agents table:
shipping_agent_code shipping_agent_name shipping_agent_description
UP UPS g
US USPS q
*/
CREATE TABLE "Roles" (
role_code CHAR(15) NOT NULL,
role_description VARCHAR(255),
PRIMARY KEY (role_code)
)
/*
2 rows from Roles table:
role_code role_description
ED Editor
PT Photo
*/ | Which documents have more than 1 draft copies? List document id and number of draft copies. | SELECT document_id , count(*) FROM Draft_Copies GROUP BY document_id HAVING count(*) > 1; | [{'document_id': 2, 'count(*)': 2}] | Easy | false | false | false | false | false | true | true | false | false | false | false | false | false | [QUESTION]What are the ids and names of each document, as well as the number of paragraphs in each?[/QUESTION]
[SQL]SELECT T1.document_id , T2.document_name , count(*) FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_id = T2.document_id GROUP BY T1.document_id[/SQL] | [QUESTION]What are the ids and names of each document, as well as the number of paragraphs in each?[/QUESTION]
[SQL]SELECT T1.document_id , T2.document_name , count(*) FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_id = T2.document_id GROUP BY T1.document_id[/SQL] | [QUESTION]What are the ids and names of each document, as well as the number of paragraphs in each?[/QUESTION]
[SQL]SELECT T1.document_id , T2.document_name , count(*) FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_id = T2.document_id GROUP BY T1.document_id[/SQL] | [QUESTION]What are the ids and names of each document, as well as the number of paragraphs in each?[/QUESTION]
[SQL]SELECT T1.document_id , T2.document_name , count(*) FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_id = T2.document_id GROUP BY T1.document_id[/SQL] |
riding_club |
CREATE TABLE club (
"Club_ID" INTEGER,
"Club_name" TEXT,
"Region" TEXT,
"Start_year" INTEGER,
PRIMARY KEY ("Club_ID")
)
CREATE TABLE coach (
"Coach_ID" INTEGER,
"Coach_name" TEXT,
"Gender" TEXT,
"Club_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Coach_ID"),
FOREIGN KEY("Club_ID") REFERENCES club ("Club_ID")
)
CREATE TABLE match_result (
"Rank" INTEGER,
"Club_ID" INTEGER,
"Gold" INTEGER,
"Big_Silver" INTEGER,
"Small_Silver" INTEGER,
"Bronze" INTEGER,
"Points" INTEGER,
PRIMARY KEY ("Rank", "Club_ID"),
FOREIGN KEY("Club_ID") REFERENCES club ("Club_ID")
)
CREATE TABLE player (
"Player_ID" INTEGER,
"Sponsor_name" TEXT,
"Player_name" TEXT,
"Gender" TEXT,
"Residence" TEXT,
"Occupation" TEXT,
"Votes" INTEGER,
"Rank" TEXT,
PRIMARY KEY ("Player_ID")
)
CREATE TABLE player_coach (
"Player_ID" INTEGER,
"Coach_ID" INTEGER,
"Starting_year" INTEGER,
PRIMARY KEY ("Player_ID", "Coach_ID"),
FOREIGN KEY("Coach_ID") REFERENCES coach ("Coach_ID"),
FOREIGN KEY("Player_ID") REFERENCES player ("Player_ID")
) |
CREATE TABLE club (
"Club_ID" INTEGER,
"Club_name" TEXT,
"Region" TEXT,
"Start_year" INTEGER,
PRIMARY KEY ("Club_ID")
)
/*
2 rows from club table:
Club_ID Club_name Region Start_year
1 AIK USA 2009
2 BK Häcken UK 1998
*/
CREATE TABLE coach (
"Coach_ID" INTEGER,
"Coach_name" TEXT,
"Gender" TEXT,
"Club_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Coach_ID"),
FOREIGN KEY("Club_ID") REFERENCES club ("Club_ID")
)
/*
2 rows from coach table:
Coach_ID Coach_name Gender Club_ID Rank
1 Jameson Tomas M 1 1
2 Joe Fabbri F 1 2
*/
CREATE TABLE match_result (
"Rank" INTEGER,
"Club_ID" INTEGER,
"Gold" INTEGER,
"Big_Silver" INTEGER,
"Small_Silver" INTEGER,
"Bronze" INTEGER,
"Points" INTEGER,
PRIMARY KEY ("Rank", "Club_ID"),
FOREIGN KEY("Club_ID") REFERENCES club ("Club_ID")
)
/*
2 rows from match_result table:
Rank Club_ID Gold Big_Silver Small_Silver Bronze Points
1 1 20 14 9 8 168
2 2 13 11 16 9 139
*/
CREATE TABLE player (
"Player_ID" INTEGER,
"Sponsor_name" TEXT,
"Player_name" TEXT,
"Gender" TEXT,
"Residence" TEXT,
"Occupation" TEXT,
"Votes" INTEGER,
"Rank" TEXT,
PRIMARY KEY ("Player_ID")
)
/*
2 rows from player table:
Player_ID Sponsor_name Player_name Gender Residence Occupation Votes Rank
1 Brandon—Souris Jean Luc Bouché M Brandon Locomotive Engineer 6055 2nd
2 Charleswood—St. James—Assiniboia Fiona Shiells F Winnipeg Ministerial Assistant 7190 3rd
*/
CREATE TABLE player_coach (
"Player_ID" INTEGER,
"Coach_ID" INTEGER,
"Starting_year" INTEGER,
PRIMARY KEY ("Player_ID", "Coach_ID"),
FOREIGN KEY("Coach_ID") REFERENCES coach ("Coach_ID"),
FOREIGN KEY("Player_ID") REFERENCES player ("Player_ID")
)
/*
2 rows from player_coach table:
Player_ID Coach_ID Starting_year
1 1 2010
2 1 2011
*/ | Show the names of players coached by the rank 1 coach. | SELECT T3.Player_name FROM player_coach AS T1 JOIN coach AS T2 ON T1.Coach_ID = T2.Coach_ID JOIN player AS T3 ON T1.Player_ID = T3.Player_ID WHERE T2.Rank = 1 | [{'Player_name': 'Jean Luc Bouché'}, {'Player_name': 'Fiona Shiells'}, {'Player_name': 'Niki Ashton'}] | Hard | false | false | false | false | false | false | false | false | true | false | false | false | false | [QUESTION]What are the first names of all players, and their total ranking points?[/QUESTION]
[SQL]SELECT sum(ranking_points) , T1.first_name FROM players AS T1 JOIN rankings AS T2 ON T1.player_id = T2.player_id GROUP BY T1.first_name[/SQL] | [QUESTION]What are the first names of all players, and their total ranking points?[/QUESTION]
[SQL]SELECT sum(ranking_points) , T1.first_name FROM players AS T1 JOIN rankings AS T2 ON T1.player_id = T2.player_id GROUP BY T1.first_name[/SQL] | [QUESTION]What are the first names of all players, and their total ranking points?[/QUESTION]
[SQL]SELECT sum(ranking_points) , T1.first_name FROM players AS T1 JOIN rankings AS T2 ON T1.player_id = T2.player_id GROUP BY T1.first_name[/SQL] | [QUESTION]What are the first names of all players, and their total ranking points?[/QUESTION]
[SQL]SELECT sum(ranking_points) , T1.first_name FROM players AS T1 JOIN rankings AS T2 ON T1.player_id = T2.player_id GROUP BY T1.first_name[/SQL] |
game_injury |
CREATE TABLE game (
stadium_id INTEGER,
id INTEGER,
"Season" INTEGER,
"Date" TEXT,
"Home_team" TEXT,
"Away_team" TEXT,
"Score" TEXT,
"Competition" TEXT,
PRIMARY KEY (id),
FOREIGN KEY(stadium_id) REFERENCES stadium (id)
)
CREATE TABLE injury_accident (
game_id INTEGER,
id INTEGER,
"Player" TEXT,
"Injury" TEXT,
"Number_of_matches" TEXT,
"Source" TEXT,
PRIMARY KEY (id),
FOREIGN KEY(game_id) REFERENCES game (id)
)
CREATE TABLE stadium (
id INTEGER,
name TEXT,
"Home_Games" INTEGER,
"Average_Attendance" REAL,
"Total_Attendance" REAL,
"Capacity_Percentage" REAL,
PRIMARY KEY (id)
) |
CREATE TABLE game (
stadium_id INTEGER,
id INTEGER,
"Season" INTEGER,
"Date" TEXT,
"Home_team" TEXT,
"Away_team" TEXT,
"Score" TEXT,
"Competition" TEXT,
PRIMARY KEY (id),
FOREIGN KEY(stadium_id) REFERENCES stadium (id)
)
/*
2 rows from game table:
stadium_id id Season Date Home_team Away_team Score Competition
1 1 2007 18 May 2007 Quruvchi Pakhtakor 1–1 League
2 2 2007 22 September 2007 Pakhtakor Quruvchi 0–0 League
*/
CREATE TABLE injury_accident (
game_id INTEGER,
id INTEGER,
"Player" TEXT,
"Injury" TEXT,
"Number_of_matches" TEXT,
"Source" TEXT,
PRIMARY KEY (id),
FOREIGN KEY(game_id) REFERENCES game (id)
)
/*
2 rows from injury_accident table:
game_id id Player Injury Number_of_matches Source
1 1 Davide Santon Clean-up surgery on his right knee 12 inter.it
2 2 Maicon Knee problem 2 inter.it
*/
CREATE TABLE stadium (
id INTEGER,
name TEXT,
"Home_Games" INTEGER,
"Average_Attendance" REAL,
"Total_Attendance" REAL,
"Capacity_Percentage" REAL,
PRIMARY KEY (id)
)
/*
2 rows from stadium table:
id name Home_Games Average_Attendance Total_Attendance Capacity_Percentage
1 Cowboys Stadium 8 87047.0 696377.0 108.8
2 FedExField 8 83172.0 665380.0 90.7
*/ | For each injury accident, find the date of the game and the name of the injured player in the game, and sort the results in descending order of game season. | SELECT T1.date , T2.player FROM game AS T1 JOIN injury_accident AS T2 ON T1.id = T2.game_id ORDER BY T1.season DESC | [{'Date': '7 July 2011', 'Player': 'Thiago Motta (2)'}, {'Date': '14 March 2010', 'Player': 'Dejan Stanković (2)'}, {'Date': '14 March 2010', 'Player': 'Wesley Sneijder (2)'}, {'Date': '31 October 2010', 'Player': 'Esteban Cambiasso (2)'}, {'Date': '14 October 2009', 'Player': 'Iván Córdoba'}, {'Date': '8 August 2009', 'Player': 'Esteban Cambiasso'}, {'Date': '10 July 2008', 'Player': 'Wesley Sneijder'}, {'Date': '16 August 2008', 'Player': 'Diego Milito'}, {'Date': '16 August 2008', 'Player': 'Javier Zanetti'}, {'Date': '31 October 2008', 'Player': 'Walter Samuel'}, {'Date': '31 October 2008', 'Player': 'Thiago Motta'}, {'Date': '31 October 2008', 'Player': 'Goran Pandev'}, {'Date': '18 May 2007', 'Player': 'Davide Santon'}, {'Date': '22 September 2007', 'Player': 'Maicon'}, {'Date': '9 December 2007', 'Player': 'Dejan Stanković'}] | Medium | false | false | false | true | false | false | false | true | false | false | false | false | false | [QUESTION]Find the total ranking points for each player and their first name.[/QUESTION]
[SQL]SELECT sum(ranking_points) , T1.first_name FROM players AS T1 JOIN rankings AS T2 ON T1.player_id = T2.player_id GROUP BY T1.first_name[/SQL] | [QUESTION]Find the total ranking points for each player and their first name.[/QUESTION]
[SQL]SELECT sum(ranking_points) , T1.first_name FROM players AS T1 JOIN rankings AS T2 ON T1.player_id = T2.player_id GROUP BY T1.first_name[/SQL] |
||
college_2 |
CREATE TABLE advisor (
"s_ID" VARCHAR(5),
"i_ID" VARCHAR(5),
PRIMARY KEY ("s_ID"),
FOREIGN KEY("i_ID") REFERENCES instructor ("ID"),
FOREIGN KEY("s_ID") REFERENCES student ("ID")
)
CREATE TABLE classroom (
building VARCHAR(15),
room_number VARCHAR(7),
capacity NUMERIC(4, 0),
PRIMARY KEY (building, room_number)
)
CREATE TABLE course (
course_id VARCHAR(8),
title VARCHAR(50),
dept_name VARCHAR(20),
credits NUMERIC(2, 0),
PRIMARY KEY (course_id),
FOREIGN KEY(dept_name) REFERENCES department (dept_name),
CHECK (credits > 0)
)
CREATE TABLE department (
dept_name VARCHAR(20),
building VARCHAR(15),
budget NUMERIC(12, 2),
PRIMARY KEY (dept_name),
CHECK (budget > 0)
)
CREATE TABLE instructor (
"ID" VARCHAR(5),
name VARCHAR(20) NOT NULL,
dept_name VARCHAR(20),
salary NUMERIC(8, 2),
PRIMARY KEY ("ID"),
FOREIGN KEY(dept_name) REFERENCES department (dept_name),
CHECK (salary > 29000)
)
CREATE TABLE prereq (
course_id VARCHAR(8),
prereq_id VARCHAR(8),
PRIMARY KEY (course_id, prereq_id),
FOREIGN KEY(course_id) REFERENCES course (course_id),
FOREIGN KEY(prereq_id) REFERENCES course (course_id)
)
CREATE TABLE section (
course_id VARCHAR(8),
sec_id VARCHAR(8),
semester VARCHAR(6),
year NUMERIC(4, 0),
building VARCHAR(15),
room_number VARCHAR(7),
time_slot_id VARCHAR(4),
PRIMARY KEY (course_id, sec_id, semester, year),
FOREIGN KEY(course_id) REFERENCES course (course_id),
FOREIGN KEY(building, room_number) REFERENCES classroom (building, room_number),
CHECK (semester in ('Fall', 'Winter', 'Spring', 'Summer')),
CHECK (year > 1701 and year < 2100)
)
CREATE TABLE student (
"ID" VARCHAR(5),
name VARCHAR(20) NOT NULL,
dept_name VARCHAR(20),
tot_cred NUMERIC(3, 0),
PRIMARY KEY ("ID"),
FOREIGN KEY(dept_name) REFERENCES department (dept_name),
CHECK (tot_cred >= 0)
)
CREATE TABLE takes (
"ID" VARCHAR(5),
course_id VARCHAR(8),
sec_id VARCHAR(8),
semester VARCHAR(6),
year NUMERIC(4, 0),
grade VARCHAR(2),
PRIMARY KEY ("ID", course_id, sec_id, semester, year),
FOREIGN KEY(course_id, sec_id, semester, year) REFERENCES section (course_id, sec_id, semester, year),
FOREIGN KEY("ID") REFERENCES student ("ID")
)
CREATE TABLE teaches (
"ID" VARCHAR(5),
course_id VARCHAR(8),
sec_id VARCHAR(8),
semester VARCHAR(6),
year NUMERIC(4, 0),
PRIMARY KEY ("ID", course_id, sec_id, semester, year),
FOREIGN KEY(course_id, sec_id, semester, year) REFERENCES section (course_id, sec_id, semester, year),
FOREIGN KEY("ID") REFERENCES instructor ("ID")
)
CREATE TABLE time_slot (
time_slot_id VARCHAR(4),
day VARCHAR(1),
start_hr NUMERIC(2),
start_min NUMERIC(2),
end_hr NUMERIC(2),
end_min NUMERIC(2),
PRIMARY KEY (time_slot_id, day, start_hr, start_min),
CHECK (start_hr >= 0 and start_hr < 24),
CHECK (start_min >= 0 and start_min < 60),
CHECK (end_hr >= 0 and end_hr < 24),
CHECK (end_min >= 0 and end_min < 60)
) |
CREATE TABLE advisor (
"s_ID" VARCHAR(5),
"i_ID" VARCHAR(5),
PRIMARY KEY ("s_ID"),
FOREIGN KEY("i_ID") REFERENCES instructor ("ID"),
FOREIGN KEY("s_ID") REFERENCES student ("ID")
)
/*
2 rows from advisor table:
s_ID i_ID
24746 19368
79352 95030
*/
CREATE TABLE classroom (
building VARCHAR(15),
room_number VARCHAR(7),
capacity NUMERIC(4, 0),
PRIMARY KEY (building, room_number)
)
/*
2 rows from classroom table:
building room_number capacity
Lamberton 134 10
Chandler 375 10
*/
CREATE TABLE course (
course_id VARCHAR(8),
title VARCHAR(50),
dept_name VARCHAR(20),
credits NUMERIC(2, 0),
PRIMARY KEY (course_id),
FOREIGN KEY(dept_name) REFERENCES department (dept_name),
CHECK (credits > 0)
)
/*
2 rows from course table:
course_id title dept_name credits
787 C Programming Mech. Eng. 4
238 The Music of Donovan Mech. Eng. 3
*/
CREATE TABLE department (
dept_name VARCHAR(20),
building VARCHAR(15),
budget NUMERIC(12, 2),
PRIMARY KEY (dept_name),
CHECK (budget > 0)
)
/*
2 rows from department table:
dept_name building budget
Civil Eng. Chandler 255041.46
Biology Candlestick 647610.55
*/
CREATE TABLE instructor (
"ID" VARCHAR(5),
name VARCHAR(20) NOT NULL,
dept_name VARCHAR(20),
salary NUMERIC(8, 2),
PRIMARY KEY ("ID"),
FOREIGN KEY(dept_name) REFERENCES department (dept_name),
CHECK (salary > 29000)
)
/*
2 rows from instructor table:
ID name dept_name salary
63395 McKinnon Cybernetics 94333.99
78699 Pingr Statistics 59303.62
*/
CREATE TABLE prereq (
course_id VARCHAR(8),
prereq_id VARCHAR(8),
PRIMARY KEY (course_id, prereq_id),
FOREIGN KEY(course_id) REFERENCES course (course_id),
FOREIGN KEY(prereq_id) REFERENCES course (course_id)
)
/*
2 rows from prereq table:
course_id prereq_id
376 130
760 169
*/
CREATE TABLE section (
course_id VARCHAR(8),
sec_id VARCHAR(8),
semester VARCHAR(6),
year NUMERIC(4, 0),
building VARCHAR(15),
room_number VARCHAR(7),
time_slot_id VARCHAR(4),
PRIMARY KEY (course_id, sec_id, semester, year),
FOREIGN KEY(course_id) REFERENCES course (course_id),
FOREIGN KEY(building, room_number) REFERENCES classroom (building, room_number),
CHECK (semester in ('Fall', 'Winter', 'Spring', 'Summer')),
CHECK (year > 1701 and year < 2100)
)
/*
2 rows from section table:
course_id sec_id semester year building room_number time_slot_id
313 1 Fall 2010 Chandler 804 N
747 1 Spring 2004 Gates 314 K
*/
CREATE TABLE student (
"ID" VARCHAR(5),
name VARCHAR(20) NOT NULL,
dept_name VARCHAR(20),
tot_cred NUMERIC(3, 0),
PRIMARY KEY ("ID"),
FOREIGN KEY(dept_name) REFERENCES department (dept_name),
CHECK (tot_cred >= 0)
)
/*
2 rows from student table:
ID name dept_name tot_cred
24746 Schrefl History 4
79352 Rumat Finance 100
*/
CREATE TABLE takes (
"ID" VARCHAR(5),
course_id VARCHAR(8),
sec_id VARCHAR(8),
semester VARCHAR(6),
year NUMERIC(4, 0),
grade VARCHAR(2),
PRIMARY KEY ("ID", course_id, sec_id, semester, year),
FOREIGN KEY(course_id, sec_id, semester, year) REFERENCES section (course_id, sec_id, semester, year),
FOREIGN KEY("ID") REFERENCES student ("ID")
)
/*
2 rows from takes table:
ID course_id sec_id semester year grade
65901 401 1 Fall 2003 C-
24932 802 1 Spring 2003 B-
*/
CREATE TABLE teaches (
"ID" VARCHAR(5),
course_id VARCHAR(8),
sec_id VARCHAR(8),
semester VARCHAR(6),
year NUMERIC(4, 0),
PRIMARY KEY ("ID", course_id, sec_id, semester, year),
FOREIGN KEY(course_id, sec_id, semester, year) REFERENCES section (course_id, sec_id, semester, year),
FOREIGN KEY("ID") REFERENCES instructor ("ID")
)
/*
2 rows from teaches table:
ID course_id sec_id semester year
34175 747 1 Spring 2004
3199 169 1 Spring 2007
*/
CREATE TABLE time_slot (
time_slot_id VARCHAR(4),
day VARCHAR(1),
start_hr NUMERIC(2),
start_min NUMERIC(2),
end_hr NUMERIC(2),
end_min NUMERIC(2),
PRIMARY KEY (time_slot_id, day, start_hr, start_min),
CHECK (start_hr >= 0 and start_hr < 24),
CHECK (start_min >= 0 and start_min < 60),
CHECK (end_hr >= 0 and end_hr < 24),
CHECK (end_min >= 0 and end_min < 60)
)
/*
2 rows from time_slot table:
time_slot_id day start_hr start_min end_hr end_min
A M 8.0000000000 0E-10 8.0000000000 50.0000000000
A W 8.0000000000 0E-10 8.0000000000 50.0000000000
*/ | How many instructors are in the department with the highest budget, and what is their average salary? | SELECT avg(T1.salary) , count(*) FROM instructor AS T1 JOIN department AS T2 ON T1.dept_name = T2.dept_name ORDER BY T2.budget DESC LIMIT 1 | [{'avg(T1.salary)': 77600.18819999999, 'count(*)': 50}] | Medium | false | false | false | true | true | false | false | true | false | false | false | false | false | [QUESTION]How many students are in each department?[/QUESTION]
[SQL]SELECT count(*) , dept_code FROM student GROUP BY dept_code[/SQL] | [QUESTION]How many students are in each department?[/QUESTION]
[SQL]SELECT count(*) , dept_code FROM student GROUP BY dept_code[/SQL] | [QUESTION]How many students are in each department?[/QUESTION]
[SQL]SELECT count(*) , dept_code FROM student GROUP BY dept_code[/SQL] | [QUESTION]How many students are in each department?[/QUESTION]
[SQL]SELECT count(*) , dept_code FROM student GROUP BY dept_code[/SQL] |
match_season |
CREATE TABLE country (
"Country_id" INTEGER,
"Country_name" TEXT,
"Capital" TEXT,
"Official_native_language" TEXT,
PRIMARY KEY ("Country_id")
)
CREATE TABLE match_season (
"Season" REAL,
"Player" TEXT,
"Position" TEXT,
"Country" INTEGER,
"Team" INTEGER,
"Draft_Pick_Number" INTEGER,
"Draft_Class" TEXT,
"College" TEXT,
PRIMARY KEY ("Season"),
FOREIGN KEY("Team") REFERENCES team ("Team_id"),
FOREIGN KEY("Country") REFERENCES country ("Country_id")
)
CREATE TABLE player (
"Player_ID" INTEGER,
"Player" TEXT,
"Years_Played" TEXT,
"Total_WL" TEXT,
"Singles_WL" TEXT,
"Doubles_WL" TEXT,
"Team" INTEGER,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY("Team") REFERENCES team ("Team_id")
)
CREATE TABLE team (
"Team_id" INTEGER,
"Name" TEXT,
PRIMARY KEY ("Team_id")
) |
CREATE TABLE country (
"Country_id" INTEGER,
"Country_name" TEXT,
"Capital" TEXT,
"Official_native_language" TEXT,
PRIMARY KEY ("Country_id")
)
/*
2 rows from country table:
Country_id Country_name Capital Official_native_language
1 Indonesia Jakarta Bahasa Indonesia
2 Iran Tehran Persian ( Arabic script )
*/
CREATE TABLE match_season (
"Season" REAL,
"Player" TEXT,
"Position" TEXT,
"Country" INTEGER,
"Team" INTEGER,
"Draft_Pick_Number" INTEGER,
"Draft_Class" TEXT,
"College" TEXT,
PRIMARY KEY ("Season"),
FOREIGN KEY("Team") REFERENCES team ("Team_id"),
FOREIGN KEY("Country") REFERENCES country ("Country_id")
)
/*
2 rows from match_season table:
Season Player Position Country Team Draft_Pick_Number Draft_Class College
1996.0 Steve Ralston Category:Articles with hCards Midfielder 6 1 18 1996 MLS College Draft Florida International
1997.0 Mike Duhaney Category:Articles with hCards Defender 6 2 87 1996 MLS Inaugural Player Draft UNLV
*/
CREATE TABLE player (
"Player_ID" INTEGER,
"Player" TEXT,
"Years_Played" TEXT,
"Total_WL" TEXT,
"Singles_WL" TEXT,
"Doubles_WL" TEXT,
"Team" INTEGER,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY("Team") REFERENCES team ("Team_id")
)
/*
2 rows from player table:
Player_ID Player Years_Played Total_WL Singles_WL Doubles_WL Team
1 Cho Soong-Jae (630) 1 (2011) 2–0 1–0 1–0 1
2 Chung Hong (717) 1 (2011) 0–0 0–0 0–0 1
*/
CREATE TABLE team (
"Team_id" INTEGER,
"Name" TEXT,
PRIMARY KEY ("Team_id")
)
/*
2 rows from team table:
Team_id Name
1 Columbus Crew
2 Evalyn Feil
*/ | Which college have both players with position midfielder and players with position defender? | SELECT College FROM match_season WHERE POSITION = "Midfielder" INTERSECT SELECT College FROM match_season WHERE POSITION = "Defender" | [{'College': 'Maryland'}] | Hard | false | false | false | false | false | false | false | false | false | false | true | false | false | [QUESTION]what is the full name and id of the college with the largest number of baseball players?[/QUESTION]
[SQL]SELECT T1.name_full , T1.college_id FROM college AS T1 JOIN player_college AS T2 ON T1.college_id = T2.college_id GROUP BY T1.college_id ORDER BY count(*) DESC LIMIT 1;[/SQL] | [QUESTION]what is the full name and id of the college with the largest number of baseball players?[/QUESTION]
[SQL]SELECT T1.name_full , T1.college_id FROM college AS T1 JOIN player_college AS T2 ON T1.college_id = T2.college_id GROUP BY T1.college_id ORDER BY count(*) DESC LIMIT 1;[/SQL] |
||
geo |
CREATE TABLE border_info (
state_name TEXT,
border TEXT,
PRIMARY KEY (border, state_name),
FOREIGN KEY(border) REFERENCES state (state_name),
FOREIGN KEY(state_name) REFERENCES state (state_name)
)
CREATE TABLE city (
city_name TEXT,
population INTEGER DEFAULT NULL,
country_name VARCHAR(3) DEFAULT '' NOT NULL,
state_name TEXT,
PRIMARY KEY (city_name, state_name),
FOREIGN KEY(state_name) REFERENCES state (state_name)
)
CREATE TABLE highlow (
state_name TEXT,
highest_elevation TEXT,
lowest_point TEXT,
highest_point TEXT,
lowest_elevation TEXT,
PRIMARY KEY (state_name),
FOREIGN KEY(state_name) REFERENCES state (state_name)
)
CREATE TABLE lake (
lake_name TEXT,
area DOUBLE DEFAULT NULL,
country_name VARCHAR(3) DEFAULT '' NOT NULL,
state_name TEXT
)
CREATE TABLE mountain (
mountain_name TEXT,
mountain_altitude INTEGER DEFAULT NULL,
country_name VARCHAR(3) DEFAULT '' NOT NULL,
state_name TEXT,
PRIMARY KEY (mountain_name, state_name),
FOREIGN KEY(state_name) REFERENCES state (state_name)
)
CREATE TABLE river (
river_name TEXT,
length INTEGER DEFAULT NULL,
country_name VARCHAR(3) DEFAULT '' NOT NULL,
traverse TEXT,
PRIMARY KEY (river_name),
FOREIGN KEY(traverse) REFERENCES state (state_name)
)
CREATE TABLE state (
state_name TEXT,
population INTEGER DEFAULT NULL,
area DOUBLE DEFAULT NULL,
country_name VARCHAR(3) DEFAULT '' NOT NULL,
capital TEXT,
density DOUBLE DEFAULT NULL,
PRIMARY KEY (state_name)
) |
CREATE TABLE border_info (
state_name TEXT,
border TEXT,
PRIMARY KEY (border, state_name),
FOREIGN KEY(border) REFERENCES state (state_name),
FOREIGN KEY(state_name) REFERENCES state (state_name)
)
/*
2 rows from border_info table:
state_name border
*/
CREATE TABLE city (
city_name TEXT,
population INTEGER DEFAULT NULL,
country_name VARCHAR(3) DEFAULT '' NOT NULL,
state_name TEXT,
PRIMARY KEY (city_name, state_name),
FOREIGN KEY(state_name) REFERENCES state (state_name)
)
/*
2 rows from city table:
city_name population country_name state_name
*/
CREATE TABLE highlow (
state_name TEXT,
highest_elevation TEXT,
lowest_point TEXT,
highest_point TEXT,
lowest_elevation TEXT,
PRIMARY KEY (state_name),
FOREIGN KEY(state_name) REFERENCES state (state_name)
)
/*
2 rows from highlow table:
state_name highest_elevation lowest_point highest_point lowest_elevation
*/
CREATE TABLE lake (
lake_name TEXT,
area DOUBLE DEFAULT NULL,
country_name VARCHAR(3) DEFAULT '' NOT NULL,
state_name TEXT
)
/*
2 rows from lake table:
lake_name area country_name state_name
*/
CREATE TABLE mountain (
mountain_name TEXT,
mountain_altitude INTEGER DEFAULT NULL,
country_name VARCHAR(3) DEFAULT '' NOT NULL,
state_name TEXT,
PRIMARY KEY (mountain_name, state_name),
FOREIGN KEY(state_name) REFERENCES state (state_name)
)
/*
2 rows from mountain table:
mountain_name mountain_altitude country_name state_name
*/
CREATE TABLE river (
river_name TEXT,
length INTEGER DEFAULT NULL,
country_name VARCHAR(3) DEFAULT '' NOT NULL,
traverse TEXT,
PRIMARY KEY (river_name),
FOREIGN KEY(traverse) REFERENCES state (state_name)
)
/*
2 rows from river table:
river_name length country_name traverse
*/
CREATE TABLE state (
state_name TEXT,
population INTEGER DEFAULT NULL,
area DOUBLE DEFAULT NULL,
country_name VARCHAR(3) DEFAULT '' NOT NULL,
capital TEXT,
density DOUBLE DEFAULT NULL,
PRIMARY KEY (state_name)
)
/*
2 rows from state table:
state_name population area country_name capital density
*/ | which state has the largest city | SELECT state_name FROM city WHERE population = ( SELECT MAX ( population ) FROM city ); | [{'Nenhum': 'Nenhum resultado encontrado'}] | Extra Hard | false | false | false | false | false | false | false | false | false | true | false | false | false | [QUESTION]what is the biggest american city in a state with a river[/QUESTION]
[SQL]SELECT DISTINCT t1.city_name FROM city AS t1 JOIN river AS t2 ON t2.traverse = t1.state_name WHERE t1.population = ( SELECT MAX ( t1.population ) FROM river AS t2 JOIN city AS t1 ON t2.traverse = t1.state_name );[/SQL] | [QUESTION]what is the biggest american city in a state with a river[/QUESTION]
[SQL]SELECT DISTINCT t1.city_name FROM city AS t1 JOIN river AS t2 ON t2.traverse = t1.state_name WHERE t1.population = ( SELECT MAX ( t1.population ) FROM river AS t2 JOIN city AS t1 ON t2.traverse = t1.state_name );[/SQL] | [QUESTION]what is the biggest american city in a state with a river[/QUESTION]
[SQL]SELECT DISTINCT t1.city_name FROM city AS t1 JOIN river AS t2 ON t2.traverse = t1.state_name WHERE t1.population = ( SELECT MAX ( t1.population ) FROM river AS t2 JOIN city AS t1 ON t2.traverse = t1.state_name );[/SQL] | [QUESTION]what is the biggest american city in a state with a river[/QUESTION]
[SQL]SELECT DISTINCT t1.city_name FROM city AS t1 JOIN river AS t2 ON t2.traverse = t1.state_name WHERE t1.population = ( SELECT MAX ( t1.population ) FROM river AS t2 JOIN city AS t1 ON t2.traverse = t1.state_name );[/SQL] |
store_1 |
CREATE TABLE albums (
id INTEGER,
title VARCHAR(160) NOT NULL,
artist_id INTEGER NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY(artist_id) REFERENCES artists (id)
)
CREATE TABLE artists (
id INTEGER,
name VARCHAR(120),
PRIMARY KEY (id)
)
CREATE TABLE customers (
id INTEGER,
first_name VARCHAR(40) NOT NULL,
last_name VARCHAR(20) NOT NULL,
company VARCHAR(80),
address VARCHAR(70),
city VARCHAR(40),
state VARCHAR(40),
country VARCHAR(40),
postal_code VARCHAR(10),
phone VARCHAR(24),
fax VARCHAR(24),
email VARCHAR(60) NOT NULL,
support_rep_id INTEGER,
PRIMARY KEY (id),
FOREIGN KEY(support_rep_id) REFERENCES employees (id)
)
CREATE TABLE employees (
id INTEGER,
last_name VARCHAR(20) NOT NULL,
first_name VARCHAR(20) NOT NULL,
title VARCHAR(30),
reports_to INTEGER,
birth_date TIMESTAMP,
hire_date TIMESTAMP,
address VARCHAR(70),
city VARCHAR(40),
state VARCHAR(40),
country VARCHAR(40),
postal_code VARCHAR(10),
phone VARCHAR(24),
fax VARCHAR(24),
email VARCHAR(60),
PRIMARY KEY (id),
FOREIGN KEY(reports_to) REFERENCES employees (id)
)
CREATE TABLE genres (
id INTEGER,
name VARCHAR(120),
PRIMARY KEY (id)
)
CREATE TABLE invoice_lines (
id INTEGER,
invoice_id INTEGER NOT NULL,
track_id INTEGER NOT NULL,
unit_price NUMERIC(10, 2) NOT NULL,
quantity INTEGER NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY(invoice_id) REFERENCES invoices (id),
FOREIGN KEY(track_id) REFERENCES tracks (id)
)
CREATE TABLE invoices (
id INTEGER,
customer_id INTEGER NOT NULL,
invoice_date TIMESTAMP NOT NULL,
billing_address VARCHAR(70),
billing_city VARCHAR(40),
billing_state VARCHAR(40),
billing_country VARCHAR(40),
billing_postal_code VARCHAR(10),
total NUMERIC(10, 2) NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY(customer_id) REFERENCES customers (id)
)
CREATE TABLE media_types (
id INTEGER,
name VARCHAR(120),
PRIMARY KEY (id)
)
CREATE TABLE playlist_tracks (
playlist_id INTEGER NOT NULL,
track_id INTEGER NOT NULL,
CONSTRAINT "PK_PlaylistTrack" PRIMARY KEY (playlist_id, track_id),
FOREIGN KEY(playlist_id) REFERENCES playlists (id),
FOREIGN KEY(track_id) REFERENCES tracks (id)
)
CREATE TABLE playlists (
id INTEGER,
name VARCHAR(120),
PRIMARY KEY (id)
)
CREATE TABLE tracks (
id INTEGER,
name VARCHAR(200) NOT NULL,
album_id INTEGER,
media_type_id INTEGER NOT NULL,
genre_id INTEGER,
composer VARCHAR(220),
milliseconds INTEGER NOT NULL,
bytes INTEGER,
unit_price NUMERIC(10, 2) NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY(album_id) REFERENCES albums (id),
FOREIGN KEY(genre_id) REFERENCES genres (id),
FOREIGN KEY(media_type_id) REFERENCES media_types (id)
) |
CREATE TABLE albums (
id INTEGER,
title VARCHAR(160) NOT NULL,
artist_id INTEGER NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY(artist_id) REFERENCES artists (id)
)
/*
2 rows from albums table:
id title artist_id
1 For Those About To Rock We Salute You 1
2 Balls to the Wall 2
*/
CREATE TABLE artists (
id INTEGER,
name VARCHAR(120),
PRIMARY KEY (id)
)
/*
2 rows from artists table:
id name
1 AC/DC
2 Accept
*/
CREATE TABLE customers (
id INTEGER,
first_name VARCHAR(40) NOT NULL,
last_name VARCHAR(20) NOT NULL,
company VARCHAR(80),
address VARCHAR(70),
city VARCHAR(40),
state VARCHAR(40),
country VARCHAR(40),
postal_code VARCHAR(10),
phone VARCHAR(24),
fax VARCHAR(24),
email VARCHAR(60) NOT NULL,
support_rep_id INTEGER,
PRIMARY KEY (id),
FOREIGN KEY(support_rep_id) REFERENCES employees (id)
)
/*
2 rows from customers table:
id first_name last_name company address city state country postal_code phone fax email support_rep_id
1 Luís Gonçalves Embraer - Empresa Brasileira de Aeronáutica S.A. Av. Brigadeiro Faria Lima, 2170 São José dos Campos SP Brazil 12227-000 +55 (12) 3923-5555 +55 (12) 3923-5566 [email protected] 3
2 Leonie Köhler None Theodor-Heuss-Straße 34 Stuttgart None Germany 70174 +49 0711 2842222 None [email protected] 5
*/
CREATE TABLE employees (
id INTEGER,
last_name VARCHAR(20) NOT NULL,
first_name VARCHAR(20) NOT NULL,
title VARCHAR(30),
reports_to INTEGER,
birth_date TIMESTAMP,
hire_date TIMESTAMP,
address VARCHAR(70),
city VARCHAR(40),
state VARCHAR(40),
country VARCHAR(40),
postal_code VARCHAR(10),
phone VARCHAR(24),
fax VARCHAR(24),
email VARCHAR(60),
PRIMARY KEY (id),
FOREIGN KEY(reports_to) REFERENCES employees (id)
)
/*
2 rows from employees table:
id last_name first_name title reports_to birth_date hire_date address city state country postal_code phone fax email
1 Adams Andrew General Manager None 1962-02-18 00:00:00 2002-08-14 00:00:00 11120 Jasper Ave NW Edmonton AB Canada T5K 2N1 +1 (780) 428-9482 +1 (780) 428-3457 [email protected]
2 Edwards Nancy Sales Manager 1 1958-12-08 00:00:00 2002-05-01 00:00:00 825 8 Ave SW Calgary AB Canada T2P 2T3 +1 (403) 262-3443 +1 (403) 262-3322 [email protected]
*/
CREATE TABLE genres (
id INTEGER,
name VARCHAR(120),
PRIMARY KEY (id)
)
/*
2 rows from genres table:
id name
1 Rock
2 Jazz
*/
CREATE TABLE invoice_lines (
id INTEGER,
invoice_id INTEGER NOT NULL,
track_id INTEGER NOT NULL,
unit_price NUMERIC(10, 2) NOT NULL,
quantity INTEGER NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY(invoice_id) REFERENCES invoices (id),
FOREIGN KEY(track_id) REFERENCES tracks (id)
)
/*
2 rows from invoice_lines table:
id invoice_id track_id unit_price quantity
1 1 2 0.99 1
2 1 4 0.99 1
*/
CREATE TABLE invoices (
id INTEGER,
customer_id INTEGER NOT NULL,
invoice_date TIMESTAMP NOT NULL,
billing_address VARCHAR(70),
billing_city VARCHAR(40),
billing_state VARCHAR(40),
billing_country VARCHAR(40),
billing_postal_code VARCHAR(10),
total NUMERIC(10, 2) NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY(customer_id) REFERENCES customers (id)
)
/*
2 rows from invoices table:
id customer_id invoice_date billing_address billing_city billing_state billing_country billing_postal_code total
1 2 2007-01-01 00:00:00 Theodor-Heuss-Straße 34 Stuttgart None Germany 70174 1.98
2 4 2007-01-02 00:00:00 Ullevålsveien 14 Oslo None Norway 0171 3.96
*/
CREATE TABLE media_types (
id INTEGER,
name VARCHAR(120),
PRIMARY KEY (id)
)
/*
2 rows from media_types table:
id name
1 MPEG audio file
2 Protected AAC audio file
*/
CREATE TABLE playlist_tracks (
playlist_id INTEGER NOT NULL,
track_id INTEGER NOT NULL,
CONSTRAINT "PK_PlaylistTrack" PRIMARY KEY (playlist_id, track_id),
FOREIGN KEY(playlist_id) REFERENCES playlists (id),
FOREIGN KEY(track_id) REFERENCES tracks (id)
)
/*
2 rows from playlist_tracks table:
playlist_id track_id
1 3402
1 3389
*/
CREATE TABLE playlists (
id INTEGER,
name VARCHAR(120),
PRIMARY KEY (id)
)
/*
2 rows from playlists table:
id name
1 Music
2 Movies
*/
CREATE TABLE tracks (
id INTEGER,
name VARCHAR(200) NOT NULL,
album_id INTEGER,
media_type_id INTEGER NOT NULL,
genre_id INTEGER,
composer VARCHAR(220),
milliseconds INTEGER NOT NULL,
bytes INTEGER,
unit_price NUMERIC(10, 2) NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY(album_id) REFERENCES albums (id),
FOREIGN KEY(genre_id) REFERENCES genres (id),
FOREIGN KEY(media_type_id) REFERENCES media_types (id)
)
/*
2 rows from tracks table:
id name album_id media_type_id genre_id composer milliseconds bytes unit_price
1 For Those About To Rock (We Salute You) 1 1 1 Angus Young, Malcolm Young, Brian Johnson 343719 11170334 0.99
2 Balls to the Wall 2 2 1 None 342562 5510424 0.99
*/ | What is the address of employee Nancy Edwards? | SELECT address FROM employees WHERE first_name = "Nancy" AND last_name = "Edwards"; | [{'address': '825 8 Ave SW'}] | Easy | false | false | false | false | false | false | false | false | false | false | false | false | false | ||||
twitter_1 |
CREATE TABLE follows (
f1 INTEGER NOT NULL,
f2 INTEGER NOT NULL,
PRIMARY KEY (f1, f2),
FOREIGN KEY(f2) REFERENCES user_profiles (uid),
FOREIGN KEY(f1) REFERENCES user_profiles (uid)
)
CREATE TABLE tweets (
id BIGINT NOT NULL,
uid INTEGER NOT NULL,
text CHAR(140) NOT NULL,
createdate DATETIME DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (id),
FOREIGN KEY(uid) REFERENCES user_profiles (uid)
)
CREATE TABLE user_profiles (
uid INTEGER NOT NULL,
name VARCHAR(255) DEFAULT NULL,
email VARCHAR(255) DEFAULT NULL,
partitionid INTEGER DEFAULT NULL,
followers INTEGER DEFAULT NULL,
PRIMARY KEY (uid)
) |
CREATE TABLE follows (
f1 INTEGER NOT NULL,
f2 INTEGER NOT NULL,
PRIMARY KEY (f1, f2),
FOREIGN KEY(f2) REFERENCES user_profiles (uid),
FOREIGN KEY(f1) REFERENCES user_profiles (uid)
)
/*
2 rows from follows table:
f1 f2
1 2
2 3
*/
CREATE TABLE tweets (
id BIGINT NOT NULL,
uid INTEGER NOT NULL,
text CHAR(140) NOT NULL,
createdate DATETIME DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (id),
FOREIGN KEY(uid) REFERENCES user_profiles (uid)
)
/*
2 rows from tweets table:
id uid text createdate
1 1 Hello I'm Tony Stark. 2018-03-09 20:00:14
2 3 Today I have went shopping at Laffayette. 2018-03-09 20:01:02
*/
CREATE TABLE user_profiles (
uid INTEGER NOT NULL,
name VARCHAR(255) DEFAULT NULL,
email VARCHAR(255) DEFAULT NULL,
partitionid INTEGER DEFAULT NULL,
followers INTEGER DEFAULT NULL,
PRIMARY KEY (uid)
)
/*
2 rows from user_profiles table:
uid name email partitionid followers
1 Iron Man [email protected] 1 6662425
2 Mary [email protected] 2 890
*/ | Find the names of users whose emails contain ‘superstar’ or ‘edu’. | SELECT name FROM user_profiles WHERE email LIKE '%superstar%' OR email LIKE '%edu%' | [{'name': 'Mary'}, {'name': 'Tyler Swift'}, {'name': 'Celine Dion'}, {'name': 'Natalie Portman'}] | Easy | false | true | false | false | false | false | false | false | false | false | false | false | false | ||||
small_bank_1 |
CREATE TABLE "ACCOUNTS" (
custid BIGINT NOT NULL,
name VARCHAR(64) NOT NULL,
PRIMARY KEY (custid)
)
CREATE TABLE "CHECKING" (
custid BIGINT NOT NULL,
balance FLOAT NOT NULL,
PRIMARY KEY (custid),
FOREIGN KEY(custid) REFERENCES "ACCOUNTS" (custid)
)
CREATE TABLE "SAVINGS" (
custid BIGINT NOT NULL,
balance FLOAT NOT NULL,
PRIMARY KEY (custid),
FOREIGN KEY(custid) REFERENCES "ACCOUNTS" (custid)
) |
CREATE TABLE "ACCOUNTS" (
custid BIGINT NOT NULL,
name VARCHAR(64) NOT NULL,
PRIMARY KEY (custid)
)
/*
2 rows from ACCOUNTS table:
custid name
1 Brown
2 Wang
*/
CREATE TABLE "CHECKING" (
custid BIGINT NOT NULL,
balance FLOAT NOT NULL,
PRIMARY KEY (custid),
FOREIGN KEY(custid) REFERENCES "ACCOUNTS" (custid)
)
/*
2 rows from CHECKING table:
custid balance
1 10000.0
2 2000.0
*/
CREATE TABLE "SAVINGS" (
custid BIGINT NOT NULL,
balance FLOAT NOT NULL,
PRIMARY KEY (custid),
FOREIGN KEY(custid) REFERENCES "ACCOUNTS" (custid)
)
/*
2 rows from SAVINGS table:
custid balance
1 200000.0
2 999999999.0
*/ | What is the name corresponding to the accoung with the lowest sum of checking and savings balances? | SELECT T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid ORDER BY T2.balance + T3.balance LIMIT 1 | [{'name': 'Porter'}] | Hard | false | false | false | true | true | false | false | false | true | false | false | false | false | [QUESTION]What is the name of the bank branch that has lent the greatest amount?[/QUESTION]
[SQL]SELECT T1.bname FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id GROUP BY T1.bname ORDER BY sum(T2.amount) DESC LIMIT 1[/SQL] | [QUESTION]What is the name of the bank branch that has lent the greatest amount?[/QUESTION]
[SQL]SELECT T1.bname FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id GROUP BY T1.bname ORDER BY sum(T2.amount) DESC LIMIT 1[/SQL] | [QUESTION]What is the name of the bank branch that has lent the greatest amount?[/QUESTION]
[SQL]SELECT T1.bname FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id GROUP BY T1.bname ORDER BY sum(T2.amount) DESC LIMIT 1[/SQL] | [QUESTION]What is the name of the bank branch that has lent the greatest amount?[/QUESTION]
[SQL]SELECT T1.bname FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id GROUP BY T1.bname ORDER BY sum(T2.amount) DESC LIMIT 1[/SQL] |
flight_4 |
CREATE TABLE airlines (
alid INTEGER,
name TEXT,
iata VARCHAR(2),
icao VARCHAR(3),
callsign TEXT,
country TEXT,
active VARCHAR(2),
PRIMARY KEY (alid)
)
CREATE TABLE airports (
apid INTEGER,
name TEXT NOT NULL,
city TEXT,
country TEXT,
x REAL,
y REAL,
elevation BIGINT,
iata TEXT(3),
icao TEXT(4),
PRIMARY KEY (apid)
)
CREATE TABLE routes (
rid INTEGER,
dst_apid INTEGER,
dst_ap VARCHAR(4),
src_apid BIGINT,
src_ap VARCHAR(4),
alid BIGINT,
airline VARCHAR(4),
codeshare TEXT,
PRIMARY KEY (rid),
FOREIGN KEY(dst_apid) REFERENCES airports (apid),
FOREIGN KEY(src_apid) REFERENCES airports (apid),
FOREIGN KEY(alid) REFERENCES airlines (alid)
) |
CREATE TABLE airlines (
alid INTEGER,
name TEXT,
iata VARCHAR(2),
icao VARCHAR(3),
callsign TEXT,
country TEXT,
active VARCHAR(2),
PRIMARY KEY (alid)
)
/*
2 rows from airlines table:
alid name iata icao callsign country active
-1 Unknown - N/A None None Y
1 Private flight - N/A Y
*/
CREATE TABLE airports (
apid INTEGER,
name TEXT NOT NULL,
city TEXT,
country TEXT,
x REAL,
y REAL,
elevation BIGINT,
iata TEXT(3),
icao TEXT(4),
PRIMARY KEY (apid)
)
/*
2 rows from airports table:
apid name city country x y elevation iata icao
1 Goroka Airport Goroka Papua New Guinea 145.391998291 -6.081689834590001 5282 GKA AYGA
2 Madang Airport Madang Papua New Guinea 145.789001465 -5.20707988739 20 MAG AYMD
*/
CREATE TABLE routes (
rid INTEGER,
dst_apid INTEGER,
dst_ap VARCHAR(4),
src_apid BIGINT,
src_ap VARCHAR(4),
alid BIGINT,
airline VARCHAR(4),
codeshare TEXT,
PRIMARY KEY (rid),
FOREIGN KEY(dst_apid) REFERENCES airports (apid),
FOREIGN KEY(src_apid) REFERENCES airports (apid),
FOREIGN KEY(alid) REFERENCES airlines (alid)
)
/*
2 rows from routes table:
rid dst_apid dst_ap src_apid src_ap alid airline codeshare
37 2990 KZ 2965 AER 410 2B None
38 2990 KZ 2966 ASF 410 2B None
*/ | How many airlines operate out of each country in descending order? | SELECT country , count(*) FROM airlines GROUP BY country ORDER BY count(*) DESC | [{'country': 'United States', 'count(*)': 1099}, {'country': 'Mexico', 'count(*)': 440}, {'country': 'United Kingdom', 'count(*)': 414}, {'country': 'Canada', 'count(*)': 323}, {'country': 'Russia', 'count(*)': 238}, {'country': 'Spain', 'count(*)': 168}, {'country': 'Germany', 'count(*)': 135}, {'country': 'France', 'count(*)': 123}, {'country': 'Australia', 'count(*)': 94}, {'country': 'Italy', 'count(*)': 93}, {'country': 'South Africa', 'count(*)': 91}, {'country': 'Ukraine', 'count(*)': 90}, {'country': 'Nigeria', 'count(*)': 85}, {'country': 'Kazakhstan', 'count(*)': 79}, {'country': 'China', 'count(*)': 72}, {'country': 'Sweden', 'count(*)': 70}, {'country': 'Switzerland', 'count(*)': 60}, {'country': 'Brazil', 'count(*)': 60}, {'country': 'Thailand', 'count(*)': 52}, {'country': 'Netherlands', 'count(*)': 52}, {'country': 'Indonesia', 'count(*)': 50}, {'country': 'Austria', 'count(*)': 50}, {'country': 'Sudan', 'count(*)': 49}, {'country': 'Japan', 'count(*)': 49}, {'country': 'Egypt', 'count(*)': 49}, {'country': 'Portugal', 'count(*)': 45}, {'country': 'Colombia', 'count(*)': 44}, {'country': 'Chile', 'count(*)': 44}, {'country': 'Turkey', 'count(*)': 39}, {'country': 'Angola', 'count(*)': 37}, {'country': 'Mauritania', 'count(*)': 35}, {'country': 'Kyrgyzstan', 'count(*)': 34}, {'country': 'Iran', 'count(*)': 34}, {'country': 'Denmark', 'count(*)': 32}, {'country': 'Czech Republic', 'count(*)': 32}, {'country': 'United Arab Emirates', 'count(*)': 31}, {'country': 'Norway', 'count(*)': 31}, {'country': 'Dominican Republic', 'count(*)': 30}, {'country': 'Pakistan', 'count(*)': 29}, {'country': 'India', 'count(*)': 29}, {'country': 'Greece', 'count(*)': 29}, {'country': 'Argentina', 'count(*)': 29}, {'country': 'New Zealand', 'count(*)': 28}, {'country': 'Ireland', 'count(*)': 28}, {'country': 'Bulgaria', 'count(*)': 28}, {'country': 'Belgium', 'count(*)': 27}, {'country': 'Venezuela', 'count(*)': 26}, {'country': 'Sierra Leone', 'count(*)': 26}, {'country': 'Peru', 'count(*)': 26}, {'country': 'Libya', 'count(*)': 26}, {'country': 'Ecuador', 'count(*)': 26}, {'country': 'Uganda', 'count(*)': 24}, {'country': 'Kenya', 'count(*)': 24}, {'country': 'Zambia', 'count(*)': 23}, {'country': 'Israel', 'count(*)': 22}, {'country': 'Philippines', 'count(*)': 21}, {'country': 'Poland', 'count(*)': 20}, {'country': 'Moldova', 'count(*)': 20}, {'country': 'Iceland', 'count(*)': 20}, {'country': 'Ghana', 'count(*)': 20}, {'country': 'Slovakia', 'count(*)': 19}, {'country': 'Lithuania', 'count(*)': 19}, {'country': 'Finland', 'count(*)': 19}, {'country': 'Democratic Republic of the Congo', 'count(*)': 19}, {'country': 'Cambodia', 'count(*)': 19}, {'country': 'Romania', 'count(*)': 18}, {'country': 'Hungary', 'count(*)': 18}, {'country': 'Georgia', 'count(*)': 18}, {'country': 'Ivory Coast', 'count(*)': 17}, {'country': 'Haiti', 'count(*)': 17}, {'country': 'Armenia', 'count(*)': 17}, {'country': 'Lebanon', 'count(*)': 16}, {'country': '', 'count(*)': 15}, {'country': 'Uruguay', 'count(*)': 14}, {'country': 'Serbia', 'count(*)': 14}, {'country': 'Malaysia', 'count(*)': 14}, {'country': 'Guinea', 'count(*)': 14}, {'country': 'Bangladesh', 'count(*)': 14}, {'country': 'Senegal', 'count(*)': 13}, {'country': 'Latvia', 'count(*)': 13}, {'country': 'Luxembourg', 'count(*)': 12}, {'country': 'Uzbekistan', 'count(*)': 11}, {'country': 'Singapore', 'count(*)': 11}, {'country': 'Nepal', 'count(*)': 11}, {'country': 'Namibia', 'count(*)': 11}, {'country': 'Gabon', 'count(*)': 11}, {'country': 'Equatorial Guinea', 'count(*)': 11}, {'country': 'Tanzania', 'count(*)': 10}, {'country': 'Croatia', 'count(*)': 10}, {'country': 'Barbados', 'count(*)': 10}, {'country': 'Taiwan', 'count(*)': 9}, {'country': 'Mali', 'count(*)': 9}, {'country': 'Estonia', 'count(*)': 9}, {'country': 'Democratic Republic of Congo', 'count(*)': 9}, {'country': 'Cyprus', 'count(*)': 9}, {'country': 'Costa Rica', 'count(*)': 9}, {'country': 'Bolivia', 'count(*)': 9}, {'country': 'Belarus', 'count(*)': 9}, {'country': 'Bahrain', 'count(*)': 9}, {'country': 'Bahamas', 'count(*)': 9}, {'country': 'Zimbabwe', 'count(*)': 8}, {'country': 'Vietnam', 'count(*)': 8}, {'country': 'Tunisia', 'count(*)': 8}, {'country': 'Republic of Korea', 'count(*)': 8}, {'country': 'Morocco', 'count(*)': 8}, {'country': 'Mongolia', 'count(*)': 8}, {'country': 'Macedonia', 'count(*)': 8}, {'country': 'Guinea-Bissau', 'count(*)': 8}, {'country': 'Djibouti', 'count(*)': 8}, {'country': 'Chad', 'count(*)': 8}, {'country': 'Afghanistan', 'count(*)': 8}, {'country': 'Tajikistan', 'count(*)': 7}, {'country': 'Sao Tome and Principe', 'count(*)': 7}, {'country': 'Netherlands Antilles', 'count(*)': 7}, {'country': 'Mozambique', 'count(*)': 7}, {'country': 'Maldives', 'count(*)': 7}, {'country': 'Jordan', 'count(*)': 7}, {'country': 'Cameroon', 'count(*)': 7}, {'country': 'Burma', 'count(*)': 7}, {'country': 'Burkina Faso', 'count(*)': 7}, {'country': 'Azerbaijan', 'count(*)': 7}, {'country': 'Swaziland', 'count(*)': 6}, {'country': 'Suriname', 'count(*)': 6}, {'country': 'Sri Lanka', 'count(*)': 6}, {'country': 'South Korea', 'count(*)': 6}, {'country': 'Slovenia', 'count(*)': 6}, {'country': 'Saudi Arabia', 'count(*)': 6}, {'country': 'Rwanda', 'count(*)': 6}, {'country': 'Panama', 'count(*)': 6}, {'country': 'Oman', 'count(*)': 6}, {'country': 'Malta', 'count(*)': 6}, {'country': 'Honduras', 'count(*)': 6}, {'country': 'Guatemala', 'count(*)': 6}, {'country': 'Gambia', 'count(*)': 6}, {'country': 'Benin', 'count(*)': 6}, {'country': 'Aruba', 'count(*)': 6}, {'country': 'Algeria', 'count(*)': 6}, {'country': 'Syrian Arab Republic', 'count(*)': 5}, {'country': 'Somali Republic', 'count(*)': 5}, {'country': 'S', 'count(*)': 5}, {'country': 'Republic of the Congo', 'count(*)': 5}, {'country': 'Papua New Guinea', 'count(*)': 5}, {'country': 'Netherland', 'count(*)': 5}, {'country': 'Malawi', 'count(*)': 5}, {'country': 'Hong Kong SAR of China', 'count(*)': 5}, {'country': 'Fiji', 'count(*)': 5}, {'country': 'Ethiopia', 'count(*)': 5}, {'country': 'El Salvador', 'count(*)': 5}, {'country': 'Cuba', 'count(*)': 5}, {'country': 'Central African Republic', 'count(*)': 5}, {'country': 'Turks and Caicos Islands', 'count(*)': 4}, {'country': 'Togo', 'count(*)': 4}, {'country': 'Qatar', 'count(*)': 4}, {'country': 'Paraguay', 'count(*)': 4}, {'country': 'Niger', 'count(*)': 4}, {'country': 'Nicaragua', 'count(*)': 4}, {'country': 'Kuwait', 'count(*)': 4}, {'country': 'Jamaica', 'count(*)': 4}, {'country': 'Guyana', 'count(*)': 4}, {'country': 'Congo (Kinshasa)', 'count(*)': 4}, {'country': 'Bosnia and Herzegovina', 'count(*)': 4}, {'country': 'Antigua and Barbuda', 'count(*)': 4}, {'country': 'Albania', 'count(*)': 4}, {'country': 'Yemen', 'count(*)': 3}, {'country': 'Turkmenistan', 'count(*)': 3}, {'country': 'Tonga', 'count(*)': 3}, {'country': 'Solomon Islands', 'count(*)': 3}, {'country': 'Russian Federation', 'count(*)': 3}, {'country': 'Palau', 'count(*)': 3}, {'country': 'Myanmar', 'count(*)': 3}, {'country': 'Mauritius', 'count(*)': 3}, {'country': 'Madagascar', 'count(*)': 3}, {'country': 'Macao', 'count(*)': 3}, {'country': 'Liberia', 'count(*)': 3}, {'country': 'Lao Peoples Democratic Republic', 'count(*)': 3}, {'country': 'Hong Kong', 'count(*)': 3}, {'country': 'Comoros', 'count(*)': 3}, {'country': 'Cape Verde', 'count(*)': 3}, {'country': 'Burundi', 'count(*)': 3}, {'country': 'Belize', 'count(*)': 3}, {'country': None, 'count(*)': 3}, {'country': 'Trinidad and Tobago', 'count(*)': 2}, {'country': 'Saint Vincent and the Grenadines', 'count(*)': 2}, {'country': 'Saint Lucia', 'count(*)': 2}, {'country': 'Nauru', 'count(*)': 2}, {'country': 'Montenegro', 'count(*)': 2}, {'country': 'Kiribati', 'count(*)': 2}, {'country': 'Iraq', 'count(*)': 2}, {'country': 'Faroe Islands', 'count(*)': 2}, {'country': 'Eritrea', 'count(*)': 2}, {'country': 'Cook Islands', 'count(*)': 2}, {'country': 'Cayman Islands', 'count(*)': 2}, {'country': 'WATCHDOG', 'count(*)': 1}, {'country': 'Vanuatu', 'count(*)': 1}, {'country': 'VELES', 'count(*)': 1}, {'country': 'UNited Kingdom', 'count(*)': 1}, {'country': 'UNIFORM OSCAR', 'count(*)': 1}, {'country': 'Syria', 'count(*)': 1}, {'country': 'South Sudan', 'count(*)': 1}, {'country': 'Seychelles', 'count(*)': 1}, {'country': 'Samoa', 'count(*)': 1}, {'country': 'Saint Kitts and Nevis', 'count(*)': 1}, {'country': 'SWISSBIRD', 'count(*)': 1}, {'country': 'SCHEFF', 'count(*)': 1}, {'country': 'Russia]]', 'count(*)': 1}, {'country': 'Reunion', 'count(*)': 1}, {'country': 'RENTAXEL', 'count(*)': 1}, {'country': 'Puerto Rico', 'count(*)': 1}, {'country': 'ODINN', 'count(*)': 1}, {'country': 'Montserrat', 'count(*)': 1}, {'country': 'Monaco', 'count(*)': 1}, {'country': 'Marshall Islands', 'count(*)': 1}, {'country': 'LAP', 'count(*)': 1}, {'country': 'Guadeloupe', 'count(*)': 1}, {'country': 'French Polynesia', 'count(*)': 1}, {'country': 'French Guiana', 'count(*)': 1}, {'country': "Democratic People's Republic of Korea", 'count(*)': 1}, {'country': 'DRAGON', 'count(*)': 1}, {'country': "Cote d'Ivoire", 'count(*)': 1}, {'country': 'Congo (Brazzaville)', 'count(*)': 1}, {'country': 'Canadian Territories', 'count(*)': 1}, {'country': 'COMPANY AS', 'count(*)': 1}, {'country': 'Brunei', 'count(*)': 1}, {'country': 'British Virgin Islands', 'count(*)': 1}, {'country': 'Botswana', 'count(*)': 1}, {'country': 'Bhutan', 'count(*)': 1}, {'country': 'Bermuda', 'count(*)': 1}, {'country': 'American Samoa', 'count(*)': 1}, {'country': 'Air S', 'count(*)': 1}, {'country': 'AZIMUT', 'count(*)': 1}, {'country': 'AVIOQUINTANA', 'count(*)': 1}, {'country': 'AVINOR', 'count(*)': 1}, {'country': 'AVIANCA', 'count(*)': 1}, {'country': 'AVEMEX', 'count(*)': 1}, {'country': 'AUSA', 'count(*)': 1}, {'country': 'AURORA AIR', 'count(*)': 1}, {'country': 'AUDI AIR', 'count(*)': 1}, {'country': 'ATLANTIS CANADA', 'count(*)': 1}, {'country': 'ATLANTIC NICARAGUA', 'count(*)': 1}, {'country': 'ATCO', 'count(*)': 1}, {'country': 'ASUR', 'count(*)': 1}, {'country': 'ASTORIA', 'count(*)': 1}, {'country': 'ASA PESADA', 'count(*)': 1}, {'country': 'ARMSTRONG', 'count(*)': 1}, {'country': 'ARIZAIR', 'count(*)': 1}, {'country': 'AQUILINE', 'count(*)': 1}, {'country': 'APPALACHIAN', 'count(*)': 1}, {'country': 'ANTARES', 'count(*)': 1}, {'country': 'ALNACIONAL', 'count(*)': 1}, {'country': 'ALL STAR', 'count(*)': 1}, {'country': 'ALDAWLYH AIR', 'count(*)': 1}, {'country': 'ALCON', 'count(*)': 1}, {'country': 'ALASKA PACIFIC', 'count(*)': 1}, {'country': 'ALASKA', 'count(*)': 1}, {'country': 'ALAMO', 'count(*)': 1}, {'country': 'AIRWAVE', 'count(*)': 1}, {'country': 'AIRPORT HELICOPTER', 'count(*)': 1}, {'country': 'AIRPAC', 'count(*)': 1}, {'country': 'AIRNAT', 'count(*)': 1}, {'country': 'AIRMAN', 'count(*)': 1}, {'country': 'AIRFLIGHT', 'count(*)': 1}, {'country': 'AIREX', 'count(*)': 1}, {'country': 'AIR-MAUR', 'count(*)': 1}, {'country': 'AIR PRINT', 'count(*)': 1}, {'country': 'AIR FREIGHTER', 'count(*)': 1}, {'country': 'AIR CLASS', 'count(*)': 1}, {'country': 'AEROWEE', 'count(*)': 1}, {'country': 'AEROVARADERO', 'count(*)': 1}, {'country': 'AEROSUN', 'count(*)': 1}, {'country': 'AEROSOL', 'count(*)': 1}, {'country': 'AEROPUMA', 'count(*)': 1}, {'country': 'AEROPERLAS', 'count(*)': 1}, {'country': 'AEROCESAR', 'count(*)': 1}, {'country': 'AEROCENTER', 'count(*)': 1}, {'country': 'ACTIVE AERO', 'count(*)': 1}, {'country': 'ACOM', 'count(*)': 1}, {'country': ' S.A.', 'count(*)': 1}, {'country': ' Boonville Stage Line', 'count(*)': 1}] | Easy | false | false | false | true | false | true | false | false | false | false | false | false | false | [QUESTION]What is the total number of airlines?[/QUESTION]
[SQL]SELECT count(*) FROM AIRLINES[/SQL] | [QUESTION]What is the total number of airlines?[/QUESTION]
[SQL]SELECT count(*) FROM AIRLINES[/SQL] | [QUESTION]What is the total number of airlines?[/QUESTION]
[SQL]SELECT count(*) FROM AIRLINES[/SQL] | [QUESTION]What is the total number of airlines?[/QUESTION]
[SQL]SELECT count(*) FROM AIRLINES[/SQL] |
party_people |
CREATE TABLE member (
"Member_ID" INTEGER,
"Member_Name" TEXT,
"Party_ID" TEXT,
"In_office" TEXT,
PRIMARY KEY ("Member_ID"),
FOREIGN KEY("Party_ID") REFERENCES party ("Party_ID")
)
CREATE TABLE party (
"Party_ID" INTEGER,
"Minister" TEXT,
"Took_office" TEXT,
"Left_office" TEXT,
"Region_ID" INTEGER,
"Party_name" TEXT,
PRIMARY KEY ("Party_ID"),
FOREIGN KEY("Region_ID") REFERENCES region ("Region_ID")
)
CREATE TABLE party_events (
"Event_ID" INTEGER,
"Event_Name" TEXT,
"Party_ID" INTEGER,
"Member_in_charge_ID" INTEGER,
PRIMARY KEY ("Event_ID"),
FOREIGN KEY("Member_in_charge_ID") REFERENCES member ("Member_ID"),
FOREIGN KEY("Party_ID") REFERENCES party ("Party_ID")
)
CREATE TABLE region (
"Region_ID" INTEGER,
"Region_name" TEXT,
"Date" TEXT,
"Label" TEXT,
"Format" TEXT,
"Catalogue" TEXT,
PRIMARY KEY ("Region_ID")
) |
CREATE TABLE member (
"Member_ID" INTEGER,
"Member_Name" TEXT,
"Party_ID" TEXT,
"In_office" TEXT,
PRIMARY KEY ("Member_ID"),
FOREIGN KEY("Party_ID") REFERENCES party ("Party_ID")
)
/*
2 rows from member table:
Member_ID Member_Name Party_ID In_office
1 Hon Tony Abbott 3 1994–present
2 Hon Dick Adams 2 1993–2013
*/
CREATE TABLE party (
"Party_ID" INTEGER,
"Minister" TEXT,
"Took_office" TEXT,
"Left_office" TEXT,
"Region_ID" INTEGER,
"Party_name" TEXT,
PRIMARY KEY ("Party_ID"),
FOREIGN KEY("Region_ID") REFERENCES region ("Region_ID")
)
/*
2 rows from party table:
Party_ID Minister Took_office Left_office Region_ID Party_name
1 Dr. Kwame Nkrumah (MP) 1957 1958 1 Convention Peoples Party
2 Kojo Botsio (MP) 1958 1959 2 Progress Party
*/
CREATE TABLE party_events (
"Event_ID" INTEGER,
"Event_Name" TEXT,
"Party_ID" INTEGER,
"Member_in_charge_ID" INTEGER,
PRIMARY KEY ("Event_ID"),
FOREIGN KEY("Member_in_charge_ID") REFERENCES member ("Member_ID"),
FOREIGN KEY("Party_ID") REFERENCES party ("Party_ID")
)
/*
2 rows from party_events table:
Event_ID Event_Name Party_ID Member_in_charge_ID
1 Annaual Meeting 1 4
2 Conference 1 12
*/
CREATE TABLE region (
"Region_ID" INTEGER,
"Region_name" TEXT,
"Date" TEXT,
"Label" TEXT,
"Format" TEXT,
"Catalogue" TEXT,
PRIMARY KEY ("Region_ID")
)
/*
2 rows from region table:
Region_ID Region_name Date Label Format Catalogue
1 United Kingdom 1 July 2002 Parlophone CD 540 3622
2 United Kingdom 1 July 2002 Parlophone 2× LP 539 9821
*/ | How many Annual Meeting events happened in the United Kingdom region? | SELECT count(*) FROM region AS t1 JOIN party AS t2 ON t1.region_id = t2.region_id JOIN party_events AS t3 ON t2.party_id = t3.party_id WHERE t1.region_name = "United Kingdom" AND t3.Event_Name = "Annaual Meeting" | [{'count(*)': 2}] | Hard | false | false | false | false | false | false | false | false | true | false | false | false | false | ||||
election |
CREATE TABLE county (
"County_Id" INTEGER,
"County_name" TEXT,
"Population" REAL,
"Zip_code" TEXT,
PRIMARY KEY ("County_Id")
)
CREATE TABLE election (
"Election_ID" INTEGER,
"Counties_Represented" TEXT,
"District" INTEGER,
"Delegate" TEXT,
"Party" INTEGER,
"First_Elected" REAL,
"Committee" TEXT,
PRIMARY KEY ("Election_ID"),
FOREIGN KEY("District") REFERENCES county ("County_Id"),
FOREIGN KEY("Party") REFERENCES party ("Party_ID")
)
CREATE TABLE party (
"Party_ID" INTEGER,
"Year" REAL,
"Party" TEXT,
"Governor" TEXT,
"Lieutenant_Governor" TEXT,
"Comptroller" TEXT,
"Attorney_General" TEXT,
"US_Senate" TEXT,
PRIMARY KEY ("Party_ID")
) |
CREATE TABLE county (
"County_Id" INTEGER,
"County_name" TEXT,
"Population" REAL,
"Zip_code" TEXT,
PRIMARY KEY ("County_Id")
)
/*
2 rows from county table:
County_Id County_name Population Zip_code
1 Howard 21000.0 D21
2 Baltimore County 90000.0 D08
*/
CREATE TABLE election (
"Election_ID" INTEGER,
"Counties_Represented" TEXT,
"District" INTEGER,
"Delegate" TEXT,
"Party" INTEGER,
"First_Elected" REAL,
"Committee" TEXT,
PRIMARY KEY ("Election_ID"),
FOREIGN KEY("District") REFERENCES county ("County_Id"),
FOREIGN KEY("Party") REFERENCES party ("Party_ID")
)
/*
2 rows from election table:
Election_ID Counties_Represented District Delegate Party First_Elected Committee
1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations
2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters
*/
CREATE TABLE party (
"Party_ID" INTEGER,
"Year" REAL,
"Party" TEXT,
"Governor" TEXT,
"Lieutenant_Governor" TEXT,
"Comptroller" TEXT,
"Attorney_General" TEXT,
"US_Senate" TEXT,
PRIMARY KEY ("Party_ID")
)
/*
2 rows from party table:
Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate
1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer
2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer
*/ | Which committees have delegates from the Democratic party? | SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T2.Party = "Democratic" | [{'Committee': 'Appropriations'}, {'Committee': 'Economic Matters'}, {'Committee': 'Environmental Matters'}, {'Committee': 'Appropriations'}] | Medium | false | false | false | false | false | false | false | true | false | false | false | false | false | ||||
geo |
CREATE TABLE border_info (
state_name TEXT,
border TEXT,
PRIMARY KEY (border, state_name),
FOREIGN KEY(border) REFERENCES state (state_name),
FOREIGN KEY(state_name) REFERENCES state (state_name)
)
CREATE TABLE city (
city_name TEXT,
population INTEGER DEFAULT NULL,
country_name VARCHAR(3) DEFAULT '' NOT NULL,
state_name TEXT,
PRIMARY KEY (city_name, state_name),
FOREIGN KEY(state_name) REFERENCES state (state_name)
)
CREATE TABLE highlow (
state_name TEXT,
highest_elevation TEXT,
lowest_point TEXT,
highest_point TEXT,
lowest_elevation TEXT,
PRIMARY KEY (state_name),
FOREIGN KEY(state_name) REFERENCES state (state_name)
)
CREATE TABLE lake (
lake_name TEXT,
area DOUBLE DEFAULT NULL,
country_name VARCHAR(3) DEFAULT '' NOT NULL,
state_name TEXT
)
CREATE TABLE mountain (
mountain_name TEXT,
mountain_altitude INTEGER DEFAULT NULL,
country_name VARCHAR(3) DEFAULT '' NOT NULL,
state_name TEXT,
PRIMARY KEY (mountain_name, state_name),
FOREIGN KEY(state_name) REFERENCES state (state_name)
)
CREATE TABLE river (
river_name TEXT,
length INTEGER DEFAULT NULL,
country_name VARCHAR(3) DEFAULT '' NOT NULL,
traverse TEXT,
PRIMARY KEY (river_name),
FOREIGN KEY(traverse) REFERENCES state (state_name)
)
CREATE TABLE state (
state_name TEXT,
population INTEGER DEFAULT NULL,
area DOUBLE DEFAULT NULL,
country_name VARCHAR(3) DEFAULT '' NOT NULL,
capital TEXT,
density DOUBLE DEFAULT NULL,
PRIMARY KEY (state_name)
) |
CREATE TABLE border_info (
state_name TEXT,
border TEXT,
PRIMARY KEY (border, state_name),
FOREIGN KEY(border) REFERENCES state (state_name),
FOREIGN KEY(state_name) REFERENCES state (state_name)
)
/*
2 rows from border_info table:
state_name border
*/
CREATE TABLE city (
city_name TEXT,
population INTEGER DEFAULT NULL,
country_name VARCHAR(3) DEFAULT '' NOT NULL,
state_name TEXT,
PRIMARY KEY (city_name, state_name),
FOREIGN KEY(state_name) REFERENCES state (state_name)
)
/*
2 rows from city table:
city_name population country_name state_name
*/
CREATE TABLE highlow (
state_name TEXT,
highest_elevation TEXT,
lowest_point TEXT,
highest_point TEXT,
lowest_elevation TEXT,
PRIMARY KEY (state_name),
FOREIGN KEY(state_name) REFERENCES state (state_name)
)
/*
2 rows from highlow table:
state_name highest_elevation lowest_point highest_point lowest_elevation
*/
CREATE TABLE lake (
lake_name TEXT,
area DOUBLE DEFAULT NULL,
country_name VARCHAR(3) DEFAULT '' NOT NULL,
state_name TEXT
)
/*
2 rows from lake table:
lake_name area country_name state_name
*/
CREATE TABLE mountain (
mountain_name TEXT,
mountain_altitude INTEGER DEFAULT NULL,
country_name VARCHAR(3) DEFAULT '' NOT NULL,
state_name TEXT,
PRIMARY KEY (mountain_name, state_name),
FOREIGN KEY(state_name) REFERENCES state (state_name)
)
/*
2 rows from mountain table:
mountain_name mountain_altitude country_name state_name
*/
CREATE TABLE river (
river_name TEXT,
length INTEGER DEFAULT NULL,
country_name VARCHAR(3) DEFAULT '' NOT NULL,
traverse TEXT,
PRIMARY KEY (river_name),
FOREIGN KEY(traverse) REFERENCES state (state_name)
)
/*
2 rows from river table:
river_name length country_name traverse
*/
CREATE TABLE state (
state_name TEXT,
population INTEGER DEFAULT NULL,
area DOUBLE DEFAULT NULL,
country_name VARCHAR(3) DEFAULT '' NOT NULL,
capital TEXT,
density DOUBLE DEFAULT NULL,
PRIMARY KEY (state_name)
)
/*
2 rows from state table:
state_name population area country_name capital density
*/ | which is the lowest point of the states that the mississippi runs through | SELECT lowest_point FROM highlow WHERE state_name IN ( SELECT traverse FROM river WHERE river_name = "mississippi" ) ORDER BY lowest_elevation LIMIT 1; | [{'Nenhum': 'Nenhum resultado encontrado'}] | Extra Hard | false | false | false | true | true | false | false | false | false | true | false | false | false | [QUESTION]what is the largest state that borders the state with the lowest point in the usa[/QUESTION]
[SQL]SELECT t1.state_name FROM highlow AS t3 JOIN border_info AS t1 ON t3.state_name = t1.border JOIN state AS t2 ON t2.state_name = t1.border WHERE t3.lowest_elevation = ( SELECT MIN ( lowest_elevation ) FROM highlow ) ORDER BY t2.area DESC LIMIT 1;[/SQL] | [QUESTION]what is the largest state that borders the state with the lowest point in the usa[/QUESTION]
[SQL]SELECT t1.state_name FROM highlow AS t3 JOIN border_info AS t1 ON t3.state_name = t1.border JOIN state AS t2 ON t2.state_name = t1.border WHERE t3.lowest_elevation = ( SELECT MIN ( lowest_elevation ) FROM highlow ) ORDER BY t2.area DESC LIMIT 1;[/SQL] | [QUESTION]what is the largest state that borders the state with the lowest point in the usa[/QUESTION]
[SQL]SELECT t1.state_name FROM highlow AS t3 JOIN border_info AS t1 ON t3.state_name = t1.border JOIN state AS t2 ON t2.state_name = t1.border WHERE t3.lowest_elevation = ( SELECT MIN ( lowest_elevation ) FROM highlow ) ORDER BY t2.area DESC LIMIT 1;[/SQL] | [QUESTION]what is the largest state that borders the state with the lowest point in the usa[/QUESTION]
[SQL]SELECT t1.state_name FROM highlow AS t3 JOIN border_info AS t1 ON t3.state_name = t1.border JOIN state AS t2 ON t2.state_name = t1.border WHERE t3.lowest_elevation = ( SELECT MIN ( lowest_elevation ) FROM highlow ) ORDER BY t2.area DESC LIMIT 1;[/SQL] |
product_catalog |
CREATE TABLE "Attribute_Definitions" (
attribute_id INTEGER,
attribute_name VARCHAR(30),
attribute_data_type VARCHAR(10),
PRIMARY KEY (attribute_id)
)
CREATE TABLE "Catalog_Contents" (
catalog_entry_id INTEGER,
catalog_level_number INTEGER NOT NULL,
parent_entry_id INTEGER,
previous_entry_id INTEGER,
next_entry_id INTEGER,
catalog_entry_name VARCHAR(80),
product_stock_number VARCHAR(50),
price_in_dollars DOUBLE,
price_in_euros DOUBLE,
price_in_pounds DOUBLE,
capacity VARCHAR(20),
length VARCHAR(20),
height VARCHAR(20),
width VARCHAR(20),
PRIMARY KEY (catalog_entry_id),
FOREIGN KEY(catalog_level_number) REFERENCES "Catalog_Structure" (catalog_level_number)
)
CREATE TABLE "Catalog_Contents_Additional_Attributes" (
catalog_entry_id INTEGER NOT NULL,
catalog_level_number INTEGER NOT NULL,
attribute_id INTEGER NOT NULL,
attribute_value VARCHAR(255) NOT NULL,
FOREIGN KEY(catalog_level_number) REFERENCES "Catalog_Structure" (catalog_level_number),
FOREIGN KEY(catalog_entry_id) REFERENCES "Catalog_Contents" (catalog_entry_id)
)
CREATE TABLE "Catalog_Structure" (
catalog_level_number INTEGER,
catalog_id INTEGER NOT NULL,
catalog_level_name VARCHAR(50),
PRIMARY KEY (catalog_level_number),
FOREIGN KEY(catalog_id) REFERENCES "Catalogs" (catalog_id)
)
CREATE TABLE "Catalogs" (
catalog_id INTEGER,
catalog_name VARCHAR(50),
catalog_publisher VARCHAR(80),
date_of_publication DATETIME,
date_of_latest_revision DATETIME,
PRIMARY KEY (catalog_id)
) |
CREATE TABLE "Attribute_Definitions" (
attribute_id INTEGER,
attribute_name VARCHAR(30),
attribute_data_type VARCHAR(10),
PRIMARY KEY (attribute_id)
)
/*
2 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
*/
CREATE TABLE "Catalog_Contents" (
catalog_entry_id INTEGER,
catalog_level_number INTEGER NOT NULL,
parent_entry_id INTEGER,
previous_entry_id INTEGER,
next_entry_id INTEGER,
catalog_entry_name VARCHAR(80),
product_stock_number VARCHAR(50),
price_in_dollars DOUBLE,
price_in_euros DOUBLE,
price_in_pounds DOUBLE,
capacity VARCHAR(20),
length VARCHAR(20),
height VARCHAR(20),
width VARCHAR(20),
PRIMARY KEY (catalog_entry_id),
FOREIGN KEY(catalog_level_number) REFERENCES "Catalog_Structure" (catalog_level_number)
)
/*
2 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
*/
CREATE TABLE "Catalog_Contents_Additional_Attributes" (
catalog_entry_id INTEGER NOT NULL,
catalog_level_number INTEGER NOT NULL,
attribute_id INTEGER NOT NULL,
attribute_value VARCHAR(255) NOT NULL,
FOREIGN KEY(catalog_level_number) REFERENCES "Catalog_Structure" (catalog_level_number),
FOREIGN KEY(catalog_entry_id) REFERENCES "Catalog_Contents" (catalog_entry_id)
)
/*
2 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
*/
CREATE TABLE "Catalog_Structure" (
catalog_level_number INTEGER,
catalog_id INTEGER NOT NULL,
catalog_level_name VARCHAR(50),
PRIMARY KEY (catalog_level_number),
FOREIGN KEY(catalog_id) REFERENCES "Catalogs" (catalog_id)
)
/*
2 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
*/
CREATE TABLE "Catalogs" (
catalog_id INTEGER,
catalog_name VARCHAR(50),
catalog_publisher VARCHAR(80),
date_of_publication DATETIME,
date_of_latest_revision DATETIME,
PRIMARY KEY (catalog_id)
)
/*
2 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
*/ | Which attribute definitions have attribute value 0? Give me the attribute name and attribute ID. | SELECT t1.attribute_name , t1.attribute_id FROM Attribute_Definitions AS t1 JOIN Catalog_Contents_Additional_Attributes AS t2 ON t1.attribute_id = t2.attribute_id WHERE t2.attribute_value = 0 | [{'attribute_name': 'Yellow', 'attribute_id': 3}, {'attribute_name': 'Black', 'attribute_id': 2}, {'attribute_name': 'Sweet', 'attribute_id': 4}, {'attribute_name': 'Black', 'attribute_id': 2}, {'attribute_name': 'Black', 'attribute_id': 2}, {'attribute_name': 'Sweet', 'attribute_id': 4}, {'attribute_name': 'Yellow', 'attribute_id': 3}, {'attribute_name': 'Sweet', 'attribute_id': 4}] | Medium | false | false | false | false | false | false | false | true | false | false | false | false | false | ||||
geo |
CREATE TABLE border_info (
state_name TEXT,
border TEXT,
PRIMARY KEY (border, state_name),
FOREIGN KEY(border) REFERENCES state (state_name),
FOREIGN KEY(state_name) REFERENCES state (state_name)
)
CREATE TABLE city (
city_name TEXT,
population INTEGER DEFAULT NULL,
country_name VARCHAR(3) DEFAULT '' NOT NULL,
state_name TEXT,
PRIMARY KEY (city_name, state_name),
FOREIGN KEY(state_name) REFERENCES state (state_name)
)
CREATE TABLE highlow (
state_name TEXT,
highest_elevation TEXT,
lowest_point TEXT,
highest_point TEXT,
lowest_elevation TEXT,
PRIMARY KEY (state_name),
FOREIGN KEY(state_name) REFERENCES state (state_name)
)
CREATE TABLE lake (
lake_name TEXT,
area DOUBLE DEFAULT NULL,
country_name VARCHAR(3) DEFAULT '' NOT NULL,
state_name TEXT
)
CREATE TABLE mountain (
mountain_name TEXT,
mountain_altitude INTEGER DEFAULT NULL,
country_name VARCHAR(3) DEFAULT '' NOT NULL,
state_name TEXT,
PRIMARY KEY (mountain_name, state_name),
FOREIGN KEY(state_name) REFERENCES state (state_name)
)
CREATE TABLE river (
river_name TEXT,
length INTEGER DEFAULT NULL,
country_name VARCHAR(3) DEFAULT '' NOT NULL,
traverse TEXT,
PRIMARY KEY (river_name),
FOREIGN KEY(traverse) REFERENCES state (state_name)
)
CREATE TABLE state (
state_name TEXT,
population INTEGER DEFAULT NULL,
area DOUBLE DEFAULT NULL,
country_name VARCHAR(3) DEFAULT '' NOT NULL,
capital TEXT,
density DOUBLE DEFAULT NULL,
PRIMARY KEY (state_name)
) |
CREATE TABLE border_info (
state_name TEXT,
border TEXT,
PRIMARY KEY (border, state_name),
FOREIGN KEY(border) REFERENCES state (state_name),
FOREIGN KEY(state_name) REFERENCES state (state_name)
)
/*
2 rows from border_info table:
state_name border
*/
CREATE TABLE city (
city_name TEXT,
population INTEGER DEFAULT NULL,
country_name VARCHAR(3) DEFAULT '' NOT NULL,
state_name TEXT,
PRIMARY KEY (city_name, state_name),
FOREIGN KEY(state_name) REFERENCES state (state_name)
)
/*
2 rows from city table:
city_name population country_name state_name
*/
CREATE TABLE highlow (
state_name TEXT,
highest_elevation TEXT,
lowest_point TEXT,
highest_point TEXT,
lowest_elevation TEXT,
PRIMARY KEY (state_name),
FOREIGN KEY(state_name) REFERENCES state (state_name)
)
/*
2 rows from highlow table:
state_name highest_elevation lowest_point highest_point lowest_elevation
*/
CREATE TABLE lake (
lake_name TEXT,
area DOUBLE DEFAULT NULL,
country_name VARCHAR(3) DEFAULT '' NOT NULL,
state_name TEXT
)
/*
2 rows from lake table:
lake_name area country_name state_name
*/
CREATE TABLE mountain (
mountain_name TEXT,
mountain_altitude INTEGER DEFAULT NULL,
country_name VARCHAR(3) DEFAULT '' NOT NULL,
state_name TEXT,
PRIMARY KEY (mountain_name, state_name),
FOREIGN KEY(state_name) REFERENCES state (state_name)
)
/*
2 rows from mountain table:
mountain_name mountain_altitude country_name state_name
*/
CREATE TABLE river (
river_name TEXT,
length INTEGER DEFAULT NULL,
country_name VARCHAR(3) DEFAULT '' NOT NULL,
traverse TEXT,
PRIMARY KEY (river_name),
FOREIGN KEY(traverse) REFERENCES state (state_name)
)
/*
2 rows from river table:
river_name length country_name traverse
*/
CREATE TABLE state (
state_name TEXT,
population INTEGER DEFAULT NULL,
area DOUBLE DEFAULT NULL,
country_name VARCHAR(3) DEFAULT '' NOT NULL,
capital TEXT,
density DOUBLE DEFAULT NULL,
PRIMARY KEY (state_name)
)
/*
2 rows from state table:
state_name population area country_name capital density
*/ | what is the biggest state in continental us | SELECT state_name FROM state WHERE area = ( SELECT MAX ( area ) FROM state ); | [{'Nenhum': 'Nenhum resultado encontrado'}] | Extra Hard | false | false | false | false | false | false | false | false | false | true | false | false | false | [QUESTION]how many states border the largest state[/QUESTION]
[SQL]SELECT COUNT ( border ) FROM border_info WHERE state_name = ( SELECT state_name FROM state WHERE area = ( SELECT MAX ( area ) FROM state ) );[/SQL] | [QUESTION]how many states border the largest state[/QUESTION]
[SQL]SELECT COUNT ( border ) FROM border_info WHERE state_name = ( SELECT state_name FROM state WHERE area = ( SELECT MAX ( area ) FROM state ) );[/SQL] | [QUESTION]how many states border the largest state[/QUESTION]
[SQL]SELECT COUNT ( border ) FROM border_info WHERE state_name = ( SELECT state_name FROM state WHERE area = ( SELECT MAX ( area ) FROM state ) );[/SQL] | [QUESTION]how many states border the largest state[/QUESTION]
[SQL]SELECT COUNT ( border ) FROM border_info WHERE state_name = ( SELECT state_name FROM state WHERE area = ( SELECT MAX ( area ) FROM state ) );[/SQL] |
academic |
CREATE TABLE author (
aid INTEGER,
homepage TEXT,
name TEXT,
oid INTEGER,
PRIMARY KEY (aid)
)
CREATE TABLE cite (
cited INTEGER,
citing INTEGER,
FOREIGN KEY(cited) REFERENCES publication (pid),
FOREIGN KEY(citing) REFERENCES publication (pid)
)
CREATE TABLE conference (
cid INTEGER,
homepage TEXT,
name TEXT,
PRIMARY KEY (cid)
)
CREATE TABLE domain (
did INTEGER,
name TEXT,
PRIMARY KEY (did)
)
CREATE TABLE domain_author (
aid INTEGER,
did INTEGER,
PRIMARY KEY (did, aid),
FOREIGN KEY(did) REFERENCES domain (did),
FOREIGN KEY(aid) REFERENCES author (aid)
)
CREATE TABLE domain_conference (
cid INTEGER,
did INTEGER,
PRIMARY KEY (did, cid),
FOREIGN KEY(did) REFERENCES domain (did),
FOREIGN KEY(cid) REFERENCES conference (cid)
)
CREATE TABLE domain_journal (
did INTEGER,
jid INTEGER,
PRIMARY KEY (did, jid),
FOREIGN KEY(jid) REFERENCES journal (jid),
FOREIGN KEY(did) REFERENCES domain (did)
)
CREATE TABLE domain_keyword (
did INTEGER,
kid INTEGER,
PRIMARY KEY (did, kid),
FOREIGN KEY(kid) REFERENCES keyword (kid),
FOREIGN KEY(did) REFERENCES domain (did)
)
CREATE TABLE domain_publication (
did INTEGER,
pid INTEGER,
PRIMARY KEY (did, pid),
FOREIGN KEY(pid) REFERENCES publication (pid),
FOREIGN KEY(did) REFERENCES domain (did)
)
CREATE TABLE journal (
homepage TEXT,
jid INTEGER,
name TEXT,
PRIMARY KEY (jid)
)
CREATE TABLE keyword (
keyword TEXT,
kid INTEGER,
PRIMARY KEY (kid)
)
CREATE TABLE organization (
continent TEXT,
homepage TEXT,
name TEXT,
oid INTEGER,
PRIMARY KEY (oid)
)
CREATE TABLE publication (
abstract TEXT,
cid TEXT,
citation_num INTEGER,
jid INTEGER,
pid INTEGER,
reference_num INTEGER,
title TEXT,
year INTEGER,
PRIMARY KEY (pid),
FOREIGN KEY(jid) REFERENCES journal (jid),
FOREIGN KEY(cid) REFERENCES conference (cid)
)
CREATE TABLE publication_keyword (
pid INTEGER,
kid INTEGER,
PRIMARY KEY (kid, pid),
FOREIGN KEY(pid) REFERENCES publication (pid),
FOREIGN KEY(kid) REFERENCES keyword (kid)
)
CREATE TABLE writes (
aid INTEGER,
pid INTEGER,
PRIMARY KEY (aid, pid),
FOREIGN KEY(pid) REFERENCES publication (pid),
FOREIGN KEY(aid) REFERENCES author (aid)
) |
CREATE TABLE author (
aid INTEGER,
homepage TEXT,
name TEXT,
oid INTEGER,
PRIMARY KEY (aid)
)
/*
2 rows from author table:
aid homepage name oid
*/
CREATE TABLE cite (
cited INTEGER,
citing INTEGER,
FOREIGN KEY(cited) REFERENCES publication (pid),
FOREIGN KEY(citing) REFERENCES publication (pid)
)
/*
2 rows from cite table:
cited citing
*/
CREATE TABLE conference (
cid INTEGER,
homepage TEXT,
name TEXT,
PRIMARY KEY (cid)
)
/*
2 rows from conference table:
cid homepage name
*/
CREATE TABLE domain (
did INTEGER,
name TEXT,
PRIMARY KEY (did)
)
/*
2 rows from domain table:
did name
*/
CREATE TABLE domain_author (
aid INTEGER,
did INTEGER,
PRIMARY KEY (did, aid),
FOREIGN KEY(did) REFERENCES domain (did),
FOREIGN KEY(aid) REFERENCES author (aid)
)
/*
2 rows from domain_author table:
aid did
*/
CREATE TABLE domain_conference (
cid INTEGER,
did INTEGER,
PRIMARY KEY (did, cid),
FOREIGN KEY(did) REFERENCES domain (did),
FOREIGN KEY(cid) REFERENCES conference (cid)
)
/*
2 rows from domain_conference table:
cid did
*/
CREATE TABLE domain_journal (
did INTEGER,
jid INTEGER,
PRIMARY KEY (did, jid),
FOREIGN KEY(jid) REFERENCES journal (jid),
FOREIGN KEY(did) REFERENCES domain (did)
)
/*
2 rows from domain_journal table:
did jid
*/
CREATE TABLE domain_keyword (
did INTEGER,
kid INTEGER,
PRIMARY KEY (did, kid),
FOREIGN KEY(kid) REFERENCES keyword (kid),
FOREIGN KEY(did) REFERENCES domain (did)
)
/*
2 rows from domain_keyword table:
did kid
*/
CREATE TABLE domain_publication (
did INTEGER,
pid INTEGER,
PRIMARY KEY (did, pid),
FOREIGN KEY(pid) REFERENCES publication (pid),
FOREIGN KEY(did) REFERENCES domain (did)
)
/*
2 rows from domain_publication table:
did pid
*/
CREATE TABLE journal (
homepage TEXT,
jid INTEGER,
name TEXT,
PRIMARY KEY (jid)
)
/*
2 rows from journal table:
homepage jid name
*/
CREATE TABLE keyword (
keyword TEXT,
kid INTEGER,
PRIMARY KEY (kid)
)
/*
2 rows from keyword table:
keyword kid
*/
CREATE TABLE organization (
continent TEXT,
homepage TEXT,
name TEXT,
oid INTEGER,
PRIMARY KEY (oid)
)
/*
2 rows from organization table:
continent homepage name oid
*/
CREATE TABLE publication (
abstract TEXT,
cid TEXT,
citation_num INTEGER,
jid INTEGER,
pid INTEGER,
reference_num INTEGER,
title TEXT,
year INTEGER,
PRIMARY KEY (pid),
FOREIGN KEY(jid) REFERENCES journal (jid),
FOREIGN KEY(cid) REFERENCES conference (cid)
)
/*
2 rows from publication table:
abstract cid citation_num jid pid reference_num title year
*/
CREATE TABLE publication_keyword (
pid INTEGER,
kid INTEGER,
PRIMARY KEY (kid, pid),
FOREIGN KEY(pid) REFERENCES publication (pid),
FOREIGN KEY(kid) REFERENCES keyword (kid)
)
/*
2 rows from publication_keyword table:
pid kid
*/
CREATE TABLE writes (
aid INTEGER,
pid INTEGER,
PRIMARY KEY (aid, pid),
FOREIGN KEY(pid) REFERENCES publication (pid),
FOREIGN KEY(aid) REFERENCES author (aid)
)
/*
2 rows from writes table:
aid pid
*/ | return me the domain where " H. V. Jagadish " is focused . | SELECT t2.name FROM domain_author AS t3 JOIN author AS t1 ON t3.aid = t1.aid JOIN DOMAIN AS t2 ON t2.did = t3.did WHERE t1.name = "H. V. Jagadish"; | [{'Nenhum': 'Nenhum resultado encontrado'}] | Hard | false | false | false | false | false | false | false | false | true | false | false | false | false | [QUESTION]return me the keywords, which have been contained by more than 10 papers of " H. V. Jagadish " .[/QUESTION]
[SQL]SELECT t1.keyword FROM publication_keyword AS t5 JOIN keyword AS t1 ON t5.kid = t1.kid JOIN publication AS t3 ON t3.pid = t5.pid JOIN writes AS t4 ON t4.pid = t3.pid JOIN author AS t2 ON t4.aid = t2.aid WHERE t2.name = "H. V. Jagadish" GROUP BY t1.keyword HAVING COUNT ( DISTINCT t3.title ) > 10;[/SQL] |
|||
flight_4 |
CREATE TABLE airlines (
alid INTEGER,
name TEXT,
iata VARCHAR(2),
icao VARCHAR(3),
callsign TEXT,
country TEXT,
active VARCHAR(2),
PRIMARY KEY (alid)
)
CREATE TABLE airports (
apid INTEGER,
name TEXT NOT NULL,
city TEXT,
country TEXT,
x REAL,
y REAL,
elevation BIGINT,
iata TEXT(3),
icao TEXT(4),
PRIMARY KEY (apid)
)
CREATE TABLE routes (
rid INTEGER,
dst_apid INTEGER,
dst_ap VARCHAR(4),
src_apid BIGINT,
src_ap VARCHAR(4),
alid BIGINT,
airline VARCHAR(4),
codeshare TEXT,
PRIMARY KEY (rid),
FOREIGN KEY(dst_apid) REFERENCES airports (apid),
FOREIGN KEY(src_apid) REFERENCES airports (apid),
FOREIGN KEY(alid) REFERENCES airlines (alid)
) |
CREATE TABLE airlines (
alid INTEGER,
name TEXT,
iata VARCHAR(2),
icao VARCHAR(3),
callsign TEXT,
country TEXT,
active VARCHAR(2),
PRIMARY KEY (alid)
)
/*
2 rows from airlines table:
alid name iata icao callsign country active
-1 Unknown - N/A None None Y
1 Private flight - N/A Y
*/
CREATE TABLE airports (
apid INTEGER,
name TEXT NOT NULL,
city TEXT,
country TEXT,
x REAL,
y REAL,
elevation BIGINT,
iata TEXT(3),
icao TEXT(4),
PRIMARY KEY (apid)
)
/*
2 rows from airports table:
apid name city country x y elevation iata icao
1 Goroka Airport Goroka Papua New Guinea 145.391998291 -6.081689834590001 5282 GKA AYGA
2 Madang Airport Madang Papua New Guinea 145.789001465 -5.20707988739 20 MAG AYMD
*/
CREATE TABLE routes (
rid INTEGER,
dst_apid INTEGER,
dst_ap VARCHAR(4),
src_apid BIGINT,
src_ap VARCHAR(4),
alid BIGINT,
airline VARCHAR(4),
codeshare TEXT,
PRIMARY KEY (rid),
FOREIGN KEY(dst_apid) REFERENCES airports (apid),
FOREIGN KEY(src_apid) REFERENCES airports (apid),
FOREIGN KEY(alid) REFERENCES airlines (alid)
)
/*
2 rows from routes table:
rid dst_apid dst_ap src_apid src_ap alid airline codeshare
37 2990 KZ 2965 AER 410 2B None
38 2990 KZ 2966 ASF 410 2B None
*/ | What are the cities with exactly two airports? | SELECT city FROM airports GROUP BY city HAVING count(*) = 2 | [{'city': 'Abilene'}, {'city': 'Adana'}, {'city': 'Addis Ababa'}, {'city': 'Adelaide'}, {'city': 'Ajaccio'}, {'city': 'Alamogordo'}, {'city': 'Amberley'}, {'city': 'Amman'}, {'city': 'Andersen'}, {'city': 'Araracuara'}, {'city': 'Ardmore'}, {'city': 'Argyle'}, {'city': 'Arlington'}, {'city': 'Austin'}, {'city': 'Bagan'}, {'city': 'Bahrain'}, {'city': 'Baltimore'}, {'city': 'Bandar Abbas'}, {'city': 'Bangalore'}, {'city': 'Bangkok'}, {'city': 'Baracoa Playa'}, {'city': 'Barcelona'}, {'city': 'Barrow Island'}, {'city': 'Basse Terre'}, {'city': 'Bathurst'}, {'city': 'Bauru'}, {'city': 'Beaumont'}, {'city': 'Bedford'}, {'city': 'Beijing'}, {'city': 'Belem'}, {'city': 'Belfast'}, {'city': 'Belo Horizonte'}, {'city': 'Birmingham'}, {'city': 'Bloemfontein'}, {'city': 'Bloomington'}, {'city': 'Boa Vista'}, {'city': 'Bodrum'}, {'city': 'Brest'}, {'city': 'Brisbane'}, {'city': 'Bristol'}, {'city': 'Bucharest'}, {'city': 'Budapest'}, {'city': 'Calgary'}, {'city': 'Camden'}, {'city': 'Campinas'}, {'city': 'Carlsbad'}, {'city': 'Celle'}, {'city': 'Chambery'}, {'city': 'Cincinnati'}, {'city': 'Clarksville'}, {'city': 'Clinton'}, {'city': 'Clovis'}, {'city': 'Cochrane'}, {'city': 'Cockburn Town'}, {'city': 'Cold Bay'}, {'city': 'Colmar'}, {'city': 'Colombo'}, {'city': 'Concord'}, {'city': 'Concordia'}, {'city': 'Copenhagen'}, {'city': 'Cordoba'}, {'city': 'Corpus Christi'}, {'city': 'Crestview'}, {'city': 'Curitiba'}, {'city': 'Cuxhaven'}, {'city': 'Danville'}, {'city': 'Deer Lake'}, {'city': 'Del Rio'}, {'city': 'Delhi'}, {'city': 'Derby'}, {'city': 'Dhaka'}, {'city': 'Dillingham'}, {'city': 'Doha'}, {'city': 'Dubai'}, {'city': 'Dublin'}, {'city': 'Durango'}, {'city': 'Durban'}, {'city': 'Edinburgh'}, {'city': 'Edmonton'}, {'city': 'El Calafate'}, {'city': 'El Paso'}, {'city': 'Elkhart'}, {'city': 'Ely'}, {'city': 'Esfahan'}, {'city': 'Essen'}, {'city': 'Eureka'}, {'city': 'Fairbanks'}, {'city': 'Faro'}, {'city': 'Fayetteville'}, {'city': 'Fes'}, {'city': 'Flagler'}, {'city': 'Florence'}, {'city': 'Flores'}, {'city': 'Fort Lauderdale'}, {'city': 'Fort Myers'}, {'city': 'Fort Smith'}, {'city': 'Fort Worth'}, {'city': 'Freetown'}, {'city': 'Futuna Island'}, {'city': 'Gainesville'}, {'city': 'Geraldton'}, {'city': 'Gothenborg'}, {'city': 'Granada'}, {'city': 'Grand Forks'}, {'city': 'Greenwood'}, {'city': 'Guantanamo'}, {'city': 'Guapiles'}, {'city': 'Halifax'}, {'city': 'Hamadan'}, {'city': 'Hamburg'}, {'city': 'Hampton'}, {'city': 'Hanoi'}, {'city': 'Harare'}, {'city': 'Harrisburg'}, {'city': 'Hayward'}, {'city': 'Hillsboro'}, {'city': 'Hiroshima'}, {'city': 'Hobart'}, {'city': 'Hong Kong'}, {'city': 'Hyderabad'}, {'city': 'Indianapolis'}, {'city': 'Isparta'}, {'city': 'Jamestown'}, {'city': 'Jasper'}, {'city': 'Jeddah'}, {'city': 'Kabul'}, {'city': 'Kamloops'}, {'city': 'Kansas City'}, {'city': 'Katowice'}, {'city': 'Kaunas'}, {'city': 'Kavala'}, {'city': 'Kazan'}, {'city': 'Kenora'}, {'city': 'Khabarovsk'}, {'city': 'Kinshasa'}, {'city': 'Klawock'}, {'city': 'Knoxville'}, {'city': 'Kochi'}, {'city': 'Komsomolsk-on-Amur'}, {'city': 'Kostroma'}, {'city': 'Krasnoyarsk'}, {'city': 'Kuala Lumpur'}, {'city': 'Kutahya'}, {'city': 'Kuwait'}, {'city': 'Kwajalein'}, {'city': 'La Paz'}, {'city': 'La Rochelle'}, {'city': 'Lafayette'}, {'city': 'Lahore'}, {'city': 'Lancaster'}, {'city': 'Lansing'}, {'city': 'Lanzhou'}, {'city': 'Laverton'}, {'city': 'Lawrence'}, {'city': 'Leeds'}, {'city': 'Leesburg'}, {'city': 'Leon'}, {'city': 'Lewiston'}, {'city': 'Lima'}, {'city': 'Lincoln'}, {'city': 'Linden'}, {'city': 'Linkoeping'}, {'city': 'Liverpool'}, {'city': 'Lompoc'}, {'city': 'Longview'}, {'city': 'Louisville'}, {'city': 'Lusaka'}, {'city': 'Lyon'}, {'city': 'Madison'}, {'city': 'Magadan'}, {'city': 'Makale'}, {'city': 'Malatya'}, {'city': 'Manaus'}, {'city': 'Manchester'}, {'city': 'Manzanillo'}, {'city': 'Maracaibo'}, {'city': 'Marathon'}, {'city': 'Marshall'}, {'city': 'Marshfield'}, {'city': 'Marysville'}, {'city': 'Maseru'}, {'city': 'Matsu Islands'}, {'city': 'Medan'}, {'city': 'Memphis'}, {'city': 'Merced'}, {'city': 'Merida'}, {'city': 'Mesa'}, {'city': 'Metz'}, {'city': 'Middelburg'}, {'city': 'Midland'}, {'city': 'Milano'}, {'city': 'Milwaukee'}, {'city': 'Minot'}, {'city': 'Minsk'}, {'city': 'Molokai'}, {'city': 'Monroe'}, {'city': 'Monrovia'}, {'city': 'Monterrey'}, {'city': 'Montevideo'}, {'city': 'Montgomery'}, {'city': 'Moroni'}, {'city': 'Morristown'}, {'city': 'Mount Pleasant'}, {'city': 'Mountain Home'}, {'city': 'Murcia'}, {'city': 'Murmansk'}, {'city': 'Nagoya'}, {'city': 'Nakhon Ratchasima'}, {'city': 'Nakhon Sawan'}, {'city': 'Nakhon Si Thammarat'}, {'city': 'Nanaimo'}, {'city': 'Nancy'}, {'city': 'Naples'}, {'city': 'Nassau'}, {'city': 'Naypyidaw'}, {'city': 'Nicoya'}, {'city': 'Nogales'}, {'city': 'Norfolk'}, {'city': 'Norrkoeping'}, {'city': 'Noumea'}, {'city': 'Ocana'}, {'city': 'Ogden'}, {'city': 'Olathe'}, {'city': 'Omaha'}, {'city': 'Omsk'}, {'city': 'Ontario'}, {'city': 'Orange'}, {'city': 'Oranjestad'}, {'city': 'Oriximina'}, {'city': 'Orlando'}, {'city': 'Orleans'}, {'city': 'Oslo'}, {'city': 'Padang'}, {'city': 'Palermo'}, {'city': 'Pemba'}, {'city': 'Pensacola'}, {'city': 'Perry'}, {'city': 'Peru'}, {'city': 'Peterborough'}, {'city': 'Petersburg'}, {'city': 'Petrozavodsk'}, {'city': 'Phetchabun'}, {'city': 'Pingtung'}, {'city': 'Pittsburgh'}, {'city': 'Plymouth'}, {'city': 'Port Angeles'}, {'city': 'Porto Alegre'}, {'city': 'Poznan'}, {'city': 'Princeton'}, {'city': 'Rapid City'}, {'city': 'Reims'}, {'city': 'Rhodos'}, {'city': 'Riyadh'}, {'city': 'Roi Et'}, {'city': 'Romblon'}, {'city': 'Rota'}, {'city': 'Salem'}, {'city': 'Salinas'}, {'city': 'Salt Lake City'}, {'city': 'Samana'}, {'city': 'Samara'}, {'city': 'San Fernando'}, {'city': 'San Juan'}, {'city': 'San Julian'}, {'city': 'San Salvador'}, {'city': 'San Sebastian'}, {'city': 'Sanliurfa'}, {'city': 'Santa Clara'}, {'city': 'Santa Fe'}, {'city': 'Santa Lucia'}, {'city': 'Santa Maria'}, {'city': 'Sapporo'}, {'city': 'Scranton'}, {'city': 'Seattle'}, {'city': 'Seoul'}, {'city': 'Severomorsk'}, {'city': 'Shanghai'}, {'city': 'Shenyang'}, {'city': 'Sidney'}, {'city': 'Sihanoukville'}, {'city': 'Sinop'}, {'city': 'Sovetskaya Gavan'}, {'city': 'St. Louis'}, {'city': 'St.-pierre'}, {'city': 'Stephenville'}, {'city': 'Szczecin'}, {'city': 'Tacoma'}, {'city': 'Taichung'}, {'city': 'Taipei'}, {'city': 'Tashkent'}, {'city': 'Tel-aviv'}, {'city': 'Tenerife'}, {'city': 'Tok'}, {'city': 'Toledo'}, {'city': 'Tonopah'}, {'city': 'Toowoomba'}, {'city': 'Topeka'}, {'city': 'Trenton'}, {'city': 'Treviso'}, {'city': 'Trinidad'}, {'city': 'Tripoli'}, {'city': 'Trujillo'}, {'city': 'Tulsa'}, {'city': 'Tuxtla Gutierrez'}, {'city': 'Ufa'}, {'city': 'Ulyanovsk'}, {'city': 'Uummannaq'}, {'city': 'Uvalde'}, {'city': 'Valdosta'}, {'city': 'Valencia'}, {'city': 'Verdun'}, {'city': 'Vitoria'}, {'city': 'Waco'}, {'city': 'Waterloo'}, {'city': 'Watertown'}, {'city': 'Wellington'}, {'city': 'West Palm Beach'}, {'city': 'Windhoek'}, {'city': 'Winnipeg'}, {'city': 'Yakutsk'}, {'city': 'Yaounde'}, {'city': 'Yekaterinburg'}, {'city': 'Yerevan'}, {'city': 'Zhytomyr'}] | Easy | false | false | false | false | false | true | true | false | false | false | false | false | false | [QUESTION]How many airports do we have?[/QUESTION]
[SQL]SELECT count(*) FROM AIRPORTS[/SQL] | [QUESTION]How many airports do we have?[/QUESTION]
[SQL]SELECT count(*) FROM AIRPORTS[/SQL] | [QUESTION]How many airports do we have?[/QUESTION]
[SQL]SELECT count(*) FROM AIRPORTS[/SQL] | [QUESTION]How many airports do we have?[/QUESTION]
[SQL]SELECT count(*) FROM AIRPORTS[/SQL] |
apartment_rentals |
CREATE TABLE "Apartment_Bookings" (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
FOREIGN KEY(apt_id) REFERENCES "Apartments" (apt_id),
FOREIGN KEY(guest_id) REFERENCES "Guests" (guest_id),
UNIQUE (apt_booking_id)
)
CREATE TABLE "Apartment_Buildings" (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
)
CREATE TABLE "Apartment_Facilities" (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY(apt_id) REFERENCES "Apartments" (apt_id)
)
CREATE TABLE "Apartments" (
apt_id INTEGER NOT NULL,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
FOREIGN KEY(building_id) REFERENCES "Apartment_Buildings" (building_id),
UNIQUE (apt_id)
)
CREATE TABLE "Guests" (
guest_id INTEGER NOT NULL,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
)
CREATE TABLE "View_Unit_Status" (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn NUMERIC,
PRIMARY KEY (status_date),
FOREIGN KEY(apt_id) REFERENCES "Apartments" (apt_id),
FOREIGN KEY(apt_booking_id) REFERENCES "Apartment_Bookings" (apt_booking_id)
) |
CREATE TABLE "Apartment_Bookings" (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
FOREIGN KEY(apt_id) REFERENCES "Apartments" (apt_id),
FOREIGN KEY(guest_id) REFERENCES "Guests" (guest_id),
UNIQUE (apt_booking_id)
)
/*
2 rows from Apartment_Bookings table:
apt_booking_id apt_id guest_id booking_status_code booking_start_date booking_end_date
258 10 2 Provisional 2016-09-26 17:13:49 2017-10-07 11:38:48
279 15 15 Provisional 2016-04-01 06:28:08 2017-10-25 11:08:42
*/
CREATE TABLE "Apartment_Buildings" (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
)
/*
2 rows from Apartment_Buildings table:
building_id building_short_name building_full_name building_description building_address building_manager building_phone
133 Normandie Court Normandie Court Studio 7950 Casper Vista Apt. 176
Marquiseberg, CA 70496 Emma (948)040-1064x387
153 Mercedes House Mercedes House Studio 354 Otto Villages
Charliefort, VT 71664 Brenden 915-617-2408x832
*/
CREATE TABLE "Apartment_Facilities" (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY(apt_id) REFERENCES "Apartments" (apt_id)
)
/*
2 rows from Apartment_Facilities table:
apt_id facility_code
1 Boardband
2 Boardband
*/
CREATE TABLE "Apartments" (
apt_id INTEGER NOT NULL,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
FOREIGN KEY(building_id) REFERENCES "Apartment_Buildings" (building_id),
UNIQUE (apt_id)
)
/*
2 rows from Apartments table:
apt_id building_id apt_type_code apt_number bathroom_count bedroom_count room_count
1 808 Flat Suite 645 1 3 7
2 624 Flat Apt. 585 2 4 5
*/
CREATE TABLE "Guests" (
guest_id INTEGER NOT NULL,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
)
/*
2 rows from Guests table:
guest_id gender_code guest_first_name guest_last_name date_of_birth
1 Male Kip DuBuque 1995-11-04 07:09:57
2 Unknown Rebeca Runolfsdottir 1974-05-12 21:53:58
*/
CREATE TABLE "View_Unit_Status" (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn NUMERIC,
PRIMARY KEY (status_date),
FOREIGN KEY(apt_id) REFERENCES "Apartments" (apt_id),
FOREIGN KEY(apt_booking_id) REFERENCES "Apartment_Bookings" (apt_booking_id)
)
/*
2 rows from View_Unit_Status table:
apt_id apt_booking_id status_date available_yn
11 920 1970-09-28 10:24:29 1.0000000000
15 575 1972-03-23 22:55:53 1.0000000000
*/ | Find the total number of rooms in the apartments that have facility code "Gym". | SELECT sum(T2.room_count) FROM Apartment_Facilities AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.facility_code = "Gym" | [{'sum(T2.room_count)': 15}] | Medium | false | false | false | false | false | false | false | true | false | false | false | false | false | [QUESTION]Find the number of classes offered for all class rooms that held at least 2 classes.[/QUESTION]
[SQL]SELECT count(*) , class_room FROM CLASS GROUP BY class_room HAVING count(*) >= 2[/SQL] | [QUESTION]Find the number of classes offered for all class rooms that held at least 2 classes.[/QUESTION]
[SQL]SELECT count(*) , class_room FROM CLASS GROUP BY class_room HAVING count(*) >= 2[/SQL] | [QUESTION]Find the number of classes offered for all class rooms that held at least 2 classes.[/QUESTION]
[SQL]SELECT count(*) , class_room FROM CLASS GROUP BY class_room HAVING count(*) >= 2[/SQL] | [QUESTION]Find the number of classes offered for all class rooms that held at least 2 classes.[/QUESTION]
[SQL]SELECT count(*) , class_room FROM CLASS GROUP BY class_room HAVING count(*) >= 2[/SQL] |
body_builder |
CREATE TABLE body_builder (
"Body_Builder_ID" INTEGER,
"People_ID" INTEGER,
"Snatch" REAL,
"Clean_Jerk" REAL,
"Total" REAL,
PRIMARY KEY ("Body_Builder_ID"),
FOREIGN KEY("People_ID") REFERENCES people ("People_ID")
)
CREATE TABLE people (
"People_ID" INTEGER,
"Name" TEXT,
"Height" REAL,
"Weight" REAL,
"Birth_Date" TEXT,
"Birth_Place" TEXT,
PRIMARY KEY ("People_ID")
) |
CREATE TABLE body_builder (
"Body_Builder_ID" INTEGER,
"People_ID" INTEGER,
"Snatch" REAL,
"Clean_Jerk" REAL,
"Total" REAL,
PRIMARY KEY ("Body_Builder_ID"),
FOREIGN KEY("People_ID") REFERENCES people ("People_ID")
)
/*
2 rows from body_builder table:
Body_Builder_ID People_ID Snatch Clean_Jerk Total
1 1 142.5 175.0 317.5
2 2 137.5 177.5 315.0
*/
CREATE TABLE people (
"People_ID" INTEGER,
"Name" TEXT,
"Height" REAL,
"Weight" REAL,
"Birth_Date" TEXT,
"Birth_Place" TEXT,
PRIMARY KEY ("People_ID")
)
/*
2 rows from people table:
People_ID Name Height Weight Birth_Date Birth_Place
1 Jack Campbell 182.0 80.0 January 1, 1992 Port Huron, Michigan
2 Ty Conklin 192.0 90.0 March 30, 1976 Anchorage, Alaska
*/ | How many persons are not body builders? | SELECT count(*) FROM people WHERE people_id NOT IN (SELECT People_ID FROM body_builder) | [{'count(*)': 1}] | Easy | false | false | false | false | false | false | false | false | false | false | false | false | false | ||||
car_1 |
CREATE TABLE car_makers (
"Id" INTEGER,
"Maker" TEXT,
"FullName" TEXT,
"Country" TEXT,
PRIMARY KEY ("Id"),
FOREIGN KEY("Country") REFERENCES countries ("CountryId")
)
CREATE TABLE car_names (
"MakeId" INTEGER,
"Model" TEXT,
"Make" TEXT,
PRIMARY KEY ("MakeId"),
FOREIGN KEY("Model") REFERENCES model_list ("Model")
)
CREATE TABLE cars_data (
"Id" INTEGER,
"MPG" TEXT,
"Cylinders" INTEGER,
"Edispl" REAL,
"Horsepower" TEXT,
"Weight" INTEGER,
"Accelerate" REAL,
"Year" INTEGER,
PRIMARY KEY ("Id"),
FOREIGN KEY("Id") REFERENCES car_names ("MakeId")
)
CREATE TABLE continents (
"ContId" INTEGER,
"Continent" TEXT,
PRIMARY KEY ("ContId")
)
CREATE TABLE countries (
"CountryId" INTEGER,
"CountryName" TEXT,
"Continent" INTEGER,
PRIMARY KEY ("CountryId"),
FOREIGN KEY("Continent") REFERENCES continents ("ContId")
)
CREATE TABLE model_list (
"ModelId" INTEGER,
"Maker" INTEGER,
"Model" TEXT,
PRIMARY KEY ("ModelId"),
FOREIGN KEY("Maker") REFERENCES car_makers ("Id"),
UNIQUE ("Model")
) |
CREATE TABLE car_makers (
"Id" INTEGER,
"Maker" TEXT,
"FullName" TEXT,
"Country" TEXT,
PRIMARY KEY ("Id"),
FOREIGN KEY("Country") REFERENCES countries ("CountryId")
)
/*
2 rows from car_makers table:
Id Maker FullName Country
1 amc American Motor Company 1
2 volkswagen Volkswagen 2
*/
CREATE TABLE car_names (
"MakeId" INTEGER,
"Model" TEXT,
"Make" TEXT,
PRIMARY KEY ("MakeId"),
FOREIGN KEY("Model") REFERENCES model_list ("Model")
)
/*
2 rows from car_names table:
MakeId Model Make
1 chevrolet chevrolet chevelle malibu
2 buick buick skylark 320
*/
CREATE TABLE cars_data (
"Id" INTEGER,
"MPG" TEXT,
"Cylinders" INTEGER,
"Edispl" REAL,
"Horsepower" TEXT,
"Weight" INTEGER,
"Accelerate" REAL,
"Year" INTEGER,
PRIMARY KEY ("Id"),
FOREIGN KEY("Id") REFERENCES car_names ("MakeId")
)
/*
2 rows from cars_data table:
Id MPG Cylinders Edispl Horsepower Weight Accelerate Year
1 18 8 307.0 130 3504 12.0 1970
2 15 8 350.0 165 3693 11.5 1970
*/
CREATE TABLE continents (
"ContId" INTEGER,
"Continent" TEXT,
PRIMARY KEY ("ContId")
)
/*
2 rows from continents table:
ContId Continent
1 america
2 europe
*/
CREATE TABLE countries (
"CountryId" INTEGER,
"CountryName" TEXT,
"Continent" INTEGER,
PRIMARY KEY ("CountryId"),
FOREIGN KEY("Continent") REFERENCES continents ("ContId")
)
/*
2 rows from countries table:
CountryId CountryName Continent
1 usa 1
2 germany 2
*/
CREATE TABLE model_list (
"ModelId" INTEGER,
"Maker" INTEGER,
"Model" TEXT,
PRIMARY KEY ("ModelId"),
FOREIGN KEY("Maker") REFERENCES car_makers ("Id"),
UNIQUE ("Model")
)
/*
2 rows from model_list table:
ModelId Maker Model
1 1 amc
2 2 audi
*/ | What is the car model with the highest mpg ? | SELECT t1.model FROM car_names AS t1 JOIN cars_data AS t2 ON t1.makeid = t2.id ORDER BY t2.mpg DESC LIMIT 1; | [{'Model': 'citroen'}] | Medium | false | false | false | true | true | false | false | true | false | false | false | false | false | [QUESTION]What is the maximum mpg of the cars that had 8 cylinders or that were produced before 1980 ?[/QUESTION]
[SQL]SELECT max(mpg) FROM cars_data WHERE cylinders = 8 OR YEAR < 1980[/SQL] | [QUESTION]What is the maximum mpg of the cars that had 8 cylinders or that were produced before 1980 ?[/QUESTION]
[SQL]SELECT max(mpg) FROM cars_data WHERE cylinders = 8 OR YEAR < 1980[/SQL] | [QUESTION]What is the maximum mpg of the cars that had 8 cylinders or that were produced before 1980 ?[/QUESTION]
[SQL]SELECT max(mpg) FROM cars_data WHERE cylinders = 8 OR YEAR < 1980[/SQL] | [QUESTION]What is the maximum mpg of the cars that had 8 cylinders or that were produced before 1980 ?[/QUESTION]
[SQL]SELECT max(mpg) FROM cars_data WHERE cylinders = 8 OR YEAR < 1980[/SQL] |
cre_Docs_and_Epenses |
CREATE TABLE "Accounts" (
"Account_ID" INTEGER NOT NULL,
"Statement_ID" INTEGER NOT NULL,
"Account_Details" VARCHAR(255),
PRIMARY KEY ("Account_ID"),
FOREIGN KEY("Statement_ID") REFERENCES "Statements" ("Statement_ID")
)
CREATE TABLE "Documents" (
"Document_ID" INTEGER NOT NULL,
"Document_Type_Code" CHAR(15) NOT NULL,
"Project_ID" INTEGER NOT NULL,
"Document_Date" DATETIME,
"Document_Name" VARCHAR(255),
"Document_Description" VARCHAR(255),
"Other_Details" VARCHAR(255),
PRIMARY KEY ("Document_ID"),
FOREIGN KEY("Document_Type_Code") REFERENCES "Ref_Document_Types" ("Document_Type_Code"),
FOREIGN KEY("Project_ID") REFERENCES "Projects" ("Project_ID")
)
CREATE TABLE "Documents_with_Expenses" (
"Document_ID" INTEGER NOT NULL,
"Budget_Type_Code" CHAR(15) NOT NULL,
"Document_Details" VARCHAR(255),
PRIMARY KEY ("Document_ID"),
FOREIGN KEY("Budget_Type_Code") REFERENCES "Ref_Budget_Codes" ("Budget_Type_Code"),
FOREIGN KEY("Document_ID") REFERENCES "Documents" ("Document_ID")
)
CREATE TABLE "Projects" (
"Project_ID" INTEGER NOT NULL,
"Project_Details" VARCHAR(255),
PRIMARY KEY ("Project_ID")
)
CREATE TABLE "Ref_Budget_Codes" (
"Budget_Type_Code" CHAR(15) NOT NULL,
"Budget_Type_Description" VARCHAR(255) NOT NULL,
PRIMARY KEY ("Budget_Type_Code")
)
CREATE TABLE "Ref_Document_Types" (
"Document_Type_Code" CHAR(15) NOT NULL,
"Document_Type_Name" VARCHAR(255) NOT NULL,
"Document_Type_Description" VARCHAR(255) NOT NULL,
PRIMARY KEY ("Document_Type_Code")
)
CREATE TABLE "Statements" (
"Statement_ID" INTEGER NOT NULL,
"Statement_Details" VARCHAR(255),
PRIMARY KEY ("Statement_ID"),
FOREIGN KEY("Statement_ID") REFERENCES "Documents" ("Document_ID")
) |
CREATE TABLE "Accounts" (
"Account_ID" INTEGER NOT NULL,
"Statement_ID" INTEGER NOT NULL,
"Account_Details" VARCHAR(255),
PRIMARY KEY ("Account_ID"),
FOREIGN KEY("Statement_ID") REFERENCES "Statements" ("Statement_ID")
)
/*
2 rows from Accounts table:
Account_ID Statement_ID Account_Details
7 57 495.063
61 57 930.14
*/
CREATE TABLE "Documents" (
"Document_ID" INTEGER NOT NULL,
"Document_Type_Code" CHAR(15) NOT NULL,
"Project_ID" INTEGER NOT NULL,
"Document_Date" DATETIME,
"Document_Name" VARCHAR(255),
"Document_Description" VARCHAR(255),
"Other_Details" VARCHAR(255),
PRIMARY KEY ("Document_ID"),
FOREIGN KEY("Document_Type_Code") REFERENCES "Ref_Document_Types" ("Document_Type_Code"),
FOREIGN KEY("Project_ID") REFERENCES "Projects" ("Project_ID")
)
/*
2 rows from Documents table:
Document_ID Document_Type_Code Project_ID Document_Date Document_Name Document_Description Other_Details
29 CV 30 2004-08-28 06:59:19 Review on UK files None None
42 BK 105 2012-12-27 19:09:18 Review on Canadian files None None
*/
CREATE TABLE "Documents_with_Expenses" (
"Document_ID" INTEGER NOT NULL,
"Budget_Type_Code" CHAR(15) NOT NULL,
"Document_Details" VARCHAR(255),
PRIMARY KEY ("Document_ID"),
FOREIGN KEY("Budget_Type_Code") REFERENCES "Ref_Budget_Codes" ("Budget_Type_Code"),
FOREIGN KEY("Document_ID") REFERENCES "Documents" ("Document_ID")
)
/*
2 rows from Documents_with_Expenses table:
Document_ID Budget_Type_Code Document_Details
57 GV government
192 GV government
*/
CREATE TABLE "Projects" (
"Project_ID" INTEGER NOT NULL,
"Project_Details" VARCHAR(255),
PRIMARY KEY ("Project_ID")
)
/*
2 rows from Projects table:
Project_ID Project_Details
30 Society Research project
35 Internet of Things project
*/
CREATE TABLE "Ref_Budget_Codes" (
"Budget_Type_Code" CHAR(15) NOT NULL,
"Budget_Type_Description" VARCHAR(255) NOT NULL,
PRIMARY KEY ("Budget_Type_Code")
)
/*
2 rows from Ref_Budget_Codes table:
Budget_Type_Code Budget_Type_Description
GV Government
ORG Organisation
*/
CREATE TABLE "Ref_Document_Types" (
"Document_Type_Code" CHAR(15) NOT NULL,
"Document_Type_Name" VARCHAR(255) NOT NULL,
"Document_Type_Description" VARCHAR(255) NOT NULL,
PRIMARY KEY ("Document_Type_Code")
)
/*
2 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
BK Book excellent
CV CV excellent
*/
CREATE TABLE "Statements" (
"Statement_ID" INTEGER NOT NULL,
"Statement_Details" VARCHAR(255),
PRIMARY KEY ("Statement_ID"),
FOREIGN KEY("Statement_ID") REFERENCES "Documents" ("Document_ID")
)
/*
2 rows from Statements table:
Statement_ID Statement_Details
57 Open Project
192 Private Project
*/ | Give the ids of documents with expenses that have the budget code 'SF'. | SELECT document_id FROM Documents_with_expenses WHERE budget_type_code = 'SF' | [{'Document_ID': 309}, {'Document_ID': 367}] | Easy | false | false | false | false | false | false | false | false | false | false | false | false | false | ||||
gas_company |
CREATE TABLE company (
"Company_ID" INTEGER,
"Rank" INTEGER,
"Company" TEXT,
"Headquarters" TEXT,
"Main_Industry" TEXT,
"Sales_billion" REAL,
"Profits_billion" REAL,
"Assets_billion" REAL,
"Market_Value" REAL,
PRIMARY KEY ("Company_ID")
)
CREATE TABLE gas_station (
"Station_ID" INTEGER,
"Open_Year" INTEGER,
"Location" TEXT,
"Manager_Name" TEXT,
"Vice_Manager_Name" TEXT,
"Representative_Name" TEXT,
PRIMARY KEY ("Station_ID")
)
CREATE TABLE station_company (
"Station_ID" INTEGER,
"Company_ID" INTEGER,
"Rank_of_the_Year" INTEGER,
PRIMARY KEY ("Station_ID", "Company_ID"),
FOREIGN KEY("Company_ID") REFERENCES company ("Company_ID"),
FOREIGN KEY("Station_ID") REFERENCES gas_station ("Station_ID")
) |
CREATE TABLE company (
"Company_ID" INTEGER,
"Rank" INTEGER,
"Company" TEXT,
"Headquarters" TEXT,
"Main_Industry" TEXT,
"Sales_billion" REAL,
"Profits_billion" REAL,
"Assets_billion" REAL,
"Market_Value" REAL,
PRIMARY KEY ("Company_ID")
)
/*
2 rows from company table:
Company_ID Rank Company Headquarters Main_Industry Sales_billion Profits_billion Assets_billion Market_Value
1 1 ExxonMobil USA Oil and gas 433.5 41.1 331.1 407.4
2 3 General Electric USA Conglomerate 147.3 14.2 717.2 213.7
*/
CREATE TABLE gas_station (
"Station_ID" INTEGER,
"Open_Year" INTEGER,
"Location" TEXT,
"Manager_Name" TEXT,
"Vice_Manager_Name" TEXT,
"Representative_Name" TEXT,
PRIMARY KEY ("Station_ID")
)
/*
2 rows from gas_station table:
Station_ID Open_Year Location Manager_Name Vice_Manager_Name Representative_Name
1 1998 Herne Hill BrianWingrave Russell Denman Clive Burr
2 1999 Channel Hill SimonMarloe Russell Brown Rob Jefferies
*/
CREATE TABLE station_company (
"Station_ID" INTEGER,
"Company_ID" INTEGER,
"Rank_of_the_Year" INTEGER,
PRIMARY KEY ("Station_ID", "Company_ID"),
FOREIGN KEY("Company_ID") REFERENCES company ("Company_ID"),
FOREIGN KEY("Station_ID") REFERENCES gas_station ("Station_ID")
)
/*
2 rows from station_company table:
Station_ID Company_ID Rank_of_the_Year
11 1 1
1 3 2
*/ | What is the total number of companies? | SELECT count(*) FROM company | [{'count(*)': 10}] | Easy | false | false | false | false | false | false | false | false | false | false | false | false | false | [QUESTION]What is the number of employees?[/QUESTION]
[SQL]SELECT count(*) FROM Employee[/SQL] | [QUESTION]What is the number of employees?[/QUESTION]
[SQL]SELECT count(*) FROM Employee[/SQL] | [QUESTION]What is the number of employees?[/QUESTION]
[SQL]SELECT count(*) FROM Employee[/SQL] | [QUESTION]What is the number of employees?[/QUESTION]
[SQL]SELECT count(*) FROM Employee[/SQL] |
soccer_1 |
CREATE TABLE "Country" (
id INTEGER,
name TEXT,
PRIMARY KEY (id)
)
CREATE TABLE "League" (
id INTEGER,
country_id INTEGER,
name TEXT,
PRIMARY KEY (id),
FOREIGN KEY(country_id) REFERENCES "Country" (id)
)
CREATE TABLE "Player" (
id INTEGER,
player_api_id INTEGER,
player_name TEXT,
player_fifa_api_id INTEGER,
birthday TEXT,
height INTEGER,
weight INTEGER,
PRIMARY KEY (id)
)
CREATE TABLE "Player_Attributes" (
id INTEGER,
player_fifa_api_id INTEGER,
player_api_id INTEGER,
date TEXT,
overall_rating INTEGER,
potential INTEGER,
preferred_foot TEXT,
attacking_work_rate TEXT,
defensive_work_rate TEXT,
crossing INTEGER,
finishing INTEGER,
heading_accuracy INTEGER,
short_passing INTEGER,
volleys INTEGER,
dribbling INTEGER,
curve INTEGER,
free_kick_accuracy INTEGER,
long_passing INTEGER,
ball_control INTEGER,
acceleration INTEGER,
sprint_speed INTEGER,
agility INTEGER,
reactions INTEGER,
balance INTEGER,
shot_power INTEGER,
jumping INTEGER,
stamina INTEGER,
strength INTEGER,
long_shots INTEGER,
aggression INTEGER,
interceptions INTEGER,
positioning INTEGER,
vision INTEGER,
penalties INTEGER,
marking INTEGER,
standing_tackle INTEGER,
sliding_tackle INTEGER,
gk_diving INTEGER,
gk_handling INTEGER,
gk_kicking INTEGER,
gk_positioning INTEGER,
gk_reflexes INTEGER,
PRIMARY KEY (id),
FOREIGN KEY(player_api_id) REFERENCES "Player" (player_api_id),
FOREIGN KEY(player_fifa_api_id) REFERENCES "Player" (player_fifa_api_id)
)
CREATE TABLE "Team" (
id INTEGER,
team_api_id INTEGER,
team_fifa_api_id INTEGER,
team_long_name TEXT,
team_short_name TEXT,
PRIMARY KEY (id)
)
CREATE TABLE "Team_Attributes" (
id INTEGER,
team_fifa_api_id INTEGER,
team_api_id INTEGER,
date TEXT,
"buildUpPlaySpeed" INTEGER,
"buildUpPlaySpeedClass" TEXT,
"buildUpPlayDribbling" INTEGER,
"buildUpPlayDribblingClass" TEXT,
"buildUpPlayPassing" INTEGER,
"buildUpPlayPassingClass" TEXT,
"buildUpPlayPositioningClass" TEXT,
"chanceCreationPassing" INTEGER,
"chanceCreationPassingClass" TEXT,
"chanceCreationCrossing" INTEGER,
"chanceCreationCrossingClass" TEXT,
"chanceCreationShooting" INTEGER,
"chanceCreationShootingClass" TEXT,
"chanceCreationPositioningClass" TEXT,
"defencePressure" INTEGER,
"defencePressureClass" TEXT,
"defenceAggression" INTEGER,
"defenceAggressionClass" TEXT,
"defenceTeamWidth" INTEGER,
"defenceTeamWidthClass" TEXT,
"defenceDefenderLineClass" TEXT,
PRIMARY KEY (id),
FOREIGN KEY(team_api_id) REFERENCES "Team" (team_api_id),
FOREIGN KEY(team_fifa_api_id) REFERENCES "Team" (team_fifa_api_id)
) |
CREATE TABLE "Country" (
id INTEGER,
name TEXT,
PRIMARY KEY (id)
)
/*
2 rows from Country table:
id name
1 Belgium
1729 England
*/
CREATE TABLE "League" (
id INTEGER,
country_id INTEGER,
name TEXT,
PRIMARY KEY (id),
FOREIGN KEY(country_id) REFERENCES "Country" (id)
)
/*
2 rows from League table:
id country_id name
1 1 Belgium Jupiler League
1729 1729 England Premier League
*/
CREATE TABLE "Player" (
id INTEGER,
player_api_id INTEGER,
player_name TEXT,
player_fifa_api_id INTEGER,
birthday TEXT,
height INTEGER,
weight INTEGER,
PRIMARY KEY (id)
)
/*
2 rows from Player table:
id player_api_id player_name player_fifa_api_id birthday height weight
1 505942 Aaron Appindangoye 218353 1992-02-29 00:00:00 182.88 187
2 155782 Aaron Cresswell 189615 1989-12-15 00:00:00 170.18 146
*/
CREATE TABLE "Player_Attributes" (
id INTEGER,
player_fifa_api_id INTEGER,
player_api_id INTEGER,
date TEXT,
overall_rating INTEGER,
potential INTEGER,
preferred_foot TEXT,
attacking_work_rate TEXT,
defensive_work_rate TEXT,
crossing INTEGER,
finishing INTEGER,
heading_accuracy INTEGER,
short_passing INTEGER,
volleys INTEGER,
dribbling INTEGER,
curve INTEGER,
free_kick_accuracy INTEGER,
long_passing INTEGER,
ball_control INTEGER,
acceleration INTEGER,
sprint_speed INTEGER,
agility INTEGER,
reactions INTEGER,
balance INTEGER,
shot_power INTEGER,
jumping INTEGER,
stamina INTEGER,
strength INTEGER,
long_shots INTEGER,
aggression INTEGER,
interceptions INTEGER,
positioning INTEGER,
vision INTEGER,
penalties INTEGER,
marking INTEGER,
standing_tackle INTEGER,
sliding_tackle INTEGER,
gk_diving INTEGER,
gk_handling INTEGER,
gk_kicking INTEGER,
gk_positioning INTEGER,
gk_reflexes INTEGER,
PRIMARY KEY (id),
FOREIGN KEY(player_api_id) REFERENCES "Player" (player_api_id),
FOREIGN KEY(player_fifa_api_id) REFERENCES "Player" (player_fifa_api_id)
)
/*
2 rows from Player_Attributes table:
id player_fifa_api_id player_api_id date overall_rating potential preferred_foot attacking_work_rate defensive_work_rate crossing finishing heading_accuracy short_passing volleys dribbling curve free_kick_accuracy long_passing ball_control acceleration sprint_speed agility reactions balance shot_power jumping stamina strength long_shots aggression interceptions positioning vision penalties marking standing_tackle sliding_tackle gk_diving gk_handling gk_kicking gk_positioning gk_reflexes
1 218353 505942 2016-02-18 00:00:00 67 71 right medium medium 49 44 71 61 44 51 45 39 64 49 60 64 59 47 65 55 58 54 76 35 71 70 45 54 48 65 69 69 6 11 10 8 8
2 218353 505942 2015-11-19 00:00:00 67 71 right medium medium 49 44 71 61 44 51 45 39 64 49 60 64 59 47 65 55 58 54 76 35 71 70 45 54 48 65 69 69 6 11 10 8 8
*/
CREATE TABLE "Team" (
id INTEGER,
team_api_id INTEGER,
team_fifa_api_id INTEGER,
team_long_name TEXT,
team_short_name TEXT,
PRIMARY KEY (id)
)
/*
2 rows from Team table:
id team_api_id team_fifa_api_id team_long_name team_short_name
1 9987 673 KRC Genk GEN
2 9993 675 Beerschot AC BAC
*/
CREATE TABLE "Team_Attributes" (
id INTEGER,
team_fifa_api_id INTEGER,
team_api_id INTEGER,
date TEXT,
"buildUpPlaySpeed" INTEGER,
"buildUpPlaySpeedClass" TEXT,
"buildUpPlayDribbling" INTEGER,
"buildUpPlayDribblingClass" TEXT,
"buildUpPlayPassing" INTEGER,
"buildUpPlayPassingClass" TEXT,
"buildUpPlayPositioningClass" TEXT,
"chanceCreationPassing" INTEGER,
"chanceCreationPassingClass" TEXT,
"chanceCreationCrossing" INTEGER,
"chanceCreationCrossingClass" TEXT,
"chanceCreationShooting" INTEGER,
"chanceCreationShootingClass" TEXT,
"chanceCreationPositioningClass" TEXT,
"defencePressure" INTEGER,
"defencePressureClass" TEXT,
"defenceAggression" INTEGER,
"defenceAggressionClass" TEXT,
"defenceTeamWidth" INTEGER,
"defenceTeamWidthClass" TEXT,
"defenceDefenderLineClass" TEXT,
PRIMARY KEY (id),
FOREIGN KEY(team_api_id) REFERENCES "Team" (team_api_id),
FOREIGN KEY(team_fifa_api_id) REFERENCES "Team" (team_fifa_api_id)
)
/*
2 rows from Team_Attributes table:
id team_fifa_api_id team_api_id date buildUpPlaySpeed buildUpPlaySpeedClass buildUpPlayDribbling buildUpPlayDribblingClass buildUpPlayPassing buildUpPlayPassingClass buildUpPlayPositioningClass chanceCreationPassing chanceCreationPassingClass chanceCreationCrossing chanceCreationCrossingClass chanceCreationShooting chanceCreationShootingClass chanceCreationPositioningClass defencePressure defencePressureClass defenceAggression defenceAggressionClass defenceTeamWidth defenceTeamWidthClass defenceDefenderLineClass
1 434 9930 2010-02-22 00:00:00 60 Balanced None Little 50 Mixed Organised 60 Normal 65 Normal 55 Normal Organised 50 Medium 55 Press 45 Normal Cover
2 434 9930 2014-09-19 00:00:00 52 Balanced 48 Normal 56 Mixed Organised 54 Normal 63 Normal 64 Normal Organised 47 Medium 44 Press 54 Normal Cover
*/ | Of all players with an overall rating greater than 80, how many are right-footed and left-footed? | SELECT preferred_foot , count(*) FROM Player_Attributes WHERE overall_rating > 80 GROUP BY preferred_foot | [{'preferred_foot': 'left', 'count(*)': 1606}, {'preferred_foot': 'right', 'count(*)': 5955}] | Easy | false | false | false | false | false | true | false | false | false | false | false | false | false | [QUESTION]What are the first name and last name of the players who have weight above 220 or height below 75?[/QUESTION]
[SQL]SELECT name_first , name_last FROM player WHERE weight > 220 OR height < 75[/SQL] | [QUESTION]What are the first name and last name of the players who have weight above 220 or height below 75?[/QUESTION]
[SQL]SELECT name_first , name_last FROM player WHERE weight > 220 OR height < 75[/SQL] | [QUESTION]What are the first name and last name of the players who have weight above 220 or height below 75?[/QUESTION]
[SQL]SELECT name_first , name_last FROM player WHERE weight > 220 OR height < 75[/SQL] |
|
student_1 |
CREATE TABLE list (
"LastName" TEXT,
"FirstName" TEXT,
"Grade" INTEGER,
"Classroom" INTEGER,
PRIMARY KEY ("LastName", "FirstName")
)
CREATE TABLE teachers (
"LastName" TEXT,
"FirstName" TEXT,
"Classroom" INTEGER,
PRIMARY KEY ("LastName", "FirstName")
) |
CREATE TABLE list (
"LastName" TEXT,
"FirstName" TEXT,
"Grade" INTEGER,
"Classroom" INTEGER,
PRIMARY KEY ("LastName", "FirstName")
)
/*
2 rows from list table:
LastName FirstName Grade Classroom
CAR MAUDE 2 101
KRISTENSEN STORMY 6 112
*/
CREATE TABLE teachers (
"LastName" TEXT,
"FirstName" TEXT,
"Classroom" INTEGER,
PRIMARY KEY ("LastName", "FirstName")
)
/*
2 rows from teachers table:
LastName FirstName Classroom
MACROSTIE MIN 101
COVIN JEROME 102
*/ | Find the last names of all the teachers that teach GELL TAMI. | SELECT T2.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.firstname = "GELL" AND T1.lastname = "TAMI" | [{'Nenhum': 'Nenhum resultado encontrado'}] | Medium | false | false | false | false | false | false | false | true | false | false | false | false | false | [QUESTION]List the names of teachers in ascending order of age.[/QUESTION]
[SQL]SELECT Name FROM teacher ORDER BY Age ASC[/SQL] | [QUESTION]List the names of teachers in ascending order of age.[/QUESTION]
[SQL]SELECT Name FROM teacher ORDER BY Age ASC[/SQL] | [QUESTION]List the names of teachers in ascending order of age.[/QUESTION]
[SQL]SELECT Name FROM teacher ORDER BY Age ASC[/SQL] |
|
race_track |
CREATE TABLE race (
"Race_ID" INTEGER,
"Name" TEXT,
"Class" TEXT,
"Date" TEXT,
"Track_ID" TEXT,
PRIMARY KEY ("Race_ID"),
FOREIGN KEY("Track_ID") REFERENCES track ("Track_ID")
)
CREATE TABLE track (
"Track_ID" INTEGER,
"Name" TEXT,
"Location" TEXT,
"Seating" REAL,
"Year_Opened" REAL,
PRIMARY KEY ("Track_ID")
) |
CREATE TABLE race (
"Race_ID" INTEGER,
"Name" TEXT,
"Class" TEXT,
"Date" TEXT,
"Track_ID" TEXT,
PRIMARY KEY ("Race_ID"),
FOREIGN KEY("Track_ID") REFERENCES track ("Track_ID")
)
/*
2 rows from race table:
Race_ID Name Class Date Track_ID
1 Rolex 24 At Daytona DP/GT January 26 January 27 1
2 Gainsco Grand Prix of Miami DP/GT March 29 2
*/
CREATE TABLE track (
"Track_ID" INTEGER,
"Name" TEXT,
"Location" TEXT,
"Seating" REAL,
"Year_Opened" REAL,
PRIMARY KEY ("Track_ID")
)
/*
2 rows from track table:
Track_ID Name Location Seating Year_Opened
1 Auto Club Speedway Fontana, CA 92000.0 1997.0
2 Chicagoland Speedway Joliet, IL 75000.0 2001.0
*/ | How many races are there? | SELECT count(*) FROM race | [{'count(*)': 7}] | Easy | false | false | false | false | false | false | false | false | false | false | false | false | false | [QUESTION]How many distinct nationalities are there?[/QUESTION]
[SQL]SELECT count(DISTINCT Nationality) FROM people[/SQL] | [QUESTION]How many distinct nationalities are there?[/QUESTION]
[SQL]SELECT count(DISTINCT Nationality) FROM people[/SQL] | [QUESTION]How many distinct nationalities are there?[/QUESTION]
[SQL]SELECT count(DISTINCT Nationality) FROM people[/SQL] | [QUESTION]How many distinct nationalities are there?[/QUESTION]
[SQL]SELECT count(DISTINCT Nationality) FROM people[/SQL] |
chinook_1 |
CREATE TABLE "Album" (
"AlbumId" INTEGER NOT NULL,
"Title" VARCHAR(160) NOT NULL,
"ArtistId" INTEGER NOT NULL,
PRIMARY KEY ("AlbumId"),
FOREIGN KEY("ArtistId") REFERENCES "Artist" ("ArtistId")
)
CREATE TABLE "Artist" (
"ArtistId" INTEGER NOT NULL,
"Name" VARCHAR(120) DEFAULT NULL,
PRIMARY KEY ("ArtistId")
)
CREATE TABLE "Customer" (
"CustomerId" INTEGER NOT NULL,
"FirstName" VARCHAR(40) NOT NULL,
"LastName" VARCHAR(20) NOT NULL,
"Company" VARCHAR(80) DEFAULT NULL,
"Address" VARCHAR(70) DEFAULT NULL,
"City" VARCHAR(40) DEFAULT NULL,
"State" VARCHAR(40) DEFAULT NULL,
"Country" VARCHAR(40) DEFAULT NULL,
"PostalCode" VARCHAR(10) DEFAULT NULL,
"Phone" VARCHAR(24) DEFAULT NULL,
"Fax" VARCHAR(24) DEFAULT NULL,
"Email" VARCHAR(60) NOT NULL,
"SupportRepId" INTEGER DEFAULT NULL,
PRIMARY KEY ("CustomerId"),
FOREIGN KEY("SupportRepId") REFERENCES "Employee" ("EmployeeId")
)
CREATE TABLE "Employee" (
"EmployeeId" INTEGER NOT NULL,
"LastName" VARCHAR(20) NOT NULL,
"FirstName" VARCHAR(20) NOT NULL,
"Title" VARCHAR(30) DEFAULT NULL,
"ReportsTo" INTEGER DEFAULT NULL,
"BirthDate" DATETIME DEFAULT NULL,
"HireDate" DATETIME DEFAULT NULL,
"Address" VARCHAR(70) DEFAULT NULL,
"City" VARCHAR(40) DEFAULT NULL,
"State" VARCHAR(40) DEFAULT NULL,
"Country" VARCHAR(40) DEFAULT NULL,
"PostalCode" VARCHAR(10) DEFAULT NULL,
"Phone" VARCHAR(24) DEFAULT NULL,
"Fax" VARCHAR(24) DEFAULT NULL,
"Email" VARCHAR(60) DEFAULT NULL,
PRIMARY KEY ("EmployeeId"),
FOREIGN KEY("ReportsTo") REFERENCES "Employee" ("EmployeeId")
)
CREATE TABLE "Genre" (
"GenreId" INTEGER NOT NULL,
"Name" VARCHAR(120) DEFAULT NULL,
PRIMARY KEY ("GenreId")
)
CREATE TABLE "Invoice" (
"InvoiceId" INTEGER NOT NULL,
"CustomerId" INTEGER NOT NULL,
"InvoiceDate" DATETIME NOT NULL,
"BillingAddress" VARCHAR(70) DEFAULT NULL,
"BillingCity" VARCHAR(40) DEFAULT NULL,
"BillingState" VARCHAR(40) DEFAULT NULL,
"BillingCountry" VARCHAR(40) DEFAULT NULL,
"BillingPostalCode" VARCHAR(10) DEFAULT NULL,
"Total" DECIMAL(10, 2) NOT NULL,
PRIMARY KEY ("InvoiceId"),
FOREIGN KEY("CustomerId") REFERENCES "Customer" ("CustomerId")
)
CREATE TABLE "InvoiceLine" (
"InvoiceLineId" INTEGER NOT NULL,
"InvoiceId" INTEGER NOT NULL,
"TrackId" INTEGER NOT NULL,
"UnitPrice" DECIMAL(10, 2) NOT NULL,
"Quantity" INTEGER NOT NULL,
PRIMARY KEY ("InvoiceLineId"),
FOREIGN KEY("TrackId") REFERENCES "Track" ("TrackId"),
FOREIGN KEY("InvoiceId") REFERENCES "Invoice" ("InvoiceId")
)
CREATE TABLE "MediaType" (
"MediaTypeId" INTEGER NOT NULL,
"Name" VARCHAR(120) DEFAULT NULL,
PRIMARY KEY ("MediaTypeId")
)
CREATE TABLE "Playlist" (
"PlaylistId" INTEGER NOT NULL,
"Name" VARCHAR(120) DEFAULT NULL,
PRIMARY KEY ("PlaylistId")
)
CREATE TABLE "PlaylistTrack" (
"PlaylistId" INTEGER NOT NULL,
"TrackId" INTEGER NOT NULL,
PRIMARY KEY ("PlaylistId", "TrackId"),
FOREIGN KEY("TrackId") REFERENCES "Track" ("TrackId"),
FOREIGN KEY("PlaylistId") REFERENCES "Playlist" ("PlaylistId")
)
CREATE TABLE "Track" (
"TrackId" INTEGER NOT NULL,
"Name" VARCHAR(200) NOT NULL,
"AlbumId" INTEGER DEFAULT NULL,
"MediaTypeId" INTEGER NOT NULL,
"GenreId" INTEGER DEFAULT NULL,
"Composer" VARCHAR(220) DEFAULT NULL,
"Milliseconds" INTEGER NOT NULL,
"Bytes" INTEGER DEFAULT NULL,
"UnitPrice" DECIMAL(10, 2) NOT NULL,
PRIMARY KEY ("TrackId"),
FOREIGN KEY("MediaTypeId") REFERENCES "MediaType" ("MediaTypeId"),
FOREIGN KEY("GenreId") REFERENCES "Genre" ("GenreId"),
FOREIGN KEY("AlbumId") REFERENCES "Album" ("AlbumId")
) |
CREATE TABLE "Album" (
"AlbumId" INTEGER NOT NULL,
"Title" VARCHAR(160) NOT NULL,
"ArtistId" INTEGER NOT NULL,
PRIMARY KEY ("AlbumId"),
FOREIGN KEY("ArtistId") REFERENCES "Artist" ("ArtistId")
)
/*
2 rows from Album table:
AlbumId Title ArtistId
1 For Those About To Rock We Salute You 1
2 Balls to the Wall 2
*/
CREATE TABLE "Artist" (
"ArtistId" INTEGER NOT NULL,
"Name" VARCHAR(120) DEFAULT NULL,
PRIMARY KEY ("ArtistId")
)
/*
2 rows from Artist table:
ArtistId Name
1 AC/DC
2 Accept
*/
CREATE TABLE "Customer" (
"CustomerId" INTEGER NOT NULL,
"FirstName" VARCHAR(40) NOT NULL,
"LastName" VARCHAR(20) NOT NULL,
"Company" VARCHAR(80) DEFAULT NULL,
"Address" VARCHAR(70) DEFAULT NULL,
"City" VARCHAR(40) DEFAULT NULL,
"State" VARCHAR(40) DEFAULT NULL,
"Country" VARCHAR(40) DEFAULT NULL,
"PostalCode" VARCHAR(10) DEFAULT NULL,
"Phone" VARCHAR(24) DEFAULT NULL,
"Fax" VARCHAR(24) DEFAULT NULL,
"Email" VARCHAR(60) NOT NULL,
"SupportRepId" INTEGER DEFAULT NULL,
PRIMARY KEY ("CustomerId"),
FOREIGN KEY("SupportRepId") REFERENCES "Employee" ("EmployeeId")
)
/*
2 rows from Customer table:
CustomerId FirstName LastName Company Address City State Country PostalCode Phone Fax Email SupportRepId
1 Luís Gonçalves Embraer - Empresa Brasileira de Aeronáutica S.A. Av. Brigadeiro Faria Lima, 2170 São José dos Campos SP Brazil 12227-000 +55 (12) 3923-5555 +55 (12) 3923-5566 [email protected] 3
2 Leonie Köhler None Theodor-Heuss-Straße 34 Stuttgart None Germany 70174 +49 0711 2842222 None [email protected] 5
*/
CREATE TABLE "Employee" (
"EmployeeId" INTEGER NOT NULL,
"LastName" VARCHAR(20) NOT NULL,
"FirstName" VARCHAR(20) NOT NULL,
"Title" VARCHAR(30) DEFAULT NULL,
"ReportsTo" INTEGER DEFAULT NULL,
"BirthDate" DATETIME DEFAULT NULL,
"HireDate" DATETIME DEFAULT NULL,
"Address" VARCHAR(70) DEFAULT NULL,
"City" VARCHAR(40) DEFAULT NULL,
"State" VARCHAR(40) DEFAULT NULL,
"Country" VARCHAR(40) DEFAULT NULL,
"PostalCode" VARCHAR(10) DEFAULT NULL,
"Phone" VARCHAR(24) DEFAULT NULL,
"Fax" VARCHAR(24) DEFAULT NULL,
"Email" VARCHAR(60) DEFAULT NULL,
PRIMARY KEY ("EmployeeId"),
FOREIGN KEY("ReportsTo") REFERENCES "Employee" ("EmployeeId")
)
/*
2 rows from Employee table:
EmployeeId LastName FirstName Title ReportsTo BirthDate HireDate Address City State Country PostalCode Phone Fax Email
1 Adams Andrew General Manager None 1962-02-18 00:00:00 2002-08-14 00:00:00 11120 Jasper Ave NW Edmonton AB Canada T5K 2N1 +1 (780) 428-9482 +1 (780) 428-3457 [email protected]
2 Edwards Nancy Sales Manager 1 1958-12-08 00:00:00 2002-05-01 00:00:00 825 8 Ave SW Calgary AB Canada T2P 2T3 +1 (403) 262-3443 +1 (403) 262-3322 [email protected]
*/
CREATE TABLE "Genre" (
"GenreId" INTEGER NOT NULL,
"Name" VARCHAR(120) DEFAULT NULL,
PRIMARY KEY ("GenreId")
)
/*
2 rows from Genre table:
GenreId Name
1 Rock
2 Jazz
*/
CREATE TABLE "Invoice" (
"InvoiceId" INTEGER NOT NULL,
"CustomerId" INTEGER NOT NULL,
"InvoiceDate" DATETIME NOT NULL,
"BillingAddress" VARCHAR(70) DEFAULT NULL,
"BillingCity" VARCHAR(40) DEFAULT NULL,
"BillingState" VARCHAR(40) DEFAULT NULL,
"BillingCountry" VARCHAR(40) DEFAULT NULL,
"BillingPostalCode" VARCHAR(10) DEFAULT NULL,
"Total" DECIMAL(10, 2) NOT NULL,
PRIMARY KEY ("InvoiceId"),
FOREIGN KEY("CustomerId") REFERENCES "Customer" ("CustomerId")
)
/*
2 rows from Invoice table:
InvoiceId CustomerId InvoiceDate BillingAddress BillingCity BillingState BillingCountry BillingPostalCode Total
1 2 2009-01-01 00:00:00 Theodor-Heuss-Straße 34 Stuttgart None Germany 70174 1.98
2 4 2009-01-02 00:00:00 Ullevålsveien 14 Oslo None Norway 0171 3.96
*/
CREATE TABLE "InvoiceLine" (
"InvoiceLineId" INTEGER NOT NULL,
"InvoiceId" INTEGER NOT NULL,
"TrackId" INTEGER NOT NULL,
"UnitPrice" DECIMAL(10, 2) NOT NULL,
"Quantity" INTEGER NOT NULL,
PRIMARY KEY ("InvoiceLineId"),
FOREIGN KEY("TrackId") REFERENCES "Track" ("TrackId"),
FOREIGN KEY("InvoiceId") REFERENCES "Invoice" ("InvoiceId")
)
/*
2 rows from InvoiceLine table:
InvoiceLineId InvoiceId TrackId UnitPrice Quantity
1 1 2 0.99 1
2 1 4 0.99 1
*/
CREATE TABLE "MediaType" (
"MediaTypeId" INTEGER NOT NULL,
"Name" VARCHAR(120) DEFAULT NULL,
PRIMARY KEY ("MediaTypeId")
)
/*
2 rows from MediaType table:
MediaTypeId Name
1 MPEG audio file
2 Protected AAC audio file
*/
CREATE TABLE "Playlist" (
"PlaylistId" INTEGER NOT NULL,
"Name" VARCHAR(120) DEFAULT NULL,
PRIMARY KEY ("PlaylistId")
)
/*
2 rows from Playlist table:
PlaylistId Name
1 Music
2 Movies
*/
CREATE TABLE "PlaylistTrack" (
"PlaylistId" INTEGER NOT NULL,
"TrackId" INTEGER NOT NULL,
PRIMARY KEY ("PlaylistId", "TrackId"),
FOREIGN KEY("TrackId") REFERENCES "Track" ("TrackId"),
FOREIGN KEY("PlaylistId") REFERENCES "Playlist" ("PlaylistId")
)
/*
2 rows from PlaylistTrack table:
PlaylistId TrackId
1 1
8 1
*/
CREATE TABLE "Track" (
"TrackId" INTEGER NOT NULL,
"Name" VARCHAR(200) NOT NULL,
"AlbumId" INTEGER DEFAULT NULL,
"MediaTypeId" INTEGER NOT NULL,
"GenreId" INTEGER DEFAULT NULL,
"Composer" VARCHAR(220) DEFAULT NULL,
"Milliseconds" INTEGER NOT NULL,
"Bytes" INTEGER DEFAULT NULL,
"UnitPrice" DECIMAL(10, 2) NOT NULL,
PRIMARY KEY ("TrackId"),
FOREIGN KEY("MediaTypeId") REFERENCES "MediaType" ("MediaTypeId"),
FOREIGN KEY("GenreId") REFERENCES "Genre" ("GenreId"),
FOREIGN KEY("AlbumId") REFERENCES "Album" ("AlbumId")
)
/*
2 rows from Track table:
TrackId Name AlbumId MediaTypeId GenreId Composer Milliseconds Bytes UnitPrice
1 For Those About To Rock (We Salute You) 1 1 1 Angus Young, Malcolm Young, Brian Johnson 343719 11170334 0.99
2 Balls to the Wall 2 2 1 None 342562 5510424 0.99
*/ | List the phone numbers of all employees. | SELECT Phone FROM EMPLOYEE | [{'Phone': '+1 (780) 428-9482'}, {'Phone': '+1 (403) 262-3443'}, {'Phone': '+1 (403) 262-3443'}, {'Phone': '+1 (403) 263-4423'}, {'Phone': '1 (780) 836-9987'}, {'Phone': '+1 (403) 246-9887'}, {'Phone': '+1 (403) 456-9986'}, {'Phone': '+1 (403) 467-3351'}] | Easy | false | false | false | false | false | false | false | false | false | false | false | false | false | [QUESTION]List the names of employees and sort in ascending order of age.[/QUESTION]
[SQL]SELECT name FROM employee ORDER BY age[/SQL] | [QUESTION]List the names of employees and sort in ascending order of age.[/QUESTION]
[SQL]SELECT name FROM employee ORDER BY age[/SQL] | [QUESTION]List the names of employees and sort in ascending order of age.[/QUESTION]
[SQL]SELECT name FROM employee ORDER BY age[/SQL] | [QUESTION]List the names of employees and sort in ascending order of age.[/QUESTION]
[SQL]SELECT name FROM employee ORDER BY age[/SQL] |
activity_1 |
CREATE TABLE "Activity" (
actid INTEGER,
activity_name VARCHAR(25),
PRIMARY KEY (actid)
)
CREATE TABLE "Faculty" (
"FacID" INTEGER,
"Lname" VARCHAR(15),
"Fname" VARCHAR(15),
"Rank" VARCHAR(15),
"Sex" VARCHAR(1),
"Phone" INTEGER,
"Room" VARCHAR(5),
"Building" VARCHAR(13),
PRIMARY KEY ("FacID")
)
CREATE TABLE "Faculty_Participates_in" (
"FacID" INTEGER,
actid INTEGER,
FOREIGN KEY("FacID") REFERENCES "Faculty" ("FacID"),
FOREIGN KEY(actid) REFERENCES "Activity" (actid)
)
CREATE TABLE "Participates_in" (
stuid INTEGER,
actid INTEGER,
FOREIGN KEY(stuid) REFERENCES "Student" ("StuID"),
FOREIGN KEY(actid) REFERENCES "Activity" (actid)
)
CREATE TABLE "Student" (
"StuID" INTEGER,
"LName" VARCHAR(12),
"Fname" VARCHAR(12),
"Age" INTEGER,
"Sex" VARCHAR(1),
"Major" INTEGER,
"Advisor" INTEGER,
city_code VARCHAR(3),
PRIMARY KEY ("StuID")
) |
CREATE TABLE "Activity" (
actid INTEGER,
activity_name VARCHAR(25),
PRIMARY KEY (actid)
)
/*
2 rows from Activity table:
actid activity_name
770 Mountain Climbing
771 Canoeing
*/
CREATE TABLE "Faculty" (
"FacID" INTEGER,
"Lname" VARCHAR(15),
"Fname" VARCHAR(15),
"Rank" VARCHAR(15),
"Sex" VARCHAR(1),
"Phone" INTEGER,
"Room" VARCHAR(5),
"Building" VARCHAR(13),
PRIMARY KEY ("FacID")
)
/*
2 rows from Faculty table:
FacID Lname Fname Rank Sex Phone Room Building
1082 Giuliano Mark Instructor M 2424 224 NEB
1121 Goodrich Michael Professor M 3593 219 NEB
*/
CREATE TABLE "Faculty_Participates_in" (
"FacID" INTEGER,
actid INTEGER,
FOREIGN KEY("FacID") REFERENCES "Faculty" ("FacID"),
FOREIGN KEY(actid) REFERENCES "Activity" (actid)
)
/*
2 rows from Faculty_Participates_in table:
FacID actid
1082 784
1082 785
*/
CREATE TABLE "Participates_in" (
stuid INTEGER,
actid INTEGER,
FOREIGN KEY(stuid) REFERENCES "Student" ("StuID"),
FOREIGN KEY(actid) REFERENCES "Activity" (actid)
)
/*
2 rows from Participates_in table:
stuid actid
1001 770
1001 771
*/
CREATE TABLE "Student" (
"StuID" INTEGER,
"LName" VARCHAR(12),
"Fname" VARCHAR(12),
"Age" INTEGER,
"Sex" VARCHAR(1),
"Major" INTEGER,
"Advisor" INTEGER,
city_code VARCHAR(3),
PRIMARY KEY ("StuID")
)
/*
2 rows from Student table:
StuID LName Fname Age Sex Major Advisor city_code
1001 Smith Linda 18 F 600 1121 BAL
1002 Kim Tracy 19 F 600 7712 HKG
*/ | Which students have professors as their advisors? Find their student ids. | SELECT T2.StuID FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor WHERE T1.rank = "Professor" | [{'StuID': 1001}, {'StuID': 1002}, {'StuID': 1005}, {'StuID': 1006}, {'StuID': 1008}, {'StuID': 1011}, {'StuID': 1012}, {'StuID': 1017}, {'StuID': 1018}, {'StuID': 1020}, {'StuID': 1024}, {'StuID': 1025}, {'StuID': 1026}, {'StuID': 1027}] | Medium | false | false | false | false | false | false | false | true | false | false | false | false | false | [QUESTION]Find the first names of professors who are teaching more than one class.[/QUESTION]
[SQL]SELECT T2.emp_fname FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num GROUP BY T1.prof_num HAVING count(*) > 1[/SQL] | [QUESTION]Find the first names of professors who are teaching more than one class.[/QUESTION]
[SQL]SELECT T2.emp_fname FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num GROUP BY T1.prof_num HAVING count(*) > 1[/SQL] | [QUESTION]Find the first names of professors who are teaching more than one class.[/QUESTION]
[SQL]SELECT T2.emp_fname FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num GROUP BY T1.prof_num HAVING count(*) > 1[/SQL] | [QUESTION]Find the first names of professors who are teaching more than one class.[/QUESTION]
[SQL]SELECT T2.emp_fname FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num GROUP BY T1.prof_num HAVING count(*) > 1[/SQL] |
tracking_grants_for_research |
CREATE TABLE "Document_Types" (
document_type_code VARCHAR(10),
document_description VARCHAR(255) NOT NULL,
PRIMARY KEY (document_type_code)
)
CREATE TABLE "Documents" (
document_id INTEGER,
document_type_code VARCHAR(10),
grant_id INTEGER NOT NULL,
sent_date DATETIME NOT NULL,
response_received_date DATETIME NOT NULL,
other_details VARCHAR(255) NOT NULL,
PRIMARY KEY (document_id),
FOREIGN KEY(grant_id) REFERENCES "Grants" (grant_id),
FOREIGN KEY(document_type_code) REFERENCES "Document_Types" (document_type_code)
)
CREATE TABLE "Grants" (
grant_id INTEGER,
organisation_id INTEGER NOT NULL,
grant_amount DECIMAL(19, 4) DEFAULT 0 NOT NULL,
grant_start_date DATETIME NOT NULL,
grant_end_date DATETIME NOT NULL,
other_details VARCHAR(255) NOT NULL,
PRIMARY KEY (grant_id),
FOREIGN KEY(organisation_id) REFERENCES "Organisations" (organisation_id)
)
CREATE TABLE "Organisation_Types" (
organisation_type VARCHAR(10),
organisation_type_description VARCHAR(255) NOT NULL,
PRIMARY KEY (organisation_type)
)
CREATE TABLE "Organisations" (
organisation_id INTEGER,
organisation_type VARCHAR(10) NOT NULL,
organisation_details VARCHAR(255) NOT NULL,
PRIMARY KEY (organisation_id),
FOREIGN KEY(organisation_type) REFERENCES "Organisation_Types" (organisation_type)
)
CREATE TABLE "Project_Outcomes" (
project_id INTEGER NOT NULL,
outcome_code VARCHAR(10) NOT NULL,
outcome_details VARCHAR(255),
FOREIGN KEY(outcome_code) REFERENCES "Research_Outcomes" (outcome_code),
FOREIGN KEY(project_id) REFERENCES "Projects" (project_id)
)
CREATE TABLE "Project_Staff" (
staff_id DOUBLE,
project_id INTEGER NOT NULL,
role_code VARCHAR(10) NOT NULL,
date_from DATETIME,
date_to DATETIME,
other_details VARCHAR(255),
PRIMARY KEY (staff_id),
FOREIGN KEY(role_code) REFERENCES "Staff_Roles" (role_code),
FOREIGN KEY(project_id) REFERENCES "Projects" (project_id)
)
CREATE TABLE "Projects" (
project_id INTEGER,
organisation_id INTEGER NOT NULL,
project_details VARCHAR(255) NOT NULL,
PRIMARY KEY (project_id),
FOREIGN KEY(organisation_id) REFERENCES "Organisations" (organisation_id)
)
CREATE TABLE "Research_Outcomes" (
outcome_code VARCHAR(10),
outcome_description VARCHAR(255) NOT NULL,
PRIMARY KEY (outcome_code)
)
CREATE TABLE "Research_Staff" (
staff_id INTEGER,
employer_organisation_id INTEGER NOT NULL,
staff_details VARCHAR(255) NOT NULL,
PRIMARY KEY (staff_id),
FOREIGN KEY(employer_organisation_id) REFERENCES "Organisations" (organisation_id)
)
CREATE TABLE "Staff_Roles" (
role_code VARCHAR(10),
role_description VARCHAR(255) NOT NULL,
PRIMARY KEY (role_code)
)
CREATE TABLE "Tasks" (
task_id INTEGER,
project_id INTEGER NOT NULL,
task_details VARCHAR(255) NOT NULL,
"eg Agree Objectives" VARCHAR(1),
PRIMARY KEY (task_id),
FOREIGN KEY(project_id) REFERENCES "Projects" (project_id)
) |
CREATE TABLE "Document_Types" (
document_type_code VARCHAR(10),
document_description VARCHAR(255) NOT NULL,
PRIMARY KEY (document_type_code)
)
/*
2 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
*/
CREATE TABLE "Documents" (
document_id INTEGER,
document_type_code VARCHAR(10),
grant_id INTEGER NOT NULL,
sent_date DATETIME NOT NULL,
response_received_date DATETIME NOT NULL,
other_details VARCHAR(255) NOT NULL,
PRIMARY KEY (document_id),
FOREIGN KEY(grant_id) REFERENCES "Grants" (grant_id),
FOREIGN KEY(document_type_code) REFERENCES "Document_Types" (document_type_code)
)
/*
2 rows from Documents table:
document_id document_type_code grant_id sent_date response_received_date other_details
1 APP 5 1986-11-30 07:56:35 1977-12-01 02:18:53
2 APP 13 2004-01-23 11:57:08 1979-12-08 10:38:07
*/
CREATE TABLE "Grants" (
grant_id INTEGER,
organisation_id INTEGER NOT NULL,
grant_amount DECIMAL(19, 4) DEFAULT 0 NOT NULL,
grant_start_date DATETIME NOT NULL,
grant_end_date DATETIME NOT NULL,
other_details VARCHAR(255) NOT NULL,
PRIMARY KEY (grant_id),
FOREIGN KEY(organisation_id) REFERENCES "Organisations" (organisation_id)
)
/*
2 rows from Grants table:
grant_id organisation_id grant_amount grant_start_date grant_end_date other_details
1 10 4094.5420 2016-11-20 00:18:51 2004-10-24 09:09:39 et
2 3 281.2446 1985-10-09 20:08:49 1985-06-08 00:22:07 occaecati
*/
CREATE TABLE "Organisation_Types" (
organisation_type VARCHAR(10),
organisation_type_description VARCHAR(255) NOT NULL,
PRIMARY KEY (organisation_type)
)
/*
2 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
*/
CREATE TABLE "Organisations" (
organisation_id INTEGER,
organisation_type VARCHAR(10) NOT NULL,
organisation_details VARCHAR(255) NOT NULL,
PRIMARY KEY (organisation_id),
FOREIGN KEY(organisation_type) REFERENCES "Organisation_Types" (organisation_type)
)
/*
2 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
*/
CREATE TABLE "Project_Outcomes" (
project_id INTEGER NOT NULL,
outcome_code VARCHAR(10) NOT NULL,
outcome_details VARCHAR(255),
FOREIGN KEY(outcome_code) REFERENCES "Research_Outcomes" (outcome_code),
FOREIGN KEY(project_id) REFERENCES "Projects" (project_id)
)
/*
2 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
*/
CREATE TABLE "Project_Staff" (
staff_id DOUBLE,
project_id INTEGER NOT NULL,
role_code VARCHAR(10) NOT NULL,
date_from DATETIME,
date_to DATETIME,
other_details VARCHAR(255),
PRIMARY KEY (staff_id),
FOREIGN KEY(role_code) REFERENCES "Staff_Roles" (role_code),
FOREIGN KEY(project_id) REFERENCES "Projects" (project_id)
)
/*
2 rows from Project_Staff table:
staff_id project_id role_code date_from date_to other_details
0.0 2 leader 1981-10-04 22:44:50 1985-05-30 22:26:30 None
674810.0 5 leader 2003-04-19 15:06:20 2010-12-08 11:55:36 None
*/
CREATE TABLE "Projects" (
project_id INTEGER,
organisation_id INTEGER NOT NULL,
project_details VARCHAR(255) NOT NULL,
PRIMARY KEY (project_id),
FOREIGN KEY(organisation_id) REFERENCES "Organisations" (organisation_id)
)
/*
2 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
*/
CREATE TABLE "Research_Outcomes" (
outcome_code VARCHAR(10),
outcome_description VARCHAR(255) NOT NULL,
PRIMARY KEY (outcome_code)
)
/*
2 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
*/
CREATE TABLE "Research_Staff" (
staff_id INTEGER,
employer_organisation_id INTEGER NOT NULL,
staff_details VARCHAR(255) NOT NULL,
PRIMARY KEY (staff_id),
FOREIGN KEY(employer_organisation_id) REFERENCES "Organisations" (organisation_id)
)
/*
2 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
*/
CREATE TABLE "Staff_Roles" (
role_code VARCHAR(10),
role_description VARCHAR(255) NOT NULL,
PRIMARY KEY (role_code)
)
/*
2 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
*/
CREATE TABLE "Tasks" (
task_id INTEGER,
project_id INTEGER NOT NULL,
task_details VARCHAR(255) NOT NULL,
"eg Agree Objectives" VARCHAR(1),
PRIMARY KEY (task_id),
FOREIGN KEY(project_id) REFERENCES "Projects" (project_id)
)
/*
2 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
*/ | When do all the researcher role staff start to work, and when do they stop working? | SELECT date_from , date_to FROM Project_Staff WHERE role_code = 'researcher' | [{'date_from': '1981-10-09 21:32:53', 'date_to': '2004-12-16 13:03:36'}, {'date_from': '1983-02-07 17:55:59', 'date_to': '2004-07-28 03:11:47'}, {'date_from': '1991-01-11 16:57:50', 'date_to': '1993-06-09 12:44:28'}, {'date_from': '2005-01-13 11:49:48', 'date_to': '1973-07-19 04:51:26'}, {'date_from': '1970-03-25 06:18:11', 'date_to': '1985-12-05 12:00:58'}, {'date_from': '1972-01-17 19:42:16', 'date_to': '2016-03-15 00:33:18'}, {'date_from': '2000-08-28 11:49:17', 'date_to': '2007-02-02 17:26:02'}, {'date_from': '1989-04-24 23:51:54', 'date_to': '2002-03-19 18:00:36'}, {'date_from': '1973-12-12 11:46:28', 'date_to': '1971-07-19 22:49:05'}] | Easy | false | false | false | false | false | false | false | false | false | false | false | false | false | ||||
sakila_1 |
CREATE TABLE actor (
actor_id INTEGER NOT NULL,
first_name VARCHAR(45) NOT NULL,
last_name VARCHAR(45) NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (actor_id)
)
CREATE TABLE address (
address_id INTEGER NOT NULL,
address VARCHAR(50) NOT NULL,
address2 VARCHAR(50) DEFAULT NULL,
district VARCHAR(20) NOT NULL,
city_id INTEGER NOT NULL,
postal_code VARCHAR(10) DEFAULT NULL,
phone VARCHAR(20) NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (address_id),
FOREIGN KEY(city_id) REFERENCES city (city_id)
)
CREATE TABLE category (
category_id INTEGER NOT NULL,
name VARCHAR(25) NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (category_id)
)
CREATE TABLE city (
city_id INTEGER NOT NULL,
city VARCHAR(50) NOT NULL,
country_id INTEGER NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (city_id),
FOREIGN KEY(country_id) REFERENCES country (country_id)
)
CREATE TABLE country (
country_id INTEGER NOT NULL,
country VARCHAR(50) NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (country_id)
)
CREATE TABLE customer (
customer_id INTEGER NOT NULL,
store_id INTEGER NOT NULL,
first_name VARCHAR(45) NOT NULL,
last_name VARCHAR(45) NOT NULL,
email VARCHAR(50) DEFAULT NULL,
address_id INTEGER NOT NULL,
active BOOLEAN DEFAULT TRUE NOT NULL,
create_date DATETIME NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (customer_id),
FOREIGN KEY(address_id) REFERENCES address (address_id),
FOREIGN KEY(store_id) REFERENCES store (store_id)
)
CREATE TABLE film (
film_id INTEGER NOT NULL,
title VARCHAR(255) NOT NULL,
description TEXT DEFAULT NULL,
release_year NUMERIC DEFAULT NULL,
language_id INTEGER NOT NULL,
original_language_id INTEGER DEFAULT NULL,
rental_duration INTEGER DEFAULT 3 NOT NULL,
rental_rate DECIMAL(4, 2) DEFAULT 4.99 NOT NULL,
length INTEGER DEFAULT NULL,
replacement_cost DECIMAL(5, 2) DEFAULT 19.99 NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (film_id),
FOREIGN KEY(language_id) REFERENCES language (language_id),
FOREIGN KEY(original_language_id) REFERENCES language (language_id)
)
CREATE TABLE film_actor (
actor_id INTEGER NOT NULL,
film_id INTEGER NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (actor_id, film_id),
FOREIGN KEY(actor_id) REFERENCES actor (actor_id),
FOREIGN KEY(film_id) REFERENCES film (film_id)
)
CREATE TABLE film_category (
film_id INTEGER NOT NULL,
category_id INTEGER NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (film_id, category_id),
FOREIGN KEY(film_id) REFERENCES film (film_id),
FOREIGN KEY(category_id) REFERENCES category (category_id)
)
CREATE TABLE film_text (
film_id SMALLINT NOT NULL,
title VARCHAR(255) NOT NULL,
description TEXT,
PRIMARY KEY (film_id)
)
CREATE TABLE inventory (
inventory_id INTEGER NOT NULL,
film_id INTEGER NOT NULL,
store_id INTEGER NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (inventory_id),
FOREIGN KEY(store_id) REFERENCES store (store_id),
FOREIGN KEY(film_id) REFERENCES film (film_id)
)
CREATE TABLE language (
language_id INTEGER NOT NULL,
name CHAR(20) NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (language_id)
)
CREATE TABLE payment (
payment_id INTEGER NOT NULL,
customer_id INTEGER NOT NULL,
staff_id INTEGER NOT NULL,
rental_id INTEGER DEFAULT NULL,
amount DECIMAL(5, 2) NOT NULL,
payment_date DATETIME NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (payment_id),
FOREIGN KEY(rental_id) REFERENCES rental (rental_id),
FOREIGN KEY(customer_id) REFERENCES customer (customer_id),
FOREIGN KEY(staff_id) REFERENCES staff (staff_id)
)
CREATE TABLE rental (
rental_id INTEGER NOT NULL,
rental_date DATETIME NOT NULL,
inventory_id INTEGER NOT NULL,
customer_id INTEGER NOT NULL,
return_date DATETIME DEFAULT NULL,
staff_id INTEGER NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (rental_id),
FOREIGN KEY(staff_id) REFERENCES staff (staff_id),
FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),
FOREIGN KEY(customer_id) REFERENCES customer (customer_id)
)
CREATE TABLE staff (
staff_id INTEGER NOT NULL,
first_name VARCHAR(45) NOT NULL,
last_name VARCHAR(45) NOT NULL,
address_id INTEGER NOT NULL,
picture BLOB DEFAULT NULL,
email VARCHAR(50) DEFAULT NULL,
store_id INTEGER NOT NULL,
active BOOLEAN DEFAULT TRUE NOT NULL,
username VARCHAR(16) NOT NULL,
password VARCHAR(40) DEFAULT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (staff_id),
FOREIGN KEY(address_id) REFERENCES address (address_id)
)
CREATE TABLE store (
store_id INTEGER NOT NULL,
manager_staff_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (store_id),
FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id),
FOREIGN KEY(address_id) REFERENCES address (address_id)
) |
CREATE TABLE actor (
actor_id INTEGER NOT NULL,
first_name VARCHAR(45) NOT NULL,
last_name VARCHAR(45) NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (actor_id)
)
/*
2 rows from actor table:
actor_id first_name last_name last_update
1 PENELOPE GUINESS 2006-02-15 04:34:33
2 NICK WAHLBERG 2006-02-15 04:34:33
*/
CREATE TABLE address (
address_id INTEGER NOT NULL,
address VARCHAR(50) NOT NULL,
address2 VARCHAR(50) DEFAULT NULL,
district VARCHAR(20) NOT NULL,
city_id INTEGER NOT NULL,
postal_code VARCHAR(10) DEFAULT NULL,
phone VARCHAR(20) NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (address_id),
FOREIGN KEY(city_id) REFERENCES city (city_id)
)
/*
2 rows from address table:
address_id address address2 district city_id postal_code phone last_update
1 47 MySakila Drive None Alberta 300 2006-02-15 04:45:30
2 28 MySQL Boulevard None QLD 576 2006-02-15 04:45:30
*/
CREATE TABLE category (
category_id INTEGER NOT NULL,
name VARCHAR(25) NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (category_id)
)
/*
2 rows from category table:
category_id name last_update
1 Action 2006-02-15 04:46:27
2 Animation 2006-02-15 04:46:27
*/
CREATE TABLE city (
city_id INTEGER NOT NULL,
city VARCHAR(50) NOT NULL,
country_id INTEGER NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (city_id),
FOREIGN KEY(country_id) REFERENCES country (country_id)
)
/*
2 rows from city table:
city_id city country_id last_update
1 A Corua (La Corua) 87 2006-02-15 04:45:25
2 Abha 82 2006-02-15 04:45:25
*/
CREATE TABLE country (
country_id INTEGER NOT NULL,
country VARCHAR(50) NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (country_id)
)
/*
2 rows from country table:
country_id country last_update
1 Afghanistan 2006-02-15 04:44:00
2 Algeria 2006-02-15 04:44:00
*/
CREATE TABLE customer (
customer_id INTEGER NOT NULL,
store_id INTEGER NOT NULL,
first_name VARCHAR(45) NOT NULL,
last_name VARCHAR(45) NOT NULL,
email VARCHAR(50) DEFAULT NULL,
address_id INTEGER NOT NULL,
active BOOLEAN DEFAULT TRUE NOT NULL,
create_date DATETIME NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (customer_id),
FOREIGN KEY(address_id) REFERENCES address (address_id),
FOREIGN KEY(store_id) REFERENCES store (store_id)
)
/*
2 rows from customer table:
customer_id store_id first_name last_name email address_id active create_date last_update
1 1 MARY SMITH [email protected] 5 True 2006-02-14 22:04:36 2006-02-15 04:57:20
2 1 PATRICIA JOHNSON [email protected] 6 True 2006-02-14 22:04:36 2006-02-15 04:57:20
*/
CREATE TABLE film (
film_id INTEGER NOT NULL,
title VARCHAR(255) NOT NULL,
description TEXT DEFAULT NULL,
release_year NUMERIC DEFAULT NULL,
language_id INTEGER NOT NULL,
original_language_id INTEGER DEFAULT NULL,
rental_duration INTEGER DEFAULT 3 NOT NULL,
rental_rate DECIMAL(4, 2) DEFAULT 4.99 NOT NULL,
length INTEGER DEFAULT NULL,
replacement_cost DECIMAL(5, 2) DEFAULT 19.99 NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (film_id),
FOREIGN KEY(language_id) REFERENCES language (language_id),
FOREIGN KEY(original_language_id) REFERENCES language (language_id)
)
/*
2 rows from film table:
film_id title description release_year language_id original_language_id rental_duration rental_rate length replacement_cost last_update
1 ACADEMY DINOSAUR A Epic Drama of a Feminist And a Mad Scientist who must Battle a Teacher in The Canadian Rockies 2006.0000000000 1 None 6 0.99 86 20.99 2006-02-15 05:03:42
2 ACE GOLDFINGER A Astounding Epistle of a Database Administrator And a Explorer who must Find a Car in Ancient China 2006.0000000000 1 None 3 4.99 48 12.99 2006-02-15 05:03:42
*/
CREATE TABLE film_actor (
actor_id INTEGER NOT NULL,
film_id INTEGER NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (actor_id, film_id),
FOREIGN KEY(actor_id) REFERENCES actor (actor_id),
FOREIGN KEY(film_id) REFERENCES film (film_id)
)
/*
2 rows from film_actor table:
actor_id film_id last_update
1 1 2006-02-15 05:05:03
1 23 2006-02-15 05:05:03
*/
CREATE TABLE film_category (
film_id INTEGER NOT NULL,
category_id INTEGER NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (film_id, category_id),
FOREIGN KEY(film_id) REFERENCES film (film_id),
FOREIGN KEY(category_id) REFERENCES category (category_id)
)
/*
2 rows from film_category table:
film_id category_id last_update
1 6 2006-02-15 05:07:09
2 11 2006-02-15 05:07:09
*/
CREATE TABLE film_text (
film_id SMALLINT NOT NULL,
title VARCHAR(255) NOT NULL,
description TEXT,
PRIMARY KEY (film_id)
)
/*
2 rows from film_text table:
film_id title description
*/
CREATE TABLE inventory (
inventory_id INTEGER NOT NULL,
film_id INTEGER NOT NULL,
store_id INTEGER NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (inventory_id),
FOREIGN KEY(store_id) REFERENCES store (store_id),
FOREIGN KEY(film_id) REFERENCES film (film_id)
)
/*
2 rows from inventory table:
inventory_id film_id store_id last_update
1 1 1 2006-02-15 05:09:17
2 1 1 2006-02-15 05:09:17
*/
CREATE TABLE language (
language_id INTEGER NOT NULL,
name CHAR(20) NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (language_id)
)
/*
2 rows from language table:
language_id name last_update
*/
CREATE TABLE payment (
payment_id INTEGER NOT NULL,
customer_id INTEGER NOT NULL,
staff_id INTEGER NOT NULL,
rental_id INTEGER DEFAULT NULL,
amount DECIMAL(5, 2) NOT NULL,
payment_date DATETIME NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (payment_id),
FOREIGN KEY(rental_id) REFERENCES rental (rental_id),
FOREIGN KEY(customer_id) REFERENCES customer (customer_id),
FOREIGN KEY(staff_id) REFERENCES staff (staff_id)
)
/*
2 rows from payment table:
payment_id customer_id staff_id rental_id amount payment_date last_update
1 1 1 76 2.99 2005-05-25 11:30:37 2006-02-15 22:12:30
2 1 1 573 0.99 2005-05-28 10:35:23 2006-02-15 22:12:30
*/
CREATE TABLE rental (
rental_id INTEGER NOT NULL,
rental_date DATETIME NOT NULL,
inventory_id INTEGER NOT NULL,
customer_id INTEGER NOT NULL,
return_date DATETIME DEFAULT NULL,
staff_id INTEGER NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (rental_id),
FOREIGN KEY(staff_id) REFERENCES staff (staff_id),
FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),
FOREIGN KEY(customer_id) REFERENCES customer (customer_id)
)
/*
2 rows from rental table:
rental_id rental_date inventory_id customer_id return_date staff_id last_update
1 2005-05-24 22:53:30 367 130 2005-05-26 22:04:30 1 2006-02-15 21:30:53
2 2005-05-24 22:54:33 1525 459 2005-05-28 19:40:33 1 2006-02-15 21:30:53
*/
CREATE TABLE staff (
staff_id INTEGER NOT NULL,
first_name VARCHAR(45) NOT NULL,
last_name VARCHAR(45) NOT NULL,
address_id INTEGER NOT NULL,
picture BLOB DEFAULT NULL,
email VARCHAR(50) DEFAULT NULL,
store_id INTEGER NOT NULL,
active BOOLEAN DEFAULT TRUE NOT NULL,
username VARCHAR(16) NOT NULL,
password VARCHAR(40) DEFAULT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (staff_id),
FOREIGN KEY(address_id) REFERENCES address (address_id)
)
/*
2 rows from staff table:
staff_id first_name last_name address_id picture email store_id active username password last_update
*/
CREATE TABLE store (
store_id INTEGER NOT NULL,
manager_staff_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (store_id),
FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id),
FOREIGN KEY(address_id) REFERENCES address (address_id)
)
/*
2 rows from store table:
store_id manager_staff_id address_id last_update
*/ | What are the city name, id, and number of addresses corresponding to the city with the most addressed? | SELECT T2.city , count(*) , T1.city_id FROM address AS T1 JOIN city AS T2 ON T1.city_id = T2.city_id GROUP BY T1.city_id ORDER BY count(*) DESC LIMIT 1 | [{'city': 'Woodridge', 'count(*)': 2, 'city_id': 576}] | Medium | false | false | false | true | true | true | false | true | false | false | false | false | false | [QUESTION]What is the number of employees from each city?[/QUESTION]
[SQL]SELECT count(*) , city FROM employee GROUP BY city[/SQL] | [QUESTION]What is the number of employees from each city?[/QUESTION]
[SQL]SELECT count(*) , city FROM employee GROUP BY city[/SQL] | [QUESTION]What is the number of employees from each city?[/QUESTION]
[SQL]SELECT count(*) , city FROM employee GROUP BY city[/SQL] | [QUESTION]What is the number of employees from each city?[/QUESTION]
[SQL]SELECT count(*) , city FROM employee GROUP BY city[/SQL] |
activity_1 |
CREATE TABLE "Activity" (
actid INTEGER,
activity_name VARCHAR(25),
PRIMARY KEY (actid)
)
CREATE TABLE "Faculty" (
"FacID" INTEGER,
"Lname" VARCHAR(15),
"Fname" VARCHAR(15),
"Rank" VARCHAR(15),
"Sex" VARCHAR(1),
"Phone" INTEGER,
"Room" VARCHAR(5),
"Building" VARCHAR(13),
PRIMARY KEY ("FacID")
)
CREATE TABLE "Faculty_Participates_in" (
"FacID" INTEGER,
actid INTEGER,
FOREIGN KEY("FacID") REFERENCES "Faculty" ("FacID"),
FOREIGN KEY(actid) REFERENCES "Activity" (actid)
)
CREATE TABLE "Participates_in" (
stuid INTEGER,
actid INTEGER,
FOREIGN KEY(stuid) REFERENCES "Student" ("StuID"),
FOREIGN KEY(actid) REFERENCES "Activity" (actid)
)
CREATE TABLE "Student" (
"StuID" INTEGER,
"LName" VARCHAR(12),
"Fname" VARCHAR(12),
"Age" INTEGER,
"Sex" VARCHAR(1),
"Major" INTEGER,
"Advisor" INTEGER,
city_code VARCHAR(3),
PRIMARY KEY ("StuID")
) |
CREATE TABLE "Activity" (
actid INTEGER,
activity_name VARCHAR(25),
PRIMARY KEY (actid)
)
/*
2 rows from Activity table:
actid activity_name
770 Mountain Climbing
771 Canoeing
*/
CREATE TABLE "Faculty" (
"FacID" INTEGER,
"Lname" VARCHAR(15),
"Fname" VARCHAR(15),
"Rank" VARCHAR(15),
"Sex" VARCHAR(1),
"Phone" INTEGER,
"Room" VARCHAR(5),
"Building" VARCHAR(13),
PRIMARY KEY ("FacID")
)
/*
2 rows from Faculty table:
FacID Lname Fname Rank Sex Phone Room Building
1082 Giuliano Mark Instructor M 2424 224 NEB
1121 Goodrich Michael Professor M 3593 219 NEB
*/
CREATE TABLE "Faculty_Participates_in" (
"FacID" INTEGER,
actid INTEGER,
FOREIGN KEY("FacID") REFERENCES "Faculty" ("FacID"),
FOREIGN KEY(actid) REFERENCES "Activity" (actid)
)
/*
2 rows from Faculty_Participates_in table:
FacID actid
1082 784
1082 785
*/
CREATE TABLE "Participates_in" (
stuid INTEGER,
actid INTEGER,
FOREIGN KEY(stuid) REFERENCES "Student" ("StuID"),
FOREIGN KEY(actid) REFERENCES "Activity" (actid)
)
/*
2 rows from Participates_in table:
stuid actid
1001 770
1001 771
*/
CREATE TABLE "Student" (
"StuID" INTEGER,
"LName" VARCHAR(12),
"Fname" VARCHAR(12),
"Age" INTEGER,
"Sex" VARCHAR(1),
"Major" INTEGER,
"Advisor" INTEGER,
city_code VARCHAR(3),
PRIMARY KEY ("StuID")
)
/*
2 rows from Student table:
StuID LName Fname Age Sex Major Advisor city_code
1001 Smith Linda 18 F 600 1121 BAL
1002 Kim Tracy 19 F 600 7712 HKG
*/ | Tell me the first and last name of the student who has the most activities. | SELECT T1.fname , T1.lname FROM Student AS T1 JOIN Participates_in AS T2 ON T1.StuID = T2.StuID GROUP BY T1.StuID ORDER BY count(*) DESC LIMIT 1 | [{'Fname': 'Michael', 'LName': 'Leighton'}] | Medium | false | false | false | true | true | true | false | true | false | false | false | false | false | [QUESTION]Give the name of the student with the most likes.[/QUESTION]
[SQL]SELECT T2.name FROM Likes AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id GROUP BY T1.student_id ORDER BY count(*) DESC LIMIT 1[/SQL] | [QUESTION]Give the name of the student with the most likes.[/QUESTION]
[SQL]SELECT T2.name FROM Likes AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id GROUP BY T1.student_id ORDER BY count(*) DESC LIMIT 1[/SQL] | [QUESTION]Give the name of the student with the most likes.[/QUESTION]
[SQL]SELECT T2.name FROM Likes AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id GROUP BY T1.student_id ORDER BY count(*) DESC LIMIT 1[/SQL] | [QUESTION]Give the name of the student with the most likes.[/QUESTION]
[SQL]SELECT T2.name FROM Likes AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id GROUP BY T1.student_id ORDER BY count(*) DESC LIMIT 1[/SQL] |
architecture |
CREATE TABLE architect (
id TEXT,
name TEXT,
nationality TEXT,
gender TEXT,
PRIMARY KEY (id)
)
CREATE TABLE bridge (
architect_id INTEGER,
id INTEGER,
name TEXT,
location TEXT,
length_meters REAL,
length_feet REAL,
PRIMARY KEY (id),
FOREIGN KEY(architect_id) REFERENCES architect (id)
)
CREATE TABLE mill (
architect_id INTEGER,
id INTEGER,
location TEXT,
name TEXT,
type TEXT,
built_year INTEGER,
notes TEXT,
PRIMARY KEY (id),
FOREIGN KEY(architect_id) REFERENCES architect (id)
) |
CREATE TABLE architect (
id TEXT,
name TEXT,
nationality TEXT,
gender TEXT,
PRIMARY KEY (id)
)
/*
2 rows from architect table:
id name nationality gender
1 Frank Lloyd Wright American male
2 Frank Gehry Canadian male
*/
CREATE TABLE bridge (
architect_id INTEGER,
id INTEGER,
name TEXT,
location TEXT,
length_meters REAL,
length_feet REAL,
PRIMARY KEY (id),
FOREIGN KEY(architect_id) REFERENCES architect (id)
)
/*
2 rows from bridge table:
architect_id id name location length_meters length_feet
1 1 Xian Ren Qiao (Fairy Bridge) Guangxi , China 121.0 400.0
2 2 Landscape Arch Arches National Park , Utah , USA 88.0 290.0
*/
CREATE TABLE mill (
architect_id INTEGER,
id INTEGER,
location TEXT,
name TEXT,
type TEXT,
built_year INTEGER,
notes TEXT,
PRIMARY KEY (id),
FOREIGN KEY(architect_id) REFERENCES architect (id)
)
/*
2 rows from mill table:
architect_id id location name type built_year notes
1 1 Coswarem Le Vieux Molen Grondzeiler 1840 Molenechos (Dutch)
1 2 Donceel Moulin Bertrand Grondzeiler 1890 Molenechos (Dutch)
*/ | What are the distinct types of mills that are built by American or Canadian architects? | SELECT DISTINCT T1.type FROM mill AS T1 JOIN architect AS t2 ON T1.architect_id = T2.id WHERE T2.nationality = 'American' OR T2.nationality = 'Canadian' | [{'type': 'Grondzeiler'}] | Medium | true | false | false | false | false | false | false | true | false | false | false | false | false | ||||
scholar |
CREATE TABLE "paperDataset" (
"paperId" INTEGER DEFAULT NULL,
"datasetId" INTEGER DEFAULT NULL,
PRIMARY KEY ("datasetId", "paperId")
)
CREATE TABLE "paperKeyphrase" (
"paperId" INTEGER DEFAULT NULL,
"keyphraseId" INTEGER DEFAULT NULL,
PRIMARY KEY ("keyphraseId", "paperId"),
FOREIGN KEY("keyphraseId") REFERENCES keyphrase ("keyphraseId"),
FOREIGN KEY("paperId") REFERENCES paper ("paperId")
)
CREATE TABLE author (
"authorId" INTEGER NOT NULL,
"authorName" VARCHAR(50) DEFAULT NULL,
PRIMARY KEY ("authorId")
)
CREATE TABLE cite (
"citingPaperId" INTEGER NOT NULL,
"citedPaperId" INTEGER NOT NULL,
PRIMARY KEY ("citingPaperId", "citedPaperId"),
FOREIGN KEY("citingPaperId") REFERENCES paper ("paperId"),
FOREIGN KEY("citedPaperId") REFERENCES paper ("paperId")
)
CREATE TABLE dataset (
"datasetId" INTEGER NOT NULL,
"datasetName" VARCHAR(50) DEFAULT NULL,
PRIMARY KEY ("datasetId")
)
CREATE TABLE journal (
"journalId" INTEGER NOT NULL,
"journalName" VARCHAR(100) DEFAULT NULL,
PRIMARY KEY ("journalId")
)
CREATE TABLE keyphrase (
"keyphraseId" INTEGER NOT NULL,
"keyphraseName" VARCHAR(50) DEFAULT NULL,
PRIMARY KEY ("keyphraseId")
)
CREATE TABLE paper (
"paperId" INTEGER NOT NULL,
title VARCHAR(300) DEFAULT NULL,
"venueId" INTEGER DEFAULT NULL,
year INTEGER DEFAULT NULL,
"numCiting" INTEGER DEFAULT NULL,
"numCitedBy" INTEGER DEFAULT NULL,
"journalId" INTEGER DEFAULT NULL,
PRIMARY KEY ("paperId"),
FOREIGN KEY("venueId") REFERENCES venue ("venueId"),
FOREIGN KEY("journalId") REFERENCES journal ("journalId")
)
CREATE TABLE venue (
"venueId" INTEGER NOT NULL,
"venueName" VARCHAR(100) DEFAULT NULL,
PRIMARY KEY ("venueId")
)
CREATE TABLE writes (
"paperId" INTEGER DEFAULT NULL,
"authorId" INTEGER DEFAULT NULL,
PRIMARY KEY ("paperId", "authorId"),
FOREIGN KEY("authorId") REFERENCES author ("authorId"),
FOREIGN KEY("paperId") REFERENCES paper ("paperId")
) |
CREATE TABLE "paperDataset" (
"paperId" INTEGER DEFAULT NULL,
"datasetId" INTEGER DEFAULT NULL,
PRIMARY KEY ("datasetId", "paperId")
)
/*
2 rows from paperDataset table:
paperId datasetId
*/
CREATE TABLE "paperKeyphrase" (
"paperId" INTEGER DEFAULT NULL,
"keyphraseId" INTEGER DEFAULT NULL,
PRIMARY KEY ("keyphraseId", "paperId"),
FOREIGN KEY("keyphraseId") REFERENCES keyphrase ("keyphraseId"),
FOREIGN KEY("paperId") REFERENCES paper ("paperId")
)
/*
2 rows from paperKeyphrase table:
paperId keyphraseId
*/
CREATE TABLE author (
"authorId" INTEGER NOT NULL,
"authorName" VARCHAR(50) DEFAULT NULL,
PRIMARY KEY ("authorId")
)
/*
2 rows from author table:
authorId authorName
*/
CREATE TABLE cite (
"citingPaperId" INTEGER NOT NULL,
"citedPaperId" INTEGER NOT NULL,
PRIMARY KEY ("citingPaperId", "citedPaperId"),
FOREIGN KEY("citingPaperId") REFERENCES paper ("paperId"),
FOREIGN KEY("citedPaperId") REFERENCES paper ("paperId")
)
/*
2 rows from cite table:
citingPaperId citedPaperId
*/
CREATE TABLE dataset (
"datasetId" INTEGER NOT NULL,
"datasetName" VARCHAR(50) DEFAULT NULL,
PRIMARY KEY ("datasetId")
)
/*
2 rows from dataset table:
datasetId datasetName
*/
CREATE TABLE journal (
"journalId" INTEGER NOT NULL,
"journalName" VARCHAR(100) DEFAULT NULL,
PRIMARY KEY ("journalId")
)
/*
2 rows from journal table:
journalId journalName
*/
CREATE TABLE keyphrase (
"keyphraseId" INTEGER NOT NULL,
"keyphraseName" VARCHAR(50) DEFAULT NULL,
PRIMARY KEY ("keyphraseId")
)
/*
2 rows from keyphrase table:
keyphraseId keyphraseName
*/
CREATE TABLE paper (
"paperId" INTEGER NOT NULL,
title VARCHAR(300) DEFAULT NULL,
"venueId" INTEGER DEFAULT NULL,
year INTEGER DEFAULT NULL,
"numCiting" INTEGER DEFAULT NULL,
"numCitedBy" INTEGER DEFAULT NULL,
"journalId" INTEGER DEFAULT NULL,
PRIMARY KEY ("paperId"),
FOREIGN KEY("venueId") REFERENCES venue ("venueId"),
FOREIGN KEY("journalId") REFERENCES journal ("journalId")
)
/*
2 rows from paper table:
paperId title venueId year numCiting numCitedBy journalId
*/
CREATE TABLE venue (
"venueId" INTEGER NOT NULL,
"venueName" VARCHAR(100) DEFAULT NULL,
PRIMARY KEY ("venueId")
)
/*
2 rows from venue table:
venueId venueName
*/
CREATE TABLE writes (
"paperId" INTEGER DEFAULT NULL,
"authorId" INTEGER DEFAULT NULL,
PRIMARY KEY ("paperId", "authorId"),
FOREIGN KEY("authorId") REFERENCES author ("authorId"),
FOREIGN KEY("paperId") REFERENCES paper ("paperId")
)
/*
2 rows from writes table:
paperId authorId
*/ | What papers were published at acl in 2012 were about Parsing ? | SELECT DISTINCT t3.paperid FROM paperkeyphrase AS t2 JOIN keyphrase AS t1 ON t2.keyphraseid = t1.keyphraseid JOIN paper AS t3 ON t3.paperid = t2.paperid JOIN venue AS t4 ON t4.venueid = t3.venueid WHERE t1.keyphrasename = "Parsing" AND t3.year = 2012 AND t4.venuename = "acl"; | [{'Nenhum': 'Nenhum resultado encontrado'}] | Hard | true | false | false | false | false | false | false | false | true | false | false | false | false | ||||
sakila_1 |
CREATE TABLE actor (
actor_id INTEGER NOT NULL,
first_name VARCHAR(45) NOT NULL,
last_name VARCHAR(45) NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (actor_id)
)
CREATE TABLE address (
address_id INTEGER NOT NULL,
address VARCHAR(50) NOT NULL,
address2 VARCHAR(50) DEFAULT NULL,
district VARCHAR(20) NOT NULL,
city_id INTEGER NOT NULL,
postal_code VARCHAR(10) DEFAULT NULL,
phone VARCHAR(20) NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (address_id),
FOREIGN KEY(city_id) REFERENCES city (city_id)
)
CREATE TABLE category (
category_id INTEGER NOT NULL,
name VARCHAR(25) NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (category_id)
)
CREATE TABLE city (
city_id INTEGER NOT NULL,
city VARCHAR(50) NOT NULL,
country_id INTEGER NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (city_id),
FOREIGN KEY(country_id) REFERENCES country (country_id)
)
CREATE TABLE country (
country_id INTEGER NOT NULL,
country VARCHAR(50) NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (country_id)
)
CREATE TABLE customer (
customer_id INTEGER NOT NULL,
store_id INTEGER NOT NULL,
first_name VARCHAR(45) NOT NULL,
last_name VARCHAR(45) NOT NULL,
email VARCHAR(50) DEFAULT NULL,
address_id INTEGER NOT NULL,
active BOOLEAN DEFAULT TRUE NOT NULL,
create_date DATETIME NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (customer_id),
FOREIGN KEY(address_id) REFERENCES address (address_id),
FOREIGN KEY(store_id) REFERENCES store (store_id)
)
CREATE TABLE film (
film_id INTEGER NOT NULL,
title VARCHAR(255) NOT NULL,
description TEXT DEFAULT NULL,
release_year NUMERIC DEFAULT NULL,
language_id INTEGER NOT NULL,
original_language_id INTEGER DEFAULT NULL,
rental_duration INTEGER DEFAULT 3 NOT NULL,
rental_rate DECIMAL(4, 2) DEFAULT 4.99 NOT NULL,
length INTEGER DEFAULT NULL,
replacement_cost DECIMAL(5, 2) DEFAULT 19.99 NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (film_id),
FOREIGN KEY(language_id) REFERENCES language (language_id),
FOREIGN KEY(original_language_id) REFERENCES language (language_id)
)
CREATE TABLE film_actor (
actor_id INTEGER NOT NULL,
film_id INTEGER NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (actor_id, film_id),
FOREIGN KEY(actor_id) REFERENCES actor (actor_id),
FOREIGN KEY(film_id) REFERENCES film (film_id)
)
CREATE TABLE film_category (
film_id INTEGER NOT NULL,
category_id INTEGER NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (film_id, category_id),
FOREIGN KEY(film_id) REFERENCES film (film_id),
FOREIGN KEY(category_id) REFERENCES category (category_id)
)
CREATE TABLE film_text (
film_id SMALLINT NOT NULL,
title VARCHAR(255) NOT NULL,
description TEXT,
PRIMARY KEY (film_id)
)
CREATE TABLE inventory (
inventory_id INTEGER NOT NULL,
film_id INTEGER NOT NULL,
store_id INTEGER NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (inventory_id),
FOREIGN KEY(store_id) REFERENCES store (store_id),
FOREIGN KEY(film_id) REFERENCES film (film_id)
)
CREATE TABLE language (
language_id INTEGER NOT NULL,
name CHAR(20) NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (language_id)
)
CREATE TABLE payment (
payment_id INTEGER NOT NULL,
customer_id INTEGER NOT NULL,
staff_id INTEGER NOT NULL,
rental_id INTEGER DEFAULT NULL,
amount DECIMAL(5, 2) NOT NULL,
payment_date DATETIME NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (payment_id),
FOREIGN KEY(rental_id) REFERENCES rental (rental_id),
FOREIGN KEY(customer_id) REFERENCES customer (customer_id),
FOREIGN KEY(staff_id) REFERENCES staff (staff_id)
)
CREATE TABLE rental (
rental_id INTEGER NOT NULL,
rental_date DATETIME NOT NULL,
inventory_id INTEGER NOT NULL,
customer_id INTEGER NOT NULL,
return_date DATETIME DEFAULT NULL,
staff_id INTEGER NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (rental_id),
FOREIGN KEY(staff_id) REFERENCES staff (staff_id),
FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),
FOREIGN KEY(customer_id) REFERENCES customer (customer_id)
)
CREATE TABLE staff (
staff_id INTEGER NOT NULL,
first_name VARCHAR(45) NOT NULL,
last_name VARCHAR(45) NOT NULL,
address_id INTEGER NOT NULL,
picture BLOB DEFAULT NULL,
email VARCHAR(50) DEFAULT NULL,
store_id INTEGER NOT NULL,
active BOOLEAN DEFAULT TRUE NOT NULL,
username VARCHAR(16) NOT NULL,
password VARCHAR(40) DEFAULT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (staff_id),
FOREIGN KEY(address_id) REFERENCES address (address_id)
)
CREATE TABLE store (
store_id INTEGER NOT NULL,
manager_staff_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (store_id),
FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id),
FOREIGN KEY(address_id) REFERENCES address (address_id)
) |
CREATE TABLE actor (
actor_id INTEGER NOT NULL,
first_name VARCHAR(45) NOT NULL,
last_name VARCHAR(45) NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (actor_id)
)
/*
2 rows from actor table:
actor_id first_name last_name last_update
1 PENELOPE GUINESS 2006-02-15 04:34:33
2 NICK WAHLBERG 2006-02-15 04:34:33
*/
CREATE TABLE address (
address_id INTEGER NOT NULL,
address VARCHAR(50) NOT NULL,
address2 VARCHAR(50) DEFAULT NULL,
district VARCHAR(20) NOT NULL,
city_id INTEGER NOT NULL,
postal_code VARCHAR(10) DEFAULT NULL,
phone VARCHAR(20) NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (address_id),
FOREIGN KEY(city_id) REFERENCES city (city_id)
)
/*
2 rows from address table:
address_id address address2 district city_id postal_code phone last_update
1 47 MySakila Drive None Alberta 300 2006-02-15 04:45:30
2 28 MySQL Boulevard None QLD 576 2006-02-15 04:45:30
*/
CREATE TABLE category (
category_id INTEGER NOT NULL,
name VARCHAR(25) NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (category_id)
)
/*
2 rows from category table:
category_id name last_update
1 Action 2006-02-15 04:46:27
2 Animation 2006-02-15 04:46:27
*/
CREATE TABLE city (
city_id INTEGER NOT NULL,
city VARCHAR(50) NOT NULL,
country_id INTEGER NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (city_id),
FOREIGN KEY(country_id) REFERENCES country (country_id)
)
/*
2 rows from city table:
city_id city country_id last_update
1 A Corua (La Corua) 87 2006-02-15 04:45:25
2 Abha 82 2006-02-15 04:45:25
*/
CREATE TABLE country (
country_id INTEGER NOT NULL,
country VARCHAR(50) NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (country_id)
)
/*
2 rows from country table:
country_id country last_update
1 Afghanistan 2006-02-15 04:44:00
2 Algeria 2006-02-15 04:44:00
*/
CREATE TABLE customer (
customer_id INTEGER NOT NULL,
store_id INTEGER NOT NULL,
first_name VARCHAR(45) NOT NULL,
last_name VARCHAR(45) NOT NULL,
email VARCHAR(50) DEFAULT NULL,
address_id INTEGER NOT NULL,
active BOOLEAN DEFAULT TRUE NOT NULL,
create_date DATETIME NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (customer_id),
FOREIGN KEY(address_id) REFERENCES address (address_id),
FOREIGN KEY(store_id) REFERENCES store (store_id)
)
/*
2 rows from customer table:
customer_id store_id first_name last_name email address_id active create_date last_update
1 1 MARY SMITH [email protected] 5 True 2006-02-14 22:04:36 2006-02-15 04:57:20
2 1 PATRICIA JOHNSON [email protected] 6 True 2006-02-14 22:04:36 2006-02-15 04:57:20
*/
CREATE TABLE film (
film_id INTEGER NOT NULL,
title VARCHAR(255) NOT NULL,
description TEXT DEFAULT NULL,
release_year NUMERIC DEFAULT NULL,
language_id INTEGER NOT NULL,
original_language_id INTEGER DEFAULT NULL,
rental_duration INTEGER DEFAULT 3 NOT NULL,
rental_rate DECIMAL(4, 2) DEFAULT 4.99 NOT NULL,
length INTEGER DEFAULT NULL,
replacement_cost DECIMAL(5, 2) DEFAULT 19.99 NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (film_id),
FOREIGN KEY(language_id) REFERENCES language (language_id),
FOREIGN KEY(original_language_id) REFERENCES language (language_id)
)
/*
2 rows from film table:
film_id title description release_year language_id original_language_id rental_duration rental_rate length replacement_cost last_update
1 ACADEMY DINOSAUR A Epic Drama of a Feminist And a Mad Scientist who must Battle a Teacher in The Canadian Rockies 2006.0000000000 1 None 6 0.99 86 20.99 2006-02-15 05:03:42
2 ACE GOLDFINGER A Astounding Epistle of a Database Administrator And a Explorer who must Find a Car in Ancient China 2006.0000000000 1 None 3 4.99 48 12.99 2006-02-15 05:03:42
*/
CREATE TABLE film_actor (
actor_id INTEGER NOT NULL,
film_id INTEGER NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (actor_id, film_id),
FOREIGN KEY(actor_id) REFERENCES actor (actor_id),
FOREIGN KEY(film_id) REFERENCES film (film_id)
)
/*
2 rows from film_actor table:
actor_id film_id last_update
1 1 2006-02-15 05:05:03
1 23 2006-02-15 05:05:03
*/
CREATE TABLE film_category (
film_id INTEGER NOT NULL,
category_id INTEGER NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (film_id, category_id),
FOREIGN KEY(film_id) REFERENCES film (film_id),
FOREIGN KEY(category_id) REFERENCES category (category_id)
)
/*
2 rows from film_category table:
film_id category_id last_update
1 6 2006-02-15 05:07:09
2 11 2006-02-15 05:07:09
*/
CREATE TABLE film_text (
film_id SMALLINT NOT NULL,
title VARCHAR(255) NOT NULL,
description TEXT,
PRIMARY KEY (film_id)
)
/*
2 rows from film_text table:
film_id title description
*/
CREATE TABLE inventory (
inventory_id INTEGER NOT NULL,
film_id INTEGER NOT NULL,
store_id INTEGER NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (inventory_id),
FOREIGN KEY(store_id) REFERENCES store (store_id),
FOREIGN KEY(film_id) REFERENCES film (film_id)
)
/*
2 rows from inventory table:
inventory_id film_id store_id last_update
1 1 1 2006-02-15 05:09:17
2 1 1 2006-02-15 05:09:17
*/
CREATE TABLE language (
language_id INTEGER NOT NULL,
name CHAR(20) NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (language_id)
)
/*
2 rows from language table:
language_id name last_update
*/
CREATE TABLE payment (
payment_id INTEGER NOT NULL,
customer_id INTEGER NOT NULL,
staff_id INTEGER NOT NULL,
rental_id INTEGER DEFAULT NULL,
amount DECIMAL(5, 2) NOT NULL,
payment_date DATETIME NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (payment_id),
FOREIGN KEY(rental_id) REFERENCES rental (rental_id),
FOREIGN KEY(customer_id) REFERENCES customer (customer_id),
FOREIGN KEY(staff_id) REFERENCES staff (staff_id)
)
/*
2 rows from payment table:
payment_id customer_id staff_id rental_id amount payment_date last_update
1 1 1 76 2.99 2005-05-25 11:30:37 2006-02-15 22:12:30
2 1 1 573 0.99 2005-05-28 10:35:23 2006-02-15 22:12:30
*/
CREATE TABLE rental (
rental_id INTEGER NOT NULL,
rental_date DATETIME NOT NULL,
inventory_id INTEGER NOT NULL,
customer_id INTEGER NOT NULL,
return_date DATETIME DEFAULT NULL,
staff_id INTEGER NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (rental_id),
FOREIGN KEY(staff_id) REFERENCES staff (staff_id),
FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),
FOREIGN KEY(customer_id) REFERENCES customer (customer_id)
)
/*
2 rows from rental table:
rental_id rental_date inventory_id customer_id return_date staff_id last_update
1 2005-05-24 22:53:30 367 130 2005-05-26 22:04:30 1 2006-02-15 21:30:53
2 2005-05-24 22:54:33 1525 459 2005-05-28 19:40:33 1 2006-02-15 21:30:53
*/
CREATE TABLE staff (
staff_id INTEGER NOT NULL,
first_name VARCHAR(45) NOT NULL,
last_name VARCHAR(45) NOT NULL,
address_id INTEGER NOT NULL,
picture BLOB DEFAULT NULL,
email VARCHAR(50) DEFAULT NULL,
store_id INTEGER NOT NULL,
active BOOLEAN DEFAULT TRUE NOT NULL,
username VARCHAR(16) NOT NULL,
password VARCHAR(40) DEFAULT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (staff_id),
FOREIGN KEY(address_id) REFERENCES address (address_id)
)
/*
2 rows from staff table:
staff_id first_name last_name address_id picture email store_id active username password last_update
*/
CREATE TABLE store (
store_id INTEGER NOT NULL,
manager_staff_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (store_id),
FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id),
FOREIGN KEY(address_id) REFERENCES address (address_id)
)
/*
2 rows from store table:
store_id manager_staff_id address_id last_update
*/ | Count the number of different languages in these films. | SELECT count(DISTINCT language_id) FROM film | [{'count(DISTINCT language_id)': 1}] | Easy | false | false | false | false | false | false | false | false | false | false | false | false | false | [QUESTION]What is the number of distinct languages used around the world?[/QUESTION]
[SQL]SELECT count(DISTINCT LANGUAGE) FROM countrylanguage[/SQL] | [QUESTION]What is the number of distinct languages used around the world?[/QUESTION]
[SQL]SELECT count(DISTINCT LANGUAGE) FROM countrylanguage[/SQL] | [QUESTION]What is the number of distinct languages used around the world?[/QUESTION]
[SQL]SELECT count(DISTINCT LANGUAGE) FROM countrylanguage[/SQL] | [QUESTION]What is the number of distinct languages used around the world?[/QUESTION]
[SQL]SELECT count(DISTINCT LANGUAGE) FROM countrylanguage[/SQL] |