db_id stringclasses 66 values | question stringlengths 24 325 | evidence stringlengths 1 673 ⌀ | gold_query stringlengths 23 804 | db_schema stringclasses 66 values |
|---|---|---|---|---|
retail_world | How many condiments were sold in 1997? | "Condiments" is the CategoryName; in 1997 refers to year(OrderDate) = 1997; | SELECT COUNT(T2.ProductID) FROM Categories AS T1 INNER JOIN Products AS T2 ON T1.CategoryID = T2.CategoryID INNER JOIN `Order Details` AS T3 ON T2.ProductID = T3.ProductID INNER JOIN Orders AS T4 ON T3.OrderID = T4.OrderID WHERE T1.CategoryName = 'Condiments' AND T1.CategoryID = 2 AND T4.OrderDate LIKE '1997%' | CREATE TABLE Products
(
CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0
Unit TEXT, --
ReorderLevel INT, --
ProductName TEXT, --
Price REAL DEFAULT 0, --
FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),
SupplierID INTEGER, --
ProductID INTEGER PRIMARY KEY AUTOINCREMENT,
FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID),
);
CREATE TABLE Customers
(
ContactName TEXT, --
Country TEXT, --
Address TEXT, --
City TEXT, --
CustomerID INTEGER PRIMARY KEY AUTOINCREMENT,
PostalCode TEXT, --
CustomerName TEXT, --
);
CREATE TABLE EmployeeTerritories
(
TerritoryID INT, --
EmployeeID INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE OrderDetails
(
Quantity INTEGER, --
FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),
OrderID INTEGER, --
FOREIGN KEY (ProductID) REFERENCES Products (ProductID),
OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT,
ProductID INTEGER, --
);
CREATE TABLE Shippers
(
ShipperID INTEGER PRIMARY KEY AUTOINCREMENT,
ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
);
CREATE TABLE Territory
(
TerritoryDescription TEXT, --
RegionID INTEGER, --
TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT,
);
CREATE TABLE EmployeeDetails
(
EmployeeID INT PRIMARY KEY,
Title TEXT, --
Salary INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE Categories
(
CategoryID INTEGER PRIMARY KEY AUTOINCREMENT,
CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
);
CREATE TABLE Employees
(
Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT,
FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
);
CREATE TABLE Suppliers
(
PostalCode TEXT, --
Address TEXT, --
SupplierID INTEGER PRIMARY KEY AUTOINCREMENT,
City TEXT, --
Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0
Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0
ContactName TEXT, --
Phone TEXT, --
SupplierName TEXT, --
);
CREATE TABLE EmployeesExtra
(
Salary INTEGER, --
Title TEXT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
EmployeeID INTEGER PRIMARY KEY,
);
CREATE TABLE discontinued_products
(
Discontinued INTEGER, --
ProductID INTEGER PRIMARY KEY,
);
CREATE TABLE Orders
(
OrderID INTEGER PRIMARY KEY AUTOINCREMENT,
CustomerID INTEGER, --
FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),
FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID),
FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),
ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0
OrderDate DATETIME, --
EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0
);
CREATE TABLE Territories
(
TerritoryDescription TEXT, --
RegionDescription TEXT, --
);
CREATE TABLE ShippingInfo
(
ShipCountry TEXT, --
ShippedDate DATETIME, --
FOREIGN KEY (OrderID) REFERENCES Orders(OrderID),
OrderID INTEGER PRIMARY KEY,
); |
professional_basketball | What is the full name of the team that has the most players from UCLA? | "UCLA" is the college; team with most players refers to tmID where Max(Count(playerID)) | SELECT T3.name FROM players AS T1 INNER JOIN players_teams AS T2 ON T1.playerID = T2.playerID INNER JOIN teams AS T3 ON T3.tmID = T2.tmID WHERE T1.college = 'UCLA' GROUP BY T3.name ORDER BY COUNT(DISTINCT T1.playerID) DESC LIMIT 1 | CREATE TABLE players_teams
(
PostGS INTEGER, --
PostdRebounds INTEGER, --
PostPF INTEGER, --
tmID TEXT, --
threeAttempted INTEGER, --
PostRebounds INTEGER, --
assists INTEGER, --
threeMade INTEGER, --
PostBlocks INTEGER, --
PostTurnovers INTEGER, --
GP INTEGER, --
lgID TEXT, -- Example Values: `NBA`, `NBL`, `ABA`, `ABL1`, `NPBL` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0
foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade,
PostfgMade INTEGER, --
steals INTEGER, --
oRebounds INTEGER, --
PostftAttempted INTEGER, --
ftAttempted INTEGER, --
ftMade INTEGER, --
points INTEGER, --
PostfgAttempted INTEGER, --
PostftMade INTEGER, --
note TEXT, -- Example Values: `C` | Value Statics: Total count 43 - Distinct count 1 - Null count 23708
dRebounds INTEGER, --
PostSteals INTEGER, --
blocks INTEGER, --
PostAssists INTEGER, --
minutes INTEGER, --
fgAttempted INTEGER, --
playerID TEXT not null references players on update cascade on delete cascade, --
PostthreeMade INTEGER, --
PostPoints INTEGER, --
year INTEGER, --
PF INTEGER, --
fgMade INTEGER, --
PostthreeAttempted INTEGER, --
rebounds INTEGER, --
id INTEGER primary key autoincrement,
stint INTEGER, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0
PostMinutes INTEGER, --
PostGP INTEGER, --
turnovers INTEGER, --
PostoRebounds INTEGER, --
GS INTEGER, --
);
CREATE TABLE awards_coaches
(
award TEXT, -- Example Values: `NBA Coach of the Year`, `ABA Coach of the Year` | Value Statics: Total count 61 - Distinct count 2 - Null count 0
id INTEGER primary key autoincrement,
note TEXT, -- Example Values: `tie` | Value Statics: Total count 4 - Distinct count 1 - Null count 57
coachID TEXT, --
lgID TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 61 - Distinct count 2 - Null count 0
foreign key (coachID, year) references coaches (coachID, year) on update cascade on delete cascade,
year INTEGER, --
);
CREATE TABLE draft
(
draftOverall INTEGER null, --
lgID TEXT null, -- Example Values: `ABA`, `NBA` | Value Statics: Total count 8621 - Distinct count 2 - Null count 0
suffixName TEXT null, -- Example Values: `Jr.` | Value Statics: Total count 2 - Distinct count 1 - Null count 8619
draftYear INTEGER null, --
draftSelection INTEGER null, --
tmID TEXT null, --
draftRound INTEGER null, --
lastName TEXT null, --
playerID TEXT null, --
draftFrom TEXT null, --
id INTEGER default 0 not null primary key,
firstName TEXT null, --
foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade,
foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade,
);
CREATE TABLE player_allstar
(
rebounds INTEGER null, --
playerID TEXT not null, --
season_id INTEGER not null, --
assists INTEGER null, --
conference TEXT null, -- Example Values: `East`, `West`, `Weset`, `Allstars`, `Denver` | Value Statics: Total count 1608 - Distinct count 5 - Null count 0
points INTEGER null, --
personal_fouls INTEGER null, -- Example Values: `3`, `2`, `0`, `1`, `5` | Value Statics: Total count 540 - Distinct count 8 - Null count 1068
ft_attempted INTEGER null, -- Example Values: `2`, `4`, `0`, `6`, `3` | Value Statics: Total count 1561 - Distinct count 17 - Null count 47
fg_attempted INTEGER null, --
league_id TEXT null, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 1608 - Distinct count 2 - Null count 0
foreign key (playerID) references players (playerID) on update cascade on delete cascade,
fg_made INTEGER null, -- Example Values: `4`, `8`, `5`, `7`, `3` | Value Statics: Total count 1561 - Distinct count 18 - Null count 47
ft_made INTEGER null, -- Example Values: `2`, `3`, `0`, `1`, `4` | Value Statics: Total count 1561 - Distinct count 13 - Null count 47
steals INTEGER null, -- Example Values: `3`, `0`, `1`, `2`, `5` | Value Statics: Total count 398 - Distinct count 7 - Null count 1210
games_played INTEGER null, -- Example Values: `1` | Value Statics: Total count 1608 - Distinct count 1 - Null count 0
first_name TEXT null, --
d_rebounds INTEGER null, -- Example Values: `2`, `5`, `0`, `1`, `4` | Value Statics: Total count 493 - Distinct count 14 - Null count 1115
last_name TEXT null, --
primary key (playerID, season_id),
turnovers INTEGER null, -- Example Values: `1`, `0`, `3`, `2`, `4` | Value Statics: Total count 493 - Distinct count 9 - Null count 1115
three_made INTEGER null, -- Example Values: `0`, `1`, `3`, `5`, `4` | Value Statics: Total count 566 - Distinct count 7 - Null count 1042
minutes INTEGER null, --
blocks INTEGER null, -- Example Values: `2`, `0`, `1`, `3`, `5` | Value Statics: Total count 398 - Distinct count 6 - Null count 1210
three_attempted INTEGER null, -- Example Values: `0`, `1`, `6`, `7`, `10` | Value Statics: Total count 540 - Distinct count 12 - Null count 1068
o_rebounds INTEGER null, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 493 - Distinct count 10 - Null count 1115
);
CREATE TABLE awards_players
(
foreign key (playerID) references players (playerID) on update cascade on delete cascade,
year INTEGER not null, --
pos TEXT null, -- Example Values: `C`, `F`, `G`, `F/G`, `F/C` | Value Statics: Total count 833 - Distinct count 5 - Null count 886
primary key (playerID, year, award),
lgID TEXT null, -- Example Values: `NBA`, `ABA`, `NBL`, `ABL1` | Value Statics: Total count 1719 - Distinct count 4 - Null count 0
award TEXT not null, --
playerID TEXT not null, --
note TEXT null, -- Example Values: `tie` | Value Statics: Total count 37 - Distinct count 1 - Null count 1682
);
CREATE TABLE series_post
(
tmIDLoser TEXT, --
id INTEGER primary key autoincrement,
series TEXT, -- Example Values: `O`, `M`, `N`, `A`, `K` | Value Statics: Total count 775 - Distinct count 11 - Null count 0
tmIDWinner TEXT, --
round TEXT, -- Example Values: `F`, `QF`, `SF`, `DT`, `DF` | Value Statics: Total count 775 - Distinct count 11 - Null count 0
year INTEGER, --
foreign key (tmIDLoser, year) references teams (tmID, year) on update cascade on delete cascade,
foreign key (tmIDWinner, year) references teams (tmID, year) on update cascade on delete cascade,
W INTEGER, -- Example Values: `4`, `2`, `1`, `3`, `0` | Value Statics: Total count 775 - Distinct count 5 - Null count 0
lgIDLoser TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0
lgIDWinner TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0
L INTEGER, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 775 - Distinct count 5 - Null count 0
);
CREATE TABLE players
(
nameGiven TEXT null, -- Example Values: `nameGiven`, `Mort`, `Robert`, `Jim`, `Mike` | Value Statics: Total count 10 - Distinct count 9 - Null count 5052
lastseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15
hsCountry TEXT null, --
firstName TEXT null, --
hsCity TEXT null, --
firstseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15
weight INTEGER null, --
birthCountry TEXT null, --
race TEXT null, -- Example Values: `B`, `W`, `O`, `1`, `r` | Value Statics: Total count 4903 - Distinct count 5 - Null count 159
lastName TEXT null, --
birthDate DATE null, --
collegeOther TEXT null, --
birthState TEXT null, --
useFirst TEXT null, --
pos TEXT null, -- Example Values: `F-C`, `C`, `G`, `G-F`, `C-F` | Value Statics: Total count 4880 - Distinct count 14 - Null count 182
playerID TEXT not null primary key,
college TEXT null, --
highSchool TEXT null, --
hsState TEXT null, --
height REAL null, --
deathDate DATE null, --
nameSuffix TEXT null, -- Example Values: `Jr.`, `III`, `nameSuffix`, `II`, `IV` | Value Statics: Total count 324 - Distinct count 6 - Null count 4738
nameNick TEXT null, --
fullGivenName TEXT null, --
birthCity TEXT null, --
middleName TEXT null, --
);
CREATE TABLE teams
(
d_pts INTEGER null, --
name TEXT null, --
homeLost INTEGER null, --
o_ftm INTEGER null, --
franchID TEXT null, --
tmID TEXT not null, --
awayWon INTEGER null, --
primary key (year, tmID),
o_fgm INTEGER null, --
year INTEGER not null, --
awayLost INTEGER null, --
arena TEXT null, --
confID TEXT null, -- Example Values: `EC`, `WC` | Value Statics: Total count 1064 - Distinct count 2 - Null count 472
games INTEGER null, --
lost INTEGER null, --
divID TEXT null, -- Example Values: `EA`, `WE`, `ED`, `WD`, `SO` | Value Statics: Total count 1498 - Distinct count 13 - Null count 38
lgID TEXT null, -- Example Values: `NBL`, `NBA`, `PBLA`, `NPBL`, `ABL1` | Value Statics: Total count 1536 - Distinct count 6 - Null count 0
homeWon INTEGER null, --
confRank INTEGER null, -- Example Values: `0`, `4`, `3`, `5`, `7` | Value Statics: Total count 1536 - Distinct count 16 - Null count 0
o_pts INTEGER null, --
`rank` INTEGER null, -- Example Values: `1`, `2`, `4`, `5`, `6` | Value Statics: Total count 1536 - Distinct count 10 - Null count 0
playoff TEXT null, -- Example Values: `CF`, `WC`, `LC`, `CS`, `F` | Value Statics: Total count 901 - Distinct count 15 - Null count 635
won INTEGER null, --
);
CREATE TABLE coaches
(
primary key (coachID, year, tmID, stint),
lgID TEXT null, -- Example Values: `NBA`, `ABA`, `ABL1`, `PBLA`, `NPBL` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0
post_losses INTEGER null, -- Example Values: `3`, `9`, `7`, `8`, `0` | Value Statics: Total count 1649 - Distinct count 12 - Null count 40
year INTEGER not null, --
won INTEGER null, --
foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade,
post_wins INTEGER null, -- Example Values: `0`, `12`, `9`, `13`, `1` | Value Statics: Total count 1649 - Distinct count 17 - Null count 40
coachID TEXT not null, --
tmID TEXT not null, --
lost INTEGER null, --
stint INTEGER not null, -- Example Values: `2`, `1`, `4`, `5`, `3` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0
); |
synthea | When did Mrs. Ira Deckow have the standard pregnancy test? | standard pregnancy test refers to DESCRIPTION = 'Standard pregnancy test' from procedures; | SELECT T2.date FROM patients AS T1 INNER JOIN procedures AS T2 ON T1.patient = T2.PATIENT WHERE T1.prefix = 'Mrs.' AND T1.first = 'Ira' AND T1.last = 'Deckow' AND T2.description = 'Standard pregnancy test' | CREATE TABLE immunizations
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
DATE DATE, --
primary key (DATE, PATIENT, ENCOUNTER, CODE),
DESCRIPTION TEXT, -- Example Values: `Influenza seasonal injectable preservative free`, `Td (adult) preservative free`, `meningococcal MCV4P`, `Tdap`, `HPV quadrivalent` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
);
CREATE TABLE allergies
(
CODE INTEGER, -- Example Values: `232347008`, `300916003`, `419474003`, `424213003`, `300913006` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
foreign key (ENCOUNTER) references encounters(ID),
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
primary key (PATIENT, ENCOUNTER, CODE),
STOP TEXT, -- Example Values: `12/22/14`, `4/21/10`, `10/15/11`, `3/17/10`, `5/26/08` | Value Statics: Total count 16 - Distinct count 11 - Null count 556
START TEXT, --
DESCRIPTION TEXT, -- Example Values: `Allergy to dairy product`, `Allergy to tree pollen`, `Allergy to grass pollen`, `Dander (animal) allergy`, `House dust mite allergy` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
);
CREATE TABLE observations
(
DATE DATE, --
ENCOUNTER TEXT, --
VALUE REAL, --
UNITS TEXT, -- Example Values: `cm`, `kg`, `kg/m2`, `mmHg`, `Cel` | Value Statics: Total count 78444 - Distinct count 17 - Null count 455
DESCRIPTION TEXT, --
CODE TEXT, --
PATIENT TEXT, --
foreign key (PATIENT) references patients(patient),
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE medications
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, --
PATIENT TEXT, --
STOP DATE, --
START DATE, --
REASONDESCRIPTION TEXT, --
DESCRIPTION TEXT, --
primary key (START, PATIENT, ENCOUNTER, CODE),
foreign key (PATIENT) references patients(patient),
REASONCODE INTEGER, --
ENCOUNTER TEXT, --
);
CREATE TABLE careplans
(
START DATE, --
STOP DATE, --
ID TEXT, --
REASONCODE INTEGER, --
REASONDESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
DESCRIPTION TEXT, --
CODE REAL, --
ENCOUNTER TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE encounters
(
DATE DATE, --
REASONCODE INTEGER, --
CODE INTEGER, --
ID TEXT primary key,
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
REASONDESCRIPTION TEXT, --
);
CREATE TABLE procedures
(
foreign key (PATIENT) references patients(patient),
REASONDESCRIPTION TEXT, --
PATIENT TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
DATE DATE, --
DESCRIPTION TEXT, --
ENCOUNTER TEXT, --
CODE INTEGER, --
REASONCODE INTEGER, --
);
CREATE TABLE patients
(
suffix TEXT, -- Example Values: `PhD`, `JD`, `MD` | Value Statics: Total count 45 - Distinct count 3 - Null count 1417
prefix TEXT, -- Example Values: `Mr.`, `Mrs.`, `Ms.` | Value Statics: Total count 1166 - Distinct count 3 - Null count 296
deathdate DATE, --
ethnicity TEXT, --
race TEXT, -- Example Values: `black`, `white`, `hispanic`, `asian` | Value Statics: Total count 1462 - Distinct count 4 - Null count 0
address TEXT, --
birthplace TEXT, --
passport TEXT, --
maiden TEXT, --
birthdate DATE, --
marital TEXT, -- Example Values: `S`, `M` | Value Statics: Total count 1033 - Distinct count 2 - Null count 429
gender TEXT, -- Example Values: `F`, `M` | Value Statics: Total count 1462 - Distinct count 2 - Null count 0
drivers TEXT, --
first TEXT, --
last TEXT, --
patient TEXT primary key,
ssn TEXT, --
);
CREATE TABLE claims
(
ENCOUNTER TEXT references encounters, --
PATIENT TEXT references patients, --
ORGANIZATION TEXT, -- Example Values: `temp organization` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
TOTAL INTEGER, -- Example Values: `100` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
BILLABLEPERIOD DATE, --
DIAGNOSIS TEXT, --
ID TEXT primary key,
);
CREATE TABLE conditions
(
START DATE, --
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
CODE INTEGER, --
ENCOUNTER TEXT, --
STOP DATE, --
foreign key (ENCOUNTER) references encounters(ID),
foreign key (DESCRIPTION) references all_prevalences(ITEM),
);
CREATE TABLE all_prevalences
(
"POPULATION TYPE" TEXT, -- Example Values: `LIVING` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
"POPULATION COUNT" INTEGER, -- Example Values: `1000` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
ITEM TEXT primary key,
"PREVALENCE PERCENTAGE" REAL, --
"PREVALENCE RATE" REAL, --
OCCURRENCES INTEGER, --
); |
software_company | Of the first 60,000 customers who sent a true response to the incentive mailing sent by the marketing department, how many of them are teenagers? | RESPONSE = 'true'; teenagers are people aged between 13 and 19 years; | SELECT COUNT(T1.ID) FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID WHERE T1.age >= 13 AND T1.age <= 19 AND T2.RESPONSE = 'true' | CREATE TABLE Customers
(
EDUCATIONNUM INTEGER, -- Example Values: `7`, `3`, `4`, `11`, `5` | Value Statics: Total count 100000 - Distinct count 17 - Null count 0
MARITAL_STATUS TEXT, -- Example Values: `Never-married`, `Married-civ-spouse`, `Divorced`, `Widowed`, `Other` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
ID INTEGER constraint Customers_pk primary key,
SEX TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
OCCUPATION TEXT, -- Example Values: `Machine-op-inspct`, `Handlers-cleaners`, `Exec-managerial`, `Farming-fishing`, `Other-service` | Value Statics: Total count 100000 - Distinct count 8 - Null count 0
age INTEGER, --
GEOID INTEGER constraint Customers_Demog_GEOID_fk references Demog, --
);
CREATE TABLE Mailings1_2
(
RESPONSE TEXT, -- Example Values: `false`, `true` | Value Statics: Total count 60000 - Distinct count 2 - Null count 0
REFID INTEGER constraint Mailings1_2_pk primary key constraint Mailings1_2_Customers_ID_fk references Customers,
REF_DATE DATETIME, -- Example Values: `2007-02-01 12:00:00.0`, `2007-03-01 12:00:00.0` | Value Statics: Total count 60000 - Distinct count 2 - Null count 0
);
CREATE TABLE Sales
(
REFID INTEGER references Customers, --
EVENT_DATE DATETIME, --
AMOUNT REAL, --
EVENTID INTEGER constraint Sales_pk primary key,
);
CREATE TABLE Demog
(
A_VAR1 REAL, --
A_VAR2 REAL, --
A_VAR14 REAL, --
A_VAR8 REAL, --
A_VAR12 REAL, --
A_VAR6 REAL, --
A_VAR17 REAL, --
A_VAR15 REAL, --
A_VAR10 REAL, --
A_VAR16 REAL, --
INHABITANTS_K REAL, --
A_VAR3 REAL, --
A_VAR7 REAL, --
A_VAR4 REAL, --
A_VAR5 REAL, --
A_VAR13 REAL, --
A_VAR9 REAL, --
INCOME_K REAL, --
GEOID INTEGER constraint Demog_pk primary key,
A_VAR18 REAL, --
A_VAR11 REAL, --
);
CREATE TABLE mailings3
(
RESPONSE TEXT, -- Example Values: `false`, `true` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
REF_DATE DATETIME, -- Example Values: `2007-07-01 12:00:00.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
REFID INTEGER constraint mailings3_pk primary key,
); |
retail_world | What is the category of the product that has the highest number of discontinued products? | discontinued products refers to Discontinued = 1; highest number of discontinued products refers to MAX(Discontinued = 1) | SELECT T2.CategoryName FROM Products AS T1 INNER JOIN Categories AS T2 ON T1.CategoryID = T2.CategoryID WHERE T1.Discontinued = 1 GROUP BY T2.CategoryName ORDER BY COUNT(T1.ProductID) DESC LIMIT 1 | CREATE TABLE Products
(
CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0
Unit TEXT, --
ReorderLevel INT, --
ProductName TEXT, --
Price REAL DEFAULT 0, --
FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),
SupplierID INTEGER, --
ProductID INTEGER PRIMARY KEY AUTOINCREMENT,
FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID),
);
CREATE TABLE Customers
(
ContactName TEXT, --
Country TEXT, --
Address TEXT, --
City TEXT, --
CustomerID INTEGER PRIMARY KEY AUTOINCREMENT,
PostalCode TEXT, --
CustomerName TEXT, --
);
CREATE TABLE EmployeeTerritories
(
TerritoryID INT, --
EmployeeID INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE OrderDetails
(
Quantity INTEGER, --
FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),
OrderID INTEGER, --
FOREIGN KEY (ProductID) REFERENCES Products (ProductID),
OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT,
ProductID INTEGER, --
);
CREATE TABLE Shippers
(
ShipperID INTEGER PRIMARY KEY AUTOINCREMENT,
ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
);
CREATE TABLE Territory
(
TerritoryDescription TEXT, --
RegionID INTEGER, --
TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT,
);
CREATE TABLE EmployeeDetails
(
EmployeeID INT PRIMARY KEY,
Title TEXT, --
Salary INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE Categories
(
CategoryID INTEGER PRIMARY KEY AUTOINCREMENT,
CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
);
CREATE TABLE Employees
(
Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT,
FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
);
CREATE TABLE Suppliers
(
PostalCode TEXT, --
Address TEXT, --
SupplierID INTEGER PRIMARY KEY AUTOINCREMENT,
City TEXT, --
Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0
Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0
ContactName TEXT, --
Phone TEXT, --
SupplierName TEXT, --
);
CREATE TABLE EmployeesExtra
(
Salary INTEGER, --
Title TEXT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
EmployeeID INTEGER PRIMARY KEY,
);
CREATE TABLE discontinued_products
(
Discontinued INTEGER, --
ProductID INTEGER PRIMARY KEY,
);
CREATE TABLE Orders
(
OrderID INTEGER PRIMARY KEY AUTOINCREMENT,
CustomerID INTEGER, --
FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),
FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID),
FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),
ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0
OrderDate DATETIME, --
EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0
);
CREATE TABLE Territories
(
TerritoryDescription TEXT, --
RegionDescription TEXT, --
);
CREATE TABLE ShippingInfo
(
ShipCountry TEXT, --
ShippedDate DATETIME, --
FOREIGN KEY (OrderID) REFERENCES Orders(OrderID),
OrderID INTEGER PRIMARY KEY,
); |
professional_basketball | Please list the first names of the players with the most personal fouls in the 'NBL' league. | "NBL" is the lgID; most personal foul refers to Max(Count(PF)) | SELECT T1.firstName FROM players AS T1 INNER JOIN players_teams AS T2 ON T1.playerID = T2.playerID WHERE T2.lgID = 'NBL' GROUP BY T1.playerID, T1.firstName ORDER BY COUNT(PF) DESC LIMIT 1 | CREATE TABLE players_teams
(
PostGS INTEGER, --
PostdRebounds INTEGER, --
PostPF INTEGER, --
tmID TEXT, --
threeAttempted INTEGER, --
PostRebounds INTEGER, --
assists INTEGER, --
threeMade INTEGER, --
PostBlocks INTEGER, --
PostTurnovers INTEGER, --
GP INTEGER, --
lgID TEXT, -- Example Values: `NBA`, `NBL`, `ABA`, `ABL1`, `NPBL` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0
foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade,
PostfgMade INTEGER, --
steals INTEGER, --
oRebounds INTEGER, --
PostftAttempted INTEGER, --
ftAttempted INTEGER, --
ftMade INTEGER, --
points INTEGER, --
PostfgAttempted INTEGER, --
PostftMade INTEGER, --
note TEXT, -- Example Values: `C` | Value Statics: Total count 43 - Distinct count 1 - Null count 23708
dRebounds INTEGER, --
PostSteals INTEGER, --
blocks INTEGER, --
PostAssists INTEGER, --
minutes INTEGER, --
fgAttempted INTEGER, --
playerID TEXT not null references players on update cascade on delete cascade, --
PostthreeMade INTEGER, --
PostPoints INTEGER, --
year INTEGER, --
PF INTEGER, --
fgMade INTEGER, --
PostthreeAttempted INTEGER, --
rebounds INTEGER, --
id INTEGER primary key autoincrement,
stint INTEGER, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0
PostMinutes INTEGER, --
PostGP INTEGER, --
turnovers INTEGER, --
PostoRebounds INTEGER, --
GS INTEGER, --
);
CREATE TABLE awards_coaches
(
award TEXT, -- Example Values: `NBA Coach of the Year`, `ABA Coach of the Year` | Value Statics: Total count 61 - Distinct count 2 - Null count 0
id INTEGER primary key autoincrement,
note TEXT, -- Example Values: `tie` | Value Statics: Total count 4 - Distinct count 1 - Null count 57
coachID TEXT, --
lgID TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 61 - Distinct count 2 - Null count 0
foreign key (coachID, year) references coaches (coachID, year) on update cascade on delete cascade,
year INTEGER, --
);
CREATE TABLE draft
(
draftOverall INTEGER null, --
lgID TEXT null, -- Example Values: `ABA`, `NBA` | Value Statics: Total count 8621 - Distinct count 2 - Null count 0
suffixName TEXT null, -- Example Values: `Jr.` | Value Statics: Total count 2 - Distinct count 1 - Null count 8619
draftYear INTEGER null, --
draftSelection INTEGER null, --
tmID TEXT null, --
draftRound INTEGER null, --
lastName TEXT null, --
playerID TEXT null, --
draftFrom TEXT null, --
id INTEGER default 0 not null primary key,
firstName TEXT null, --
foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade,
foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade,
);
CREATE TABLE player_allstar
(
rebounds INTEGER null, --
playerID TEXT not null, --
season_id INTEGER not null, --
assists INTEGER null, --
conference TEXT null, -- Example Values: `East`, `West`, `Weset`, `Allstars`, `Denver` | Value Statics: Total count 1608 - Distinct count 5 - Null count 0
points INTEGER null, --
personal_fouls INTEGER null, -- Example Values: `3`, `2`, `0`, `1`, `5` | Value Statics: Total count 540 - Distinct count 8 - Null count 1068
ft_attempted INTEGER null, -- Example Values: `2`, `4`, `0`, `6`, `3` | Value Statics: Total count 1561 - Distinct count 17 - Null count 47
fg_attempted INTEGER null, --
league_id TEXT null, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 1608 - Distinct count 2 - Null count 0
foreign key (playerID) references players (playerID) on update cascade on delete cascade,
fg_made INTEGER null, -- Example Values: `4`, `8`, `5`, `7`, `3` | Value Statics: Total count 1561 - Distinct count 18 - Null count 47
ft_made INTEGER null, -- Example Values: `2`, `3`, `0`, `1`, `4` | Value Statics: Total count 1561 - Distinct count 13 - Null count 47
steals INTEGER null, -- Example Values: `3`, `0`, `1`, `2`, `5` | Value Statics: Total count 398 - Distinct count 7 - Null count 1210
games_played INTEGER null, -- Example Values: `1` | Value Statics: Total count 1608 - Distinct count 1 - Null count 0
first_name TEXT null, --
d_rebounds INTEGER null, -- Example Values: `2`, `5`, `0`, `1`, `4` | Value Statics: Total count 493 - Distinct count 14 - Null count 1115
last_name TEXT null, --
primary key (playerID, season_id),
turnovers INTEGER null, -- Example Values: `1`, `0`, `3`, `2`, `4` | Value Statics: Total count 493 - Distinct count 9 - Null count 1115
three_made INTEGER null, -- Example Values: `0`, `1`, `3`, `5`, `4` | Value Statics: Total count 566 - Distinct count 7 - Null count 1042
minutes INTEGER null, --
blocks INTEGER null, -- Example Values: `2`, `0`, `1`, `3`, `5` | Value Statics: Total count 398 - Distinct count 6 - Null count 1210
three_attempted INTEGER null, -- Example Values: `0`, `1`, `6`, `7`, `10` | Value Statics: Total count 540 - Distinct count 12 - Null count 1068
o_rebounds INTEGER null, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 493 - Distinct count 10 - Null count 1115
);
CREATE TABLE awards_players
(
foreign key (playerID) references players (playerID) on update cascade on delete cascade,
year INTEGER not null, --
pos TEXT null, -- Example Values: `C`, `F`, `G`, `F/G`, `F/C` | Value Statics: Total count 833 - Distinct count 5 - Null count 886
primary key (playerID, year, award),
lgID TEXT null, -- Example Values: `NBA`, `ABA`, `NBL`, `ABL1` | Value Statics: Total count 1719 - Distinct count 4 - Null count 0
award TEXT not null, --
playerID TEXT not null, --
note TEXT null, -- Example Values: `tie` | Value Statics: Total count 37 - Distinct count 1 - Null count 1682
);
CREATE TABLE series_post
(
tmIDLoser TEXT, --
id INTEGER primary key autoincrement,
series TEXT, -- Example Values: `O`, `M`, `N`, `A`, `K` | Value Statics: Total count 775 - Distinct count 11 - Null count 0
tmIDWinner TEXT, --
round TEXT, -- Example Values: `F`, `QF`, `SF`, `DT`, `DF` | Value Statics: Total count 775 - Distinct count 11 - Null count 0
year INTEGER, --
foreign key (tmIDLoser, year) references teams (tmID, year) on update cascade on delete cascade,
foreign key (tmIDWinner, year) references teams (tmID, year) on update cascade on delete cascade,
W INTEGER, -- Example Values: `4`, `2`, `1`, `3`, `0` | Value Statics: Total count 775 - Distinct count 5 - Null count 0
lgIDLoser TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0
lgIDWinner TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0
L INTEGER, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 775 - Distinct count 5 - Null count 0
);
CREATE TABLE players
(
nameGiven TEXT null, -- Example Values: `nameGiven`, `Mort`, `Robert`, `Jim`, `Mike` | Value Statics: Total count 10 - Distinct count 9 - Null count 5052
lastseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15
hsCountry TEXT null, --
firstName TEXT null, --
hsCity TEXT null, --
firstseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15
weight INTEGER null, --
birthCountry TEXT null, --
race TEXT null, -- Example Values: `B`, `W`, `O`, `1`, `r` | Value Statics: Total count 4903 - Distinct count 5 - Null count 159
lastName TEXT null, --
birthDate DATE null, --
collegeOther TEXT null, --
birthState TEXT null, --
useFirst TEXT null, --
pos TEXT null, -- Example Values: `F-C`, `C`, `G`, `G-F`, `C-F` | Value Statics: Total count 4880 - Distinct count 14 - Null count 182
playerID TEXT not null primary key,
college TEXT null, --
highSchool TEXT null, --
hsState TEXT null, --
height REAL null, --
deathDate DATE null, --
nameSuffix TEXT null, -- Example Values: `Jr.`, `III`, `nameSuffix`, `II`, `IV` | Value Statics: Total count 324 - Distinct count 6 - Null count 4738
nameNick TEXT null, --
fullGivenName TEXT null, --
birthCity TEXT null, --
middleName TEXT null, --
);
CREATE TABLE teams
(
d_pts INTEGER null, --
name TEXT null, --
homeLost INTEGER null, --
o_ftm INTEGER null, --
franchID TEXT null, --
tmID TEXT not null, --
awayWon INTEGER null, --
primary key (year, tmID),
o_fgm INTEGER null, --
year INTEGER not null, --
awayLost INTEGER null, --
arena TEXT null, --
confID TEXT null, -- Example Values: `EC`, `WC` | Value Statics: Total count 1064 - Distinct count 2 - Null count 472
games INTEGER null, --
lost INTEGER null, --
divID TEXT null, -- Example Values: `EA`, `WE`, `ED`, `WD`, `SO` | Value Statics: Total count 1498 - Distinct count 13 - Null count 38
lgID TEXT null, -- Example Values: `NBL`, `NBA`, `PBLA`, `NPBL`, `ABL1` | Value Statics: Total count 1536 - Distinct count 6 - Null count 0
homeWon INTEGER null, --
confRank INTEGER null, -- Example Values: `0`, `4`, `3`, `5`, `7` | Value Statics: Total count 1536 - Distinct count 16 - Null count 0
o_pts INTEGER null, --
`rank` INTEGER null, -- Example Values: `1`, `2`, `4`, `5`, `6` | Value Statics: Total count 1536 - Distinct count 10 - Null count 0
playoff TEXT null, -- Example Values: `CF`, `WC`, `LC`, `CS`, `F` | Value Statics: Total count 901 - Distinct count 15 - Null count 635
won INTEGER null, --
);
CREATE TABLE coaches
(
primary key (coachID, year, tmID, stint),
lgID TEXT null, -- Example Values: `NBA`, `ABA`, `ABL1`, `PBLA`, `NPBL` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0
post_losses INTEGER null, -- Example Values: `3`, `9`, `7`, `8`, `0` | Value Statics: Total count 1649 - Distinct count 12 - Null count 40
year INTEGER not null, --
won INTEGER null, --
foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade,
post_wins INTEGER null, -- Example Values: `0`, `12`, `9`, `13`, `1` | Value Statics: Total count 1649 - Distinct count 17 - Null count 40
coachID TEXT not null, --
tmID TEXT not null, --
lost INTEGER null, --
stint INTEGER not null, -- Example Values: `2`, `1`, `4`, `5`, `3` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0
); |
superstore | What is the name of the product that has the highest original price? | has the highest original price refers to MAX(DIVIDE(Sales, SUTRACT(1, discount))); name of the product refers to "Product Name" | SELECT T2.`Product Name` FROM east_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` ORDER BY (T1.Sales / (1 - T1.Discount)) DESC LIMIT 1 | CREATE TABLE west_superstore
(
Profit REAL, --
Region TEXT, -- Example Values: `West` | Value Statics: Total count 6406 - Distinct count 1 - Null count 0
"Product ID" TEXT, --
foreign key ("Product ID", Region) references product("Product ID",Region),
"Order Date" DATE, --
foreign key ("Customer ID", Region) references people("Customer ID",Region),
"Ship Mode" TEXT, -- Example Values: `Second Class`, `Standard Class`, `First Class`, `Same Day` | Value Statics: Total count 6406 - Distinct count 4 - Null count 0
"Customer ID" TEXT, --
"Order ID" TEXT, --
"Row ID" INTEGER primary key,
Sales REAL, --
Quantity INTEGER, -- Example Values: `3`, `5`, `4`, `10`, `2` | Value Statics: Total count 6406 - Distinct count 14 - Null count 0
Discount REAL, -- Example Values: `0.0`, `0.15`, `0.2`, `0.7`, `0.5` | Value Statics: Total count 6406 - Distinct count 5 - Null count 0
"Ship Date" DATE, --
);
CREATE TABLE people
(
Region TEXT, -- Example Values: `Central`, `East`, `West`, `South` | Value Statics: Total count 2501 - Distinct count 4 - Null count 0
Country TEXT, -- Example Values: `United States` | Value Statics: Total count 2501 - Distinct count 1 - Null count 0
State TEXT, --
primary key ("Customer ID", Region),
City TEXT, --
Segment TEXT, -- Example Values: `Consumer`, `Home Office`, `Corporate` | Value Statics: Total count 2501 - Distinct count 3 - Null count 0
"Customer ID" TEXT, --
"Postal Code" INTEGER, --
"Customer Name" TEXT, --
);
CREATE TABLE product
(
"Product ID" TEXT, --
Region TEXT, -- Example Values: `Central`, `South`, `West`, `East` | Value Statics: Total count 5298 - Distinct count 4 - Null count 0
"Sub-Category" TEXT, -- Example Values: `Bookcases`, `Chairs`, `Furnishings`, `Tables`, `Appliances` | Value Statics: Total count 5298 - Distinct count 17 - Null count 0
Category TEXT, -- Example Values: `Furniture`, `Office Supplies`, `Technology` | Value Statics: Total count 5298 - Distinct count 3 - Null count 0
"Product Name" TEXT, --
primary key ("Product ID", Region),
);
CREATE TABLE central_superstore
(
"Ship Mode" TEXT, -- Example Values: `Standard Class`, `First Class`, `Second Class`, `Same Day` | Value Statics: Total count 4646 - Distinct count 4 - Null count 0
Quantity INTEGER, -- Example Values: `2`, `3`, `7`, `1`, `5` | Value Statics: Total count 4646 - Distinct count 14 - Null count 0
"Ship Date" DATE, --
"Order Date" DATE, --
"Order ID" TEXT, --
"Row ID" INTEGER primary key,
"Product ID" TEXT, --
foreign key ("Customer ID", Region) references people("Customer ID",Region),
Sales REAL, --
foreign key ("Product ID", Region) references product("Product ID",Region),
Profit REAL, --
"Customer ID" TEXT, --
Discount REAL, -- Example Values: `0.2`, `0.8`, `0.6`, `0.0`, `0.1` | Value Statics: Total count 4646 - Distinct count 9 - Null count 0
Region TEXT, -- Example Values: `Central` | Value Statics: Total count 4646 - Distinct count 1 - Null count 0
);
CREATE TABLE east_superstore
(
"Row ID" INTEGER primary key,
Region TEXT, -- Example Values: `East` | Value Statics: Total count 5696 - Distinct count 1 - Null count 0
"Order ID" TEXT, --
"Product ID" TEXT, --
Sales REAL, --
foreign key ("Product ID", Region) references product("Product ID",Region),
Discount REAL, -- Example Values: `0.2`, `0.0`, `0.7`, `0.5`, `0.4` | Value Statics: Total count 5696 - Distinct count 7 - Null count 0
Quantity INTEGER, -- Example Values: `3`, `2`, `7`, `4`, `6` | Value Statics: Total count 5696 - Distinct count 14 - Null count 0
Profit REAL, --
foreign key ("Customer ID", Region) references people("Customer ID",Region),
"Ship Mode" TEXT, -- Example Values: `Standard Class`, `First Class`, `Second Class`, `Same Day` | Value Statics: Total count 5696 - Distinct count 4 - Null count 0
"Customer ID" TEXT, --
"Order Date" DATE, --
"Ship Date" DATE, --
);
CREATE TABLE south_superstore
(
"Product ID" TEXT, --
Profit REAL, --
Sales REAL, --
"Order Date" DATE, --
"Customer ID" TEXT, --
Discount REAL, -- Example Values: `0.0`, `0.7`, `0.2`, `0.5`, `0.45` | Value Statics: Total count 3240 - Distinct count 6 - Null count 0
Region TEXT, -- Example Values: `South` | Value Statics: Total count 3240 - Distinct count 1 - Null count 0
"Ship Date" DATE, --
foreign key ("Product ID", Region) references product("Product ID",Region),
foreign key ("Customer ID", Region) references people("Customer ID",Region),
Quantity INTEGER, -- Example Values: `3`, `9`, `2`, `4`, `1` | Value Statics: Total count 3240 - Distinct count 14 - Null count 0
"Order ID" TEXT, --
"Row ID" INTEGER primary key,
"Ship Mode" TEXT, -- Example Values: `First Class`, `Standard Class`, `Second Class`, `Same Day` | Value Statics: Total count 3240 - Distinct count 4 - Null count 0
); |
synthea | How many patients are allergic to eggs? | allergic to eggs refer to DESCRIPTION = 'Allergy to eggs' from allergies; | SELECT COUNT(PATIENT) FROM allergies WHERE DESCRIPTION = 'Allergy to eggs' | CREATE TABLE immunizations
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
DATE DATE, --
primary key (DATE, PATIENT, ENCOUNTER, CODE),
DESCRIPTION TEXT, -- Example Values: `Influenza seasonal injectable preservative free`, `Td (adult) preservative free`, `meningococcal MCV4P`, `Tdap`, `HPV quadrivalent` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
);
CREATE TABLE allergies
(
CODE INTEGER, -- Example Values: `232347008`, `300916003`, `419474003`, `424213003`, `300913006` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
foreign key (ENCOUNTER) references encounters(ID),
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
primary key (PATIENT, ENCOUNTER, CODE),
STOP TEXT, -- Example Values: `12/22/14`, `4/21/10`, `10/15/11`, `3/17/10`, `5/26/08` | Value Statics: Total count 16 - Distinct count 11 - Null count 556
START TEXT, --
DESCRIPTION TEXT, -- Example Values: `Allergy to dairy product`, `Allergy to tree pollen`, `Allergy to grass pollen`, `Dander (animal) allergy`, `House dust mite allergy` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
);
CREATE TABLE observations
(
DATE DATE, --
ENCOUNTER TEXT, --
VALUE REAL, --
UNITS TEXT, -- Example Values: `cm`, `kg`, `kg/m2`, `mmHg`, `Cel` | Value Statics: Total count 78444 - Distinct count 17 - Null count 455
DESCRIPTION TEXT, --
CODE TEXT, --
PATIENT TEXT, --
foreign key (PATIENT) references patients(patient),
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE medications
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, --
PATIENT TEXT, --
STOP DATE, --
START DATE, --
REASONDESCRIPTION TEXT, --
DESCRIPTION TEXT, --
primary key (START, PATIENT, ENCOUNTER, CODE),
foreign key (PATIENT) references patients(patient),
REASONCODE INTEGER, --
ENCOUNTER TEXT, --
);
CREATE TABLE careplans
(
START DATE, --
STOP DATE, --
ID TEXT, --
REASONCODE INTEGER, --
REASONDESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
DESCRIPTION TEXT, --
CODE REAL, --
ENCOUNTER TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE encounters
(
DATE DATE, --
REASONCODE INTEGER, --
CODE INTEGER, --
ID TEXT primary key,
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
REASONDESCRIPTION TEXT, --
);
CREATE TABLE procedures
(
foreign key (PATIENT) references patients(patient),
REASONDESCRIPTION TEXT, --
PATIENT TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
DATE DATE, --
DESCRIPTION TEXT, --
ENCOUNTER TEXT, --
CODE INTEGER, --
REASONCODE INTEGER, --
);
CREATE TABLE patients
(
suffix TEXT, -- Example Values: `PhD`, `JD`, `MD` | Value Statics: Total count 45 - Distinct count 3 - Null count 1417
prefix TEXT, -- Example Values: `Mr.`, `Mrs.`, `Ms.` | Value Statics: Total count 1166 - Distinct count 3 - Null count 296
deathdate DATE, --
ethnicity TEXT, --
race TEXT, -- Example Values: `black`, `white`, `hispanic`, `asian` | Value Statics: Total count 1462 - Distinct count 4 - Null count 0
address TEXT, --
birthplace TEXT, --
passport TEXT, --
maiden TEXT, --
birthdate DATE, --
marital TEXT, -- Example Values: `S`, `M` | Value Statics: Total count 1033 - Distinct count 2 - Null count 429
gender TEXT, -- Example Values: `F`, `M` | Value Statics: Total count 1462 - Distinct count 2 - Null count 0
drivers TEXT, --
first TEXT, --
last TEXT, --
patient TEXT primary key,
ssn TEXT, --
);
CREATE TABLE claims
(
ENCOUNTER TEXT references encounters, --
PATIENT TEXT references patients, --
ORGANIZATION TEXT, -- Example Values: `temp organization` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
TOTAL INTEGER, -- Example Values: `100` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
BILLABLEPERIOD DATE, --
DIAGNOSIS TEXT, --
ID TEXT primary key,
);
CREATE TABLE conditions
(
START DATE, --
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
CODE INTEGER, --
ENCOUNTER TEXT, --
STOP DATE, --
foreign key (ENCOUNTER) references encounters(ID),
foreign key (DESCRIPTION) references all_prevalences(ITEM),
);
CREATE TABLE all_prevalences
(
"POPULATION TYPE" TEXT, -- Example Values: `LIVING` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
"POPULATION COUNT" INTEGER, -- Example Values: `1000` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
ITEM TEXT primary key,
"PREVALENCE PERCENTAGE" REAL, --
"PREVALENCE RATE" REAL, --
OCCURRENCES INTEGER, --
); |
software_company | Among the customers who come from the place with 25746 inhabitants, how many of them are male? | place with 44114 inhabitants refers to GEOID where INHABITANTS_K = 44.114; SEX = 'Male'; | SELECT COUNT(T1.ID) FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T2.INHABITANTS_K = 25.746 AND T1.SEX = 'Male' | CREATE TABLE Customers
(
EDUCATIONNUM INTEGER, -- Example Values: `7`, `3`, `4`, `11`, `5` | Value Statics: Total count 100000 - Distinct count 17 - Null count 0
MARITAL_STATUS TEXT, -- Example Values: `Never-married`, `Married-civ-spouse`, `Divorced`, `Widowed`, `Other` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
ID INTEGER constraint Customers_pk primary key,
SEX TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
OCCUPATION TEXT, -- Example Values: `Machine-op-inspct`, `Handlers-cleaners`, `Exec-managerial`, `Farming-fishing`, `Other-service` | Value Statics: Total count 100000 - Distinct count 8 - Null count 0
age INTEGER, --
GEOID INTEGER constraint Customers_Demog_GEOID_fk references Demog, --
);
CREATE TABLE Mailings1_2
(
RESPONSE TEXT, -- Example Values: `false`, `true` | Value Statics: Total count 60000 - Distinct count 2 - Null count 0
REFID INTEGER constraint Mailings1_2_pk primary key constraint Mailings1_2_Customers_ID_fk references Customers,
REF_DATE DATETIME, -- Example Values: `2007-02-01 12:00:00.0`, `2007-03-01 12:00:00.0` | Value Statics: Total count 60000 - Distinct count 2 - Null count 0
);
CREATE TABLE Sales
(
REFID INTEGER references Customers, --
EVENT_DATE DATETIME, --
AMOUNT REAL, --
EVENTID INTEGER constraint Sales_pk primary key,
);
CREATE TABLE Demog
(
A_VAR1 REAL, --
A_VAR2 REAL, --
A_VAR14 REAL, --
A_VAR8 REAL, --
A_VAR12 REAL, --
A_VAR6 REAL, --
A_VAR17 REAL, --
A_VAR15 REAL, --
A_VAR10 REAL, --
A_VAR16 REAL, --
INHABITANTS_K REAL, --
A_VAR3 REAL, --
A_VAR7 REAL, --
A_VAR4 REAL, --
A_VAR5 REAL, --
A_VAR13 REAL, --
A_VAR9 REAL, --
INCOME_K REAL, --
GEOID INTEGER constraint Demog_pk primary key,
A_VAR18 REAL, --
A_VAR11 REAL, --
);
CREATE TABLE mailings3
(
RESPONSE TEXT, -- Example Values: `false`, `true` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
REF_DATE DATETIME, -- Example Values: `2007-07-01 12:00:00.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
REFID INTEGER constraint mailings3_pk primary key,
); |
retail_world | What is the total sales amount of all discontinued products? | discontinued products refers to Discontinued = 1; total sales amount refers to SUM(MULTIPLY(UnitPrice, Quantity)) | SELECT SUM(T2.UnitPrice * T2.Quantity) FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Discontinued = 1 | CREATE TABLE Products
(
CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0
Unit TEXT, --
ReorderLevel INT, --
ProductName TEXT, --
Price REAL DEFAULT 0, --
FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),
SupplierID INTEGER, --
ProductID INTEGER PRIMARY KEY AUTOINCREMENT,
FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID),
);
CREATE TABLE Customers
(
ContactName TEXT, --
Country TEXT, --
Address TEXT, --
City TEXT, --
CustomerID INTEGER PRIMARY KEY AUTOINCREMENT,
PostalCode TEXT, --
CustomerName TEXT, --
);
CREATE TABLE EmployeeTerritories
(
TerritoryID INT, --
EmployeeID INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE OrderDetails
(
Quantity INTEGER, --
FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),
OrderID INTEGER, --
FOREIGN KEY (ProductID) REFERENCES Products (ProductID),
OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT,
ProductID INTEGER, --
);
CREATE TABLE Shippers
(
ShipperID INTEGER PRIMARY KEY AUTOINCREMENT,
ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
);
CREATE TABLE Territory
(
TerritoryDescription TEXT, --
RegionID INTEGER, --
TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT,
);
CREATE TABLE EmployeeDetails
(
EmployeeID INT PRIMARY KEY,
Title TEXT, --
Salary INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE Categories
(
CategoryID INTEGER PRIMARY KEY AUTOINCREMENT,
CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
);
CREATE TABLE Employees
(
Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT,
FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
);
CREATE TABLE Suppliers
(
PostalCode TEXT, --
Address TEXT, --
SupplierID INTEGER PRIMARY KEY AUTOINCREMENT,
City TEXT, --
Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0
Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0
ContactName TEXT, --
Phone TEXT, --
SupplierName TEXT, --
);
CREATE TABLE EmployeesExtra
(
Salary INTEGER, --
Title TEXT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
EmployeeID INTEGER PRIMARY KEY,
);
CREATE TABLE discontinued_products
(
Discontinued INTEGER, --
ProductID INTEGER PRIMARY KEY,
);
CREATE TABLE Orders
(
OrderID INTEGER PRIMARY KEY AUTOINCREMENT,
CustomerID INTEGER, --
FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),
FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID),
FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),
ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0
OrderDate DATETIME, --
EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0
);
CREATE TABLE Territories
(
TerritoryDescription TEXT, --
RegionDescription TEXT, --
);
CREATE TABLE ShippingInfo
(
ShipCountry TEXT, --
ShippedDate DATETIME, --
FOREIGN KEY (OrderID) REFERENCES Orders(OrderID),
OrderID INTEGER PRIMARY KEY,
); |
software_company | What is the number of inhabitants of the place the most customers are from? | the most customers are from refers to GEOID where MAX(COUNT(ID)); number of inhabitants refers to INHABITANTS_K; | SELECT DISTINCT T2.INHABITANTS_K FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID ORDER BY T2.INHABITANTS_K DESC | CREATE TABLE Customers
(
EDUCATIONNUM INTEGER, -- Example Values: `7`, `3`, `4`, `11`, `5` | Value Statics: Total count 100000 - Distinct count 17 - Null count 0
MARITAL_STATUS TEXT, -- Example Values: `Never-married`, `Married-civ-spouse`, `Divorced`, `Widowed`, `Other` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
ID INTEGER constraint Customers_pk primary key,
SEX TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
OCCUPATION TEXT, -- Example Values: `Machine-op-inspct`, `Handlers-cleaners`, `Exec-managerial`, `Farming-fishing`, `Other-service` | Value Statics: Total count 100000 - Distinct count 8 - Null count 0
age INTEGER, --
GEOID INTEGER constraint Customers_Demog_GEOID_fk references Demog, --
);
CREATE TABLE Mailings1_2
(
RESPONSE TEXT, -- Example Values: `false`, `true` | Value Statics: Total count 60000 - Distinct count 2 - Null count 0
REFID INTEGER constraint Mailings1_2_pk primary key constraint Mailings1_2_Customers_ID_fk references Customers,
REF_DATE DATETIME, -- Example Values: `2007-02-01 12:00:00.0`, `2007-03-01 12:00:00.0` | Value Statics: Total count 60000 - Distinct count 2 - Null count 0
);
CREATE TABLE Sales
(
REFID INTEGER references Customers, --
EVENT_DATE DATETIME, --
AMOUNT REAL, --
EVENTID INTEGER constraint Sales_pk primary key,
);
CREATE TABLE Demog
(
A_VAR1 REAL, --
A_VAR2 REAL, --
A_VAR14 REAL, --
A_VAR8 REAL, --
A_VAR12 REAL, --
A_VAR6 REAL, --
A_VAR17 REAL, --
A_VAR15 REAL, --
A_VAR10 REAL, --
A_VAR16 REAL, --
INHABITANTS_K REAL, --
A_VAR3 REAL, --
A_VAR7 REAL, --
A_VAR4 REAL, --
A_VAR5 REAL, --
A_VAR13 REAL, --
A_VAR9 REAL, --
INCOME_K REAL, --
GEOID INTEGER constraint Demog_pk primary key,
A_VAR18 REAL, --
A_VAR11 REAL, --
);
CREATE TABLE mailings3
(
RESPONSE TEXT, -- Example Values: `false`, `true` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
REF_DATE DATETIME, -- Example Values: `2007-07-01 12:00:00.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
REFID INTEGER constraint mailings3_pk primary key,
); |
retail_world | How old was the oldest employee at the time he or she was hired? | oldest employee at the time he or she was hired refers to MAX(SUBTRACT(HireDate, Birthdate)) | SELECT MAX(TIMESTAMPDIFF(YEAR, BirthDate, HireDate)) FROM Employees | CREATE TABLE Products
(
CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0
Unit TEXT, --
ReorderLevel INT, --
ProductName TEXT, --
Price REAL DEFAULT 0, --
FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),
SupplierID INTEGER, --
ProductID INTEGER PRIMARY KEY AUTOINCREMENT,
FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID),
);
CREATE TABLE Customers
(
ContactName TEXT, --
Country TEXT, --
Address TEXT, --
City TEXT, --
CustomerID INTEGER PRIMARY KEY AUTOINCREMENT,
PostalCode TEXT, --
CustomerName TEXT, --
);
CREATE TABLE EmployeeTerritories
(
TerritoryID INT, --
EmployeeID INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE OrderDetails
(
Quantity INTEGER, --
FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),
OrderID INTEGER, --
FOREIGN KEY (ProductID) REFERENCES Products (ProductID),
OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT,
ProductID INTEGER, --
);
CREATE TABLE Shippers
(
ShipperID INTEGER PRIMARY KEY AUTOINCREMENT,
ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
);
CREATE TABLE Territory
(
TerritoryDescription TEXT, --
RegionID INTEGER, --
TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT,
);
CREATE TABLE EmployeeDetails
(
EmployeeID INT PRIMARY KEY,
Title TEXT, --
Salary INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE Categories
(
CategoryID INTEGER PRIMARY KEY AUTOINCREMENT,
CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
);
CREATE TABLE Employees
(
Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT,
FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
);
CREATE TABLE Suppliers
(
PostalCode TEXT, --
Address TEXT, --
SupplierID INTEGER PRIMARY KEY AUTOINCREMENT,
City TEXT, --
Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0
Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0
ContactName TEXT, --
Phone TEXT, --
SupplierName TEXT, --
);
CREATE TABLE EmployeesExtra
(
Salary INTEGER, --
Title TEXT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
EmployeeID INTEGER PRIMARY KEY,
);
CREATE TABLE discontinued_products
(
Discontinued INTEGER, --
ProductID INTEGER PRIMARY KEY,
);
CREATE TABLE Orders
(
OrderID INTEGER PRIMARY KEY AUTOINCREMENT,
CustomerID INTEGER, --
FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),
FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID),
FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),
ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0
OrderDate DATETIME, --
EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0
);
CREATE TABLE Territories
(
TerritoryDescription TEXT, --
RegionDescription TEXT, --
);
CREATE TABLE ShippingInfo
(
ShipCountry TEXT, --
ShippedDate DATETIME, --
FOREIGN KEY (OrderID) REFERENCES Orders(OrderID),
OrderID INTEGER PRIMARY KEY,
); |
professional_basketball | How many teams have played more than 3800 points and have player with "Most Valuable Player" award? | played more than 3800 points refers to Sum(points) > = 3800 | SELECT COUNT(DISTINCT T4.name) FROM ( SELECT T1.name, SUM(T2.points) FROM teams AS T1 INNER JOIN players_teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year INNER JOIN awards_players AS T3 ON T2.playerID = T3.playerID WHERE T3.award = 'Most Valuable Player' GROUP BY T1.name HAVING SUM(T2.points) >= 3800 ) AS T4 | CREATE TABLE players_teams
(
PostGS INTEGER, --
PostdRebounds INTEGER, --
PostPF INTEGER, --
tmID TEXT, --
threeAttempted INTEGER, --
PostRebounds INTEGER, --
assists INTEGER, --
threeMade INTEGER, --
PostBlocks INTEGER, --
PostTurnovers INTEGER, --
GP INTEGER, --
lgID TEXT, -- Example Values: `NBA`, `NBL`, `ABA`, `ABL1`, `NPBL` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0
foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade,
PostfgMade INTEGER, --
steals INTEGER, --
oRebounds INTEGER, --
PostftAttempted INTEGER, --
ftAttempted INTEGER, --
ftMade INTEGER, --
points INTEGER, --
PostfgAttempted INTEGER, --
PostftMade INTEGER, --
note TEXT, -- Example Values: `C` | Value Statics: Total count 43 - Distinct count 1 - Null count 23708
dRebounds INTEGER, --
PostSteals INTEGER, --
blocks INTEGER, --
PostAssists INTEGER, --
minutes INTEGER, --
fgAttempted INTEGER, --
playerID TEXT not null references players on update cascade on delete cascade, --
PostthreeMade INTEGER, --
PostPoints INTEGER, --
year INTEGER, --
PF INTEGER, --
fgMade INTEGER, --
PostthreeAttempted INTEGER, --
rebounds INTEGER, --
id INTEGER primary key autoincrement,
stint INTEGER, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0
PostMinutes INTEGER, --
PostGP INTEGER, --
turnovers INTEGER, --
PostoRebounds INTEGER, --
GS INTEGER, --
);
CREATE TABLE awards_coaches
(
award TEXT, -- Example Values: `NBA Coach of the Year`, `ABA Coach of the Year` | Value Statics: Total count 61 - Distinct count 2 - Null count 0
id INTEGER primary key autoincrement,
note TEXT, -- Example Values: `tie` | Value Statics: Total count 4 - Distinct count 1 - Null count 57
coachID TEXT, --
lgID TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 61 - Distinct count 2 - Null count 0
foreign key (coachID, year) references coaches (coachID, year) on update cascade on delete cascade,
year INTEGER, --
);
CREATE TABLE draft
(
draftOverall INTEGER null, --
lgID TEXT null, -- Example Values: `ABA`, `NBA` | Value Statics: Total count 8621 - Distinct count 2 - Null count 0
suffixName TEXT null, -- Example Values: `Jr.` | Value Statics: Total count 2 - Distinct count 1 - Null count 8619
draftYear INTEGER null, --
draftSelection INTEGER null, --
tmID TEXT null, --
draftRound INTEGER null, --
lastName TEXT null, --
playerID TEXT null, --
draftFrom TEXT null, --
id INTEGER default 0 not null primary key,
firstName TEXT null, --
foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade,
foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade,
);
CREATE TABLE player_allstar
(
rebounds INTEGER null, --
playerID TEXT not null, --
season_id INTEGER not null, --
assists INTEGER null, --
conference TEXT null, -- Example Values: `East`, `West`, `Weset`, `Allstars`, `Denver` | Value Statics: Total count 1608 - Distinct count 5 - Null count 0
points INTEGER null, --
personal_fouls INTEGER null, -- Example Values: `3`, `2`, `0`, `1`, `5` | Value Statics: Total count 540 - Distinct count 8 - Null count 1068
ft_attempted INTEGER null, -- Example Values: `2`, `4`, `0`, `6`, `3` | Value Statics: Total count 1561 - Distinct count 17 - Null count 47
fg_attempted INTEGER null, --
league_id TEXT null, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 1608 - Distinct count 2 - Null count 0
foreign key (playerID) references players (playerID) on update cascade on delete cascade,
fg_made INTEGER null, -- Example Values: `4`, `8`, `5`, `7`, `3` | Value Statics: Total count 1561 - Distinct count 18 - Null count 47
ft_made INTEGER null, -- Example Values: `2`, `3`, `0`, `1`, `4` | Value Statics: Total count 1561 - Distinct count 13 - Null count 47
steals INTEGER null, -- Example Values: `3`, `0`, `1`, `2`, `5` | Value Statics: Total count 398 - Distinct count 7 - Null count 1210
games_played INTEGER null, -- Example Values: `1` | Value Statics: Total count 1608 - Distinct count 1 - Null count 0
first_name TEXT null, --
d_rebounds INTEGER null, -- Example Values: `2`, `5`, `0`, `1`, `4` | Value Statics: Total count 493 - Distinct count 14 - Null count 1115
last_name TEXT null, --
primary key (playerID, season_id),
turnovers INTEGER null, -- Example Values: `1`, `0`, `3`, `2`, `4` | Value Statics: Total count 493 - Distinct count 9 - Null count 1115
three_made INTEGER null, -- Example Values: `0`, `1`, `3`, `5`, `4` | Value Statics: Total count 566 - Distinct count 7 - Null count 1042
minutes INTEGER null, --
blocks INTEGER null, -- Example Values: `2`, `0`, `1`, `3`, `5` | Value Statics: Total count 398 - Distinct count 6 - Null count 1210
three_attempted INTEGER null, -- Example Values: `0`, `1`, `6`, `7`, `10` | Value Statics: Total count 540 - Distinct count 12 - Null count 1068
o_rebounds INTEGER null, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 493 - Distinct count 10 - Null count 1115
);
CREATE TABLE awards_players
(
foreign key (playerID) references players (playerID) on update cascade on delete cascade,
year INTEGER not null, --
pos TEXT null, -- Example Values: `C`, `F`, `G`, `F/G`, `F/C` | Value Statics: Total count 833 - Distinct count 5 - Null count 886
primary key (playerID, year, award),
lgID TEXT null, -- Example Values: `NBA`, `ABA`, `NBL`, `ABL1` | Value Statics: Total count 1719 - Distinct count 4 - Null count 0
award TEXT not null, --
playerID TEXT not null, --
note TEXT null, -- Example Values: `tie` | Value Statics: Total count 37 - Distinct count 1 - Null count 1682
);
CREATE TABLE series_post
(
tmIDLoser TEXT, --
id INTEGER primary key autoincrement,
series TEXT, -- Example Values: `O`, `M`, `N`, `A`, `K` | Value Statics: Total count 775 - Distinct count 11 - Null count 0
tmIDWinner TEXT, --
round TEXT, -- Example Values: `F`, `QF`, `SF`, `DT`, `DF` | Value Statics: Total count 775 - Distinct count 11 - Null count 0
year INTEGER, --
foreign key (tmIDLoser, year) references teams (tmID, year) on update cascade on delete cascade,
foreign key (tmIDWinner, year) references teams (tmID, year) on update cascade on delete cascade,
W INTEGER, -- Example Values: `4`, `2`, `1`, `3`, `0` | Value Statics: Total count 775 - Distinct count 5 - Null count 0
lgIDLoser TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0
lgIDWinner TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0
L INTEGER, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 775 - Distinct count 5 - Null count 0
);
CREATE TABLE players
(
nameGiven TEXT null, -- Example Values: `nameGiven`, `Mort`, `Robert`, `Jim`, `Mike` | Value Statics: Total count 10 - Distinct count 9 - Null count 5052
lastseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15
hsCountry TEXT null, --
firstName TEXT null, --
hsCity TEXT null, --
firstseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15
weight INTEGER null, --
birthCountry TEXT null, --
race TEXT null, -- Example Values: `B`, `W`, `O`, `1`, `r` | Value Statics: Total count 4903 - Distinct count 5 - Null count 159
lastName TEXT null, --
birthDate DATE null, --
collegeOther TEXT null, --
birthState TEXT null, --
useFirst TEXT null, --
pos TEXT null, -- Example Values: `F-C`, `C`, `G`, `G-F`, `C-F` | Value Statics: Total count 4880 - Distinct count 14 - Null count 182
playerID TEXT not null primary key,
college TEXT null, --
highSchool TEXT null, --
hsState TEXT null, --
height REAL null, --
deathDate DATE null, --
nameSuffix TEXT null, -- Example Values: `Jr.`, `III`, `nameSuffix`, `II`, `IV` | Value Statics: Total count 324 - Distinct count 6 - Null count 4738
nameNick TEXT null, --
fullGivenName TEXT null, --
birthCity TEXT null, --
middleName TEXT null, --
);
CREATE TABLE teams
(
d_pts INTEGER null, --
name TEXT null, --
homeLost INTEGER null, --
o_ftm INTEGER null, --
franchID TEXT null, --
tmID TEXT not null, --
awayWon INTEGER null, --
primary key (year, tmID),
o_fgm INTEGER null, --
year INTEGER not null, --
awayLost INTEGER null, --
arena TEXT null, --
confID TEXT null, -- Example Values: `EC`, `WC` | Value Statics: Total count 1064 - Distinct count 2 - Null count 472
games INTEGER null, --
lost INTEGER null, --
divID TEXT null, -- Example Values: `EA`, `WE`, `ED`, `WD`, `SO` | Value Statics: Total count 1498 - Distinct count 13 - Null count 38
lgID TEXT null, -- Example Values: `NBL`, `NBA`, `PBLA`, `NPBL`, `ABL1` | Value Statics: Total count 1536 - Distinct count 6 - Null count 0
homeWon INTEGER null, --
confRank INTEGER null, -- Example Values: `0`, `4`, `3`, `5`, `7` | Value Statics: Total count 1536 - Distinct count 16 - Null count 0
o_pts INTEGER null, --
`rank` INTEGER null, -- Example Values: `1`, `2`, `4`, `5`, `6` | Value Statics: Total count 1536 - Distinct count 10 - Null count 0
playoff TEXT null, -- Example Values: `CF`, `WC`, `LC`, `CS`, `F` | Value Statics: Total count 901 - Distinct count 15 - Null count 635
won INTEGER null, --
);
CREATE TABLE coaches
(
primary key (coachID, year, tmID, stint),
lgID TEXT null, -- Example Values: `NBA`, `ABA`, `ABL1`, `PBLA`, `NPBL` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0
post_losses INTEGER null, -- Example Values: `3`, `9`, `7`, `8`, `0` | Value Statics: Total count 1649 - Distinct count 12 - Null count 40
year INTEGER not null, --
won INTEGER null, --
foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade,
post_wins INTEGER null, -- Example Values: `0`, `12`, `9`, `13`, `1` | Value Statics: Total count 1649 - Distinct count 17 - Null count 40
coachID TEXT not null, --
tmID TEXT not null, --
lost INTEGER null, --
stint INTEGER not null, -- Example Values: `2`, `1`, `4`, `5`, `3` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0
); |
superstore | How many quantities of Advantus plastic paper clips were ordered overall? | Advantus plastic paper clips is the "Product Name"; | SELECT SUM(T1.Quantity) FROM central_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T2.`Product Name` = 'Advantus Plastic Paper Clips' | CREATE TABLE west_superstore
(
Profit REAL, --
Region TEXT, -- Example Values: `West` | Value Statics: Total count 6406 - Distinct count 1 - Null count 0
"Product ID" TEXT, --
foreign key ("Product ID", Region) references product("Product ID",Region),
"Order Date" DATE, --
foreign key ("Customer ID", Region) references people("Customer ID",Region),
"Ship Mode" TEXT, -- Example Values: `Second Class`, `Standard Class`, `First Class`, `Same Day` | Value Statics: Total count 6406 - Distinct count 4 - Null count 0
"Customer ID" TEXT, --
"Order ID" TEXT, --
"Row ID" INTEGER primary key,
Sales REAL, --
Quantity INTEGER, -- Example Values: `3`, `5`, `4`, `10`, `2` | Value Statics: Total count 6406 - Distinct count 14 - Null count 0
Discount REAL, -- Example Values: `0.0`, `0.15`, `0.2`, `0.7`, `0.5` | Value Statics: Total count 6406 - Distinct count 5 - Null count 0
"Ship Date" DATE, --
);
CREATE TABLE people
(
Region TEXT, -- Example Values: `Central`, `East`, `West`, `South` | Value Statics: Total count 2501 - Distinct count 4 - Null count 0
Country TEXT, -- Example Values: `United States` | Value Statics: Total count 2501 - Distinct count 1 - Null count 0
State TEXT, --
primary key ("Customer ID", Region),
City TEXT, --
Segment TEXT, -- Example Values: `Consumer`, `Home Office`, `Corporate` | Value Statics: Total count 2501 - Distinct count 3 - Null count 0
"Customer ID" TEXT, --
"Postal Code" INTEGER, --
"Customer Name" TEXT, --
);
CREATE TABLE product
(
"Product ID" TEXT, --
Region TEXT, -- Example Values: `Central`, `South`, `West`, `East` | Value Statics: Total count 5298 - Distinct count 4 - Null count 0
"Sub-Category" TEXT, -- Example Values: `Bookcases`, `Chairs`, `Furnishings`, `Tables`, `Appliances` | Value Statics: Total count 5298 - Distinct count 17 - Null count 0
Category TEXT, -- Example Values: `Furniture`, `Office Supplies`, `Technology` | Value Statics: Total count 5298 - Distinct count 3 - Null count 0
"Product Name" TEXT, --
primary key ("Product ID", Region),
);
CREATE TABLE central_superstore
(
"Ship Mode" TEXT, -- Example Values: `Standard Class`, `First Class`, `Second Class`, `Same Day` | Value Statics: Total count 4646 - Distinct count 4 - Null count 0
Quantity INTEGER, -- Example Values: `2`, `3`, `7`, `1`, `5` | Value Statics: Total count 4646 - Distinct count 14 - Null count 0
"Ship Date" DATE, --
"Order Date" DATE, --
"Order ID" TEXT, --
"Row ID" INTEGER primary key,
"Product ID" TEXT, --
foreign key ("Customer ID", Region) references people("Customer ID",Region),
Sales REAL, --
foreign key ("Product ID", Region) references product("Product ID",Region),
Profit REAL, --
"Customer ID" TEXT, --
Discount REAL, -- Example Values: `0.2`, `0.8`, `0.6`, `0.0`, `0.1` | Value Statics: Total count 4646 - Distinct count 9 - Null count 0
Region TEXT, -- Example Values: `Central` | Value Statics: Total count 4646 - Distinct count 1 - Null count 0
);
CREATE TABLE east_superstore
(
"Row ID" INTEGER primary key,
Region TEXT, -- Example Values: `East` | Value Statics: Total count 5696 - Distinct count 1 - Null count 0
"Order ID" TEXT, --
"Product ID" TEXT, --
Sales REAL, --
foreign key ("Product ID", Region) references product("Product ID",Region),
Discount REAL, -- Example Values: `0.2`, `0.0`, `0.7`, `0.5`, `0.4` | Value Statics: Total count 5696 - Distinct count 7 - Null count 0
Quantity INTEGER, -- Example Values: `3`, `2`, `7`, `4`, `6` | Value Statics: Total count 5696 - Distinct count 14 - Null count 0
Profit REAL, --
foreign key ("Customer ID", Region) references people("Customer ID",Region),
"Ship Mode" TEXT, -- Example Values: `Standard Class`, `First Class`, `Second Class`, `Same Day` | Value Statics: Total count 5696 - Distinct count 4 - Null count 0
"Customer ID" TEXT, --
"Order Date" DATE, --
"Ship Date" DATE, --
);
CREATE TABLE south_superstore
(
"Product ID" TEXT, --
Profit REAL, --
Sales REAL, --
"Order Date" DATE, --
"Customer ID" TEXT, --
Discount REAL, -- Example Values: `0.0`, `0.7`, `0.2`, `0.5`, `0.45` | Value Statics: Total count 3240 - Distinct count 6 - Null count 0
Region TEXT, -- Example Values: `South` | Value Statics: Total count 3240 - Distinct count 1 - Null count 0
"Ship Date" DATE, --
foreign key ("Product ID", Region) references product("Product ID",Region),
foreign key ("Customer ID", Region) references people("Customer ID",Region),
Quantity INTEGER, -- Example Values: `3`, `9`, `2`, `4`, `1` | Value Statics: Total count 3240 - Distinct count 14 - Null count 0
"Order ID" TEXT, --
"Row ID" INTEGER primary key,
"Ship Mode" TEXT, -- Example Values: `First Class`, `Standard Class`, `Second Class`, `Same Day` | Value Statics: Total count 3240 - Distinct count 4 - Null count 0
); |
software_company | How many of the first 60,000 customers from the place with the highest average income per month have sent a true response to the incentive mailing sent by the marketing department? | place with the highest average income per month refers to GEOID where MAX(INCOME_K); RESPONSE = 'true'; | SELECT COUNT(T1.ID) FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID INNER JOIN Demog AS T3 ON T1.GEOID = T3.GEOID WHERE T2.RESPONSE = 'true' ORDER BY T3.INCOME_K DESC LIMIT 1 | CREATE TABLE Customers
(
EDUCATIONNUM INTEGER, -- Example Values: `7`, `3`, `4`, `11`, `5` | Value Statics: Total count 100000 - Distinct count 17 - Null count 0
MARITAL_STATUS TEXT, -- Example Values: `Never-married`, `Married-civ-spouse`, `Divorced`, `Widowed`, `Other` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
ID INTEGER constraint Customers_pk primary key,
SEX TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
OCCUPATION TEXT, -- Example Values: `Machine-op-inspct`, `Handlers-cleaners`, `Exec-managerial`, `Farming-fishing`, `Other-service` | Value Statics: Total count 100000 - Distinct count 8 - Null count 0
age INTEGER, --
GEOID INTEGER constraint Customers_Demog_GEOID_fk references Demog, --
);
CREATE TABLE Mailings1_2
(
RESPONSE TEXT, -- Example Values: `false`, `true` | Value Statics: Total count 60000 - Distinct count 2 - Null count 0
REFID INTEGER constraint Mailings1_2_pk primary key constraint Mailings1_2_Customers_ID_fk references Customers,
REF_DATE DATETIME, -- Example Values: `2007-02-01 12:00:00.0`, `2007-03-01 12:00:00.0` | Value Statics: Total count 60000 - Distinct count 2 - Null count 0
);
CREATE TABLE Sales
(
REFID INTEGER references Customers, --
EVENT_DATE DATETIME, --
AMOUNT REAL, --
EVENTID INTEGER constraint Sales_pk primary key,
);
CREATE TABLE Demog
(
A_VAR1 REAL, --
A_VAR2 REAL, --
A_VAR14 REAL, --
A_VAR8 REAL, --
A_VAR12 REAL, --
A_VAR6 REAL, --
A_VAR17 REAL, --
A_VAR15 REAL, --
A_VAR10 REAL, --
A_VAR16 REAL, --
INHABITANTS_K REAL, --
A_VAR3 REAL, --
A_VAR7 REAL, --
A_VAR4 REAL, --
A_VAR5 REAL, --
A_VAR13 REAL, --
A_VAR9 REAL, --
INCOME_K REAL, --
GEOID INTEGER constraint Demog_pk primary key,
A_VAR18 REAL, --
A_VAR11 REAL, --
);
CREATE TABLE mailings3
(
RESPONSE TEXT, -- Example Values: `false`, `true` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
REF_DATE DATETIME, -- Example Values: `2007-07-01 12:00:00.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
REFID INTEGER constraint mailings3_pk primary key,
); |
retail_world | How much is the salary of the first employee that was hired? | first employee that was hired refers to MIN(HireDate) | SELECT Salary FROM Employees WHERE HireDate = ( SELECT MIN(HireDate) FROM Employees ) | CREATE TABLE Products
(
CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0
Unit TEXT, --
ReorderLevel INT, --
ProductName TEXT, --
Price REAL DEFAULT 0, --
FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),
SupplierID INTEGER, --
ProductID INTEGER PRIMARY KEY AUTOINCREMENT,
FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID),
);
CREATE TABLE Customers
(
ContactName TEXT, --
Country TEXT, --
Address TEXT, --
City TEXT, --
CustomerID INTEGER PRIMARY KEY AUTOINCREMENT,
PostalCode TEXT, --
CustomerName TEXT, --
);
CREATE TABLE EmployeeTerritories
(
TerritoryID INT, --
EmployeeID INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE OrderDetails
(
Quantity INTEGER, --
FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),
OrderID INTEGER, --
FOREIGN KEY (ProductID) REFERENCES Products (ProductID),
OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT,
ProductID INTEGER, --
);
CREATE TABLE Shippers
(
ShipperID INTEGER PRIMARY KEY AUTOINCREMENT,
ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
);
CREATE TABLE Territory
(
TerritoryDescription TEXT, --
RegionID INTEGER, --
TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT,
);
CREATE TABLE EmployeeDetails
(
EmployeeID INT PRIMARY KEY,
Title TEXT, --
Salary INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE Categories
(
CategoryID INTEGER PRIMARY KEY AUTOINCREMENT,
CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
);
CREATE TABLE Employees
(
Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT,
FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
);
CREATE TABLE Suppliers
(
PostalCode TEXT, --
Address TEXT, --
SupplierID INTEGER PRIMARY KEY AUTOINCREMENT,
City TEXT, --
Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0
Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0
ContactName TEXT, --
Phone TEXT, --
SupplierName TEXT, --
);
CREATE TABLE EmployeesExtra
(
Salary INTEGER, --
Title TEXT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
EmployeeID INTEGER PRIMARY KEY,
);
CREATE TABLE discontinued_products
(
Discontinued INTEGER, --
ProductID INTEGER PRIMARY KEY,
);
CREATE TABLE Orders
(
OrderID INTEGER PRIMARY KEY AUTOINCREMENT,
CustomerID INTEGER, --
FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),
FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID),
FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),
ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0
OrderDate DATETIME, --
EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0
);
CREATE TABLE Territories
(
TerritoryDescription TEXT, --
RegionDescription TEXT, --
);
CREATE TABLE ShippingInfo
(
ShipCountry TEXT, --
ShippedDate DATETIME, --
FOREIGN KEY (OrderID) REFERENCES Orders(OrderID),
OrderID INTEGER PRIMARY KEY,
); |
professional_basketball | Among the coaches who won the 'ABA Coach of the Year' award, which is the coach with the highest number of won games? | "ABA Coach of the Year" is the award; highest number of won games refers to Max(Count(won)) | SELECT T1.coachID FROM coaches AS T1 INNER JOIN awards_coaches AS T2 ON T1.coachID = T2.coachID WHERE T2.award = 'ABA Coach of the Year' GROUP BY T1.coachID, T1.won ORDER BY T1.won DESC LIMIT 1 | CREATE TABLE players_teams
(
PostGS INTEGER, --
PostdRebounds INTEGER, --
PostPF INTEGER, --
tmID TEXT, --
threeAttempted INTEGER, --
PostRebounds INTEGER, --
assists INTEGER, --
threeMade INTEGER, --
PostBlocks INTEGER, --
PostTurnovers INTEGER, --
GP INTEGER, --
lgID TEXT, -- Example Values: `NBA`, `NBL`, `ABA`, `ABL1`, `NPBL` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0
foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade,
PostfgMade INTEGER, --
steals INTEGER, --
oRebounds INTEGER, --
PostftAttempted INTEGER, --
ftAttempted INTEGER, --
ftMade INTEGER, --
points INTEGER, --
PostfgAttempted INTEGER, --
PostftMade INTEGER, --
note TEXT, -- Example Values: `C` | Value Statics: Total count 43 - Distinct count 1 - Null count 23708
dRebounds INTEGER, --
PostSteals INTEGER, --
blocks INTEGER, --
PostAssists INTEGER, --
minutes INTEGER, --
fgAttempted INTEGER, --
playerID TEXT not null references players on update cascade on delete cascade, --
PostthreeMade INTEGER, --
PostPoints INTEGER, --
year INTEGER, --
PF INTEGER, --
fgMade INTEGER, --
PostthreeAttempted INTEGER, --
rebounds INTEGER, --
id INTEGER primary key autoincrement,
stint INTEGER, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0
PostMinutes INTEGER, --
PostGP INTEGER, --
turnovers INTEGER, --
PostoRebounds INTEGER, --
GS INTEGER, --
);
CREATE TABLE awards_coaches
(
award TEXT, -- Example Values: `NBA Coach of the Year`, `ABA Coach of the Year` | Value Statics: Total count 61 - Distinct count 2 - Null count 0
id INTEGER primary key autoincrement,
note TEXT, -- Example Values: `tie` | Value Statics: Total count 4 - Distinct count 1 - Null count 57
coachID TEXT, --
lgID TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 61 - Distinct count 2 - Null count 0
foreign key (coachID, year) references coaches (coachID, year) on update cascade on delete cascade,
year INTEGER, --
);
CREATE TABLE draft
(
draftOverall INTEGER null, --
lgID TEXT null, -- Example Values: `ABA`, `NBA` | Value Statics: Total count 8621 - Distinct count 2 - Null count 0
suffixName TEXT null, -- Example Values: `Jr.` | Value Statics: Total count 2 - Distinct count 1 - Null count 8619
draftYear INTEGER null, --
draftSelection INTEGER null, --
tmID TEXT null, --
draftRound INTEGER null, --
lastName TEXT null, --
playerID TEXT null, --
draftFrom TEXT null, --
id INTEGER default 0 not null primary key,
firstName TEXT null, --
foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade,
foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade,
);
CREATE TABLE player_allstar
(
rebounds INTEGER null, --
playerID TEXT not null, --
season_id INTEGER not null, --
assists INTEGER null, --
conference TEXT null, -- Example Values: `East`, `West`, `Weset`, `Allstars`, `Denver` | Value Statics: Total count 1608 - Distinct count 5 - Null count 0
points INTEGER null, --
personal_fouls INTEGER null, -- Example Values: `3`, `2`, `0`, `1`, `5` | Value Statics: Total count 540 - Distinct count 8 - Null count 1068
ft_attempted INTEGER null, -- Example Values: `2`, `4`, `0`, `6`, `3` | Value Statics: Total count 1561 - Distinct count 17 - Null count 47
fg_attempted INTEGER null, --
league_id TEXT null, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 1608 - Distinct count 2 - Null count 0
foreign key (playerID) references players (playerID) on update cascade on delete cascade,
fg_made INTEGER null, -- Example Values: `4`, `8`, `5`, `7`, `3` | Value Statics: Total count 1561 - Distinct count 18 - Null count 47
ft_made INTEGER null, -- Example Values: `2`, `3`, `0`, `1`, `4` | Value Statics: Total count 1561 - Distinct count 13 - Null count 47
steals INTEGER null, -- Example Values: `3`, `0`, `1`, `2`, `5` | Value Statics: Total count 398 - Distinct count 7 - Null count 1210
games_played INTEGER null, -- Example Values: `1` | Value Statics: Total count 1608 - Distinct count 1 - Null count 0
first_name TEXT null, --
d_rebounds INTEGER null, -- Example Values: `2`, `5`, `0`, `1`, `4` | Value Statics: Total count 493 - Distinct count 14 - Null count 1115
last_name TEXT null, --
primary key (playerID, season_id),
turnovers INTEGER null, -- Example Values: `1`, `0`, `3`, `2`, `4` | Value Statics: Total count 493 - Distinct count 9 - Null count 1115
three_made INTEGER null, -- Example Values: `0`, `1`, `3`, `5`, `4` | Value Statics: Total count 566 - Distinct count 7 - Null count 1042
minutes INTEGER null, --
blocks INTEGER null, -- Example Values: `2`, `0`, `1`, `3`, `5` | Value Statics: Total count 398 - Distinct count 6 - Null count 1210
three_attempted INTEGER null, -- Example Values: `0`, `1`, `6`, `7`, `10` | Value Statics: Total count 540 - Distinct count 12 - Null count 1068
o_rebounds INTEGER null, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 493 - Distinct count 10 - Null count 1115
);
CREATE TABLE awards_players
(
foreign key (playerID) references players (playerID) on update cascade on delete cascade,
year INTEGER not null, --
pos TEXT null, -- Example Values: `C`, `F`, `G`, `F/G`, `F/C` | Value Statics: Total count 833 - Distinct count 5 - Null count 886
primary key (playerID, year, award),
lgID TEXT null, -- Example Values: `NBA`, `ABA`, `NBL`, `ABL1` | Value Statics: Total count 1719 - Distinct count 4 - Null count 0
award TEXT not null, --
playerID TEXT not null, --
note TEXT null, -- Example Values: `tie` | Value Statics: Total count 37 - Distinct count 1 - Null count 1682
);
CREATE TABLE series_post
(
tmIDLoser TEXT, --
id INTEGER primary key autoincrement,
series TEXT, -- Example Values: `O`, `M`, `N`, `A`, `K` | Value Statics: Total count 775 - Distinct count 11 - Null count 0
tmIDWinner TEXT, --
round TEXT, -- Example Values: `F`, `QF`, `SF`, `DT`, `DF` | Value Statics: Total count 775 - Distinct count 11 - Null count 0
year INTEGER, --
foreign key (tmIDLoser, year) references teams (tmID, year) on update cascade on delete cascade,
foreign key (tmIDWinner, year) references teams (tmID, year) on update cascade on delete cascade,
W INTEGER, -- Example Values: `4`, `2`, `1`, `3`, `0` | Value Statics: Total count 775 - Distinct count 5 - Null count 0
lgIDLoser TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0
lgIDWinner TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0
L INTEGER, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 775 - Distinct count 5 - Null count 0
);
CREATE TABLE players
(
nameGiven TEXT null, -- Example Values: `nameGiven`, `Mort`, `Robert`, `Jim`, `Mike` | Value Statics: Total count 10 - Distinct count 9 - Null count 5052
lastseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15
hsCountry TEXT null, --
firstName TEXT null, --
hsCity TEXT null, --
firstseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15
weight INTEGER null, --
birthCountry TEXT null, --
race TEXT null, -- Example Values: `B`, `W`, `O`, `1`, `r` | Value Statics: Total count 4903 - Distinct count 5 - Null count 159
lastName TEXT null, --
birthDate DATE null, --
collegeOther TEXT null, --
birthState TEXT null, --
useFirst TEXT null, --
pos TEXT null, -- Example Values: `F-C`, `C`, `G`, `G-F`, `C-F` | Value Statics: Total count 4880 - Distinct count 14 - Null count 182
playerID TEXT not null primary key,
college TEXT null, --
highSchool TEXT null, --
hsState TEXT null, --
height REAL null, --
deathDate DATE null, --
nameSuffix TEXT null, -- Example Values: `Jr.`, `III`, `nameSuffix`, `II`, `IV` | Value Statics: Total count 324 - Distinct count 6 - Null count 4738
nameNick TEXT null, --
fullGivenName TEXT null, --
birthCity TEXT null, --
middleName TEXT null, --
);
CREATE TABLE teams
(
d_pts INTEGER null, --
name TEXT null, --
homeLost INTEGER null, --
o_ftm INTEGER null, --
franchID TEXT null, --
tmID TEXT not null, --
awayWon INTEGER null, --
primary key (year, tmID),
o_fgm INTEGER null, --
year INTEGER not null, --
awayLost INTEGER null, --
arena TEXT null, --
confID TEXT null, -- Example Values: `EC`, `WC` | Value Statics: Total count 1064 - Distinct count 2 - Null count 472
games INTEGER null, --
lost INTEGER null, --
divID TEXT null, -- Example Values: `EA`, `WE`, `ED`, `WD`, `SO` | Value Statics: Total count 1498 - Distinct count 13 - Null count 38
lgID TEXT null, -- Example Values: `NBL`, `NBA`, `PBLA`, `NPBL`, `ABL1` | Value Statics: Total count 1536 - Distinct count 6 - Null count 0
homeWon INTEGER null, --
confRank INTEGER null, -- Example Values: `0`, `4`, `3`, `5`, `7` | Value Statics: Total count 1536 - Distinct count 16 - Null count 0
o_pts INTEGER null, --
`rank` INTEGER null, -- Example Values: `1`, `2`, `4`, `5`, `6` | Value Statics: Total count 1536 - Distinct count 10 - Null count 0
playoff TEXT null, -- Example Values: `CF`, `WC`, `LC`, `CS`, `F` | Value Statics: Total count 901 - Distinct count 15 - Null count 635
won INTEGER null, --
);
CREATE TABLE coaches
(
primary key (coachID, year, tmID, stint),
lgID TEXT null, -- Example Values: `NBA`, `ABA`, `ABL1`, `PBLA`, `NPBL` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0
post_losses INTEGER null, -- Example Values: `3`, `9`, `7`, `8`, `0` | Value Statics: Total count 1649 - Distinct count 12 - Null count 40
year INTEGER not null, --
won INTEGER null, --
foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade,
post_wins INTEGER null, -- Example Values: `0`, `12`, `9`, `13`, `1` | Value Statics: Total count 1649 - Distinct count 17 - Null count 40
coachID TEXT not null, --
tmID TEXT not null, --
lost INTEGER null, --
stint INTEGER not null, -- Example Values: `2`, `1`, `4`, `5`, `3` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0
); |
superstore | What are the names of the products that were ordered by Alejandro Grove? | ordered by Alejandro Grove refers to "Customer Name" = 'Alejandro Grove'; names of the products refers to "Product Name" | SELECT DISTINCT T3.`Product Name` FROM west_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T1.`Product ID` WHERE T2.`Customer Name` = 'Alejandro Grove' | CREATE TABLE west_superstore
(
Profit REAL, --
Region TEXT, -- Example Values: `West` | Value Statics: Total count 6406 - Distinct count 1 - Null count 0
"Product ID" TEXT, --
foreign key ("Product ID", Region) references product("Product ID",Region),
"Order Date" DATE, --
foreign key ("Customer ID", Region) references people("Customer ID",Region),
"Ship Mode" TEXT, -- Example Values: `Second Class`, `Standard Class`, `First Class`, `Same Day` | Value Statics: Total count 6406 - Distinct count 4 - Null count 0
"Customer ID" TEXT, --
"Order ID" TEXT, --
"Row ID" INTEGER primary key,
Sales REAL, --
Quantity INTEGER, -- Example Values: `3`, `5`, `4`, `10`, `2` | Value Statics: Total count 6406 - Distinct count 14 - Null count 0
Discount REAL, -- Example Values: `0.0`, `0.15`, `0.2`, `0.7`, `0.5` | Value Statics: Total count 6406 - Distinct count 5 - Null count 0
"Ship Date" DATE, --
);
CREATE TABLE people
(
Region TEXT, -- Example Values: `Central`, `East`, `West`, `South` | Value Statics: Total count 2501 - Distinct count 4 - Null count 0
Country TEXT, -- Example Values: `United States` | Value Statics: Total count 2501 - Distinct count 1 - Null count 0
State TEXT, --
primary key ("Customer ID", Region),
City TEXT, --
Segment TEXT, -- Example Values: `Consumer`, `Home Office`, `Corporate` | Value Statics: Total count 2501 - Distinct count 3 - Null count 0
"Customer ID" TEXT, --
"Postal Code" INTEGER, --
"Customer Name" TEXT, --
);
CREATE TABLE product
(
"Product ID" TEXT, --
Region TEXT, -- Example Values: `Central`, `South`, `West`, `East` | Value Statics: Total count 5298 - Distinct count 4 - Null count 0
"Sub-Category" TEXT, -- Example Values: `Bookcases`, `Chairs`, `Furnishings`, `Tables`, `Appliances` | Value Statics: Total count 5298 - Distinct count 17 - Null count 0
Category TEXT, -- Example Values: `Furniture`, `Office Supplies`, `Technology` | Value Statics: Total count 5298 - Distinct count 3 - Null count 0
"Product Name" TEXT, --
primary key ("Product ID", Region),
);
CREATE TABLE central_superstore
(
"Ship Mode" TEXT, -- Example Values: `Standard Class`, `First Class`, `Second Class`, `Same Day` | Value Statics: Total count 4646 - Distinct count 4 - Null count 0
Quantity INTEGER, -- Example Values: `2`, `3`, `7`, `1`, `5` | Value Statics: Total count 4646 - Distinct count 14 - Null count 0
"Ship Date" DATE, --
"Order Date" DATE, --
"Order ID" TEXT, --
"Row ID" INTEGER primary key,
"Product ID" TEXT, --
foreign key ("Customer ID", Region) references people("Customer ID",Region),
Sales REAL, --
foreign key ("Product ID", Region) references product("Product ID",Region),
Profit REAL, --
"Customer ID" TEXT, --
Discount REAL, -- Example Values: `0.2`, `0.8`, `0.6`, `0.0`, `0.1` | Value Statics: Total count 4646 - Distinct count 9 - Null count 0
Region TEXT, -- Example Values: `Central` | Value Statics: Total count 4646 - Distinct count 1 - Null count 0
);
CREATE TABLE east_superstore
(
"Row ID" INTEGER primary key,
Region TEXT, -- Example Values: `East` | Value Statics: Total count 5696 - Distinct count 1 - Null count 0
"Order ID" TEXT, --
"Product ID" TEXT, --
Sales REAL, --
foreign key ("Product ID", Region) references product("Product ID",Region),
Discount REAL, -- Example Values: `0.2`, `0.0`, `0.7`, `0.5`, `0.4` | Value Statics: Total count 5696 - Distinct count 7 - Null count 0
Quantity INTEGER, -- Example Values: `3`, `2`, `7`, `4`, `6` | Value Statics: Total count 5696 - Distinct count 14 - Null count 0
Profit REAL, --
foreign key ("Customer ID", Region) references people("Customer ID",Region),
"Ship Mode" TEXT, -- Example Values: `Standard Class`, `First Class`, `Second Class`, `Same Day` | Value Statics: Total count 5696 - Distinct count 4 - Null count 0
"Customer ID" TEXT, --
"Order Date" DATE, --
"Ship Date" DATE, --
);
CREATE TABLE south_superstore
(
"Product ID" TEXT, --
Profit REAL, --
Sales REAL, --
"Order Date" DATE, --
"Customer ID" TEXT, --
Discount REAL, -- Example Values: `0.0`, `0.7`, `0.2`, `0.5`, `0.45` | Value Statics: Total count 3240 - Distinct count 6 - Null count 0
Region TEXT, -- Example Values: `South` | Value Statics: Total count 3240 - Distinct count 1 - Null count 0
"Ship Date" DATE, --
foreign key ("Product ID", Region) references product("Product ID",Region),
foreign key ("Customer ID", Region) references people("Customer ID",Region),
Quantity INTEGER, -- Example Values: `3`, `9`, `2`, `4`, `1` | Value Statics: Total count 3240 - Distinct count 14 - Null count 0
"Order ID" TEXT, --
"Row ID" INTEGER primary key,
"Ship Mode" TEXT, -- Example Values: `First Class`, `Standard Class`, `Second Class`, `Same Day` | Value Statics: Total count 3240 - Distinct count 4 - Null count 0
); |
synthea | What is the most common allergy among patients? | the most common allergy refers to MAX(COUNT(DESCRIPTION)) from allergies; | SELECT DESCRIPTION FROM allergies GROUP BY DESCRIPTION ORDER BY COUNT(DESCRIPTION) DESC LIMIT 1 | CREATE TABLE immunizations
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
DATE DATE, --
primary key (DATE, PATIENT, ENCOUNTER, CODE),
DESCRIPTION TEXT, -- Example Values: `Influenza seasonal injectable preservative free`, `Td (adult) preservative free`, `meningococcal MCV4P`, `Tdap`, `HPV quadrivalent` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
);
CREATE TABLE allergies
(
CODE INTEGER, -- Example Values: `232347008`, `300916003`, `419474003`, `424213003`, `300913006` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
foreign key (ENCOUNTER) references encounters(ID),
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
primary key (PATIENT, ENCOUNTER, CODE),
STOP TEXT, -- Example Values: `12/22/14`, `4/21/10`, `10/15/11`, `3/17/10`, `5/26/08` | Value Statics: Total count 16 - Distinct count 11 - Null count 556
START TEXT, --
DESCRIPTION TEXT, -- Example Values: `Allergy to dairy product`, `Allergy to tree pollen`, `Allergy to grass pollen`, `Dander (animal) allergy`, `House dust mite allergy` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
);
CREATE TABLE observations
(
DATE DATE, --
ENCOUNTER TEXT, --
VALUE REAL, --
UNITS TEXT, -- Example Values: `cm`, `kg`, `kg/m2`, `mmHg`, `Cel` | Value Statics: Total count 78444 - Distinct count 17 - Null count 455
DESCRIPTION TEXT, --
CODE TEXT, --
PATIENT TEXT, --
foreign key (PATIENT) references patients(patient),
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE medications
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, --
PATIENT TEXT, --
STOP DATE, --
START DATE, --
REASONDESCRIPTION TEXT, --
DESCRIPTION TEXT, --
primary key (START, PATIENT, ENCOUNTER, CODE),
foreign key (PATIENT) references patients(patient),
REASONCODE INTEGER, --
ENCOUNTER TEXT, --
);
CREATE TABLE careplans
(
START DATE, --
STOP DATE, --
ID TEXT, --
REASONCODE INTEGER, --
REASONDESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
DESCRIPTION TEXT, --
CODE REAL, --
ENCOUNTER TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE encounters
(
DATE DATE, --
REASONCODE INTEGER, --
CODE INTEGER, --
ID TEXT primary key,
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
REASONDESCRIPTION TEXT, --
);
CREATE TABLE procedures
(
foreign key (PATIENT) references patients(patient),
REASONDESCRIPTION TEXT, --
PATIENT TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
DATE DATE, --
DESCRIPTION TEXT, --
ENCOUNTER TEXT, --
CODE INTEGER, --
REASONCODE INTEGER, --
);
CREATE TABLE patients
(
suffix TEXT, -- Example Values: `PhD`, `JD`, `MD` | Value Statics: Total count 45 - Distinct count 3 - Null count 1417
prefix TEXT, -- Example Values: `Mr.`, `Mrs.`, `Ms.` | Value Statics: Total count 1166 - Distinct count 3 - Null count 296
deathdate DATE, --
ethnicity TEXT, --
race TEXT, -- Example Values: `black`, `white`, `hispanic`, `asian` | Value Statics: Total count 1462 - Distinct count 4 - Null count 0
address TEXT, --
birthplace TEXT, --
passport TEXT, --
maiden TEXT, --
birthdate DATE, --
marital TEXT, -- Example Values: `S`, `M` | Value Statics: Total count 1033 - Distinct count 2 - Null count 429
gender TEXT, -- Example Values: `F`, `M` | Value Statics: Total count 1462 - Distinct count 2 - Null count 0
drivers TEXT, --
first TEXT, --
last TEXT, --
patient TEXT primary key,
ssn TEXT, --
);
CREATE TABLE claims
(
ENCOUNTER TEXT references encounters, --
PATIENT TEXT references patients, --
ORGANIZATION TEXT, -- Example Values: `temp organization` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
TOTAL INTEGER, -- Example Values: `100` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
BILLABLEPERIOD DATE, --
DIAGNOSIS TEXT, --
ID TEXT primary key,
);
CREATE TABLE conditions
(
START DATE, --
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
CODE INTEGER, --
ENCOUNTER TEXT, --
STOP DATE, --
foreign key (ENCOUNTER) references encounters(ID),
foreign key (DESCRIPTION) references all_prevalences(ITEM),
);
CREATE TABLE all_prevalences
(
"POPULATION TYPE" TEXT, -- Example Values: `LIVING` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
"POPULATION COUNT" INTEGER, -- Example Values: `1000` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
ITEM TEXT primary key,
"PREVALENCE PERCENTAGE" REAL, --
"PREVALENCE RATE" REAL, --
OCCURRENCES INTEGER, --
); |
software_company | Of the first 60,000 customers who sent a true response to the incentive mailing sent by the marketing department, how many of them are divorced males? | RESPONSE = 'true'; SEX = 'Male'; MARITAL_STATUS = 'Divorced'; | SELECT COUNT(T1.ID) FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID WHERE T1.SEX = 'Male' AND T1.MARITAL_STATUS = 'Divorced' AND T2.RESPONSE = 'true' | CREATE TABLE Customers
(
EDUCATIONNUM INTEGER, -- Example Values: `7`, `3`, `4`, `11`, `5` | Value Statics: Total count 100000 - Distinct count 17 - Null count 0
MARITAL_STATUS TEXT, -- Example Values: `Never-married`, `Married-civ-spouse`, `Divorced`, `Widowed`, `Other` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
ID INTEGER constraint Customers_pk primary key,
SEX TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
OCCUPATION TEXT, -- Example Values: `Machine-op-inspct`, `Handlers-cleaners`, `Exec-managerial`, `Farming-fishing`, `Other-service` | Value Statics: Total count 100000 - Distinct count 8 - Null count 0
age INTEGER, --
GEOID INTEGER constraint Customers_Demog_GEOID_fk references Demog, --
);
CREATE TABLE Mailings1_2
(
RESPONSE TEXT, -- Example Values: `false`, `true` | Value Statics: Total count 60000 - Distinct count 2 - Null count 0
REFID INTEGER constraint Mailings1_2_pk primary key constraint Mailings1_2_Customers_ID_fk references Customers,
REF_DATE DATETIME, -- Example Values: `2007-02-01 12:00:00.0`, `2007-03-01 12:00:00.0` | Value Statics: Total count 60000 - Distinct count 2 - Null count 0
);
CREATE TABLE Sales
(
REFID INTEGER references Customers, --
EVENT_DATE DATETIME, --
AMOUNT REAL, --
EVENTID INTEGER constraint Sales_pk primary key,
);
CREATE TABLE Demog
(
A_VAR1 REAL, --
A_VAR2 REAL, --
A_VAR14 REAL, --
A_VAR8 REAL, --
A_VAR12 REAL, --
A_VAR6 REAL, --
A_VAR17 REAL, --
A_VAR15 REAL, --
A_VAR10 REAL, --
A_VAR16 REAL, --
INHABITANTS_K REAL, --
A_VAR3 REAL, --
A_VAR7 REAL, --
A_VAR4 REAL, --
A_VAR5 REAL, --
A_VAR13 REAL, --
A_VAR9 REAL, --
INCOME_K REAL, --
GEOID INTEGER constraint Demog_pk primary key,
A_VAR18 REAL, --
A_VAR11 REAL, --
);
CREATE TABLE mailings3
(
RESPONSE TEXT, -- Example Values: `false`, `true` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
REF_DATE DATETIME, -- Example Values: `2007-07-01 12:00:00.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
REFID INTEGER constraint mailings3_pk primary key,
); |
retail_world | In August of 1996, how many orders were placed by the customer with the highest amount of orders? | August of 1996 refers to OrderDate = '1996-8'; highest amount of orders refers to MAX(COUNT(OrderID)) | SELECT COUNT(OrderID) FROM Orders WHERE OrderDate LIKE '1996-08%' GROUP BY CustomerID ORDER BY COUNT(OrderID) DESC LIMIT 1 | CREATE TABLE Products
(
CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0
Unit TEXT, --
ReorderLevel INT, --
ProductName TEXT, --
Price REAL DEFAULT 0, --
FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),
SupplierID INTEGER, --
ProductID INTEGER PRIMARY KEY AUTOINCREMENT,
FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID),
);
CREATE TABLE Customers
(
ContactName TEXT, --
Country TEXT, --
Address TEXT, --
City TEXT, --
CustomerID INTEGER PRIMARY KEY AUTOINCREMENT,
PostalCode TEXT, --
CustomerName TEXT, --
);
CREATE TABLE EmployeeTerritories
(
TerritoryID INT, --
EmployeeID INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE OrderDetails
(
Quantity INTEGER, --
FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),
OrderID INTEGER, --
FOREIGN KEY (ProductID) REFERENCES Products (ProductID),
OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT,
ProductID INTEGER, --
);
CREATE TABLE Shippers
(
ShipperID INTEGER PRIMARY KEY AUTOINCREMENT,
ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
);
CREATE TABLE Territory
(
TerritoryDescription TEXT, --
RegionID INTEGER, --
TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT,
);
CREATE TABLE EmployeeDetails
(
EmployeeID INT PRIMARY KEY,
Title TEXT, --
Salary INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE Categories
(
CategoryID INTEGER PRIMARY KEY AUTOINCREMENT,
CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
);
CREATE TABLE Employees
(
Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT,
FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
);
CREATE TABLE Suppliers
(
PostalCode TEXT, --
Address TEXT, --
SupplierID INTEGER PRIMARY KEY AUTOINCREMENT,
City TEXT, --
Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0
Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0
ContactName TEXT, --
Phone TEXT, --
SupplierName TEXT, --
);
CREATE TABLE EmployeesExtra
(
Salary INTEGER, --
Title TEXT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
EmployeeID INTEGER PRIMARY KEY,
);
CREATE TABLE discontinued_products
(
Discontinued INTEGER, --
ProductID INTEGER PRIMARY KEY,
);
CREATE TABLE Orders
(
OrderID INTEGER PRIMARY KEY AUTOINCREMENT,
CustomerID INTEGER, --
FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),
FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID),
FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),
ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0
OrderDate DATETIME, --
EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0
);
CREATE TABLE Territories
(
TerritoryDescription TEXT, --
RegionDescription TEXT, --
);
CREATE TABLE ShippingInfo
(
ShipCountry TEXT, --
ShippedDate DATETIME, --
FOREIGN KEY (OrderID) REFERENCES Orders(OrderID),
OrderID INTEGER PRIMARY KEY,
); |
synthea | How many patients have diabetes that started in 1988? | diabetes that started in 1988 refers to DESCRIPTION = 'Diabetes' from conditions and START like '1988%'; | SELECT COUNT(PATIENT) FROM conditions WHERE DESCRIPTION = 'Diabetes' AND strftime('%Y', START) = '1988' | CREATE TABLE immunizations
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
DATE DATE, --
primary key (DATE, PATIENT, ENCOUNTER, CODE),
DESCRIPTION TEXT, -- Example Values: `Influenza seasonal injectable preservative free`, `Td (adult) preservative free`, `meningococcal MCV4P`, `Tdap`, `HPV quadrivalent` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
);
CREATE TABLE allergies
(
CODE INTEGER, -- Example Values: `232347008`, `300916003`, `419474003`, `424213003`, `300913006` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
foreign key (ENCOUNTER) references encounters(ID),
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
primary key (PATIENT, ENCOUNTER, CODE),
STOP TEXT, -- Example Values: `12/22/14`, `4/21/10`, `10/15/11`, `3/17/10`, `5/26/08` | Value Statics: Total count 16 - Distinct count 11 - Null count 556
START TEXT, --
DESCRIPTION TEXT, -- Example Values: `Allergy to dairy product`, `Allergy to tree pollen`, `Allergy to grass pollen`, `Dander (animal) allergy`, `House dust mite allergy` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
);
CREATE TABLE observations
(
DATE DATE, --
ENCOUNTER TEXT, --
VALUE REAL, --
UNITS TEXT, -- Example Values: `cm`, `kg`, `kg/m2`, `mmHg`, `Cel` | Value Statics: Total count 78444 - Distinct count 17 - Null count 455
DESCRIPTION TEXT, --
CODE TEXT, --
PATIENT TEXT, --
foreign key (PATIENT) references patients(patient),
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE medications
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, --
PATIENT TEXT, --
STOP DATE, --
START DATE, --
REASONDESCRIPTION TEXT, --
DESCRIPTION TEXT, --
primary key (START, PATIENT, ENCOUNTER, CODE),
foreign key (PATIENT) references patients(patient),
REASONCODE INTEGER, --
ENCOUNTER TEXT, --
);
CREATE TABLE careplans
(
START DATE, --
STOP DATE, --
ID TEXT, --
REASONCODE INTEGER, --
REASONDESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
DESCRIPTION TEXT, --
CODE REAL, --
ENCOUNTER TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE encounters
(
DATE DATE, --
REASONCODE INTEGER, --
CODE INTEGER, --
ID TEXT primary key,
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
REASONDESCRIPTION TEXT, --
);
CREATE TABLE procedures
(
foreign key (PATIENT) references patients(patient),
REASONDESCRIPTION TEXT, --
PATIENT TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
DATE DATE, --
DESCRIPTION TEXT, --
ENCOUNTER TEXT, --
CODE INTEGER, --
REASONCODE INTEGER, --
);
CREATE TABLE patients
(
suffix TEXT, -- Example Values: `PhD`, `JD`, `MD` | Value Statics: Total count 45 - Distinct count 3 - Null count 1417
prefix TEXT, -- Example Values: `Mr.`, `Mrs.`, `Ms.` | Value Statics: Total count 1166 - Distinct count 3 - Null count 296
deathdate DATE, --
ethnicity TEXT, --
race TEXT, -- Example Values: `black`, `white`, `hispanic`, `asian` | Value Statics: Total count 1462 - Distinct count 4 - Null count 0
address TEXT, --
birthplace TEXT, --
passport TEXT, --
maiden TEXT, --
birthdate DATE, --
marital TEXT, -- Example Values: `S`, `M` | Value Statics: Total count 1033 - Distinct count 2 - Null count 429
gender TEXT, -- Example Values: `F`, `M` | Value Statics: Total count 1462 - Distinct count 2 - Null count 0
drivers TEXT, --
first TEXT, --
last TEXT, --
patient TEXT primary key,
ssn TEXT, --
);
CREATE TABLE claims
(
ENCOUNTER TEXT references encounters, --
PATIENT TEXT references patients, --
ORGANIZATION TEXT, -- Example Values: `temp organization` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
TOTAL INTEGER, -- Example Values: `100` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
BILLABLEPERIOD DATE, --
DIAGNOSIS TEXT, --
ID TEXT primary key,
);
CREATE TABLE conditions
(
START DATE, --
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
CODE INTEGER, --
ENCOUNTER TEXT, --
STOP DATE, --
foreign key (ENCOUNTER) references encounters(ID),
foreign key (DESCRIPTION) references all_prevalences(ITEM),
);
CREATE TABLE all_prevalences
(
"POPULATION TYPE" TEXT, -- Example Values: `LIVING` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
"POPULATION COUNT" INTEGER, -- Example Values: `1000` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
ITEM TEXT primary key,
"PREVALENCE PERCENTAGE" REAL, --
"PREVALENCE RATE" REAL, --
OCCURRENCES INTEGER, --
); |
software_company | Of the first 60,000 customers who sent a true response to the incentive mailing sent by the marketing department, how many of them are from a place with more than 30,000 inhabitants? | RESPONSE = 'true'; place with more than 30,000 inhabitants refers to GEOID where INHABITANTS_K > 30; | SELECT COUNT(T1.ID) FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID INNER JOIN Demog AS T3 ON T1.GEOID = T3.GEOID WHERE T3.INHABITANTS_K > 30 AND T2.RESPONSE = 'true' | CREATE TABLE Customers
(
EDUCATIONNUM INTEGER, -- Example Values: `7`, `3`, `4`, `11`, `5` | Value Statics: Total count 100000 - Distinct count 17 - Null count 0
MARITAL_STATUS TEXT, -- Example Values: `Never-married`, `Married-civ-spouse`, `Divorced`, `Widowed`, `Other` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
ID INTEGER constraint Customers_pk primary key,
SEX TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
OCCUPATION TEXT, -- Example Values: `Machine-op-inspct`, `Handlers-cleaners`, `Exec-managerial`, `Farming-fishing`, `Other-service` | Value Statics: Total count 100000 - Distinct count 8 - Null count 0
age INTEGER, --
GEOID INTEGER constraint Customers_Demog_GEOID_fk references Demog, --
);
CREATE TABLE Mailings1_2
(
RESPONSE TEXT, -- Example Values: `false`, `true` | Value Statics: Total count 60000 - Distinct count 2 - Null count 0
REFID INTEGER constraint Mailings1_2_pk primary key constraint Mailings1_2_Customers_ID_fk references Customers,
REF_DATE DATETIME, -- Example Values: `2007-02-01 12:00:00.0`, `2007-03-01 12:00:00.0` | Value Statics: Total count 60000 - Distinct count 2 - Null count 0
);
CREATE TABLE Sales
(
REFID INTEGER references Customers, --
EVENT_DATE DATETIME, --
AMOUNT REAL, --
EVENTID INTEGER constraint Sales_pk primary key,
);
CREATE TABLE Demog
(
A_VAR1 REAL, --
A_VAR2 REAL, --
A_VAR14 REAL, --
A_VAR8 REAL, --
A_VAR12 REAL, --
A_VAR6 REAL, --
A_VAR17 REAL, --
A_VAR15 REAL, --
A_VAR10 REAL, --
A_VAR16 REAL, --
INHABITANTS_K REAL, --
A_VAR3 REAL, --
A_VAR7 REAL, --
A_VAR4 REAL, --
A_VAR5 REAL, --
A_VAR13 REAL, --
A_VAR9 REAL, --
INCOME_K REAL, --
GEOID INTEGER constraint Demog_pk primary key,
A_VAR18 REAL, --
A_VAR11 REAL, --
);
CREATE TABLE mailings3
(
RESPONSE TEXT, -- Example Values: `false`, `true` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
REF_DATE DATETIME, -- Example Values: `2007-07-01 12:00:00.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
REFID INTEGER constraint mailings3_pk primary key,
); |
retail_world | What is the full name of the employees who report to the Sales Manager? | full name refers to LastName, FirstName; the Sales Manager refers to Title = 'Sales Manager'; report to refers to ReportsTo is not NULL; | SELECT FirstName, LastName FROM Employees WHERE ReportsTo = ( SELECT EmployeeID FROM Employees WHERE Title = 'Sales Manager' ) | CREATE TABLE Products
(
CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0
Unit TEXT, --
ReorderLevel INT, --
ProductName TEXT, --
Price REAL DEFAULT 0, --
FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),
SupplierID INTEGER, --
ProductID INTEGER PRIMARY KEY AUTOINCREMENT,
FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID),
);
CREATE TABLE Customers
(
ContactName TEXT, --
Country TEXT, --
Address TEXT, --
City TEXT, --
CustomerID INTEGER PRIMARY KEY AUTOINCREMENT,
PostalCode TEXT, --
CustomerName TEXT, --
);
CREATE TABLE EmployeeTerritories
(
TerritoryID INT, --
EmployeeID INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE OrderDetails
(
Quantity INTEGER, --
FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),
OrderID INTEGER, --
FOREIGN KEY (ProductID) REFERENCES Products (ProductID),
OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT,
ProductID INTEGER, --
);
CREATE TABLE Shippers
(
ShipperID INTEGER PRIMARY KEY AUTOINCREMENT,
ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
);
CREATE TABLE Territory
(
TerritoryDescription TEXT, --
RegionID INTEGER, --
TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT,
);
CREATE TABLE EmployeeDetails
(
EmployeeID INT PRIMARY KEY,
Title TEXT, --
Salary INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE Categories
(
CategoryID INTEGER PRIMARY KEY AUTOINCREMENT,
CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
);
CREATE TABLE Employees
(
Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT,
FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
);
CREATE TABLE Suppliers
(
PostalCode TEXT, --
Address TEXT, --
SupplierID INTEGER PRIMARY KEY AUTOINCREMENT,
City TEXT, --
Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0
Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0
ContactName TEXT, --
Phone TEXT, --
SupplierName TEXT, --
);
CREATE TABLE EmployeesExtra
(
Salary INTEGER, --
Title TEXT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
EmployeeID INTEGER PRIMARY KEY,
);
CREATE TABLE discontinued_products
(
Discontinued INTEGER, --
ProductID INTEGER PRIMARY KEY,
);
CREATE TABLE Orders
(
OrderID INTEGER PRIMARY KEY AUTOINCREMENT,
CustomerID INTEGER, --
FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),
FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID),
FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),
ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0
OrderDate DATETIME, --
EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0
);
CREATE TABLE Territories
(
TerritoryDescription TEXT, --
RegionDescription TEXT, --
);
CREATE TABLE ShippingInfo
(
ShipCountry TEXT, --
ShippedDate DATETIME, --
FOREIGN KEY (OrderID) REFERENCES Orders(OrderID),
OrderID INTEGER PRIMARY KEY,
); |
professional_basketball | What is the full name of the team with the fastest growth in winning rate in the 'ABA' league from 1972 to 1973? | "ABA" is the lgID; from 1972 to 1973 refers to year = 1972 and year = 1973; team with the fastest growth in winning rate = Max(Subtract(Divide(won where year = 1973, Sum(won, lost)),Divide(won where year = 1972, Sum(won, lost)))) | SELECT T1.name FROM teams AS T1 INNER JOIN ( SELECT * FROM teams WHERE lgID = 'ABA' AND year = 1972 ) AS T2 ON T1.tmID = T2.tmID WHERE T1.lgID = 'ABA' AND T1.year = 1973 ORDER BY (CAST(T1.won AS REAL) / (T1.won + T1.lost) - (CAST(T2.won AS REAL) / (T2.won + T2.lost))) DESC LIMIT 1 | CREATE TABLE players_teams
(
PostGS INTEGER, --
PostdRebounds INTEGER, --
PostPF INTEGER, --
tmID TEXT, --
threeAttempted INTEGER, --
PostRebounds INTEGER, --
assists INTEGER, --
threeMade INTEGER, --
PostBlocks INTEGER, --
PostTurnovers INTEGER, --
GP INTEGER, --
lgID TEXT, -- Example Values: `NBA`, `NBL`, `ABA`, `ABL1`, `NPBL` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0
foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade,
PostfgMade INTEGER, --
steals INTEGER, --
oRebounds INTEGER, --
PostftAttempted INTEGER, --
ftAttempted INTEGER, --
ftMade INTEGER, --
points INTEGER, --
PostfgAttempted INTEGER, --
PostftMade INTEGER, --
note TEXT, -- Example Values: `C` | Value Statics: Total count 43 - Distinct count 1 - Null count 23708
dRebounds INTEGER, --
PostSteals INTEGER, --
blocks INTEGER, --
PostAssists INTEGER, --
minutes INTEGER, --
fgAttempted INTEGER, --
playerID TEXT not null references players on update cascade on delete cascade, --
PostthreeMade INTEGER, --
PostPoints INTEGER, --
year INTEGER, --
PF INTEGER, --
fgMade INTEGER, --
PostthreeAttempted INTEGER, --
rebounds INTEGER, --
id INTEGER primary key autoincrement,
stint INTEGER, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0
PostMinutes INTEGER, --
PostGP INTEGER, --
turnovers INTEGER, --
PostoRebounds INTEGER, --
GS INTEGER, --
);
CREATE TABLE awards_coaches
(
award TEXT, -- Example Values: `NBA Coach of the Year`, `ABA Coach of the Year` | Value Statics: Total count 61 - Distinct count 2 - Null count 0
id INTEGER primary key autoincrement,
note TEXT, -- Example Values: `tie` | Value Statics: Total count 4 - Distinct count 1 - Null count 57
coachID TEXT, --
lgID TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 61 - Distinct count 2 - Null count 0
foreign key (coachID, year) references coaches (coachID, year) on update cascade on delete cascade,
year INTEGER, --
);
CREATE TABLE draft
(
draftOverall INTEGER null, --
lgID TEXT null, -- Example Values: `ABA`, `NBA` | Value Statics: Total count 8621 - Distinct count 2 - Null count 0
suffixName TEXT null, -- Example Values: `Jr.` | Value Statics: Total count 2 - Distinct count 1 - Null count 8619
draftYear INTEGER null, --
draftSelection INTEGER null, --
tmID TEXT null, --
draftRound INTEGER null, --
lastName TEXT null, --
playerID TEXT null, --
draftFrom TEXT null, --
id INTEGER default 0 not null primary key,
firstName TEXT null, --
foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade,
foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade,
);
CREATE TABLE player_allstar
(
rebounds INTEGER null, --
playerID TEXT not null, --
season_id INTEGER not null, --
assists INTEGER null, --
conference TEXT null, -- Example Values: `East`, `West`, `Weset`, `Allstars`, `Denver` | Value Statics: Total count 1608 - Distinct count 5 - Null count 0
points INTEGER null, --
personal_fouls INTEGER null, -- Example Values: `3`, `2`, `0`, `1`, `5` | Value Statics: Total count 540 - Distinct count 8 - Null count 1068
ft_attempted INTEGER null, -- Example Values: `2`, `4`, `0`, `6`, `3` | Value Statics: Total count 1561 - Distinct count 17 - Null count 47
fg_attempted INTEGER null, --
league_id TEXT null, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 1608 - Distinct count 2 - Null count 0
foreign key (playerID) references players (playerID) on update cascade on delete cascade,
fg_made INTEGER null, -- Example Values: `4`, `8`, `5`, `7`, `3` | Value Statics: Total count 1561 - Distinct count 18 - Null count 47
ft_made INTEGER null, -- Example Values: `2`, `3`, `0`, `1`, `4` | Value Statics: Total count 1561 - Distinct count 13 - Null count 47
steals INTEGER null, -- Example Values: `3`, `0`, `1`, `2`, `5` | Value Statics: Total count 398 - Distinct count 7 - Null count 1210
games_played INTEGER null, -- Example Values: `1` | Value Statics: Total count 1608 - Distinct count 1 - Null count 0
first_name TEXT null, --
d_rebounds INTEGER null, -- Example Values: `2`, `5`, `0`, `1`, `4` | Value Statics: Total count 493 - Distinct count 14 - Null count 1115
last_name TEXT null, --
primary key (playerID, season_id),
turnovers INTEGER null, -- Example Values: `1`, `0`, `3`, `2`, `4` | Value Statics: Total count 493 - Distinct count 9 - Null count 1115
three_made INTEGER null, -- Example Values: `0`, `1`, `3`, `5`, `4` | Value Statics: Total count 566 - Distinct count 7 - Null count 1042
minutes INTEGER null, --
blocks INTEGER null, -- Example Values: `2`, `0`, `1`, `3`, `5` | Value Statics: Total count 398 - Distinct count 6 - Null count 1210
three_attempted INTEGER null, -- Example Values: `0`, `1`, `6`, `7`, `10` | Value Statics: Total count 540 - Distinct count 12 - Null count 1068
o_rebounds INTEGER null, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 493 - Distinct count 10 - Null count 1115
);
CREATE TABLE awards_players
(
foreign key (playerID) references players (playerID) on update cascade on delete cascade,
year INTEGER not null, --
pos TEXT null, -- Example Values: `C`, `F`, `G`, `F/G`, `F/C` | Value Statics: Total count 833 - Distinct count 5 - Null count 886
primary key (playerID, year, award),
lgID TEXT null, -- Example Values: `NBA`, `ABA`, `NBL`, `ABL1` | Value Statics: Total count 1719 - Distinct count 4 - Null count 0
award TEXT not null, --
playerID TEXT not null, --
note TEXT null, -- Example Values: `tie` | Value Statics: Total count 37 - Distinct count 1 - Null count 1682
);
CREATE TABLE series_post
(
tmIDLoser TEXT, --
id INTEGER primary key autoincrement,
series TEXT, -- Example Values: `O`, `M`, `N`, `A`, `K` | Value Statics: Total count 775 - Distinct count 11 - Null count 0
tmIDWinner TEXT, --
round TEXT, -- Example Values: `F`, `QF`, `SF`, `DT`, `DF` | Value Statics: Total count 775 - Distinct count 11 - Null count 0
year INTEGER, --
foreign key (tmIDLoser, year) references teams (tmID, year) on update cascade on delete cascade,
foreign key (tmIDWinner, year) references teams (tmID, year) on update cascade on delete cascade,
W INTEGER, -- Example Values: `4`, `2`, `1`, `3`, `0` | Value Statics: Total count 775 - Distinct count 5 - Null count 0
lgIDLoser TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0
lgIDWinner TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0
L INTEGER, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 775 - Distinct count 5 - Null count 0
);
CREATE TABLE players
(
nameGiven TEXT null, -- Example Values: `nameGiven`, `Mort`, `Robert`, `Jim`, `Mike` | Value Statics: Total count 10 - Distinct count 9 - Null count 5052
lastseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15
hsCountry TEXT null, --
firstName TEXT null, --
hsCity TEXT null, --
firstseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15
weight INTEGER null, --
birthCountry TEXT null, --
race TEXT null, -- Example Values: `B`, `W`, `O`, `1`, `r` | Value Statics: Total count 4903 - Distinct count 5 - Null count 159
lastName TEXT null, --
birthDate DATE null, --
collegeOther TEXT null, --
birthState TEXT null, --
useFirst TEXT null, --
pos TEXT null, -- Example Values: `F-C`, `C`, `G`, `G-F`, `C-F` | Value Statics: Total count 4880 - Distinct count 14 - Null count 182
playerID TEXT not null primary key,
college TEXT null, --
highSchool TEXT null, --
hsState TEXT null, --
height REAL null, --
deathDate DATE null, --
nameSuffix TEXT null, -- Example Values: `Jr.`, `III`, `nameSuffix`, `II`, `IV` | Value Statics: Total count 324 - Distinct count 6 - Null count 4738
nameNick TEXT null, --
fullGivenName TEXT null, --
birthCity TEXT null, --
middleName TEXT null, --
);
CREATE TABLE teams
(
d_pts INTEGER null, --
name TEXT null, --
homeLost INTEGER null, --
o_ftm INTEGER null, --
franchID TEXT null, --
tmID TEXT not null, --
awayWon INTEGER null, --
primary key (year, tmID),
o_fgm INTEGER null, --
year INTEGER not null, --
awayLost INTEGER null, --
arena TEXT null, --
confID TEXT null, -- Example Values: `EC`, `WC` | Value Statics: Total count 1064 - Distinct count 2 - Null count 472
games INTEGER null, --
lost INTEGER null, --
divID TEXT null, -- Example Values: `EA`, `WE`, `ED`, `WD`, `SO` | Value Statics: Total count 1498 - Distinct count 13 - Null count 38
lgID TEXT null, -- Example Values: `NBL`, `NBA`, `PBLA`, `NPBL`, `ABL1` | Value Statics: Total count 1536 - Distinct count 6 - Null count 0
homeWon INTEGER null, --
confRank INTEGER null, -- Example Values: `0`, `4`, `3`, `5`, `7` | Value Statics: Total count 1536 - Distinct count 16 - Null count 0
o_pts INTEGER null, --
`rank` INTEGER null, -- Example Values: `1`, `2`, `4`, `5`, `6` | Value Statics: Total count 1536 - Distinct count 10 - Null count 0
playoff TEXT null, -- Example Values: `CF`, `WC`, `LC`, `CS`, `F` | Value Statics: Total count 901 - Distinct count 15 - Null count 635
won INTEGER null, --
);
CREATE TABLE coaches
(
primary key (coachID, year, tmID, stint),
lgID TEXT null, -- Example Values: `NBA`, `ABA`, `ABL1`, `PBLA`, `NPBL` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0
post_losses INTEGER null, -- Example Values: `3`, `9`, `7`, `8`, `0` | Value Statics: Total count 1649 - Distinct count 12 - Null count 40
year INTEGER not null, --
won INTEGER null, --
foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade,
post_wins INTEGER null, -- Example Values: `0`, `12`, `9`, `13`, `1` | Value Statics: Total count 1649 - Distinct count 17 - Null count 40
coachID TEXT not null, --
tmID TEXT not null, --
lost INTEGER null, --
stint INTEGER not null, -- Example Values: `2`, `1`, `4`, `5`, `3` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0
); |
synthea | What is the most common condition among the female Americans? | the most common condition refers to MAX(COUNT(DESCRIPTION)); among the female Americans refer to PATIENT where gender = 'F' and ethnicity = 'american'; | SELECT T2.DESCRIPTION FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE T1.gender = 'F' AND T1.ethnicity = 'american' GROUP BY T2.DESCRIPTION ORDER BY COUNT(T2.DESCRIPTION) DESC LIMIT 1 | CREATE TABLE immunizations
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
DATE DATE, --
primary key (DATE, PATIENT, ENCOUNTER, CODE),
DESCRIPTION TEXT, -- Example Values: `Influenza seasonal injectable preservative free`, `Td (adult) preservative free`, `meningococcal MCV4P`, `Tdap`, `HPV quadrivalent` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
);
CREATE TABLE allergies
(
CODE INTEGER, -- Example Values: `232347008`, `300916003`, `419474003`, `424213003`, `300913006` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
foreign key (ENCOUNTER) references encounters(ID),
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
primary key (PATIENT, ENCOUNTER, CODE),
STOP TEXT, -- Example Values: `12/22/14`, `4/21/10`, `10/15/11`, `3/17/10`, `5/26/08` | Value Statics: Total count 16 - Distinct count 11 - Null count 556
START TEXT, --
DESCRIPTION TEXT, -- Example Values: `Allergy to dairy product`, `Allergy to tree pollen`, `Allergy to grass pollen`, `Dander (animal) allergy`, `House dust mite allergy` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
);
CREATE TABLE observations
(
DATE DATE, --
ENCOUNTER TEXT, --
VALUE REAL, --
UNITS TEXT, -- Example Values: `cm`, `kg`, `kg/m2`, `mmHg`, `Cel` | Value Statics: Total count 78444 - Distinct count 17 - Null count 455
DESCRIPTION TEXT, --
CODE TEXT, --
PATIENT TEXT, --
foreign key (PATIENT) references patients(patient),
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE medications
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, --
PATIENT TEXT, --
STOP DATE, --
START DATE, --
REASONDESCRIPTION TEXT, --
DESCRIPTION TEXT, --
primary key (START, PATIENT, ENCOUNTER, CODE),
foreign key (PATIENT) references patients(patient),
REASONCODE INTEGER, --
ENCOUNTER TEXT, --
);
CREATE TABLE careplans
(
START DATE, --
STOP DATE, --
ID TEXT, --
REASONCODE INTEGER, --
REASONDESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
DESCRIPTION TEXT, --
CODE REAL, --
ENCOUNTER TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE encounters
(
DATE DATE, --
REASONCODE INTEGER, --
CODE INTEGER, --
ID TEXT primary key,
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
REASONDESCRIPTION TEXT, --
);
CREATE TABLE procedures
(
foreign key (PATIENT) references patients(patient),
REASONDESCRIPTION TEXT, --
PATIENT TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
DATE DATE, --
DESCRIPTION TEXT, --
ENCOUNTER TEXT, --
CODE INTEGER, --
REASONCODE INTEGER, --
);
CREATE TABLE patients
(
suffix TEXT, -- Example Values: `PhD`, `JD`, `MD` | Value Statics: Total count 45 - Distinct count 3 - Null count 1417
prefix TEXT, -- Example Values: `Mr.`, `Mrs.`, `Ms.` | Value Statics: Total count 1166 - Distinct count 3 - Null count 296
deathdate DATE, --
ethnicity TEXT, --
race TEXT, -- Example Values: `black`, `white`, `hispanic`, `asian` | Value Statics: Total count 1462 - Distinct count 4 - Null count 0
address TEXT, --
birthplace TEXT, --
passport TEXT, --
maiden TEXT, --
birthdate DATE, --
marital TEXT, -- Example Values: `S`, `M` | Value Statics: Total count 1033 - Distinct count 2 - Null count 429
gender TEXT, -- Example Values: `F`, `M` | Value Statics: Total count 1462 - Distinct count 2 - Null count 0
drivers TEXT, --
first TEXT, --
last TEXT, --
patient TEXT primary key,
ssn TEXT, --
);
CREATE TABLE claims
(
ENCOUNTER TEXT references encounters, --
PATIENT TEXT references patients, --
ORGANIZATION TEXT, -- Example Values: `temp organization` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
TOTAL INTEGER, -- Example Values: `100` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
BILLABLEPERIOD DATE, --
DIAGNOSIS TEXT, --
ID TEXT primary key,
);
CREATE TABLE conditions
(
START DATE, --
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
CODE INTEGER, --
ENCOUNTER TEXT, --
STOP DATE, --
foreign key (ENCOUNTER) references encounters(ID),
foreign key (DESCRIPTION) references all_prevalences(ITEM),
);
CREATE TABLE all_prevalences
(
"POPULATION TYPE" TEXT, -- Example Values: `LIVING` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
"POPULATION COUNT" INTEGER, -- Example Values: `1000` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
ITEM TEXT primary key,
"PREVALENCE PERCENTAGE" REAL, --
"PREVALENCE RATE" REAL, --
OCCURRENCES INTEGER, --
); |
software_company | Which customer come from a place with more inhabitants, customer no.0 or customer no.1? | place with more inhabitants refers to GEOID where ID = 0 OR ID = 1 and MAX(NHABITANTS_K); | SELECT T1.ID FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.ID = 0 OR T1.ID = 1 ORDER BY INHABITANTS_K DESC LIMIT 1 | CREATE TABLE Customers
(
EDUCATIONNUM INTEGER, -- Example Values: `7`, `3`, `4`, `11`, `5` | Value Statics: Total count 100000 - Distinct count 17 - Null count 0
MARITAL_STATUS TEXT, -- Example Values: `Never-married`, `Married-civ-spouse`, `Divorced`, `Widowed`, `Other` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
ID INTEGER constraint Customers_pk primary key,
SEX TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
OCCUPATION TEXT, -- Example Values: `Machine-op-inspct`, `Handlers-cleaners`, `Exec-managerial`, `Farming-fishing`, `Other-service` | Value Statics: Total count 100000 - Distinct count 8 - Null count 0
age INTEGER, --
GEOID INTEGER constraint Customers_Demog_GEOID_fk references Demog, --
);
CREATE TABLE Mailings1_2
(
RESPONSE TEXT, -- Example Values: `false`, `true` | Value Statics: Total count 60000 - Distinct count 2 - Null count 0
REFID INTEGER constraint Mailings1_2_pk primary key constraint Mailings1_2_Customers_ID_fk references Customers,
REF_DATE DATETIME, -- Example Values: `2007-02-01 12:00:00.0`, `2007-03-01 12:00:00.0` | Value Statics: Total count 60000 - Distinct count 2 - Null count 0
);
CREATE TABLE Sales
(
REFID INTEGER references Customers, --
EVENT_DATE DATETIME, --
AMOUNT REAL, --
EVENTID INTEGER constraint Sales_pk primary key,
);
CREATE TABLE Demog
(
A_VAR1 REAL, --
A_VAR2 REAL, --
A_VAR14 REAL, --
A_VAR8 REAL, --
A_VAR12 REAL, --
A_VAR6 REAL, --
A_VAR17 REAL, --
A_VAR15 REAL, --
A_VAR10 REAL, --
A_VAR16 REAL, --
INHABITANTS_K REAL, --
A_VAR3 REAL, --
A_VAR7 REAL, --
A_VAR4 REAL, --
A_VAR5 REAL, --
A_VAR13 REAL, --
A_VAR9 REAL, --
INCOME_K REAL, --
GEOID INTEGER constraint Demog_pk primary key,
A_VAR18 REAL, --
A_VAR11 REAL, --
);
CREATE TABLE mailings3
(
RESPONSE TEXT, -- Example Values: `false`, `true` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
REF_DATE DATETIME, -- Example Values: `2007-07-01 12:00:00.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
REFID INTEGER constraint mailings3_pk primary key,
); |
retail_world | Which country are the majority of the suppliers located? | majority of the suppliers located refers to MAX(COUNT(SupplierID)) | SELECT Country FROM Suppliers GROUP BY Country ORDER BY COUNT(SupplierID) DESC LIMIT 1 | CREATE TABLE Products
(
CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0
Unit TEXT, --
ReorderLevel INT, --
ProductName TEXT, --
Price REAL DEFAULT 0, --
FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),
SupplierID INTEGER, --
ProductID INTEGER PRIMARY KEY AUTOINCREMENT,
FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID),
);
CREATE TABLE Customers
(
ContactName TEXT, --
Country TEXT, --
Address TEXT, --
City TEXT, --
CustomerID INTEGER PRIMARY KEY AUTOINCREMENT,
PostalCode TEXT, --
CustomerName TEXT, --
);
CREATE TABLE EmployeeTerritories
(
TerritoryID INT, --
EmployeeID INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE OrderDetails
(
Quantity INTEGER, --
FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),
OrderID INTEGER, --
FOREIGN KEY (ProductID) REFERENCES Products (ProductID),
OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT,
ProductID INTEGER, --
);
CREATE TABLE Shippers
(
ShipperID INTEGER PRIMARY KEY AUTOINCREMENT,
ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
);
CREATE TABLE Territory
(
TerritoryDescription TEXT, --
RegionID INTEGER, --
TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT,
);
CREATE TABLE EmployeeDetails
(
EmployeeID INT PRIMARY KEY,
Title TEXT, --
Salary INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE Categories
(
CategoryID INTEGER PRIMARY KEY AUTOINCREMENT,
CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
);
CREATE TABLE Employees
(
Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT,
FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
);
CREATE TABLE Suppliers
(
PostalCode TEXT, --
Address TEXT, --
SupplierID INTEGER PRIMARY KEY AUTOINCREMENT,
City TEXT, --
Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0
Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0
ContactName TEXT, --
Phone TEXT, --
SupplierName TEXT, --
);
CREATE TABLE EmployeesExtra
(
Salary INTEGER, --
Title TEXT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
EmployeeID INTEGER PRIMARY KEY,
);
CREATE TABLE discontinued_products
(
Discontinued INTEGER, --
ProductID INTEGER PRIMARY KEY,
);
CREATE TABLE Orders
(
OrderID INTEGER PRIMARY KEY AUTOINCREMENT,
CustomerID INTEGER, --
FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),
FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID),
FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),
ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0
OrderDate DATETIME, --
EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0
);
CREATE TABLE Territories
(
TerritoryDescription TEXT, --
RegionDescription TEXT, --
);
CREATE TABLE ShippingInfo
(
ShipCountry TEXT, --
ShippedDate DATETIME, --
FOREIGN KEY (OrderID) REFERENCES Orders(OrderID),
OrderID INTEGER PRIMARY KEY,
); |
professional_basketball | What is the average height of an East conference All-star player? | average height refers to avg(height) | SELECT AVG(DISTINCT height) FROM players AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE conference = 'East' | CREATE TABLE players_teams
(
PostGS INTEGER, --
PostdRebounds INTEGER, --
PostPF INTEGER, --
tmID TEXT, --
threeAttempted INTEGER, --
PostRebounds INTEGER, --
assists INTEGER, --
threeMade INTEGER, --
PostBlocks INTEGER, --
PostTurnovers INTEGER, --
GP INTEGER, --
lgID TEXT, -- Example Values: `NBA`, `NBL`, `ABA`, `ABL1`, `NPBL` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0
foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade,
PostfgMade INTEGER, --
steals INTEGER, --
oRebounds INTEGER, --
PostftAttempted INTEGER, --
ftAttempted INTEGER, --
ftMade INTEGER, --
points INTEGER, --
PostfgAttempted INTEGER, --
PostftMade INTEGER, --
note TEXT, -- Example Values: `C` | Value Statics: Total count 43 - Distinct count 1 - Null count 23708
dRebounds INTEGER, --
PostSteals INTEGER, --
blocks INTEGER, --
PostAssists INTEGER, --
minutes INTEGER, --
fgAttempted INTEGER, --
playerID TEXT not null references players on update cascade on delete cascade, --
PostthreeMade INTEGER, --
PostPoints INTEGER, --
year INTEGER, --
PF INTEGER, --
fgMade INTEGER, --
PostthreeAttempted INTEGER, --
rebounds INTEGER, --
id INTEGER primary key autoincrement,
stint INTEGER, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0
PostMinutes INTEGER, --
PostGP INTEGER, --
turnovers INTEGER, --
PostoRebounds INTEGER, --
GS INTEGER, --
);
CREATE TABLE awards_coaches
(
award TEXT, -- Example Values: `NBA Coach of the Year`, `ABA Coach of the Year` | Value Statics: Total count 61 - Distinct count 2 - Null count 0
id INTEGER primary key autoincrement,
note TEXT, -- Example Values: `tie` | Value Statics: Total count 4 - Distinct count 1 - Null count 57
coachID TEXT, --
lgID TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 61 - Distinct count 2 - Null count 0
foreign key (coachID, year) references coaches (coachID, year) on update cascade on delete cascade,
year INTEGER, --
);
CREATE TABLE draft
(
draftOverall INTEGER null, --
lgID TEXT null, -- Example Values: `ABA`, `NBA` | Value Statics: Total count 8621 - Distinct count 2 - Null count 0
suffixName TEXT null, -- Example Values: `Jr.` | Value Statics: Total count 2 - Distinct count 1 - Null count 8619
draftYear INTEGER null, --
draftSelection INTEGER null, --
tmID TEXT null, --
draftRound INTEGER null, --
lastName TEXT null, --
playerID TEXT null, --
draftFrom TEXT null, --
id INTEGER default 0 not null primary key,
firstName TEXT null, --
foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade,
foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade,
);
CREATE TABLE player_allstar
(
rebounds INTEGER null, --
playerID TEXT not null, --
season_id INTEGER not null, --
assists INTEGER null, --
conference TEXT null, -- Example Values: `East`, `West`, `Weset`, `Allstars`, `Denver` | Value Statics: Total count 1608 - Distinct count 5 - Null count 0
points INTEGER null, --
personal_fouls INTEGER null, -- Example Values: `3`, `2`, `0`, `1`, `5` | Value Statics: Total count 540 - Distinct count 8 - Null count 1068
ft_attempted INTEGER null, -- Example Values: `2`, `4`, `0`, `6`, `3` | Value Statics: Total count 1561 - Distinct count 17 - Null count 47
fg_attempted INTEGER null, --
league_id TEXT null, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 1608 - Distinct count 2 - Null count 0
foreign key (playerID) references players (playerID) on update cascade on delete cascade,
fg_made INTEGER null, -- Example Values: `4`, `8`, `5`, `7`, `3` | Value Statics: Total count 1561 - Distinct count 18 - Null count 47
ft_made INTEGER null, -- Example Values: `2`, `3`, `0`, `1`, `4` | Value Statics: Total count 1561 - Distinct count 13 - Null count 47
steals INTEGER null, -- Example Values: `3`, `0`, `1`, `2`, `5` | Value Statics: Total count 398 - Distinct count 7 - Null count 1210
games_played INTEGER null, -- Example Values: `1` | Value Statics: Total count 1608 - Distinct count 1 - Null count 0
first_name TEXT null, --
d_rebounds INTEGER null, -- Example Values: `2`, `5`, `0`, `1`, `4` | Value Statics: Total count 493 - Distinct count 14 - Null count 1115
last_name TEXT null, --
primary key (playerID, season_id),
turnovers INTEGER null, -- Example Values: `1`, `0`, `3`, `2`, `4` | Value Statics: Total count 493 - Distinct count 9 - Null count 1115
three_made INTEGER null, -- Example Values: `0`, `1`, `3`, `5`, `4` | Value Statics: Total count 566 - Distinct count 7 - Null count 1042
minutes INTEGER null, --
blocks INTEGER null, -- Example Values: `2`, `0`, `1`, `3`, `5` | Value Statics: Total count 398 - Distinct count 6 - Null count 1210
three_attempted INTEGER null, -- Example Values: `0`, `1`, `6`, `7`, `10` | Value Statics: Total count 540 - Distinct count 12 - Null count 1068
o_rebounds INTEGER null, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 493 - Distinct count 10 - Null count 1115
);
CREATE TABLE awards_players
(
foreign key (playerID) references players (playerID) on update cascade on delete cascade,
year INTEGER not null, --
pos TEXT null, -- Example Values: `C`, `F`, `G`, `F/G`, `F/C` | Value Statics: Total count 833 - Distinct count 5 - Null count 886
primary key (playerID, year, award),
lgID TEXT null, -- Example Values: `NBA`, `ABA`, `NBL`, `ABL1` | Value Statics: Total count 1719 - Distinct count 4 - Null count 0
award TEXT not null, --
playerID TEXT not null, --
note TEXT null, -- Example Values: `tie` | Value Statics: Total count 37 - Distinct count 1 - Null count 1682
);
CREATE TABLE series_post
(
tmIDLoser TEXT, --
id INTEGER primary key autoincrement,
series TEXT, -- Example Values: `O`, `M`, `N`, `A`, `K` | Value Statics: Total count 775 - Distinct count 11 - Null count 0
tmIDWinner TEXT, --
round TEXT, -- Example Values: `F`, `QF`, `SF`, `DT`, `DF` | Value Statics: Total count 775 - Distinct count 11 - Null count 0
year INTEGER, --
foreign key (tmIDLoser, year) references teams (tmID, year) on update cascade on delete cascade,
foreign key (tmIDWinner, year) references teams (tmID, year) on update cascade on delete cascade,
W INTEGER, -- Example Values: `4`, `2`, `1`, `3`, `0` | Value Statics: Total count 775 - Distinct count 5 - Null count 0
lgIDLoser TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0
lgIDWinner TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0
L INTEGER, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 775 - Distinct count 5 - Null count 0
);
CREATE TABLE players
(
nameGiven TEXT null, -- Example Values: `nameGiven`, `Mort`, `Robert`, `Jim`, `Mike` | Value Statics: Total count 10 - Distinct count 9 - Null count 5052
lastseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15
hsCountry TEXT null, --
firstName TEXT null, --
hsCity TEXT null, --
firstseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15
weight INTEGER null, --
birthCountry TEXT null, --
race TEXT null, -- Example Values: `B`, `W`, `O`, `1`, `r` | Value Statics: Total count 4903 - Distinct count 5 - Null count 159
lastName TEXT null, --
birthDate DATE null, --
collegeOther TEXT null, --
birthState TEXT null, --
useFirst TEXT null, --
pos TEXT null, -- Example Values: `F-C`, `C`, `G`, `G-F`, `C-F` | Value Statics: Total count 4880 - Distinct count 14 - Null count 182
playerID TEXT not null primary key,
college TEXT null, --
highSchool TEXT null, --
hsState TEXT null, --
height REAL null, --
deathDate DATE null, --
nameSuffix TEXT null, -- Example Values: `Jr.`, `III`, `nameSuffix`, `II`, `IV` | Value Statics: Total count 324 - Distinct count 6 - Null count 4738
nameNick TEXT null, --
fullGivenName TEXT null, --
birthCity TEXT null, --
middleName TEXT null, --
);
CREATE TABLE teams
(
d_pts INTEGER null, --
name TEXT null, --
homeLost INTEGER null, --
o_ftm INTEGER null, --
franchID TEXT null, --
tmID TEXT not null, --
awayWon INTEGER null, --
primary key (year, tmID),
o_fgm INTEGER null, --
year INTEGER not null, --
awayLost INTEGER null, --
arena TEXT null, --
confID TEXT null, -- Example Values: `EC`, `WC` | Value Statics: Total count 1064 - Distinct count 2 - Null count 472
games INTEGER null, --
lost INTEGER null, --
divID TEXT null, -- Example Values: `EA`, `WE`, `ED`, `WD`, `SO` | Value Statics: Total count 1498 - Distinct count 13 - Null count 38
lgID TEXT null, -- Example Values: `NBL`, `NBA`, `PBLA`, `NPBL`, `ABL1` | Value Statics: Total count 1536 - Distinct count 6 - Null count 0
homeWon INTEGER null, --
confRank INTEGER null, -- Example Values: `0`, `4`, `3`, `5`, `7` | Value Statics: Total count 1536 - Distinct count 16 - Null count 0
o_pts INTEGER null, --
`rank` INTEGER null, -- Example Values: `1`, `2`, `4`, `5`, `6` | Value Statics: Total count 1536 - Distinct count 10 - Null count 0
playoff TEXT null, -- Example Values: `CF`, `WC`, `LC`, `CS`, `F` | Value Statics: Total count 901 - Distinct count 15 - Null count 635
won INTEGER null, --
);
CREATE TABLE coaches
(
primary key (coachID, year, tmID, stint),
lgID TEXT null, -- Example Values: `NBA`, `ABA`, `ABL1`, `PBLA`, `NPBL` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0
post_losses INTEGER null, -- Example Values: `3`, `9`, `7`, `8`, `0` | Value Statics: Total count 1649 - Distinct count 12 - Null count 40
year INTEGER not null, --
won INTEGER null, --
foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade,
post_wins INTEGER null, -- Example Values: `0`, `12`, `9`, `13`, `1` | Value Statics: Total count 1649 - Distinct count 17 - Null count 40
coachID TEXT not null, --
tmID TEXT not null, --
lost INTEGER null, --
stint INTEGER not null, -- Example Values: `2`, `1`, `4`, `5`, `3` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0
); |
superstore | Which order of Logitech G600 MMO Gaming Mouse has the highest total cost? | Logitech G600 MMO Gaming Mouse refers to "Product Name"; highest total cost refers to MAX(SUTRACT(MULTIPLY(DIVIDE(Sales, SUTRACT(1, discount)), Quantity), Profit)) | SELECT T1.`Order ID` FROM central_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T2.`Product Name` = 'Logitech G600 MMO Gaming Mouse' GROUP BY T1.`Order ID` ORDER BY SUM((T1.Sales / (1 - T1.Discount)) * T1.Quantity - T1.Profit) DESC LIMIT 1 | CREATE TABLE west_superstore
(
Profit REAL, --
Region TEXT, -- Example Values: `West` | Value Statics: Total count 6406 - Distinct count 1 - Null count 0
"Product ID" TEXT, --
foreign key ("Product ID", Region) references product("Product ID",Region),
"Order Date" DATE, --
foreign key ("Customer ID", Region) references people("Customer ID",Region),
"Ship Mode" TEXT, -- Example Values: `Second Class`, `Standard Class`, `First Class`, `Same Day` | Value Statics: Total count 6406 - Distinct count 4 - Null count 0
"Customer ID" TEXT, --
"Order ID" TEXT, --
"Row ID" INTEGER primary key,
Sales REAL, --
Quantity INTEGER, -- Example Values: `3`, `5`, `4`, `10`, `2` | Value Statics: Total count 6406 - Distinct count 14 - Null count 0
Discount REAL, -- Example Values: `0.0`, `0.15`, `0.2`, `0.7`, `0.5` | Value Statics: Total count 6406 - Distinct count 5 - Null count 0
"Ship Date" DATE, --
);
CREATE TABLE people
(
Region TEXT, -- Example Values: `Central`, `East`, `West`, `South` | Value Statics: Total count 2501 - Distinct count 4 - Null count 0
Country TEXT, -- Example Values: `United States` | Value Statics: Total count 2501 - Distinct count 1 - Null count 0
State TEXT, --
primary key ("Customer ID", Region),
City TEXT, --
Segment TEXT, -- Example Values: `Consumer`, `Home Office`, `Corporate` | Value Statics: Total count 2501 - Distinct count 3 - Null count 0
"Customer ID" TEXT, --
"Postal Code" INTEGER, --
"Customer Name" TEXT, --
);
CREATE TABLE product
(
"Product ID" TEXT, --
Region TEXT, -- Example Values: `Central`, `South`, `West`, `East` | Value Statics: Total count 5298 - Distinct count 4 - Null count 0
"Sub-Category" TEXT, -- Example Values: `Bookcases`, `Chairs`, `Furnishings`, `Tables`, `Appliances` | Value Statics: Total count 5298 - Distinct count 17 - Null count 0
Category TEXT, -- Example Values: `Furniture`, `Office Supplies`, `Technology` | Value Statics: Total count 5298 - Distinct count 3 - Null count 0
"Product Name" TEXT, --
primary key ("Product ID", Region),
);
CREATE TABLE central_superstore
(
"Ship Mode" TEXT, -- Example Values: `Standard Class`, `First Class`, `Second Class`, `Same Day` | Value Statics: Total count 4646 - Distinct count 4 - Null count 0
Quantity INTEGER, -- Example Values: `2`, `3`, `7`, `1`, `5` | Value Statics: Total count 4646 - Distinct count 14 - Null count 0
"Ship Date" DATE, --
"Order Date" DATE, --
"Order ID" TEXT, --
"Row ID" INTEGER primary key,
"Product ID" TEXT, --
foreign key ("Customer ID", Region) references people("Customer ID",Region),
Sales REAL, --
foreign key ("Product ID", Region) references product("Product ID",Region),
Profit REAL, --
"Customer ID" TEXT, --
Discount REAL, -- Example Values: `0.2`, `0.8`, `0.6`, `0.0`, `0.1` | Value Statics: Total count 4646 - Distinct count 9 - Null count 0
Region TEXT, -- Example Values: `Central` | Value Statics: Total count 4646 - Distinct count 1 - Null count 0
);
CREATE TABLE east_superstore
(
"Row ID" INTEGER primary key,
Region TEXT, -- Example Values: `East` | Value Statics: Total count 5696 - Distinct count 1 - Null count 0
"Order ID" TEXT, --
"Product ID" TEXT, --
Sales REAL, --
foreign key ("Product ID", Region) references product("Product ID",Region),
Discount REAL, -- Example Values: `0.2`, `0.0`, `0.7`, `0.5`, `0.4` | Value Statics: Total count 5696 - Distinct count 7 - Null count 0
Quantity INTEGER, -- Example Values: `3`, `2`, `7`, `4`, `6` | Value Statics: Total count 5696 - Distinct count 14 - Null count 0
Profit REAL, --
foreign key ("Customer ID", Region) references people("Customer ID",Region),
"Ship Mode" TEXT, -- Example Values: `Standard Class`, `First Class`, `Second Class`, `Same Day` | Value Statics: Total count 5696 - Distinct count 4 - Null count 0
"Customer ID" TEXT, --
"Order Date" DATE, --
"Ship Date" DATE, --
);
CREATE TABLE south_superstore
(
"Product ID" TEXT, --
Profit REAL, --
Sales REAL, --
"Order Date" DATE, --
"Customer ID" TEXT, --
Discount REAL, -- Example Values: `0.0`, `0.7`, `0.2`, `0.5`, `0.45` | Value Statics: Total count 3240 - Distinct count 6 - Null count 0
Region TEXT, -- Example Values: `South` | Value Statics: Total count 3240 - Distinct count 1 - Null count 0
"Ship Date" DATE, --
foreign key ("Product ID", Region) references product("Product ID",Region),
foreign key ("Customer ID", Region) references people("Customer ID",Region),
Quantity INTEGER, -- Example Values: `3`, `9`, `2`, `4`, `1` | Value Statics: Total count 3240 - Distinct count 14 - Null count 0
"Order ID" TEXT, --
"Row ID" INTEGER primary key,
"Ship Mode" TEXT, -- Example Values: `First Class`, `Standard Class`, `Second Class`, `Same Day` | Value Statics: Total count 3240 - Distinct count 4 - Null count 0
); |
software_company | Among the customers from a place with more than 20,000 and less than 30,000 inhabitants, how many of them are Machine-op-inspcts? | place with more than 20,000 and less than 30,000 inhabitants refers to GEOID where INHABITANTS_K BETWEEN 20 AND 30; OCCUPATION = 'Machine-op-inspct'; | SELECT COUNT(T1.GEOID) FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.OCCUPATION = 'Machine-op-inspct' AND T2.INHABITANTS_K > 20 AND T2.INHABITANTS_K < 30 | CREATE TABLE Customers
(
EDUCATIONNUM INTEGER, -- Example Values: `7`, `3`, `4`, `11`, `5` | Value Statics: Total count 100000 - Distinct count 17 - Null count 0
MARITAL_STATUS TEXT, -- Example Values: `Never-married`, `Married-civ-spouse`, `Divorced`, `Widowed`, `Other` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
ID INTEGER constraint Customers_pk primary key,
SEX TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
OCCUPATION TEXT, -- Example Values: `Machine-op-inspct`, `Handlers-cleaners`, `Exec-managerial`, `Farming-fishing`, `Other-service` | Value Statics: Total count 100000 - Distinct count 8 - Null count 0
age INTEGER, --
GEOID INTEGER constraint Customers_Demog_GEOID_fk references Demog, --
);
CREATE TABLE Mailings1_2
(
RESPONSE TEXT, -- Example Values: `false`, `true` | Value Statics: Total count 60000 - Distinct count 2 - Null count 0
REFID INTEGER constraint Mailings1_2_pk primary key constraint Mailings1_2_Customers_ID_fk references Customers,
REF_DATE DATETIME, -- Example Values: `2007-02-01 12:00:00.0`, `2007-03-01 12:00:00.0` | Value Statics: Total count 60000 - Distinct count 2 - Null count 0
);
CREATE TABLE Sales
(
REFID INTEGER references Customers, --
EVENT_DATE DATETIME, --
AMOUNT REAL, --
EVENTID INTEGER constraint Sales_pk primary key,
);
CREATE TABLE Demog
(
A_VAR1 REAL, --
A_VAR2 REAL, --
A_VAR14 REAL, --
A_VAR8 REAL, --
A_VAR12 REAL, --
A_VAR6 REAL, --
A_VAR17 REAL, --
A_VAR15 REAL, --
A_VAR10 REAL, --
A_VAR16 REAL, --
INHABITANTS_K REAL, --
A_VAR3 REAL, --
A_VAR7 REAL, --
A_VAR4 REAL, --
A_VAR5 REAL, --
A_VAR13 REAL, --
A_VAR9 REAL, --
INCOME_K REAL, --
GEOID INTEGER constraint Demog_pk primary key,
A_VAR18 REAL, --
A_VAR11 REAL, --
);
CREATE TABLE mailings3
(
RESPONSE TEXT, -- Example Values: `false`, `true` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
REF_DATE DATETIME, -- Example Values: `2007-07-01 12:00:00.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
REFID INTEGER constraint mailings3_pk primary key,
); |
retail_world | How many employees report to Andrew Fuller? | "Andrew Fuller" refers to FirstName = 'Andrew' AND LastName = 'Fuller'; report to refers to ReportsTo ! = NULL | SELECT COUNT(EmployeeID) FROM Employees WHERE ReportsTo = ( SELECT EmployeeID FROM Employees WHERE LastName = 'Fuller' AND FirstName = 'Andrew' ) | CREATE TABLE Products
(
CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0
Unit TEXT, --
ReorderLevel INT, --
ProductName TEXT, --
Price REAL DEFAULT 0, --
FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),
SupplierID INTEGER, --
ProductID INTEGER PRIMARY KEY AUTOINCREMENT,
FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID),
);
CREATE TABLE Customers
(
ContactName TEXT, --
Country TEXT, --
Address TEXT, --
City TEXT, --
CustomerID INTEGER PRIMARY KEY AUTOINCREMENT,
PostalCode TEXT, --
CustomerName TEXT, --
);
CREATE TABLE EmployeeTerritories
(
TerritoryID INT, --
EmployeeID INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE OrderDetails
(
Quantity INTEGER, --
FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),
OrderID INTEGER, --
FOREIGN KEY (ProductID) REFERENCES Products (ProductID),
OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT,
ProductID INTEGER, --
);
CREATE TABLE Shippers
(
ShipperID INTEGER PRIMARY KEY AUTOINCREMENT,
ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
);
CREATE TABLE Territory
(
TerritoryDescription TEXT, --
RegionID INTEGER, --
TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT,
);
CREATE TABLE EmployeeDetails
(
EmployeeID INT PRIMARY KEY,
Title TEXT, --
Salary INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE Categories
(
CategoryID INTEGER PRIMARY KEY AUTOINCREMENT,
CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
);
CREATE TABLE Employees
(
Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT,
FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
);
CREATE TABLE Suppliers
(
PostalCode TEXT, --
Address TEXT, --
SupplierID INTEGER PRIMARY KEY AUTOINCREMENT,
City TEXT, --
Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0
Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0
ContactName TEXT, --
Phone TEXT, --
SupplierName TEXT, --
);
CREATE TABLE EmployeesExtra
(
Salary INTEGER, --
Title TEXT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
EmployeeID INTEGER PRIMARY KEY,
);
CREATE TABLE discontinued_products
(
Discontinued INTEGER, --
ProductID INTEGER PRIMARY KEY,
);
CREATE TABLE Orders
(
OrderID INTEGER PRIMARY KEY AUTOINCREMENT,
CustomerID INTEGER, --
FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),
FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID),
FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),
ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0
OrderDate DATETIME, --
EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0
);
CREATE TABLE Territories
(
TerritoryDescription TEXT, --
RegionDescription TEXT, --
);
CREATE TABLE ShippingInfo
(
ShipCountry TEXT, --
ShippedDate DATETIME, --
FOREIGN KEY (OrderID) REFERENCES Orders(OrderID),
OrderID INTEGER PRIMARY KEY,
); |
professional_basketball | What is the first and last name of the player with the highest field goal made rate in 1973? | in 1973 refers to year = 1973; player with highest field goal made refers to Max(Divide(fgMade, fgAttempted)) | SELECT T1.firstName, T1.lastName FROM players AS T1 INNER JOIN players_teams AS T2 ON T1.playerID = T2.playerID WHERE year = 1973 ORDER BY CAST(T2.fgMade AS REAL) / T2.fgAttempted DESC LIMIT 1 | CREATE TABLE players_teams
(
PostGS INTEGER, --
PostdRebounds INTEGER, --
PostPF INTEGER, --
tmID TEXT, --
threeAttempted INTEGER, --
PostRebounds INTEGER, --
assists INTEGER, --
threeMade INTEGER, --
PostBlocks INTEGER, --
PostTurnovers INTEGER, --
GP INTEGER, --
lgID TEXT, -- Example Values: `NBA`, `NBL`, `ABA`, `ABL1`, `NPBL` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0
foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade,
PostfgMade INTEGER, --
steals INTEGER, --
oRebounds INTEGER, --
PostftAttempted INTEGER, --
ftAttempted INTEGER, --
ftMade INTEGER, --
points INTEGER, --
PostfgAttempted INTEGER, --
PostftMade INTEGER, --
note TEXT, -- Example Values: `C` | Value Statics: Total count 43 - Distinct count 1 - Null count 23708
dRebounds INTEGER, --
PostSteals INTEGER, --
blocks INTEGER, --
PostAssists INTEGER, --
minutes INTEGER, --
fgAttempted INTEGER, --
playerID TEXT not null references players on update cascade on delete cascade, --
PostthreeMade INTEGER, --
PostPoints INTEGER, --
year INTEGER, --
PF INTEGER, --
fgMade INTEGER, --
PostthreeAttempted INTEGER, --
rebounds INTEGER, --
id INTEGER primary key autoincrement,
stint INTEGER, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0
PostMinutes INTEGER, --
PostGP INTEGER, --
turnovers INTEGER, --
PostoRebounds INTEGER, --
GS INTEGER, --
);
CREATE TABLE awards_coaches
(
award TEXT, -- Example Values: `NBA Coach of the Year`, `ABA Coach of the Year` | Value Statics: Total count 61 - Distinct count 2 - Null count 0
id INTEGER primary key autoincrement,
note TEXT, -- Example Values: `tie` | Value Statics: Total count 4 - Distinct count 1 - Null count 57
coachID TEXT, --
lgID TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 61 - Distinct count 2 - Null count 0
foreign key (coachID, year) references coaches (coachID, year) on update cascade on delete cascade,
year INTEGER, --
);
CREATE TABLE draft
(
draftOverall INTEGER null, --
lgID TEXT null, -- Example Values: `ABA`, `NBA` | Value Statics: Total count 8621 - Distinct count 2 - Null count 0
suffixName TEXT null, -- Example Values: `Jr.` | Value Statics: Total count 2 - Distinct count 1 - Null count 8619
draftYear INTEGER null, --
draftSelection INTEGER null, --
tmID TEXT null, --
draftRound INTEGER null, --
lastName TEXT null, --
playerID TEXT null, --
draftFrom TEXT null, --
id INTEGER default 0 not null primary key,
firstName TEXT null, --
foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade,
foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade,
);
CREATE TABLE player_allstar
(
rebounds INTEGER null, --
playerID TEXT not null, --
season_id INTEGER not null, --
assists INTEGER null, --
conference TEXT null, -- Example Values: `East`, `West`, `Weset`, `Allstars`, `Denver` | Value Statics: Total count 1608 - Distinct count 5 - Null count 0
points INTEGER null, --
personal_fouls INTEGER null, -- Example Values: `3`, `2`, `0`, `1`, `5` | Value Statics: Total count 540 - Distinct count 8 - Null count 1068
ft_attempted INTEGER null, -- Example Values: `2`, `4`, `0`, `6`, `3` | Value Statics: Total count 1561 - Distinct count 17 - Null count 47
fg_attempted INTEGER null, --
league_id TEXT null, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 1608 - Distinct count 2 - Null count 0
foreign key (playerID) references players (playerID) on update cascade on delete cascade,
fg_made INTEGER null, -- Example Values: `4`, `8`, `5`, `7`, `3` | Value Statics: Total count 1561 - Distinct count 18 - Null count 47
ft_made INTEGER null, -- Example Values: `2`, `3`, `0`, `1`, `4` | Value Statics: Total count 1561 - Distinct count 13 - Null count 47
steals INTEGER null, -- Example Values: `3`, `0`, `1`, `2`, `5` | Value Statics: Total count 398 - Distinct count 7 - Null count 1210
games_played INTEGER null, -- Example Values: `1` | Value Statics: Total count 1608 - Distinct count 1 - Null count 0
first_name TEXT null, --
d_rebounds INTEGER null, -- Example Values: `2`, `5`, `0`, `1`, `4` | Value Statics: Total count 493 - Distinct count 14 - Null count 1115
last_name TEXT null, --
primary key (playerID, season_id),
turnovers INTEGER null, -- Example Values: `1`, `0`, `3`, `2`, `4` | Value Statics: Total count 493 - Distinct count 9 - Null count 1115
three_made INTEGER null, -- Example Values: `0`, `1`, `3`, `5`, `4` | Value Statics: Total count 566 - Distinct count 7 - Null count 1042
minutes INTEGER null, --
blocks INTEGER null, -- Example Values: `2`, `0`, `1`, `3`, `5` | Value Statics: Total count 398 - Distinct count 6 - Null count 1210
three_attempted INTEGER null, -- Example Values: `0`, `1`, `6`, `7`, `10` | Value Statics: Total count 540 - Distinct count 12 - Null count 1068
o_rebounds INTEGER null, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 493 - Distinct count 10 - Null count 1115
);
CREATE TABLE awards_players
(
foreign key (playerID) references players (playerID) on update cascade on delete cascade,
year INTEGER not null, --
pos TEXT null, -- Example Values: `C`, `F`, `G`, `F/G`, `F/C` | Value Statics: Total count 833 - Distinct count 5 - Null count 886
primary key (playerID, year, award),
lgID TEXT null, -- Example Values: `NBA`, `ABA`, `NBL`, `ABL1` | Value Statics: Total count 1719 - Distinct count 4 - Null count 0
award TEXT not null, --
playerID TEXT not null, --
note TEXT null, -- Example Values: `tie` | Value Statics: Total count 37 - Distinct count 1 - Null count 1682
);
CREATE TABLE series_post
(
tmIDLoser TEXT, --
id INTEGER primary key autoincrement,
series TEXT, -- Example Values: `O`, `M`, `N`, `A`, `K` | Value Statics: Total count 775 - Distinct count 11 - Null count 0
tmIDWinner TEXT, --
round TEXT, -- Example Values: `F`, `QF`, `SF`, `DT`, `DF` | Value Statics: Total count 775 - Distinct count 11 - Null count 0
year INTEGER, --
foreign key (tmIDLoser, year) references teams (tmID, year) on update cascade on delete cascade,
foreign key (tmIDWinner, year) references teams (tmID, year) on update cascade on delete cascade,
W INTEGER, -- Example Values: `4`, `2`, `1`, `3`, `0` | Value Statics: Total count 775 - Distinct count 5 - Null count 0
lgIDLoser TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0
lgIDWinner TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0
L INTEGER, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 775 - Distinct count 5 - Null count 0
);
CREATE TABLE players
(
nameGiven TEXT null, -- Example Values: `nameGiven`, `Mort`, `Robert`, `Jim`, `Mike` | Value Statics: Total count 10 - Distinct count 9 - Null count 5052
lastseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15
hsCountry TEXT null, --
firstName TEXT null, --
hsCity TEXT null, --
firstseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15
weight INTEGER null, --
birthCountry TEXT null, --
race TEXT null, -- Example Values: `B`, `W`, `O`, `1`, `r` | Value Statics: Total count 4903 - Distinct count 5 - Null count 159
lastName TEXT null, --
birthDate DATE null, --
collegeOther TEXT null, --
birthState TEXT null, --
useFirst TEXT null, --
pos TEXT null, -- Example Values: `F-C`, `C`, `G`, `G-F`, `C-F` | Value Statics: Total count 4880 - Distinct count 14 - Null count 182
playerID TEXT not null primary key,
college TEXT null, --
highSchool TEXT null, --
hsState TEXT null, --
height REAL null, --
deathDate DATE null, --
nameSuffix TEXT null, -- Example Values: `Jr.`, `III`, `nameSuffix`, `II`, `IV` | Value Statics: Total count 324 - Distinct count 6 - Null count 4738
nameNick TEXT null, --
fullGivenName TEXT null, --
birthCity TEXT null, --
middleName TEXT null, --
);
CREATE TABLE teams
(
d_pts INTEGER null, --
name TEXT null, --
homeLost INTEGER null, --
o_ftm INTEGER null, --
franchID TEXT null, --
tmID TEXT not null, --
awayWon INTEGER null, --
primary key (year, tmID),
o_fgm INTEGER null, --
year INTEGER not null, --
awayLost INTEGER null, --
arena TEXT null, --
confID TEXT null, -- Example Values: `EC`, `WC` | Value Statics: Total count 1064 - Distinct count 2 - Null count 472
games INTEGER null, --
lost INTEGER null, --
divID TEXT null, -- Example Values: `EA`, `WE`, `ED`, `WD`, `SO` | Value Statics: Total count 1498 - Distinct count 13 - Null count 38
lgID TEXT null, -- Example Values: `NBL`, `NBA`, `PBLA`, `NPBL`, `ABL1` | Value Statics: Total count 1536 - Distinct count 6 - Null count 0
homeWon INTEGER null, --
confRank INTEGER null, -- Example Values: `0`, `4`, `3`, `5`, `7` | Value Statics: Total count 1536 - Distinct count 16 - Null count 0
o_pts INTEGER null, --
`rank` INTEGER null, -- Example Values: `1`, `2`, `4`, `5`, `6` | Value Statics: Total count 1536 - Distinct count 10 - Null count 0
playoff TEXT null, -- Example Values: `CF`, `WC`, `LC`, `CS`, `F` | Value Statics: Total count 901 - Distinct count 15 - Null count 635
won INTEGER null, --
);
CREATE TABLE coaches
(
primary key (coachID, year, tmID, stint),
lgID TEXT null, -- Example Values: `NBA`, `ABA`, `ABL1`, `PBLA`, `NPBL` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0
post_losses INTEGER null, -- Example Values: `3`, `9`, `7`, `8`, `0` | Value Statics: Total count 1649 - Distinct count 12 - Null count 40
year INTEGER not null, --
won INTEGER null, --
foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade,
post_wins INTEGER null, -- Example Values: `0`, `12`, `9`, `13`, `1` | Value Statics: Total count 1649 - Distinct count 17 - Null count 40
coachID TEXT not null, --
tmID TEXT not null, --
lost INTEGER null, --
stint INTEGER not null, -- Example Values: `2`, `1`, `4`, `5`, `3` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0
); |
synthea | What is the id of the patient whose hypertension started most recently? | id of the patient refers to PATIENT from conditions; hypertension refers to DESCRIPTION = 'Hypertension'; most recently refers to MAX(START); | SELECT PATIENT FROM conditions WHERE START = ( SELECT MAX(START) FROM conditions WHERE DESCRIPTION = 'Hypertension' ) | CREATE TABLE immunizations
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
DATE DATE, --
primary key (DATE, PATIENT, ENCOUNTER, CODE),
DESCRIPTION TEXT, -- Example Values: `Influenza seasonal injectable preservative free`, `Td (adult) preservative free`, `meningococcal MCV4P`, `Tdap`, `HPV quadrivalent` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
);
CREATE TABLE allergies
(
CODE INTEGER, -- Example Values: `232347008`, `300916003`, `419474003`, `424213003`, `300913006` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
foreign key (ENCOUNTER) references encounters(ID),
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
primary key (PATIENT, ENCOUNTER, CODE),
STOP TEXT, -- Example Values: `12/22/14`, `4/21/10`, `10/15/11`, `3/17/10`, `5/26/08` | Value Statics: Total count 16 - Distinct count 11 - Null count 556
START TEXT, --
DESCRIPTION TEXT, -- Example Values: `Allergy to dairy product`, `Allergy to tree pollen`, `Allergy to grass pollen`, `Dander (animal) allergy`, `House dust mite allergy` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
);
CREATE TABLE observations
(
DATE DATE, --
ENCOUNTER TEXT, --
VALUE REAL, --
UNITS TEXT, -- Example Values: `cm`, `kg`, `kg/m2`, `mmHg`, `Cel` | Value Statics: Total count 78444 - Distinct count 17 - Null count 455
DESCRIPTION TEXT, --
CODE TEXT, --
PATIENT TEXT, --
foreign key (PATIENT) references patients(patient),
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE medications
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, --
PATIENT TEXT, --
STOP DATE, --
START DATE, --
REASONDESCRIPTION TEXT, --
DESCRIPTION TEXT, --
primary key (START, PATIENT, ENCOUNTER, CODE),
foreign key (PATIENT) references patients(patient),
REASONCODE INTEGER, --
ENCOUNTER TEXT, --
);
CREATE TABLE careplans
(
START DATE, --
STOP DATE, --
ID TEXT, --
REASONCODE INTEGER, --
REASONDESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
DESCRIPTION TEXT, --
CODE REAL, --
ENCOUNTER TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE encounters
(
DATE DATE, --
REASONCODE INTEGER, --
CODE INTEGER, --
ID TEXT primary key,
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
REASONDESCRIPTION TEXT, --
);
CREATE TABLE procedures
(
foreign key (PATIENT) references patients(patient),
REASONDESCRIPTION TEXT, --
PATIENT TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
DATE DATE, --
DESCRIPTION TEXT, --
ENCOUNTER TEXT, --
CODE INTEGER, --
REASONCODE INTEGER, --
);
CREATE TABLE patients
(
suffix TEXT, -- Example Values: `PhD`, `JD`, `MD` | Value Statics: Total count 45 - Distinct count 3 - Null count 1417
prefix TEXT, -- Example Values: `Mr.`, `Mrs.`, `Ms.` | Value Statics: Total count 1166 - Distinct count 3 - Null count 296
deathdate DATE, --
ethnicity TEXT, --
race TEXT, -- Example Values: `black`, `white`, `hispanic`, `asian` | Value Statics: Total count 1462 - Distinct count 4 - Null count 0
address TEXT, --
birthplace TEXT, --
passport TEXT, --
maiden TEXT, --
birthdate DATE, --
marital TEXT, -- Example Values: `S`, `M` | Value Statics: Total count 1033 - Distinct count 2 - Null count 429
gender TEXT, -- Example Values: `F`, `M` | Value Statics: Total count 1462 - Distinct count 2 - Null count 0
drivers TEXT, --
first TEXT, --
last TEXT, --
patient TEXT primary key,
ssn TEXT, --
);
CREATE TABLE claims
(
ENCOUNTER TEXT references encounters, --
PATIENT TEXT references patients, --
ORGANIZATION TEXT, -- Example Values: `temp organization` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
TOTAL INTEGER, -- Example Values: `100` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
BILLABLEPERIOD DATE, --
DIAGNOSIS TEXT, --
ID TEXT primary key,
);
CREATE TABLE conditions
(
START DATE, --
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
CODE INTEGER, --
ENCOUNTER TEXT, --
STOP DATE, --
foreign key (ENCOUNTER) references encounters(ID),
foreign key (DESCRIPTION) references all_prevalences(ITEM),
);
CREATE TABLE all_prevalences
(
"POPULATION TYPE" TEXT, -- Example Values: `LIVING` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
"POPULATION COUNT" INTEGER, -- Example Values: `1000` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
ITEM TEXT primary key,
"PREVALENCE PERCENTAGE" REAL, --
"PREVALENCE RATE" REAL, --
OCCURRENCES INTEGER, --
); |
software_company | How many customers are from the place with the highest average income per month? | place with the highest average income per month refers to GEOID where MAX(INCOME_K); | SELECT COUNT(T1.ID) FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID ORDER BY T2.INCOME_K DESC LIMIT 1 | CREATE TABLE Customers
(
EDUCATIONNUM INTEGER, -- Example Values: `7`, `3`, `4`, `11`, `5` | Value Statics: Total count 100000 - Distinct count 17 - Null count 0
MARITAL_STATUS TEXT, -- Example Values: `Never-married`, `Married-civ-spouse`, `Divorced`, `Widowed`, `Other` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
ID INTEGER constraint Customers_pk primary key,
SEX TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
OCCUPATION TEXT, -- Example Values: `Machine-op-inspct`, `Handlers-cleaners`, `Exec-managerial`, `Farming-fishing`, `Other-service` | Value Statics: Total count 100000 - Distinct count 8 - Null count 0
age INTEGER, --
GEOID INTEGER constraint Customers_Demog_GEOID_fk references Demog, --
);
CREATE TABLE Mailings1_2
(
RESPONSE TEXT, -- Example Values: `false`, `true` | Value Statics: Total count 60000 - Distinct count 2 - Null count 0
REFID INTEGER constraint Mailings1_2_pk primary key constraint Mailings1_2_Customers_ID_fk references Customers,
REF_DATE DATETIME, -- Example Values: `2007-02-01 12:00:00.0`, `2007-03-01 12:00:00.0` | Value Statics: Total count 60000 - Distinct count 2 - Null count 0
);
CREATE TABLE Sales
(
REFID INTEGER references Customers, --
EVENT_DATE DATETIME, --
AMOUNT REAL, --
EVENTID INTEGER constraint Sales_pk primary key,
);
CREATE TABLE Demog
(
A_VAR1 REAL, --
A_VAR2 REAL, --
A_VAR14 REAL, --
A_VAR8 REAL, --
A_VAR12 REAL, --
A_VAR6 REAL, --
A_VAR17 REAL, --
A_VAR15 REAL, --
A_VAR10 REAL, --
A_VAR16 REAL, --
INHABITANTS_K REAL, --
A_VAR3 REAL, --
A_VAR7 REAL, --
A_VAR4 REAL, --
A_VAR5 REAL, --
A_VAR13 REAL, --
A_VAR9 REAL, --
INCOME_K REAL, --
GEOID INTEGER constraint Demog_pk primary key,
A_VAR18 REAL, --
A_VAR11 REAL, --
);
CREATE TABLE mailings3
(
RESPONSE TEXT, -- Example Values: `false`, `true` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
REF_DATE DATETIME, -- Example Values: `2007-07-01 12:00:00.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
REFID INTEGER constraint mailings3_pk primary key,
); |
retail_world | In which year did Around the Horn place the most orders? | Around the Horn is the CompanyName; year with the most order refers to Year (OrderDate) where Max(Count(OrderID)) | SELECT STRFTIME('%Y', T2.OrderDate) FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.CompanyName = 'Around the Horn' GROUP BY STRFTIME('%Y', T2.OrderDate) ORDER BY COUNT(T2.OrderID) DESC LIMIT 1 | CREATE TABLE Products
(
CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0
Unit TEXT, --
ReorderLevel INT, --
ProductName TEXT, --
Price REAL DEFAULT 0, --
FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),
SupplierID INTEGER, --
ProductID INTEGER PRIMARY KEY AUTOINCREMENT,
FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID),
);
CREATE TABLE Customers
(
ContactName TEXT, --
Country TEXT, --
Address TEXT, --
City TEXT, --
CustomerID INTEGER PRIMARY KEY AUTOINCREMENT,
PostalCode TEXT, --
CustomerName TEXT, --
);
CREATE TABLE EmployeeTerritories
(
TerritoryID INT, --
EmployeeID INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE OrderDetails
(
Quantity INTEGER, --
FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),
OrderID INTEGER, --
FOREIGN KEY (ProductID) REFERENCES Products (ProductID),
OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT,
ProductID INTEGER, --
);
CREATE TABLE Shippers
(
ShipperID INTEGER PRIMARY KEY AUTOINCREMENT,
ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
);
CREATE TABLE Territory
(
TerritoryDescription TEXT, --
RegionID INTEGER, --
TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT,
);
CREATE TABLE EmployeeDetails
(
EmployeeID INT PRIMARY KEY,
Title TEXT, --
Salary INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE Categories
(
CategoryID INTEGER PRIMARY KEY AUTOINCREMENT,
CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
);
CREATE TABLE Employees
(
Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT,
FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
);
CREATE TABLE Suppliers
(
PostalCode TEXT, --
Address TEXT, --
SupplierID INTEGER PRIMARY KEY AUTOINCREMENT,
City TEXT, --
Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0
Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0
ContactName TEXT, --
Phone TEXT, --
SupplierName TEXT, --
);
CREATE TABLE EmployeesExtra
(
Salary INTEGER, --
Title TEXT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
EmployeeID INTEGER PRIMARY KEY,
);
CREATE TABLE discontinued_products
(
Discontinued INTEGER, --
ProductID INTEGER PRIMARY KEY,
);
CREATE TABLE Orders
(
OrderID INTEGER PRIMARY KEY AUTOINCREMENT,
CustomerID INTEGER, --
FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),
FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID),
FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),
ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0
OrderDate DATETIME, --
EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0
);
CREATE TABLE Territories
(
TerritoryDescription TEXT, --
RegionDescription TEXT, --
);
CREATE TABLE ShippingInfo
(
ShipCountry TEXT, --
ShippedDate DATETIME, --
FOREIGN KEY (OrderID) REFERENCES Orders(OrderID),
OrderID INTEGER PRIMARY KEY,
); |
superstore | What are the names of the products with a profit of no less than 1,000 in one single order? | profit of no less than 1,000 refers to Profit > = 1000; names of the products refers to "Product Name" | SELECT DISTINCT T2.`Product Name` FROM west_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T1.Profit > 1000 | CREATE TABLE west_superstore
(
Profit REAL, --
Region TEXT, -- Example Values: `West` | Value Statics: Total count 6406 - Distinct count 1 - Null count 0
"Product ID" TEXT, --
foreign key ("Product ID", Region) references product("Product ID",Region),
"Order Date" DATE, --
foreign key ("Customer ID", Region) references people("Customer ID",Region),
"Ship Mode" TEXT, -- Example Values: `Second Class`, `Standard Class`, `First Class`, `Same Day` | Value Statics: Total count 6406 - Distinct count 4 - Null count 0
"Customer ID" TEXT, --
"Order ID" TEXT, --
"Row ID" INTEGER primary key,
Sales REAL, --
Quantity INTEGER, -- Example Values: `3`, `5`, `4`, `10`, `2` | Value Statics: Total count 6406 - Distinct count 14 - Null count 0
Discount REAL, -- Example Values: `0.0`, `0.15`, `0.2`, `0.7`, `0.5` | Value Statics: Total count 6406 - Distinct count 5 - Null count 0
"Ship Date" DATE, --
);
CREATE TABLE people
(
Region TEXT, -- Example Values: `Central`, `East`, `West`, `South` | Value Statics: Total count 2501 - Distinct count 4 - Null count 0
Country TEXT, -- Example Values: `United States` | Value Statics: Total count 2501 - Distinct count 1 - Null count 0
State TEXT, --
primary key ("Customer ID", Region),
City TEXT, --
Segment TEXT, -- Example Values: `Consumer`, `Home Office`, `Corporate` | Value Statics: Total count 2501 - Distinct count 3 - Null count 0
"Customer ID" TEXT, --
"Postal Code" INTEGER, --
"Customer Name" TEXT, --
);
CREATE TABLE product
(
"Product ID" TEXT, --
Region TEXT, -- Example Values: `Central`, `South`, `West`, `East` | Value Statics: Total count 5298 - Distinct count 4 - Null count 0
"Sub-Category" TEXT, -- Example Values: `Bookcases`, `Chairs`, `Furnishings`, `Tables`, `Appliances` | Value Statics: Total count 5298 - Distinct count 17 - Null count 0
Category TEXT, -- Example Values: `Furniture`, `Office Supplies`, `Technology` | Value Statics: Total count 5298 - Distinct count 3 - Null count 0
"Product Name" TEXT, --
primary key ("Product ID", Region),
);
CREATE TABLE central_superstore
(
"Ship Mode" TEXT, -- Example Values: `Standard Class`, `First Class`, `Second Class`, `Same Day` | Value Statics: Total count 4646 - Distinct count 4 - Null count 0
Quantity INTEGER, -- Example Values: `2`, `3`, `7`, `1`, `5` | Value Statics: Total count 4646 - Distinct count 14 - Null count 0
"Ship Date" DATE, --
"Order Date" DATE, --
"Order ID" TEXT, --
"Row ID" INTEGER primary key,
"Product ID" TEXT, --
foreign key ("Customer ID", Region) references people("Customer ID",Region),
Sales REAL, --
foreign key ("Product ID", Region) references product("Product ID",Region),
Profit REAL, --
"Customer ID" TEXT, --
Discount REAL, -- Example Values: `0.2`, `0.8`, `0.6`, `0.0`, `0.1` | Value Statics: Total count 4646 - Distinct count 9 - Null count 0
Region TEXT, -- Example Values: `Central` | Value Statics: Total count 4646 - Distinct count 1 - Null count 0
);
CREATE TABLE east_superstore
(
"Row ID" INTEGER primary key,
Region TEXT, -- Example Values: `East` | Value Statics: Total count 5696 - Distinct count 1 - Null count 0
"Order ID" TEXT, --
"Product ID" TEXT, --
Sales REAL, --
foreign key ("Product ID", Region) references product("Product ID",Region),
Discount REAL, -- Example Values: `0.2`, `0.0`, `0.7`, `0.5`, `0.4` | Value Statics: Total count 5696 - Distinct count 7 - Null count 0
Quantity INTEGER, -- Example Values: `3`, `2`, `7`, `4`, `6` | Value Statics: Total count 5696 - Distinct count 14 - Null count 0
Profit REAL, --
foreign key ("Customer ID", Region) references people("Customer ID",Region),
"Ship Mode" TEXT, -- Example Values: `Standard Class`, `First Class`, `Second Class`, `Same Day` | Value Statics: Total count 5696 - Distinct count 4 - Null count 0
"Customer ID" TEXT, --
"Order Date" DATE, --
"Ship Date" DATE, --
);
CREATE TABLE south_superstore
(
"Product ID" TEXT, --
Profit REAL, --
Sales REAL, --
"Order Date" DATE, --
"Customer ID" TEXT, --
Discount REAL, -- Example Values: `0.0`, `0.7`, `0.2`, `0.5`, `0.45` | Value Statics: Total count 3240 - Distinct count 6 - Null count 0
Region TEXT, -- Example Values: `South` | Value Statics: Total count 3240 - Distinct count 1 - Null count 0
"Ship Date" DATE, --
foreign key ("Product ID", Region) references product("Product ID",Region),
foreign key ("Customer ID", Region) references people("Customer ID",Region),
Quantity INTEGER, -- Example Values: `3`, `9`, `2`, `4`, `1` | Value Statics: Total count 3240 - Distinct count 14 - Null count 0
"Order ID" TEXT, --
"Row ID" INTEGER primary key,
"Ship Mode" TEXT, -- Example Values: `First Class`, `Standard Class`, `Second Class`, `Same Day` | Value Statics: Total count 3240 - Distinct count 4 - Null count 0
); |
synthea | How many of the patients born in 1920s had pneumonia? | patients born in 1920s refer to patient where birthdate like '192%'; pneumonia refers to DESCRIPTION = 'Pneumonia' from conditions; | SELECT COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE DESCRIPTION = 'Pneumonia' AND strftime('%Y', T1.birthdate) LIKE '192%' | CREATE TABLE immunizations
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
DATE DATE, --
primary key (DATE, PATIENT, ENCOUNTER, CODE),
DESCRIPTION TEXT, -- Example Values: `Influenza seasonal injectable preservative free`, `Td (adult) preservative free`, `meningococcal MCV4P`, `Tdap`, `HPV quadrivalent` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
);
CREATE TABLE allergies
(
CODE INTEGER, -- Example Values: `232347008`, `300916003`, `419474003`, `424213003`, `300913006` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
foreign key (ENCOUNTER) references encounters(ID),
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
primary key (PATIENT, ENCOUNTER, CODE),
STOP TEXT, -- Example Values: `12/22/14`, `4/21/10`, `10/15/11`, `3/17/10`, `5/26/08` | Value Statics: Total count 16 - Distinct count 11 - Null count 556
START TEXT, --
DESCRIPTION TEXT, -- Example Values: `Allergy to dairy product`, `Allergy to tree pollen`, `Allergy to grass pollen`, `Dander (animal) allergy`, `House dust mite allergy` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
);
CREATE TABLE observations
(
DATE DATE, --
ENCOUNTER TEXT, --
VALUE REAL, --
UNITS TEXT, -- Example Values: `cm`, `kg`, `kg/m2`, `mmHg`, `Cel` | Value Statics: Total count 78444 - Distinct count 17 - Null count 455
DESCRIPTION TEXT, --
CODE TEXT, --
PATIENT TEXT, --
foreign key (PATIENT) references patients(patient),
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE medications
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, --
PATIENT TEXT, --
STOP DATE, --
START DATE, --
REASONDESCRIPTION TEXT, --
DESCRIPTION TEXT, --
primary key (START, PATIENT, ENCOUNTER, CODE),
foreign key (PATIENT) references patients(patient),
REASONCODE INTEGER, --
ENCOUNTER TEXT, --
);
CREATE TABLE careplans
(
START DATE, --
STOP DATE, --
ID TEXT, --
REASONCODE INTEGER, --
REASONDESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
DESCRIPTION TEXT, --
CODE REAL, --
ENCOUNTER TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE encounters
(
DATE DATE, --
REASONCODE INTEGER, --
CODE INTEGER, --
ID TEXT primary key,
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
REASONDESCRIPTION TEXT, --
);
CREATE TABLE procedures
(
foreign key (PATIENT) references patients(patient),
REASONDESCRIPTION TEXT, --
PATIENT TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
DATE DATE, --
DESCRIPTION TEXT, --
ENCOUNTER TEXT, --
CODE INTEGER, --
REASONCODE INTEGER, --
);
CREATE TABLE patients
(
suffix TEXT, -- Example Values: `PhD`, `JD`, `MD` | Value Statics: Total count 45 - Distinct count 3 - Null count 1417
prefix TEXT, -- Example Values: `Mr.`, `Mrs.`, `Ms.` | Value Statics: Total count 1166 - Distinct count 3 - Null count 296
deathdate DATE, --
ethnicity TEXT, --
race TEXT, -- Example Values: `black`, `white`, `hispanic`, `asian` | Value Statics: Total count 1462 - Distinct count 4 - Null count 0
address TEXT, --
birthplace TEXT, --
passport TEXT, --
maiden TEXT, --
birthdate DATE, --
marital TEXT, -- Example Values: `S`, `M` | Value Statics: Total count 1033 - Distinct count 2 - Null count 429
gender TEXT, -- Example Values: `F`, `M` | Value Statics: Total count 1462 - Distinct count 2 - Null count 0
drivers TEXT, --
first TEXT, --
last TEXT, --
patient TEXT primary key,
ssn TEXT, --
);
CREATE TABLE claims
(
ENCOUNTER TEXT references encounters, --
PATIENT TEXT references patients, --
ORGANIZATION TEXT, -- Example Values: `temp organization` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
TOTAL INTEGER, -- Example Values: `100` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
BILLABLEPERIOD DATE, --
DIAGNOSIS TEXT, --
ID TEXT primary key,
);
CREATE TABLE conditions
(
START DATE, --
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
CODE INTEGER, --
ENCOUNTER TEXT, --
STOP DATE, --
foreign key (ENCOUNTER) references encounters(ID),
foreign key (DESCRIPTION) references all_prevalences(ITEM),
);
CREATE TABLE all_prevalences
(
"POPULATION TYPE" TEXT, -- Example Values: `LIVING` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
"POPULATION COUNT" INTEGER, -- Example Values: `1000` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
ITEM TEXT primary key,
"PREVALENCE PERCENTAGE" REAL, --
"PREVALENCE RATE" REAL, --
OCCURRENCES INTEGER, --
); |
software_company | Among the male customers, how many of them come from a place with over 30,000 inhabitants? | SEX = 'Male', over 30,000 inhabitants refer to NHABITANTS_K > 30; place refers to GEOID; | SELECT COUNT(T1.GEOID) FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.SEX = 'Male' AND T2.INHABITANTS_K > 30 | CREATE TABLE Customers
(
EDUCATIONNUM INTEGER, -- Example Values: `7`, `3`, `4`, `11`, `5` | Value Statics: Total count 100000 - Distinct count 17 - Null count 0
MARITAL_STATUS TEXT, -- Example Values: `Never-married`, `Married-civ-spouse`, `Divorced`, `Widowed`, `Other` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
ID INTEGER constraint Customers_pk primary key,
SEX TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
OCCUPATION TEXT, -- Example Values: `Machine-op-inspct`, `Handlers-cleaners`, `Exec-managerial`, `Farming-fishing`, `Other-service` | Value Statics: Total count 100000 - Distinct count 8 - Null count 0
age INTEGER, --
GEOID INTEGER constraint Customers_Demog_GEOID_fk references Demog, --
);
CREATE TABLE Mailings1_2
(
RESPONSE TEXT, -- Example Values: `false`, `true` | Value Statics: Total count 60000 - Distinct count 2 - Null count 0
REFID INTEGER constraint Mailings1_2_pk primary key constraint Mailings1_2_Customers_ID_fk references Customers,
REF_DATE DATETIME, -- Example Values: `2007-02-01 12:00:00.0`, `2007-03-01 12:00:00.0` | Value Statics: Total count 60000 - Distinct count 2 - Null count 0
);
CREATE TABLE Sales
(
REFID INTEGER references Customers, --
EVENT_DATE DATETIME, --
AMOUNT REAL, --
EVENTID INTEGER constraint Sales_pk primary key,
);
CREATE TABLE Demog
(
A_VAR1 REAL, --
A_VAR2 REAL, --
A_VAR14 REAL, --
A_VAR8 REAL, --
A_VAR12 REAL, --
A_VAR6 REAL, --
A_VAR17 REAL, --
A_VAR15 REAL, --
A_VAR10 REAL, --
A_VAR16 REAL, --
INHABITANTS_K REAL, --
A_VAR3 REAL, --
A_VAR7 REAL, --
A_VAR4 REAL, --
A_VAR5 REAL, --
A_VAR13 REAL, --
A_VAR9 REAL, --
INCOME_K REAL, --
GEOID INTEGER constraint Demog_pk primary key,
A_VAR18 REAL, --
A_VAR11 REAL, --
);
CREATE TABLE mailings3
(
RESPONSE TEXT, -- Example Values: `false`, `true` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
REF_DATE DATETIME, -- Example Values: `2007-07-01 12:00:00.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
REFID INTEGER constraint mailings3_pk primary key,
); |
retail_world | Which company placed the order with the id 10257? | "10257" is the OrderID; company refers to CompanyName | SELECT T1.CompanyName FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.OrderID = 10257 | CREATE TABLE Products
(
CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0
Unit TEXT, --
ReorderLevel INT, --
ProductName TEXT, --
Price REAL DEFAULT 0, --
FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),
SupplierID INTEGER, --
ProductID INTEGER PRIMARY KEY AUTOINCREMENT,
FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID),
);
CREATE TABLE Customers
(
ContactName TEXT, --
Country TEXT, --
Address TEXT, --
City TEXT, --
CustomerID INTEGER PRIMARY KEY AUTOINCREMENT,
PostalCode TEXT, --
CustomerName TEXT, --
);
CREATE TABLE EmployeeTerritories
(
TerritoryID INT, --
EmployeeID INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE OrderDetails
(
Quantity INTEGER, --
FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),
OrderID INTEGER, --
FOREIGN KEY (ProductID) REFERENCES Products (ProductID),
OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT,
ProductID INTEGER, --
);
CREATE TABLE Shippers
(
ShipperID INTEGER PRIMARY KEY AUTOINCREMENT,
ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
);
CREATE TABLE Territory
(
TerritoryDescription TEXT, --
RegionID INTEGER, --
TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT,
);
CREATE TABLE EmployeeDetails
(
EmployeeID INT PRIMARY KEY,
Title TEXT, --
Salary INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE Categories
(
CategoryID INTEGER PRIMARY KEY AUTOINCREMENT,
CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
);
CREATE TABLE Employees
(
Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT,
FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
);
CREATE TABLE Suppliers
(
PostalCode TEXT, --
Address TEXT, --
SupplierID INTEGER PRIMARY KEY AUTOINCREMENT,
City TEXT, --
Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0
Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0
ContactName TEXT, --
Phone TEXT, --
SupplierName TEXT, --
);
CREATE TABLE EmployeesExtra
(
Salary INTEGER, --
Title TEXT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
EmployeeID INTEGER PRIMARY KEY,
);
CREATE TABLE discontinued_products
(
Discontinued INTEGER, --
ProductID INTEGER PRIMARY KEY,
);
CREATE TABLE Orders
(
OrderID INTEGER PRIMARY KEY AUTOINCREMENT,
CustomerID INTEGER, --
FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),
FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID),
FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),
ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0
OrderDate DATETIME, --
EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0
);
CREATE TABLE Territories
(
TerritoryDescription TEXT, --
RegionDescription TEXT, --
);
CREATE TABLE ShippingInfo
(
ShipCountry TEXT, --
ShippedDate DATETIME, --
FOREIGN KEY (OrderID) REFERENCES Orders(OrderID),
OrderID INTEGER PRIMARY KEY,
); |
professional_basketball | Which coach has serviced in NBA for more than 10 years. | "NBA" is the lgID; coach who serviced for more than 10 years refers to coachID where Subtract (Max(year), Min(year)) > 10 | SELECT coachID FROM coaches WHERE lgID = 'NBA' GROUP BY coachID HAVING MAX(year) - MIN(year) > 10 | CREATE TABLE players_teams
(
PostGS INTEGER, --
PostdRebounds INTEGER, --
PostPF INTEGER, --
tmID TEXT, --
threeAttempted INTEGER, --
PostRebounds INTEGER, --
assists INTEGER, --
threeMade INTEGER, --
PostBlocks INTEGER, --
PostTurnovers INTEGER, --
GP INTEGER, --
lgID TEXT, -- Example Values: `NBA`, `NBL`, `ABA`, `ABL1`, `NPBL` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0
foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade,
PostfgMade INTEGER, --
steals INTEGER, --
oRebounds INTEGER, --
PostftAttempted INTEGER, --
ftAttempted INTEGER, --
ftMade INTEGER, --
points INTEGER, --
PostfgAttempted INTEGER, --
PostftMade INTEGER, --
note TEXT, -- Example Values: `C` | Value Statics: Total count 43 - Distinct count 1 - Null count 23708
dRebounds INTEGER, --
PostSteals INTEGER, --
blocks INTEGER, --
PostAssists INTEGER, --
minutes INTEGER, --
fgAttempted INTEGER, --
playerID TEXT not null references players on update cascade on delete cascade, --
PostthreeMade INTEGER, --
PostPoints INTEGER, --
year INTEGER, --
PF INTEGER, --
fgMade INTEGER, --
PostthreeAttempted INTEGER, --
rebounds INTEGER, --
id INTEGER primary key autoincrement,
stint INTEGER, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0
PostMinutes INTEGER, --
PostGP INTEGER, --
turnovers INTEGER, --
PostoRebounds INTEGER, --
GS INTEGER, --
);
CREATE TABLE awards_coaches
(
award TEXT, -- Example Values: `NBA Coach of the Year`, `ABA Coach of the Year` | Value Statics: Total count 61 - Distinct count 2 - Null count 0
id INTEGER primary key autoincrement,
note TEXT, -- Example Values: `tie` | Value Statics: Total count 4 - Distinct count 1 - Null count 57
coachID TEXT, --
lgID TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 61 - Distinct count 2 - Null count 0
foreign key (coachID, year) references coaches (coachID, year) on update cascade on delete cascade,
year INTEGER, --
);
CREATE TABLE draft
(
draftOverall INTEGER null, --
lgID TEXT null, -- Example Values: `ABA`, `NBA` | Value Statics: Total count 8621 - Distinct count 2 - Null count 0
suffixName TEXT null, -- Example Values: `Jr.` | Value Statics: Total count 2 - Distinct count 1 - Null count 8619
draftYear INTEGER null, --
draftSelection INTEGER null, --
tmID TEXT null, --
draftRound INTEGER null, --
lastName TEXT null, --
playerID TEXT null, --
draftFrom TEXT null, --
id INTEGER default 0 not null primary key,
firstName TEXT null, --
foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade,
foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade,
);
CREATE TABLE player_allstar
(
rebounds INTEGER null, --
playerID TEXT not null, --
season_id INTEGER not null, --
assists INTEGER null, --
conference TEXT null, -- Example Values: `East`, `West`, `Weset`, `Allstars`, `Denver` | Value Statics: Total count 1608 - Distinct count 5 - Null count 0
points INTEGER null, --
personal_fouls INTEGER null, -- Example Values: `3`, `2`, `0`, `1`, `5` | Value Statics: Total count 540 - Distinct count 8 - Null count 1068
ft_attempted INTEGER null, -- Example Values: `2`, `4`, `0`, `6`, `3` | Value Statics: Total count 1561 - Distinct count 17 - Null count 47
fg_attempted INTEGER null, --
league_id TEXT null, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 1608 - Distinct count 2 - Null count 0
foreign key (playerID) references players (playerID) on update cascade on delete cascade,
fg_made INTEGER null, -- Example Values: `4`, `8`, `5`, `7`, `3` | Value Statics: Total count 1561 - Distinct count 18 - Null count 47
ft_made INTEGER null, -- Example Values: `2`, `3`, `0`, `1`, `4` | Value Statics: Total count 1561 - Distinct count 13 - Null count 47
steals INTEGER null, -- Example Values: `3`, `0`, `1`, `2`, `5` | Value Statics: Total count 398 - Distinct count 7 - Null count 1210
games_played INTEGER null, -- Example Values: `1` | Value Statics: Total count 1608 - Distinct count 1 - Null count 0
first_name TEXT null, --
d_rebounds INTEGER null, -- Example Values: `2`, `5`, `0`, `1`, `4` | Value Statics: Total count 493 - Distinct count 14 - Null count 1115
last_name TEXT null, --
primary key (playerID, season_id),
turnovers INTEGER null, -- Example Values: `1`, `0`, `3`, `2`, `4` | Value Statics: Total count 493 - Distinct count 9 - Null count 1115
three_made INTEGER null, -- Example Values: `0`, `1`, `3`, `5`, `4` | Value Statics: Total count 566 - Distinct count 7 - Null count 1042
minutes INTEGER null, --
blocks INTEGER null, -- Example Values: `2`, `0`, `1`, `3`, `5` | Value Statics: Total count 398 - Distinct count 6 - Null count 1210
three_attempted INTEGER null, -- Example Values: `0`, `1`, `6`, `7`, `10` | Value Statics: Total count 540 - Distinct count 12 - Null count 1068
o_rebounds INTEGER null, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 493 - Distinct count 10 - Null count 1115
);
CREATE TABLE awards_players
(
foreign key (playerID) references players (playerID) on update cascade on delete cascade,
year INTEGER not null, --
pos TEXT null, -- Example Values: `C`, `F`, `G`, `F/G`, `F/C` | Value Statics: Total count 833 - Distinct count 5 - Null count 886
primary key (playerID, year, award),
lgID TEXT null, -- Example Values: `NBA`, `ABA`, `NBL`, `ABL1` | Value Statics: Total count 1719 - Distinct count 4 - Null count 0
award TEXT not null, --
playerID TEXT not null, --
note TEXT null, -- Example Values: `tie` | Value Statics: Total count 37 - Distinct count 1 - Null count 1682
);
CREATE TABLE series_post
(
tmIDLoser TEXT, --
id INTEGER primary key autoincrement,
series TEXT, -- Example Values: `O`, `M`, `N`, `A`, `K` | Value Statics: Total count 775 - Distinct count 11 - Null count 0
tmIDWinner TEXT, --
round TEXT, -- Example Values: `F`, `QF`, `SF`, `DT`, `DF` | Value Statics: Total count 775 - Distinct count 11 - Null count 0
year INTEGER, --
foreign key (tmIDLoser, year) references teams (tmID, year) on update cascade on delete cascade,
foreign key (tmIDWinner, year) references teams (tmID, year) on update cascade on delete cascade,
W INTEGER, -- Example Values: `4`, `2`, `1`, `3`, `0` | Value Statics: Total count 775 - Distinct count 5 - Null count 0
lgIDLoser TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0
lgIDWinner TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0
L INTEGER, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 775 - Distinct count 5 - Null count 0
);
CREATE TABLE players
(
nameGiven TEXT null, -- Example Values: `nameGiven`, `Mort`, `Robert`, `Jim`, `Mike` | Value Statics: Total count 10 - Distinct count 9 - Null count 5052
lastseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15
hsCountry TEXT null, --
firstName TEXT null, --
hsCity TEXT null, --
firstseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15
weight INTEGER null, --
birthCountry TEXT null, --
race TEXT null, -- Example Values: `B`, `W`, `O`, `1`, `r` | Value Statics: Total count 4903 - Distinct count 5 - Null count 159
lastName TEXT null, --
birthDate DATE null, --
collegeOther TEXT null, --
birthState TEXT null, --
useFirst TEXT null, --
pos TEXT null, -- Example Values: `F-C`, `C`, `G`, `G-F`, `C-F` | Value Statics: Total count 4880 - Distinct count 14 - Null count 182
playerID TEXT not null primary key,
college TEXT null, --
highSchool TEXT null, --
hsState TEXT null, --
height REAL null, --
deathDate DATE null, --
nameSuffix TEXT null, -- Example Values: `Jr.`, `III`, `nameSuffix`, `II`, `IV` | Value Statics: Total count 324 - Distinct count 6 - Null count 4738
nameNick TEXT null, --
fullGivenName TEXT null, --
birthCity TEXT null, --
middleName TEXT null, --
);
CREATE TABLE teams
(
d_pts INTEGER null, --
name TEXT null, --
homeLost INTEGER null, --
o_ftm INTEGER null, --
franchID TEXT null, --
tmID TEXT not null, --
awayWon INTEGER null, --
primary key (year, tmID),
o_fgm INTEGER null, --
year INTEGER not null, --
awayLost INTEGER null, --
arena TEXT null, --
confID TEXT null, -- Example Values: `EC`, `WC` | Value Statics: Total count 1064 - Distinct count 2 - Null count 472
games INTEGER null, --
lost INTEGER null, --
divID TEXT null, -- Example Values: `EA`, `WE`, `ED`, `WD`, `SO` | Value Statics: Total count 1498 - Distinct count 13 - Null count 38
lgID TEXT null, -- Example Values: `NBL`, `NBA`, `PBLA`, `NPBL`, `ABL1` | Value Statics: Total count 1536 - Distinct count 6 - Null count 0
homeWon INTEGER null, --
confRank INTEGER null, -- Example Values: `0`, `4`, `3`, `5`, `7` | Value Statics: Total count 1536 - Distinct count 16 - Null count 0
o_pts INTEGER null, --
`rank` INTEGER null, -- Example Values: `1`, `2`, `4`, `5`, `6` | Value Statics: Total count 1536 - Distinct count 10 - Null count 0
playoff TEXT null, -- Example Values: `CF`, `WC`, `LC`, `CS`, `F` | Value Statics: Total count 901 - Distinct count 15 - Null count 635
won INTEGER null, --
);
CREATE TABLE coaches
(
primary key (coachID, year, tmID, stint),
lgID TEXT null, -- Example Values: `NBA`, `ABA`, `ABL1`, `PBLA`, `NPBL` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0
post_losses INTEGER null, -- Example Values: `3`, `9`, `7`, `8`, `0` | Value Statics: Total count 1649 - Distinct count 12 - Null count 40
year INTEGER not null, --
won INTEGER null, --
foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade,
post_wins INTEGER null, -- Example Values: `0`, `12`, `9`, `13`, `1` | Value Statics: Total count 1649 - Distinct count 17 - Null count 40
coachID TEXT not null, --
tmID TEXT not null, --
lost INTEGER null, --
stint INTEGER not null, -- Example Values: `2`, `1`, `4`, `5`, `3` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0
); |
synthea | State the average period of Ms. Angelena Kertzmann's several normal pregnancies. | DIVIDE(SUBTRACT(stop time - start time), COUNT(DESCRIPTION = 'Normal pregnancy'))); | SELECT CAST(SUM(strftime('%J', T2.STOP) - strftime('%J', T2.START)) AS REAL) / COUNT(T2.PATIENT) FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE T1.prefix = 'Ms.' AND T1.first = 'Angelena' AND T1.last = 'Kertzmann' AND T2.description = 'Normal pregnancy' | CREATE TABLE immunizations
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
DATE DATE, --
primary key (DATE, PATIENT, ENCOUNTER, CODE),
DESCRIPTION TEXT, -- Example Values: `Influenza seasonal injectable preservative free`, `Td (adult) preservative free`, `meningococcal MCV4P`, `Tdap`, `HPV quadrivalent` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
);
CREATE TABLE allergies
(
CODE INTEGER, -- Example Values: `232347008`, `300916003`, `419474003`, `424213003`, `300913006` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
foreign key (ENCOUNTER) references encounters(ID),
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
primary key (PATIENT, ENCOUNTER, CODE),
STOP TEXT, -- Example Values: `12/22/14`, `4/21/10`, `10/15/11`, `3/17/10`, `5/26/08` | Value Statics: Total count 16 - Distinct count 11 - Null count 556
START TEXT, --
DESCRIPTION TEXT, -- Example Values: `Allergy to dairy product`, `Allergy to tree pollen`, `Allergy to grass pollen`, `Dander (animal) allergy`, `House dust mite allergy` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
);
CREATE TABLE observations
(
DATE DATE, --
ENCOUNTER TEXT, --
VALUE REAL, --
UNITS TEXT, -- Example Values: `cm`, `kg`, `kg/m2`, `mmHg`, `Cel` | Value Statics: Total count 78444 - Distinct count 17 - Null count 455
DESCRIPTION TEXT, --
CODE TEXT, --
PATIENT TEXT, --
foreign key (PATIENT) references patients(patient),
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE medications
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, --
PATIENT TEXT, --
STOP DATE, --
START DATE, --
REASONDESCRIPTION TEXT, --
DESCRIPTION TEXT, --
primary key (START, PATIENT, ENCOUNTER, CODE),
foreign key (PATIENT) references patients(patient),
REASONCODE INTEGER, --
ENCOUNTER TEXT, --
);
CREATE TABLE careplans
(
START DATE, --
STOP DATE, --
ID TEXT, --
REASONCODE INTEGER, --
REASONDESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
DESCRIPTION TEXT, --
CODE REAL, --
ENCOUNTER TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE encounters
(
DATE DATE, --
REASONCODE INTEGER, --
CODE INTEGER, --
ID TEXT primary key,
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
REASONDESCRIPTION TEXT, --
);
CREATE TABLE procedures
(
foreign key (PATIENT) references patients(patient),
REASONDESCRIPTION TEXT, --
PATIENT TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
DATE DATE, --
DESCRIPTION TEXT, --
ENCOUNTER TEXT, --
CODE INTEGER, --
REASONCODE INTEGER, --
);
CREATE TABLE patients
(
suffix TEXT, -- Example Values: `PhD`, `JD`, `MD` | Value Statics: Total count 45 - Distinct count 3 - Null count 1417
prefix TEXT, -- Example Values: `Mr.`, `Mrs.`, `Ms.` | Value Statics: Total count 1166 - Distinct count 3 - Null count 296
deathdate DATE, --
ethnicity TEXT, --
race TEXT, -- Example Values: `black`, `white`, `hispanic`, `asian` | Value Statics: Total count 1462 - Distinct count 4 - Null count 0
address TEXT, --
birthplace TEXT, --
passport TEXT, --
maiden TEXT, --
birthdate DATE, --
marital TEXT, -- Example Values: `S`, `M` | Value Statics: Total count 1033 - Distinct count 2 - Null count 429
gender TEXT, -- Example Values: `F`, `M` | Value Statics: Total count 1462 - Distinct count 2 - Null count 0
drivers TEXT, --
first TEXT, --
last TEXT, --
patient TEXT primary key,
ssn TEXT, --
);
CREATE TABLE claims
(
ENCOUNTER TEXT references encounters, --
PATIENT TEXT references patients, --
ORGANIZATION TEXT, -- Example Values: `temp organization` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
TOTAL INTEGER, -- Example Values: `100` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
BILLABLEPERIOD DATE, --
DIAGNOSIS TEXT, --
ID TEXT primary key,
);
CREATE TABLE conditions
(
START DATE, --
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
CODE INTEGER, --
ENCOUNTER TEXT, --
STOP DATE, --
foreign key (ENCOUNTER) references encounters(ID),
foreign key (DESCRIPTION) references all_prevalences(ITEM),
);
CREATE TABLE all_prevalences
(
"POPULATION TYPE" TEXT, -- Example Values: `LIVING` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
"POPULATION COUNT" INTEGER, -- Example Values: `1000` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
ITEM TEXT primary key,
"PREVALENCE PERCENTAGE" REAL, --
"PREVALENCE RATE" REAL, --
OCCURRENCES INTEGER, --
); |
software_company | Please list the occupations of the customers over 40 and have sent a true response to the incentive mailing sent by the marketing department. | over 40 refers to age > 40; RESPONSE = 'true'; | SELECT DISTINCT T1.OCCUPATION FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID WHERE T1.age > 40 AND T2.RESPONSE = 'true' | CREATE TABLE Customers
(
EDUCATIONNUM INTEGER, -- Example Values: `7`, `3`, `4`, `11`, `5` | Value Statics: Total count 100000 - Distinct count 17 - Null count 0
MARITAL_STATUS TEXT, -- Example Values: `Never-married`, `Married-civ-spouse`, `Divorced`, `Widowed`, `Other` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
ID INTEGER constraint Customers_pk primary key,
SEX TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
OCCUPATION TEXT, -- Example Values: `Machine-op-inspct`, `Handlers-cleaners`, `Exec-managerial`, `Farming-fishing`, `Other-service` | Value Statics: Total count 100000 - Distinct count 8 - Null count 0
age INTEGER, --
GEOID INTEGER constraint Customers_Demog_GEOID_fk references Demog, --
);
CREATE TABLE Mailings1_2
(
RESPONSE TEXT, -- Example Values: `false`, `true` | Value Statics: Total count 60000 - Distinct count 2 - Null count 0
REFID INTEGER constraint Mailings1_2_pk primary key constraint Mailings1_2_Customers_ID_fk references Customers,
REF_DATE DATETIME, -- Example Values: `2007-02-01 12:00:00.0`, `2007-03-01 12:00:00.0` | Value Statics: Total count 60000 - Distinct count 2 - Null count 0
);
CREATE TABLE Sales
(
REFID INTEGER references Customers, --
EVENT_DATE DATETIME, --
AMOUNT REAL, --
EVENTID INTEGER constraint Sales_pk primary key,
);
CREATE TABLE Demog
(
A_VAR1 REAL, --
A_VAR2 REAL, --
A_VAR14 REAL, --
A_VAR8 REAL, --
A_VAR12 REAL, --
A_VAR6 REAL, --
A_VAR17 REAL, --
A_VAR15 REAL, --
A_VAR10 REAL, --
A_VAR16 REAL, --
INHABITANTS_K REAL, --
A_VAR3 REAL, --
A_VAR7 REAL, --
A_VAR4 REAL, --
A_VAR5 REAL, --
A_VAR13 REAL, --
A_VAR9 REAL, --
INCOME_K REAL, --
GEOID INTEGER constraint Demog_pk primary key,
A_VAR18 REAL, --
A_VAR11 REAL, --
);
CREATE TABLE mailings3
(
RESPONSE TEXT, -- Example Values: `false`, `true` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
REF_DATE DATETIME, -- Example Values: `2007-07-01 12:00:00.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
REFID INTEGER constraint mailings3_pk primary key,
); |
retail_world | How many days was the fastest shipping of Berglunds snabbkp's order? | Berglunds snabbkp is the CompanyName; fastest shipping = Min(Subtract(ShippedDate, OrderDate)) | SELECT datediff(T2.ShippedDate, T2.OrderDate) FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.CompanyName = 'Berglunds snabbkp' ORDER BY datediff(T2.ShippedDate, T2.OrderDate) LIMIT 1 | CREATE TABLE Products
(
CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0
Unit TEXT, --
ReorderLevel INT, --
ProductName TEXT, --
Price REAL DEFAULT 0, --
FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),
SupplierID INTEGER, --
ProductID INTEGER PRIMARY KEY AUTOINCREMENT,
FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID),
);
CREATE TABLE Customers
(
ContactName TEXT, --
Country TEXT, --
Address TEXT, --
City TEXT, --
CustomerID INTEGER PRIMARY KEY AUTOINCREMENT,
PostalCode TEXT, --
CustomerName TEXT, --
);
CREATE TABLE EmployeeTerritories
(
TerritoryID INT, --
EmployeeID INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE OrderDetails
(
Quantity INTEGER, --
FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),
OrderID INTEGER, --
FOREIGN KEY (ProductID) REFERENCES Products (ProductID),
OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT,
ProductID INTEGER, --
);
CREATE TABLE Shippers
(
ShipperID INTEGER PRIMARY KEY AUTOINCREMENT,
ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
);
CREATE TABLE Territory
(
TerritoryDescription TEXT, --
RegionID INTEGER, --
TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT,
);
CREATE TABLE EmployeeDetails
(
EmployeeID INT PRIMARY KEY,
Title TEXT, --
Salary INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE Categories
(
CategoryID INTEGER PRIMARY KEY AUTOINCREMENT,
CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
);
CREATE TABLE Employees
(
Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT,
FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
);
CREATE TABLE Suppliers
(
PostalCode TEXT, --
Address TEXT, --
SupplierID INTEGER PRIMARY KEY AUTOINCREMENT,
City TEXT, --
Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0
Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0
ContactName TEXT, --
Phone TEXT, --
SupplierName TEXT, --
);
CREATE TABLE EmployeesExtra
(
Salary INTEGER, --
Title TEXT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
EmployeeID INTEGER PRIMARY KEY,
);
CREATE TABLE discontinued_products
(
Discontinued INTEGER, --
ProductID INTEGER PRIMARY KEY,
);
CREATE TABLE Orders
(
OrderID INTEGER PRIMARY KEY AUTOINCREMENT,
CustomerID INTEGER, --
FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),
FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID),
FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),
ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0
OrderDate DATETIME, --
EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0
);
CREATE TABLE Territories
(
TerritoryDescription TEXT, --
RegionDescription TEXT, --
);
CREATE TABLE ShippingInfo
(
ShipCountry TEXT, --
ShippedDate DATETIME, --
FOREIGN KEY (OrderID) REFERENCES Orders(OrderID),
OrderID INTEGER PRIMARY KEY,
); |
professional_basketball | Among the Most improved Players awarded from 1985-1990, how many player whose country is USA? | the Most improved Player refers to award = 'Most Improved Player'; from 1985-1990 refers to year between 1985 and 1990; country is USA refers to birthCountry = 'USA' | SELECT COUNT(DISTINCT T2.playerID) FROM awards_players AS T1 INNER JOIN players AS T2 ON T1.playerID = T2.playerID WHERE T1.award = 'Most Improved Player' AND T2.birthCountry = 'USA' AND T1.year BETWEEN 1985 AND 1990 | CREATE TABLE players_teams
(
PostGS INTEGER, --
PostdRebounds INTEGER, --
PostPF INTEGER, --
tmID TEXT, --
threeAttempted INTEGER, --
PostRebounds INTEGER, --
assists INTEGER, --
threeMade INTEGER, --
PostBlocks INTEGER, --
PostTurnovers INTEGER, --
GP INTEGER, --
lgID TEXT, -- Example Values: `NBA`, `NBL`, `ABA`, `ABL1`, `NPBL` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0
foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade,
PostfgMade INTEGER, --
steals INTEGER, --
oRebounds INTEGER, --
PostftAttempted INTEGER, --
ftAttempted INTEGER, --
ftMade INTEGER, --
points INTEGER, --
PostfgAttempted INTEGER, --
PostftMade INTEGER, --
note TEXT, -- Example Values: `C` | Value Statics: Total count 43 - Distinct count 1 - Null count 23708
dRebounds INTEGER, --
PostSteals INTEGER, --
blocks INTEGER, --
PostAssists INTEGER, --
minutes INTEGER, --
fgAttempted INTEGER, --
playerID TEXT not null references players on update cascade on delete cascade, --
PostthreeMade INTEGER, --
PostPoints INTEGER, --
year INTEGER, --
PF INTEGER, --
fgMade INTEGER, --
PostthreeAttempted INTEGER, --
rebounds INTEGER, --
id INTEGER primary key autoincrement,
stint INTEGER, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0
PostMinutes INTEGER, --
PostGP INTEGER, --
turnovers INTEGER, --
PostoRebounds INTEGER, --
GS INTEGER, --
);
CREATE TABLE awards_coaches
(
award TEXT, -- Example Values: `NBA Coach of the Year`, `ABA Coach of the Year` | Value Statics: Total count 61 - Distinct count 2 - Null count 0
id INTEGER primary key autoincrement,
note TEXT, -- Example Values: `tie` | Value Statics: Total count 4 - Distinct count 1 - Null count 57
coachID TEXT, --
lgID TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 61 - Distinct count 2 - Null count 0
foreign key (coachID, year) references coaches (coachID, year) on update cascade on delete cascade,
year INTEGER, --
);
CREATE TABLE draft
(
draftOverall INTEGER null, --
lgID TEXT null, -- Example Values: `ABA`, `NBA` | Value Statics: Total count 8621 - Distinct count 2 - Null count 0
suffixName TEXT null, -- Example Values: `Jr.` | Value Statics: Total count 2 - Distinct count 1 - Null count 8619
draftYear INTEGER null, --
draftSelection INTEGER null, --
tmID TEXT null, --
draftRound INTEGER null, --
lastName TEXT null, --
playerID TEXT null, --
draftFrom TEXT null, --
id INTEGER default 0 not null primary key,
firstName TEXT null, --
foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade,
foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade,
);
CREATE TABLE player_allstar
(
rebounds INTEGER null, --
playerID TEXT not null, --
season_id INTEGER not null, --
assists INTEGER null, --
conference TEXT null, -- Example Values: `East`, `West`, `Weset`, `Allstars`, `Denver` | Value Statics: Total count 1608 - Distinct count 5 - Null count 0
points INTEGER null, --
personal_fouls INTEGER null, -- Example Values: `3`, `2`, `0`, `1`, `5` | Value Statics: Total count 540 - Distinct count 8 - Null count 1068
ft_attempted INTEGER null, -- Example Values: `2`, `4`, `0`, `6`, `3` | Value Statics: Total count 1561 - Distinct count 17 - Null count 47
fg_attempted INTEGER null, --
league_id TEXT null, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 1608 - Distinct count 2 - Null count 0
foreign key (playerID) references players (playerID) on update cascade on delete cascade,
fg_made INTEGER null, -- Example Values: `4`, `8`, `5`, `7`, `3` | Value Statics: Total count 1561 - Distinct count 18 - Null count 47
ft_made INTEGER null, -- Example Values: `2`, `3`, `0`, `1`, `4` | Value Statics: Total count 1561 - Distinct count 13 - Null count 47
steals INTEGER null, -- Example Values: `3`, `0`, `1`, `2`, `5` | Value Statics: Total count 398 - Distinct count 7 - Null count 1210
games_played INTEGER null, -- Example Values: `1` | Value Statics: Total count 1608 - Distinct count 1 - Null count 0
first_name TEXT null, --
d_rebounds INTEGER null, -- Example Values: `2`, `5`, `0`, `1`, `4` | Value Statics: Total count 493 - Distinct count 14 - Null count 1115
last_name TEXT null, --
primary key (playerID, season_id),
turnovers INTEGER null, -- Example Values: `1`, `0`, `3`, `2`, `4` | Value Statics: Total count 493 - Distinct count 9 - Null count 1115
three_made INTEGER null, -- Example Values: `0`, `1`, `3`, `5`, `4` | Value Statics: Total count 566 - Distinct count 7 - Null count 1042
minutes INTEGER null, --
blocks INTEGER null, -- Example Values: `2`, `0`, `1`, `3`, `5` | Value Statics: Total count 398 - Distinct count 6 - Null count 1210
three_attempted INTEGER null, -- Example Values: `0`, `1`, `6`, `7`, `10` | Value Statics: Total count 540 - Distinct count 12 - Null count 1068
o_rebounds INTEGER null, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 493 - Distinct count 10 - Null count 1115
);
CREATE TABLE awards_players
(
foreign key (playerID) references players (playerID) on update cascade on delete cascade,
year INTEGER not null, --
pos TEXT null, -- Example Values: `C`, `F`, `G`, `F/G`, `F/C` | Value Statics: Total count 833 - Distinct count 5 - Null count 886
primary key (playerID, year, award),
lgID TEXT null, -- Example Values: `NBA`, `ABA`, `NBL`, `ABL1` | Value Statics: Total count 1719 - Distinct count 4 - Null count 0
award TEXT not null, --
playerID TEXT not null, --
note TEXT null, -- Example Values: `tie` | Value Statics: Total count 37 - Distinct count 1 - Null count 1682
);
CREATE TABLE series_post
(
tmIDLoser TEXT, --
id INTEGER primary key autoincrement,
series TEXT, -- Example Values: `O`, `M`, `N`, `A`, `K` | Value Statics: Total count 775 - Distinct count 11 - Null count 0
tmIDWinner TEXT, --
round TEXT, -- Example Values: `F`, `QF`, `SF`, `DT`, `DF` | Value Statics: Total count 775 - Distinct count 11 - Null count 0
year INTEGER, --
foreign key (tmIDLoser, year) references teams (tmID, year) on update cascade on delete cascade,
foreign key (tmIDWinner, year) references teams (tmID, year) on update cascade on delete cascade,
W INTEGER, -- Example Values: `4`, `2`, `1`, `3`, `0` | Value Statics: Total count 775 - Distinct count 5 - Null count 0
lgIDLoser TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0
lgIDWinner TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0
L INTEGER, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 775 - Distinct count 5 - Null count 0
);
CREATE TABLE players
(
nameGiven TEXT null, -- Example Values: `nameGiven`, `Mort`, `Robert`, `Jim`, `Mike` | Value Statics: Total count 10 - Distinct count 9 - Null count 5052
lastseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15
hsCountry TEXT null, --
firstName TEXT null, --
hsCity TEXT null, --
firstseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15
weight INTEGER null, --
birthCountry TEXT null, --
race TEXT null, -- Example Values: `B`, `W`, `O`, `1`, `r` | Value Statics: Total count 4903 - Distinct count 5 - Null count 159
lastName TEXT null, --
birthDate DATE null, --
collegeOther TEXT null, --
birthState TEXT null, --
useFirst TEXT null, --
pos TEXT null, -- Example Values: `F-C`, `C`, `G`, `G-F`, `C-F` | Value Statics: Total count 4880 - Distinct count 14 - Null count 182
playerID TEXT not null primary key,
college TEXT null, --
highSchool TEXT null, --
hsState TEXT null, --
height REAL null, --
deathDate DATE null, --
nameSuffix TEXT null, -- Example Values: `Jr.`, `III`, `nameSuffix`, `II`, `IV` | Value Statics: Total count 324 - Distinct count 6 - Null count 4738
nameNick TEXT null, --
fullGivenName TEXT null, --
birthCity TEXT null, --
middleName TEXT null, --
);
CREATE TABLE teams
(
d_pts INTEGER null, --
name TEXT null, --
homeLost INTEGER null, --
o_ftm INTEGER null, --
franchID TEXT null, --
tmID TEXT not null, --
awayWon INTEGER null, --
primary key (year, tmID),
o_fgm INTEGER null, --
year INTEGER not null, --
awayLost INTEGER null, --
arena TEXT null, --
confID TEXT null, -- Example Values: `EC`, `WC` | Value Statics: Total count 1064 - Distinct count 2 - Null count 472
games INTEGER null, --
lost INTEGER null, --
divID TEXT null, -- Example Values: `EA`, `WE`, `ED`, `WD`, `SO` | Value Statics: Total count 1498 - Distinct count 13 - Null count 38
lgID TEXT null, -- Example Values: `NBL`, `NBA`, `PBLA`, `NPBL`, `ABL1` | Value Statics: Total count 1536 - Distinct count 6 - Null count 0
homeWon INTEGER null, --
confRank INTEGER null, -- Example Values: `0`, `4`, `3`, `5`, `7` | Value Statics: Total count 1536 - Distinct count 16 - Null count 0
o_pts INTEGER null, --
`rank` INTEGER null, -- Example Values: `1`, `2`, `4`, `5`, `6` | Value Statics: Total count 1536 - Distinct count 10 - Null count 0
playoff TEXT null, -- Example Values: `CF`, `WC`, `LC`, `CS`, `F` | Value Statics: Total count 901 - Distinct count 15 - Null count 635
won INTEGER null, --
);
CREATE TABLE coaches
(
primary key (coachID, year, tmID, stint),
lgID TEXT null, -- Example Values: `NBA`, `ABA`, `ABL1`, `PBLA`, `NPBL` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0
post_losses INTEGER null, -- Example Values: `3`, `9`, `7`, `8`, `0` | Value Statics: Total count 1649 - Distinct count 12 - Null count 40
year INTEGER not null, --
won INTEGER null, --
foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade,
post_wins INTEGER null, -- Example Values: `0`, `12`, `9`, `13`, `1` | Value Statics: Total count 1649 - Distinct count 17 - Null count 40
coachID TEXT not null, --
tmID TEXT not null, --
lost INTEGER null, --
stint INTEGER not null, -- Example Values: `2`, `1`, `4`, `5`, `3` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0
); |
synthea | What is/are the ids of the tallest patient/s? | id of the tallest patient/s refers to PATIENT from observations where MAX(DESCRIPTION = 'Body Height'); | SELECT PATIENT FROM observations WHERE DESCRIPTION = 'Body Height' AND UNITS = 'cm' ORDER BY VALUE DESC LIMIT 1 | CREATE TABLE immunizations
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
DATE DATE, --
primary key (DATE, PATIENT, ENCOUNTER, CODE),
DESCRIPTION TEXT, -- Example Values: `Influenza seasonal injectable preservative free`, `Td (adult) preservative free`, `meningococcal MCV4P`, `Tdap`, `HPV quadrivalent` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
);
CREATE TABLE allergies
(
CODE INTEGER, -- Example Values: `232347008`, `300916003`, `419474003`, `424213003`, `300913006` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
foreign key (ENCOUNTER) references encounters(ID),
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
primary key (PATIENT, ENCOUNTER, CODE),
STOP TEXT, -- Example Values: `12/22/14`, `4/21/10`, `10/15/11`, `3/17/10`, `5/26/08` | Value Statics: Total count 16 - Distinct count 11 - Null count 556
START TEXT, --
DESCRIPTION TEXT, -- Example Values: `Allergy to dairy product`, `Allergy to tree pollen`, `Allergy to grass pollen`, `Dander (animal) allergy`, `House dust mite allergy` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
);
CREATE TABLE observations
(
DATE DATE, --
ENCOUNTER TEXT, --
VALUE REAL, --
UNITS TEXT, -- Example Values: `cm`, `kg`, `kg/m2`, `mmHg`, `Cel` | Value Statics: Total count 78444 - Distinct count 17 - Null count 455
DESCRIPTION TEXT, --
CODE TEXT, --
PATIENT TEXT, --
foreign key (PATIENT) references patients(patient),
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE medications
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, --
PATIENT TEXT, --
STOP DATE, --
START DATE, --
REASONDESCRIPTION TEXT, --
DESCRIPTION TEXT, --
primary key (START, PATIENT, ENCOUNTER, CODE),
foreign key (PATIENT) references patients(patient),
REASONCODE INTEGER, --
ENCOUNTER TEXT, --
);
CREATE TABLE careplans
(
START DATE, --
STOP DATE, --
ID TEXT, --
REASONCODE INTEGER, --
REASONDESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
DESCRIPTION TEXT, --
CODE REAL, --
ENCOUNTER TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE encounters
(
DATE DATE, --
REASONCODE INTEGER, --
CODE INTEGER, --
ID TEXT primary key,
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
REASONDESCRIPTION TEXT, --
);
CREATE TABLE procedures
(
foreign key (PATIENT) references patients(patient),
REASONDESCRIPTION TEXT, --
PATIENT TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
DATE DATE, --
DESCRIPTION TEXT, --
ENCOUNTER TEXT, --
CODE INTEGER, --
REASONCODE INTEGER, --
);
CREATE TABLE patients
(
suffix TEXT, -- Example Values: `PhD`, `JD`, `MD` | Value Statics: Total count 45 - Distinct count 3 - Null count 1417
prefix TEXT, -- Example Values: `Mr.`, `Mrs.`, `Ms.` | Value Statics: Total count 1166 - Distinct count 3 - Null count 296
deathdate DATE, --
ethnicity TEXT, --
race TEXT, -- Example Values: `black`, `white`, `hispanic`, `asian` | Value Statics: Total count 1462 - Distinct count 4 - Null count 0
address TEXT, --
birthplace TEXT, --
passport TEXT, --
maiden TEXT, --
birthdate DATE, --
marital TEXT, -- Example Values: `S`, `M` | Value Statics: Total count 1033 - Distinct count 2 - Null count 429
gender TEXT, -- Example Values: `F`, `M` | Value Statics: Total count 1462 - Distinct count 2 - Null count 0
drivers TEXT, --
first TEXT, --
last TEXT, --
patient TEXT primary key,
ssn TEXT, --
);
CREATE TABLE claims
(
ENCOUNTER TEXT references encounters, --
PATIENT TEXT references patients, --
ORGANIZATION TEXT, -- Example Values: `temp organization` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
TOTAL INTEGER, -- Example Values: `100` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
BILLABLEPERIOD DATE, --
DIAGNOSIS TEXT, --
ID TEXT primary key,
);
CREATE TABLE conditions
(
START DATE, --
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
CODE INTEGER, --
ENCOUNTER TEXT, --
STOP DATE, --
foreign key (ENCOUNTER) references encounters(ID),
foreign key (DESCRIPTION) references all_prevalences(ITEM),
);
CREATE TABLE all_prevalences
(
"POPULATION TYPE" TEXT, -- Example Values: `LIVING` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
"POPULATION COUNT" INTEGER, -- Example Values: `1000` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
ITEM TEXT primary key,
"PREVALENCE PERCENTAGE" REAL, --
"PREVALENCE RATE" REAL, --
OCCURRENCES INTEGER, --
); |
software_company | Of the first 60,000 customers who sent a true response to the incentive mailing sent by the marketing department, how many of them are female? | RESPONSE = 'true'; SEX = 'Female'; | SELECT COUNT(T1.ID) FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID WHERE T1.SEX = 'Female' AND T2.RESPONSE = 'true' | CREATE TABLE Customers
(
EDUCATIONNUM INTEGER, -- Example Values: `7`, `3`, `4`, `11`, `5` | Value Statics: Total count 100000 - Distinct count 17 - Null count 0
MARITAL_STATUS TEXT, -- Example Values: `Never-married`, `Married-civ-spouse`, `Divorced`, `Widowed`, `Other` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
ID INTEGER constraint Customers_pk primary key,
SEX TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
OCCUPATION TEXT, -- Example Values: `Machine-op-inspct`, `Handlers-cleaners`, `Exec-managerial`, `Farming-fishing`, `Other-service` | Value Statics: Total count 100000 - Distinct count 8 - Null count 0
age INTEGER, --
GEOID INTEGER constraint Customers_Demog_GEOID_fk references Demog, --
);
CREATE TABLE Mailings1_2
(
RESPONSE TEXT, -- Example Values: `false`, `true` | Value Statics: Total count 60000 - Distinct count 2 - Null count 0
REFID INTEGER constraint Mailings1_2_pk primary key constraint Mailings1_2_Customers_ID_fk references Customers,
REF_DATE DATETIME, -- Example Values: `2007-02-01 12:00:00.0`, `2007-03-01 12:00:00.0` | Value Statics: Total count 60000 - Distinct count 2 - Null count 0
);
CREATE TABLE Sales
(
REFID INTEGER references Customers, --
EVENT_DATE DATETIME, --
AMOUNT REAL, --
EVENTID INTEGER constraint Sales_pk primary key,
);
CREATE TABLE Demog
(
A_VAR1 REAL, --
A_VAR2 REAL, --
A_VAR14 REAL, --
A_VAR8 REAL, --
A_VAR12 REAL, --
A_VAR6 REAL, --
A_VAR17 REAL, --
A_VAR15 REAL, --
A_VAR10 REAL, --
A_VAR16 REAL, --
INHABITANTS_K REAL, --
A_VAR3 REAL, --
A_VAR7 REAL, --
A_VAR4 REAL, --
A_VAR5 REAL, --
A_VAR13 REAL, --
A_VAR9 REAL, --
INCOME_K REAL, --
GEOID INTEGER constraint Demog_pk primary key,
A_VAR18 REAL, --
A_VAR11 REAL, --
);
CREATE TABLE mailings3
(
RESPONSE TEXT, -- Example Values: `false`, `true` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
REF_DATE DATETIME, -- Example Values: `2007-07-01 12:00:00.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
REFID INTEGER constraint mailings3_pk primary key,
); |
retail_world | How many orders were from Hanna Moos company in 1999? | "Hanna Moos" is the CompanyName; in 1999 refer to YEAR (OrderDate) = 1999 | SELECT COUNT(T2.OrderID) FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE STRFTIME('%Y', T2.OrderDate) = '1999' AND T1.CompanyName = 'Hanna Moos' | CREATE TABLE Products
(
CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0
Unit TEXT, --
ReorderLevel INT, --
ProductName TEXT, --
Price REAL DEFAULT 0, --
FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),
SupplierID INTEGER, --
ProductID INTEGER PRIMARY KEY AUTOINCREMENT,
FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID),
);
CREATE TABLE Customers
(
ContactName TEXT, --
Country TEXT, --
Address TEXT, --
City TEXT, --
CustomerID INTEGER PRIMARY KEY AUTOINCREMENT,
PostalCode TEXT, --
CustomerName TEXT, --
);
CREATE TABLE EmployeeTerritories
(
TerritoryID INT, --
EmployeeID INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE OrderDetails
(
Quantity INTEGER, --
FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),
OrderID INTEGER, --
FOREIGN KEY (ProductID) REFERENCES Products (ProductID),
OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT,
ProductID INTEGER, --
);
CREATE TABLE Shippers
(
ShipperID INTEGER PRIMARY KEY AUTOINCREMENT,
ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
);
CREATE TABLE Territory
(
TerritoryDescription TEXT, --
RegionID INTEGER, --
TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT,
);
CREATE TABLE EmployeeDetails
(
EmployeeID INT PRIMARY KEY,
Title TEXT, --
Salary INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE Categories
(
CategoryID INTEGER PRIMARY KEY AUTOINCREMENT,
CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
);
CREATE TABLE Employees
(
Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT,
FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
);
CREATE TABLE Suppliers
(
PostalCode TEXT, --
Address TEXT, --
SupplierID INTEGER PRIMARY KEY AUTOINCREMENT,
City TEXT, --
Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0
Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0
ContactName TEXT, --
Phone TEXT, --
SupplierName TEXT, --
);
CREATE TABLE EmployeesExtra
(
Salary INTEGER, --
Title TEXT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
EmployeeID INTEGER PRIMARY KEY,
);
CREATE TABLE discontinued_products
(
Discontinued INTEGER, --
ProductID INTEGER PRIMARY KEY,
);
CREATE TABLE Orders
(
OrderID INTEGER PRIMARY KEY AUTOINCREMENT,
CustomerID INTEGER, --
FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),
FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID),
FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),
ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0
OrderDate DATETIME, --
EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0
);
CREATE TABLE Territories
(
TerritoryDescription TEXT, --
RegionDescription TEXT, --
);
CREATE TABLE ShippingInfo
(
ShipCountry TEXT, --
ShippedDate DATETIME, --
FOREIGN KEY (OrderID) REFERENCES Orders(OrderID),
OrderID INTEGER PRIMARY KEY,
); |
superstore | List the products ordered by Becky Martin around the Central region. | ordered by Becky Martin refers to "Customer Name" = 'Becky Martin'; Region = 'Central'; products refers to "Product Name" | SELECT DISTINCT T3.`Product Name` FROM people AS T1 INNER JOIN central_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T2.`Product ID` WHERE T1.`Customer Name` = 'Becky Martin' AND T3.Region = 'Central' | CREATE TABLE west_superstore
(
Profit REAL, --
Region TEXT, -- Example Values: `West` | Value Statics: Total count 6406 - Distinct count 1 - Null count 0
"Product ID" TEXT, --
foreign key ("Product ID", Region) references product("Product ID",Region),
"Order Date" DATE, --
foreign key ("Customer ID", Region) references people("Customer ID",Region),
"Ship Mode" TEXT, -- Example Values: `Second Class`, `Standard Class`, `First Class`, `Same Day` | Value Statics: Total count 6406 - Distinct count 4 - Null count 0
"Customer ID" TEXT, --
"Order ID" TEXT, --
"Row ID" INTEGER primary key,
Sales REAL, --
Quantity INTEGER, -- Example Values: `3`, `5`, `4`, `10`, `2` | Value Statics: Total count 6406 - Distinct count 14 - Null count 0
Discount REAL, -- Example Values: `0.0`, `0.15`, `0.2`, `0.7`, `0.5` | Value Statics: Total count 6406 - Distinct count 5 - Null count 0
"Ship Date" DATE, --
);
CREATE TABLE people
(
Region TEXT, -- Example Values: `Central`, `East`, `West`, `South` | Value Statics: Total count 2501 - Distinct count 4 - Null count 0
Country TEXT, -- Example Values: `United States` | Value Statics: Total count 2501 - Distinct count 1 - Null count 0
State TEXT, --
primary key ("Customer ID", Region),
City TEXT, --
Segment TEXT, -- Example Values: `Consumer`, `Home Office`, `Corporate` | Value Statics: Total count 2501 - Distinct count 3 - Null count 0
"Customer ID" TEXT, --
"Postal Code" INTEGER, --
"Customer Name" TEXT, --
);
CREATE TABLE product
(
"Product ID" TEXT, --
Region TEXT, -- Example Values: `Central`, `South`, `West`, `East` | Value Statics: Total count 5298 - Distinct count 4 - Null count 0
"Sub-Category" TEXT, -- Example Values: `Bookcases`, `Chairs`, `Furnishings`, `Tables`, `Appliances` | Value Statics: Total count 5298 - Distinct count 17 - Null count 0
Category TEXT, -- Example Values: `Furniture`, `Office Supplies`, `Technology` | Value Statics: Total count 5298 - Distinct count 3 - Null count 0
"Product Name" TEXT, --
primary key ("Product ID", Region),
);
CREATE TABLE central_superstore
(
"Ship Mode" TEXT, -- Example Values: `Standard Class`, `First Class`, `Second Class`, `Same Day` | Value Statics: Total count 4646 - Distinct count 4 - Null count 0
Quantity INTEGER, -- Example Values: `2`, `3`, `7`, `1`, `5` | Value Statics: Total count 4646 - Distinct count 14 - Null count 0
"Ship Date" DATE, --
"Order Date" DATE, --
"Order ID" TEXT, --
"Row ID" INTEGER primary key,
"Product ID" TEXT, --
foreign key ("Customer ID", Region) references people("Customer ID",Region),
Sales REAL, --
foreign key ("Product ID", Region) references product("Product ID",Region),
Profit REAL, --
"Customer ID" TEXT, --
Discount REAL, -- Example Values: `0.2`, `0.8`, `0.6`, `0.0`, `0.1` | Value Statics: Total count 4646 - Distinct count 9 - Null count 0
Region TEXT, -- Example Values: `Central` | Value Statics: Total count 4646 - Distinct count 1 - Null count 0
);
CREATE TABLE east_superstore
(
"Row ID" INTEGER primary key,
Region TEXT, -- Example Values: `East` | Value Statics: Total count 5696 - Distinct count 1 - Null count 0
"Order ID" TEXT, --
"Product ID" TEXT, --
Sales REAL, --
foreign key ("Product ID", Region) references product("Product ID",Region),
Discount REAL, -- Example Values: `0.2`, `0.0`, `0.7`, `0.5`, `0.4` | Value Statics: Total count 5696 - Distinct count 7 - Null count 0
Quantity INTEGER, -- Example Values: `3`, `2`, `7`, `4`, `6` | Value Statics: Total count 5696 - Distinct count 14 - Null count 0
Profit REAL, --
foreign key ("Customer ID", Region) references people("Customer ID",Region),
"Ship Mode" TEXT, -- Example Values: `Standard Class`, `First Class`, `Second Class`, `Same Day` | Value Statics: Total count 5696 - Distinct count 4 - Null count 0
"Customer ID" TEXT, --
"Order Date" DATE, --
"Ship Date" DATE, --
);
CREATE TABLE south_superstore
(
"Product ID" TEXT, --
Profit REAL, --
Sales REAL, --
"Order Date" DATE, --
"Customer ID" TEXT, --
Discount REAL, -- Example Values: `0.0`, `0.7`, `0.2`, `0.5`, `0.45` | Value Statics: Total count 3240 - Distinct count 6 - Null count 0
Region TEXT, -- Example Values: `South` | Value Statics: Total count 3240 - Distinct count 1 - Null count 0
"Ship Date" DATE, --
foreign key ("Product ID", Region) references product("Product ID",Region),
foreign key ("Customer ID", Region) references people("Customer ID",Region),
Quantity INTEGER, -- Example Values: `3`, `9`, `2`, `4`, `1` | Value Statics: Total count 3240 - Distinct count 14 - Null count 0
"Order ID" TEXT, --
"Row ID" INTEGER primary key,
"Ship Mode" TEXT, -- Example Values: `First Class`, `Standard Class`, `Second Class`, `Same Day` | Value Statics: Total count 3240 - Distinct count 4 - Null count 0
); |
synthea | Among the patients that started taking Ibuprofen 200mg Oral Tablet in 2016, how many Dominican patients stopped taking the medicine after exactly one month? | Ibuprofen 200mg Oral Tablet refers to DESCRIPTION = 'Ibuprofen 200 MG Oral Tablet' from medications; started in 2016 refers to START like '2016%'; Dominican patients refer to ethnicity = 'dominican'; stopped taking the medicine after exactly one month refers to SUBTRACT(strftime('%m', STOP), strftime('%m', START)) = 1; | SELECT COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN medications AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Ibuprofen 200 MG Oral Tablet' AND T1.ethnicity = 'dominican' AND strftime('%Y', T2.START) = '2016' AND strftime('%m', T2.STOP) - strftime('%m', T2.START) = 1 | CREATE TABLE immunizations
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
DATE DATE, --
primary key (DATE, PATIENT, ENCOUNTER, CODE),
DESCRIPTION TEXT, -- Example Values: `Influenza seasonal injectable preservative free`, `Td (adult) preservative free`, `meningococcal MCV4P`, `Tdap`, `HPV quadrivalent` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
);
CREATE TABLE allergies
(
CODE INTEGER, -- Example Values: `232347008`, `300916003`, `419474003`, `424213003`, `300913006` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
foreign key (ENCOUNTER) references encounters(ID),
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
primary key (PATIENT, ENCOUNTER, CODE),
STOP TEXT, -- Example Values: `12/22/14`, `4/21/10`, `10/15/11`, `3/17/10`, `5/26/08` | Value Statics: Total count 16 - Distinct count 11 - Null count 556
START TEXT, --
DESCRIPTION TEXT, -- Example Values: `Allergy to dairy product`, `Allergy to tree pollen`, `Allergy to grass pollen`, `Dander (animal) allergy`, `House dust mite allergy` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
);
CREATE TABLE observations
(
DATE DATE, --
ENCOUNTER TEXT, --
VALUE REAL, --
UNITS TEXT, -- Example Values: `cm`, `kg`, `kg/m2`, `mmHg`, `Cel` | Value Statics: Total count 78444 - Distinct count 17 - Null count 455
DESCRIPTION TEXT, --
CODE TEXT, --
PATIENT TEXT, --
foreign key (PATIENT) references patients(patient),
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE medications
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, --
PATIENT TEXT, --
STOP DATE, --
START DATE, --
REASONDESCRIPTION TEXT, --
DESCRIPTION TEXT, --
primary key (START, PATIENT, ENCOUNTER, CODE),
foreign key (PATIENT) references patients(patient),
REASONCODE INTEGER, --
ENCOUNTER TEXT, --
);
CREATE TABLE careplans
(
START DATE, --
STOP DATE, --
ID TEXT, --
REASONCODE INTEGER, --
REASONDESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
DESCRIPTION TEXT, --
CODE REAL, --
ENCOUNTER TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE encounters
(
DATE DATE, --
REASONCODE INTEGER, --
CODE INTEGER, --
ID TEXT primary key,
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
REASONDESCRIPTION TEXT, --
);
CREATE TABLE procedures
(
foreign key (PATIENT) references patients(patient),
REASONDESCRIPTION TEXT, --
PATIENT TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
DATE DATE, --
DESCRIPTION TEXT, --
ENCOUNTER TEXT, --
CODE INTEGER, --
REASONCODE INTEGER, --
);
CREATE TABLE patients
(
suffix TEXT, -- Example Values: `PhD`, `JD`, `MD` | Value Statics: Total count 45 - Distinct count 3 - Null count 1417
prefix TEXT, -- Example Values: `Mr.`, `Mrs.`, `Ms.` | Value Statics: Total count 1166 - Distinct count 3 - Null count 296
deathdate DATE, --
ethnicity TEXT, --
race TEXT, -- Example Values: `black`, `white`, `hispanic`, `asian` | Value Statics: Total count 1462 - Distinct count 4 - Null count 0
address TEXT, --
birthplace TEXT, --
passport TEXT, --
maiden TEXT, --
birthdate DATE, --
marital TEXT, -- Example Values: `S`, `M` | Value Statics: Total count 1033 - Distinct count 2 - Null count 429
gender TEXT, -- Example Values: `F`, `M` | Value Statics: Total count 1462 - Distinct count 2 - Null count 0
drivers TEXT, --
first TEXT, --
last TEXT, --
patient TEXT primary key,
ssn TEXT, --
);
CREATE TABLE claims
(
ENCOUNTER TEXT references encounters, --
PATIENT TEXT references patients, --
ORGANIZATION TEXT, -- Example Values: `temp organization` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
TOTAL INTEGER, -- Example Values: `100` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
BILLABLEPERIOD DATE, --
DIAGNOSIS TEXT, --
ID TEXT primary key,
);
CREATE TABLE conditions
(
START DATE, --
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
CODE INTEGER, --
ENCOUNTER TEXT, --
STOP DATE, --
foreign key (ENCOUNTER) references encounters(ID),
foreign key (DESCRIPTION) references all_prevalences(ITEM),
);
CREATE TABLE all_prevalences
(
"POPULATION TYPE" TEXT, -- Example Values: `LIVING` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
"POPULATION COUNT" INTEGER, -- Example Values: `1000` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
ITEM TEXT primary key,
"PREVALENCE PERCENTAGE" REAL, --
"PREVALENCE RATE" REAL, --
OCCURRENCES INTEGER, --
); |
software_company | How many female customers have an education level of over 11? | education level of 11 refers to EDUCATIONNUM = 11; SEX = 'Female'; | SELECT COUNT(ID) FROM Customers WHERE EDUCATIONNUM > 11 AND SEX = 'Female' | CREATE TABLE Customers
(
EDUCATIONNUM INTEGER, -- Example Values: `7`, `3`, `4`, `11`, `5` | Value Statics: Total count 100000 - Distinct count 17 - Null count 0
MARITAL_STATUS TEXT, -- Example Values: `Never-married`, `Married-civ-spouse`, `Divorced`, `Widowed`, `Other` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
ID INTEGER constraint Customers_pk primary key,
SEX TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
OCCUPATION TEXT, -- Example Values: `Machine-op-inspct`, `Handlers-cleaners`, `Exec-managerial`, `Farming-fishing`, `Other-service` | Value Statics: Total count 100000 - Distinct count 8 - Null count 0
age INTEGER, --
GEOID INTEGER constraint Customers_Demog_GEOID_fk references Demog, --
);
CREATE TABLE Mailings1_2
(
RESPONSE TEXT, -- Example Values: `false`, `true` | Value Statics: Total count 60000 - Distinct count 2 - Null count 0
REFID INTEGER constraint Mailings1_2_pk primary key constraint Mailings1_2_Customers_ID_fk references Customers,
REF_DATE DATETIME, -- Example Values: `2007-02-01 12:00:00.0`, `2007-03-01 12:00:00.0` | Value Statics: Total count 60000 - Distinct count 2 - Null count 0
);
CREATE TABLE Sales
(
REFID INTEGER references Customers, --
EVENT_DATE DATETIME, --
AMOUNT REAL, --
EVENTID INTEGER constraint Sales_pk primary key,
);
CREATE TABLE Demog
(
A_VAR1 REAL, --
A_VAR2 REAL, --
A_VAR14 REAL, --
A_VAR8 REAL, --
A_VAR12 REAL, --
A_VAR6 REAL, --
A_VAR17 REAL, --
A_VAR15 REAL, --
A_VAR10 REAL, --
A_VAR16 REAL, --
INHABITANTS_K REAL, --
A_VAR3 REAL, --
A_VAR7 REAL, --
A_VAR4 REAL, --
A_VAR5 REAL, --
A_VAR13 REAL, --
A_VAR9 REAL, --
INCOME_K REAL, --
GEOID INTEGER constraint Demog_pk primary key,
A_VAR18 REAL, --
A_VAR11 REAL, --
);
CREATE TABLE mailings3
(
RESPONSE TEXT, -- Example Values: `false`, `true` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
REF_DATE DATETIME, -- Example Values: `2007-07-01 12:00:00.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
REFID INTEGER constraint mailings3_pk primary key,
); |
retail_world | Please calculate the number of orders from customers by country in 1996. | in 1996 refer to YEAR(OrderDate) = 1996; number of order = Count(OrderID) | SELECT COUNT(T2.CustomerID) FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE STRFTIME('%Y', T2.OrderDate) = '1996' GROUP BY T1.Country | CREATE TABLE Products
(
CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0
Unit TEXT, --
ReorderLevel INT, --
ProductName TEXT, --
Price REAL DEFAULT 0, --
FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),
SupplierID INTEGER, --
ProductID INTEGER PRIMARY KEY AUTOINCREMENT,
FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID),
);
CREATE TABLE Customers
(
ContactName TEXT, --
Country TEXT, --
Address TEXT, --
City TEXT, --
CustomerID INTEGER PRIMARY KEY AUTOINCREMENT,
PostalCode TEXT, --
CustomerName TEXT, --
);
CREATE TABLE EmployeeTerritories
(
TerritoryID INT, --
EmployeeID INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE OrderDetails
(
Quantity INTEGER, --
FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),
OrderID INTEGER, --
FOREIGN KEY (ProductID) REFERENCES Products (ProductID),
OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT,
ProductID INTEGER, --
);
CREATE TABLE Shippers
(
ShipperID INTEGER PRIMARY KEY AUTOINCREMENT,
ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
);
CREATE TABLE Territory
(
TerritoryDescription TEXT, --
RegionID INTEGER, --
TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT,
);
CREATE TABLE EmployeeDetails
(
EmployeeID INT PRIMARY KEY,
Title TEXT, --
Salary INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE Categories
(
CategoryID INTEGER PRIMARY KEY AUTOINCREMENT,
CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
);
CREATE TABLE Employees
(
Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT,
FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
);
CREATE TABLE Suppliers
(
PostalCode TEXT, --
Address TEXT, --
SupplierID INTEGER PRIMARY KEY AUTOINCREMENT,
City TEXT, --
Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0
Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0
ContactName TEXT, --
Phone TEXT, --
SupplierName TEXT, --
);
CREATE TABLE EmployeesExtra
(
Salary INTEGER, --
Title TEXT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
EmployeeID INTEGER PRIMARY KEY,
);
CREATE TABLE discontinued_products
(
Discontinued INTEGER, --
ProductID INTEGER PRIMARY KEY,
);
CREATE TABLE Orders
(
OrderID INTEGER PRIMARY KEY AUTOINCREMENT,
CustomerID INTEGER, --
FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),
FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID),
FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),
ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0
OrderDate DATETIME, --
EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0
);
CREATE TABLE Territories
(
TerritoryDescription TEXT, --
RegionDescription TEXT, --
);
CREATE TABLE ShippingInfo
(
ShipCountry TEXT, --
ShippedDate DATETIME, --
FOREIGN KEY (OrderID) REFERENCES Orders(OrderID),
OrderID INTEGER PRIMARY KEY,
); |
professional_basketball | What is the full name of the team that the 'NBA Coach of the Year' 1992 winner coached? | "NBA Coach of the Year" is the award; in 1992 refers to year = 1992; | SELECT name FROM teams AS T1 INNER JOIN coaches AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year INNER JOIN awards_coaches AS T3 ON T2.coachID = T3.coachID AND T2.year = T3.year WHERE T3.year = 1992 AND award = 'NBA Coach of the Year' | CREATE TABLE players_teams
(
PostGS INTEGER, --
PostdRebounds INTEGER, --
PostPF INTEGER, --
tmID TEXT, --
threeAttempted INTEGER, --
PostRebounds INTEGER, --
assists INTEGER, --
threeMade INTEGER, --
PostBlocks INTEGER, --
PostTurnovers INTEGER, --
GP INTEGER, --
lgID TEXT, -- Example Values: `NBA`, `NBL`, `ABA`, `ABL1`, `NPBL` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0
foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade,
PostfgMade INTEGER, --
steals INTEGER, --
oRebounds INTEGER, --
PostftAttempted INTEGER, --
ftAttempted INTEGER, --
ftMade INTEGER, --
points INTEGER, --
PostfgAttempted INTEGER, --
PostftMade INTEGER, --
note TEXT, -- Example Values: `C` | Value Statics: Total count 43 - Distinct count 1 - Null count 23708
dRebounds INTEGER, --
PostSteals INTEGER, --
blocks INTEGER, --
PostAssists INTEGER, --
minutes INTEGER, --
fgAttempted INTEGER, --
playerID TEXT not null references players on update cascade on delete cascade, --
PostthreeMade INTEGER, --
PostPoints INTEGER, --
year INTEGER, --
PF INTEGER, --
fgMade INTEGER, --
PostthreeAttempted INTEGER, --
rebounds INTEGER, --
id INTEGER primary key autoincrement,
stint INTEGER, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0
PostMinutes INTEGER, --
PostGP INTEGER, --
turnovers INTEGER, --
PostoRebounds INTEGER, --
GS INTEGER, --
);
CREATE TABLE awards_coaches
(
award TEXT, -- Example Values: `NBA Coach of the Year`, `ABA Coach of the Year` | Value Statics: Total count 61 - Distinct count 2 - Null count 0
id INTEGER primary key autoincrement,
note TEXT, -- Example Values: `tie` | Value Statics: Total count 4 - Distinct count 1 - Null count 57
coachID TEXT, --
lgID TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 61 - Distinct count 2 - Null count 0
foreign key (coachID, year) references coaches (coachID, year) on update cascade on delete cascade,
year INTEGER, --
);
CREATE TABLE draft
(
draftOverall INTEGER null, --
lgID TEXT null, -- Example Values: `ABA`, `NBA` | Value Statics: Total count 8621 - Distinct count 2 - Null count 0
suffixName TEXT null, -- Example Values: `Jr.` | Value Statics: Total count 2 - Distinct count 1 - Null count 8619
draftYear INTEGER null, --
draftSelection INTEGER null, --
tmID TEXT null, --
draftRound INTEGER null, --
lastName TEXT null, --
playerID TEXT null, --
draftFrom TEXT null, --
id INTEGER default 0 not null primary key,
firstName TEXT null, --
foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade,
foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade,
);
CREATE TABLE player_allstar
(
rebounds INTEGER null, --
playerID TEXT not null, --
season_id INTEGER not null, --
assists INTEGER null, --
conference TEXT null, -- Example Values: `East`, `West`, `Weset`, `Allstars`, `Denver` | Value Statics: Total count 1608 - Distinct count 5 - Null count 0
points INTEGER null, --
personal_fouls INTEGER null, -- Example Values: `3`, `2`, `0`, `1`, `5` | Value Statics: Total count 540 - Distinct count 8 - Null count 1068
ft_attempted INTEGER null, -- Example Values: `2`, `4`, `0`, `6`, `3` | Value Statics: Total count 1561 - Distinct count 17 - Null count 47
fg_attempted INTEGER null, --
league_id TEXT null, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 1608 - Distinct count 2 - Null count 0
foreign key (playerID) references players (playerID) on update cascade on delete cascade,
fg_made INTEGER null, -- Example Values: `4`, `8`, `5`, `7`, `3` | Value Statics: Total count 1561 - Distinct count 18 - Null count 47
ft_made INTEGER null, -- Example Values: `2`, `3`, `0`, `1`, `4` | Value Statics: Total count 1561 - Distinct count 13 - Null count 47
steals INTEGER null, -- Example Values: `3`, `0`, `1`, `2`, `5` | Value Statics: Total count 398 - Distinct count 7 - Null count 1210
games_played INTEGER null, -- Example Values: `1` | Value Statics: Total count 1608 - Distinct count 1 - Null count 0
first_name TEXT null, --
d_rebounds INTEGER null, -- Example Values: `2`, `5`, `0`, `1`, `4` | Value Statics: Total count 493 - Distinct count 14 - Null count 1115
last_name TEXT null, --
primary key (playerID, season_id),
turnovers INTEGER null, -- Example Values: `1`, `0`, `3`, `2`, `4` | Value Statics: Total count 493 - Distinct count 9 - Null count 1115
three_made INTEGER null, -- Example Values: `0`, `1`, `3`, `5`, `4` | Value Statics: Total count 566 - Distinct count 7 - Null count 1042
minutes INTEGER null, --
blocks INTEGER null, -- Example Values: `2`, `0`, `1`, `3`, `5` | Value Statics: Total count 398 - Distinct count 6 - Null count 1210
three_attempted INTEGER null, -- Example Values: `0`, `1`, `6`, `7`, `10` | Value Statics: Total count 540 - Distinct count 12 - Null count 1068
o_rebounds INTEGER null, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 493 - Distinct count 10 - Null count 1115
);
CREATE TABLE awards_players
(
foreign key (playerID) references players (playerID) on update cascade on delete cascade,
year INTEGER not null, --
pos TEXT null, -- Example Values: `C`, `F`, `G`, `F/G`, `F/C` | Value Statics: Total count 833 - Distinct count 5 - Null count 886
primary key (playerID, year, award),
lgID TEXT null, -- Example Values: `NBA`, `ABA`, `NBL`, `ABL1` | Value Statics: Total count 1719 - Distinct count 4 - Null count 0
award TEXT not null, --
playerID TEXT not null, --
note TEXT null, -- Example Values: `tie` | Value Statics: Total count 37 - Distinct count 1 - Null count 1682
);
CREATE TABLE series_post
(
tmIDLoser TEXT, --
id INTEGER primary key autoincrement,
series TEXT, -- Example Values: `O`, `M`, `N`, `A`, `K` | Value Statics: Total count 775 - Distinct count 11 - Null count 0
tmIDWinner TEXT, --
round TEXT, -- Example Values: `F`, `QF`, `SF`, `DT`, `DF` | Value Statics: Total count 775 - Distinct count 11 - Null count 0
year INTEGER, --
foreign key (tmIDLoser, year) references teams (tmID, year) on update cascade on delete cascade,
foreign key (tmIDWinner, year) references teams (tmID, year) on update cascade on delete cascade,
W INTEGER, -- Example Values: `4`, `2`, `1`, `3`, `0` | Value Statics: Total count 775 - Distinct count 5 - Null count 0
lgIDLoser TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0
lgIDWinner TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0
L INTEGER, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 775 - Distinct count 5 - Null count 0
);
CREATE TABLE players
(
nameGiven TEXT null, -- Example Values: `nameGiven`, `Mort`, `Robert`, `Jim`, `Mike` | Value Statics: Total count 10 - Distinct count 9 - Null count 5052
lastseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15
hsCountry TEXT null, --
firstName TEXT null, --
hsCity TEXT null, --
firstseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15
weight INTEGER null, --
birthCountry TEXT null, --
race TEXT null, -- Example Values: `B`, `W`, `O`, `1`, `r` | Value Statics: Total count 4903 - Distinct count 5 - Null count 159
lastName TEXT null, --
birthDate DATE null, --
collegeOther TEXT null, --
birthState TEXT null, --
useFirst TEXT null, --
pos TEXT null, -- Example Values: `F-C`, `C`, `G`, `G-F`, `C-F` | Value Statics: Total count 4880 - Distinct count 14 - Null count 182
playerID TEXT not null primary key,
college TEXT null, --
highSchool TEXT null, --
hsState TEXT null, --
height REAL null, --
deathDate DATE null, --
nameSuffix TEXT null, -- Example Values: `Jr.`, `III`, `nameSuffix`, `II`, `IV` | Value Statics: Total count 324 - Distinct count 6 - Null count 4738
nameNick TEXT null, --
fullGivenName TEXT null, --
birthCity TEXT null, --
middleName TEXT null, --
);
CREATE TABLE teams
(
d_pts INTEGER null, --
name TEXT null, --
homeLost INTEGER null, --
o_ftm INTEGER null, --
franchID TEXT null, --
tmID TEXT not null, --
awayWon INTEGER null, --
primary key (year, tmID),
o_fgm INTEGER null, --
year INTEGER not null, --
awayLost INTEGER null, --
arena TEXT null, --
confID TEXT null, -- Example Values: `EC`, `WC` | Value Statics: Total count 1064 - Distinct count 2 - Null count 472
games INTEGER null, --
lost INTEGER null, --
divID TEXT null, -- Example Values: `EA`, `WE`, `ED`, `WD`, `SO` | Value Statics: Total count 1498 - Distinct count 13 - Null count 38
lgID TEXT null, -- Example Values: `NBL`, `NBA`, `PBLA`, `NPBL`, `ABL1` | Value Statics: Total count 1536 - Distinct count 6 - Null count 0
homeWon INTEGER null, --
confRank INTEGER null, -- Example Values: `0`, `4`, `3`, `5`, `7` | Value Statics: Total count 1536 - Distinct count 16 - Null count 0
o_pts INTEGER null, --
`rank` INTEGER null, -- Example Values: `1`, `2`, `4`, `5`, `6` | Value Statics: Total count 1536 - Distinct count 10 - Null count 0
playoff TEXT null, -- Example Values: `CF`, `WC`, `LC`, `CS`, `F` | Value Statics: Total count 901 - Distinct count 15 - Null count 635
won INTEGER null, --
);
CREATE TABLE coaches
(
primary key (coachID, year, tmID, stint),
lgID TEXT null, -- Example Values: `NBA`, `ABA`, `ABL1`, `PBLA`, `NPBL` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0
post_losses INTEGER null, -- Example Values: `3`, `9`, `7`, `8`, `0` | Value Statics: Total count 1649 - Distinct count 12 - Null count 40
year INTEGER not null, --
won INTEGER null, --
foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade,
post_wins INTEGER null, -- Example Values: `0`, `12`, `9`, `13`, `1` | Value Statics: Total count 1649 - Distinct count 17 - Null count 40
coachID TEXT not null, --
tmID TEXT not null, --
lost INTEGER null, --
stint INTEGER not null, -- Example Values: `2`, `1`, `4`, `5`, `3` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0
); |
synthea | How many patients have the most prevalent conditions? | the most prevalent conditions refer to MAX(PREVALENCE RATE); | SELECT COUNT(DISTINCT T2.patient) FROM all_prevalences AS T1 INNER JOIN conditions AS T2 ON lower(T1.ITEM) = lower(T2.DESCRIPTION) ORDER BY T1."PREVALENCE RATE" DESC LIMIT 1 | CREATE TABLE immunizations
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
DATE DATE, --
primary key (DATE, PATIENT, ENCOUNTER, CODE),
DESCRIPTION TEXT, -- Example Values: `Influenza seasonal injectable preservative free`, `Td (adult) preservative free`, `meningococcal MCV4P`, `Tdap`, `HPV quadrivalent` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
);
CREATE TABLE allergies
(
CODE INTEGER, -- Example Values: `232347008`, `300916003`, `419474003`, `424213003`, `300913006` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
foreign key (ENCOUNTER) references encounters(ID),
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
primary key (PATIENT, ENCOUNTER, CODE),
STOP TEXT, -- Example Values: `12/22/14`, `4/21/10`, `10/15/11`, `3/17/10`, `5/26/08` | Value Statics: Total count 16 - Distinct count 11 - Null count 556
START TEXT, --
DESCRIPTION TEXT, -- Example Values: `Allergy to dairy product`, `Allergy to tree pollen`, `Allergy to grass pollen`, `Dander (animal) allergy`, `House dust mite allergy` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
);
CREATE TABLE observations
(
DATE DATE, --
ENCOUNTER TEXT, --
VALUE REAL, --
UNITS TEXT, -- Example Values: `cm`, `kg`, `kg/m2`, `mmHg`, `Cel` | Value Statics: Total count 78444 - Distinct count 17 - Null count 455
DESCRIPTION TEXT, --
CODE TEXT, --
PATIENT TEXT, --
foreign key (PATIENT) references patients(patient),
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE medications
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, --
PATIENT TEXT, --
STOP DATE, --
START DATE, --
REASONDESCRIPTION TEXT, --
DESCRIPTION TEXT, --
primary key (START, PATIENT, ENCOUNTER, CODE),
foreign key (PATIENT) references patients(patient),
REASONCODE INTEGER, --
ENCOUNTER TEXT, --
);
CREATE TABLE careplans
(
START DATE, --
STOP DATE, --
ID TEXT, --
REASONCODE INTEGER, --
REASONDESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
DESCRIPTION TEXT, --
CODE REAL, --
ENCOUNTER TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE encounters
(
DATE DATE, --
REASONCODE INTEGER, --
CODE INTEGER, --
ID TEXT primary key,
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
REASONDESCRIPTION TEXT, --
);
CREATE TABLE procedures
(
foreign key (PATIENT) references patients(patient),
REASONDESCRIPTION TEXT, --
PATIENT TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
DATE DATE, --
DESCRIPTION TEXT, --
ENCOUNTER TEXT, --
CODE INTEGER, --
REASONCODE INTEGER, --
);
CREATE TABLE patients
(
suffix TEXT, -- Example Values: `PhD`, `JD`, `MD` | Value Statics: Total count 45 - Distinct count 3 - Null count 1417
prefix TEXT, -- Example Values: `Mr.`, `Mrs.`, `Ms.` | Value Statics: Total count 1166 - Distinct count 3 - Null count 296
deathdate DATE, --
ethnicity TEXT, --
race TEXT, -- Example Values: `black`, `white`, `hispanic`, `asian` | Value Statics: Total count 1462 - Distinct count 4 - Null count 0
address TEXT, --
birthplace TEXT, --
passport TEXT, --
maiden TEXT, --
birthdate DATE, --
marital TEXT, -- Example Values: `S`, `M` | Value Statics: Total count 1033 - Distinct count 2 - Null count 429
gender TEXT, -- Example Values: `F`, `M` | Value Statics: Total count 1462 - Distinct count 2 - Null count 0
drivers TEXT, --
first TEXT, --
last TEXT, --
patient TEXT primary key,
ssn TEXT, --
);
CREATE TABLE claims
(
ENCOUNTER TEXT references encounters, --
PATIENT TEXT references patients, --
ORGANIZATION TEXT, -- Example Values: `temp organization` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
TOTAL INTEGER, -- Example Values: `100` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
BILLABLEPERIOD DATE, --
DIAGNOSIS TEXT, --
ID TEXT primary key,
);
CREATE TABLE conditions
(
START DATE, --
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
CODE INTEGER, --
ENCOUNTER TEXT, --
STOP DATE, --
foreign key (ENCOUNTER) references encounters(ID),
foreign key (DESCRIPTION) references all_prevalences(ITEM),
);
CREATE TABLE all_prevalences
(
"POPULATION TYPE" TEXT, -- Example Values: `LIVING` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
"POPULATION COUNT" INTEGER, -- Example Values: `1000` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
ITEM TEXT primary key,
"PREVALENCE PERCENTAGE" REAL, --
"PREVALENCE RATE" REAL, --
OCCURRENCES INTEGER, --
); |
software_company | Among the customers over 30, how many of them are Machine-op-inspcts? | over 30 refers to age > 30; OCCUPATION = 'Machine-op-inspct'; | SELECT COUNT(ID) FROM Customers WHERE OCCUPATION = 'Machine-op-inspct' AND age > 30 | CREATE TABLE Customers
(
EDUCATIONNUM INTEGER, -- Example Values: `7`, `3`, `4`, `11`, `5` | Value Statics: Total count 100000 - Distinct count 17 - Null count 0
MARITAL_STATUS TEXT, -- Example Values: `Never-married`, `Married-civ-spouse`, `Divorced`, `Widowed`, `Other` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
ID INTEGER constraint Customers_pk primary key,
SEX TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
OCCUPATION TEXT, -- Example Values: `Machine-op-inspct`, `Handlers-cleaners`, `Exec-managerial`, `Farming-fishing`, `Other-service` | Value Statics: Total count 100000 - Distinct count 8 - Null count 0
age INTEGER, --
GEOID INTEGER constraint Customers_Demog_GEOID_fk references Demog, --
);
CREATE TABLE Mailings1_2
(
RESPONSE TEXT, -- Example Values: `false`, `true` | Value Statics: Total count 60000 - Distinct count 2 - Null count 0
REFID INTEGER constraint Mailings1_2_pk primary key constraint Mailings1_2_Customers_ID_fk references Customers,
REF_DATE DATETIME, -- Example Values: `2007-02-01 12:00:00.0`, `2007-03-01 12:00:00.0` | Value Statics: Total count 60000 - Distinct count 2 - Null count 0
);
CREATE TABLE Sales
(
REFID INTEGER references Customers, --
EVENT_DATE DATETIME, --
AMOUNT REAL, --
EVENTID INTEGER constraint Sales_pk primary key,
);
CREATE TABLE Demog
(
A_VAR1 REAL, --
A_VAR2 REAL, --
A_VAR14 REAL, --
A_VAR8 REAL, --
A_VAR12 REAL, --
A_VAR6 REAL, --
A_VAR17 REAL, --
A_VAR15 REAL, --
A_VAR10 REAL, --
A_VAR16 REAL, --
INHABITANTS_K REAL, --
A_VAR3 REAL, --
A_VAR7 REAL, --
A_VAR4 REAL, --
A_VAR5 REAL, --
A_VAR13 REAL, --
A_VAR9 REAL, --
INCOME_K REAL, --
GEOID INTEGER constraint Demog_pk primary key,
A_VAR18 REAL, --
A_VAR11 REAL, --
);
CREATE TABLE mailings3
(
RESPONSE TEXT, -- Example Values: `false`, `true` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
REF_DATE DATETIME, -- Example Values: `2007-07-01 12:00:00.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
REFID INTEGER constraint mailings3_pk primary key,
); |
retail_world | Which company had the most orders in 1998? | in 1998 refers to YEAR (OrderDate) = 1998; most orders = Max(Count(CustomerID)); company refers to CompanyName | SELECT T1.CompanyName FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE STRFTIME('%Y', T2.OrderDate) = '1998' GROUP BY T1.CompanyName ORDER BY COUNT(T2.OrderID) DESC LIMIT 1 | CREATE TABLE Products
(
CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0
Unit TEXT, --
ReorderLevel INT, --
ProductName TEXT, --
Price REAL DEFAULT 0, --
FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),
SupplierID INTEGER, --
ProductID INTEGER PRIMARY KEY AUTOINCREMENT,
FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID),
);
CREATE TABLE Customers
(
ContactName TEXT, --
Country TEXT, --
Address TEXT, --
City TEXT, --
CustomerID INTEGER PRIMARY KEY AUTOINCREMENT,
PostalCode TEXT, --
CustomerName TEXT, --
);
CREATE TABLE EmployeeTerritories
(
TerritoryID INT, --
EmployeeID INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE OrderDetails
(
Quantity INTEGER, --
FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),
OrderID INTEGER, --
FOREIGN KEY (ProductID) REFERENCES Products (ProductID),
OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT,
ProductID INTEGER, --
);
CREATE TABLE Shippers
(
ShipperID INTEGER PRIMARY KEY AUTOINCREMENT,
ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
);
CREATE TABLE Territory
(
TerritoryDescription TEXT, --
RegionID INTEGER, --
TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT,
);
CREATE TABLE EmployeeDetails
(
EmployeeID INT PRIMARY KEY,
Title TEXT, --
Salary INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE Categories
(
CategoryID INTEGER PRIMARY KEY AUTOINCREMENT,
CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
);
CREATE TABLE Employees
(
Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT,
FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
);
CREATE TABLE Suppliers
(
PostalCode TEXT, --
Address TEXT, --
SupplierID INTEGER PRIMARY KEY AUTOINCREMENT,
City TEXT, --
Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0
Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0
ContactName TEXT, --
Phone TEXT, --
SupplierName TEXT, --
);
CREATE TABLE EmployeesExtra
(
Salary INTEGER, --
Title TEXT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
EmployeeID INTEGER PRIMARY KEY,
);
CREATE TABLE discontinued_products
(
Discontinued INTEGER, --
ProductID INTEGER PRIMARY KEY,
);
CREATE TABLE Orders
(
OrderID INTEGER PRIMARY KEY AUTOINCREMENT,
CustomerID INTEGER, --
FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),
FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID),
FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),
ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0
OrderDate DATETIME, --
EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0
);
CREATE TABLE Territories
(
TerritoryDescription TEXT, --
RegionDescription TEXT, --
);
CREATE TABLE ShippingInfo
(
ShipCountry TEXT, --
ShippedDate DATETIME, --
FOREIGN KEY (OrderID) REFERENCES Orders(OrderID),
OrderID INTEGER PRIMARY KEY,
); |
superstore | How many customers in Chicago ordered at least 10 Cardinal EasyOpen D-Ring Binders in a single order? | at least 10 goods refers to Quantity > = 14; Cardinal EasyOpen D-Ring Binders refers to "Product Name"; customers in Chicago refers to City = 'Chicago' | SELECT COUNT(DISTINCT T1.`Customer ID`) FROM west_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T1.`Product ID` WHERE T3.`Product Name` = 'Cardinal EasyOpen D-Ring Binders' AND T2.City = 'Chicago' AND T1.Quantity > 10 | CREATE TABLE west_superstore
(
Profit REAL, --
Region TEXT, -- Example Values: `West` | Value Statics: Total count 6406 - Distinct count 1 - Null count 0
"Product ID" TEXT, --
foreign key ("Product ID", Region) references product("Product ID",Region),
"Order Date" DATE, --
foreign key ("Customer ID", Region) references people("Customer ID",Region),
"Ship Mode" TEXT, -- Example Values: `Second Class`, `Standard Class`, `First Class`, `Same Day` | Value Statics: Total count 6406 - Distinct count 4 - Null count 0
"Customer ID" TEXT, --
"Order ID" TEXT, --
"Row ID" INTEGER primary key,
Sales REAL, --
Quantity INTEGER, -- Example Values: `3`, `5`, `4`, `10`, `2` | Value Statics: Total count 6406 - Distinct count 14 - Null count 0
Discount REAL, -- Example Values: `0.0`, `0.15`, `0.2`, `0.7`, `0.5` | Value Statics: Total count 6406 - Distinct count 5 - Null count 0
"Ship Date" DATE, --
);
CREATE TABLE people
(
Region TEXT, -- Example Values: `Central`, `East`, `West`, `South` | Value Statics: Total count 2501 - Distinct count 4 - Null count 0
Country TEXT, -- Example Values: `United States` | Value Statics: Total count 2501 - Distinct count 1 - Null count 0
State TEXT, --
primary key ("Customer ID", Region),
City TEXT, --
Segment TEXT, -- Example Values: `Consumer`, `Home Office`, `Corporate` | Value Statics: Total count 2501 - Distinct count 3 - Null count 0
"Customer ID" TEXT, --
"Postal Code" INTEGER, --
"Customer Name" TEXT, --
);
CREATE TABLE product
(
"Product ID" TEXT, --
Region TEXT, -- Example Values: `Central`, `South`, `West`, `East` | Value Statics: Total count 5298 - Distinct count 4 - Null count 0
"Sub-Category" TEXT, -- Example Values: `Bookcases`, `Chairs`, `Furnishings`, `Tables`, `Appliances` | Value Statics: Total count 5298 - Distinct count 17 - Null count 0
Category TEXT, -- Example Values: `Furniture`, `Office Supplies`, `Technology` | Value Statics: Total count 5298 - Distinct count 3 - Null count 0
"Product Name" TEXT, --
primary key ("Product ID", Region),
);
CREATE TABLE central_superstore
(
"Ship Mode" TEXT, -- Example Values: `Standard Class`, `First Class`, `Second Class`, `Same Day` | Value Statics: Total count 4646 - Distinct count 4 - Null count 0
Quantity INTEGER, -- Example Values: `2`, `3`, `7`, `1`, `5` | Value Statics: Total count 4646 - Distinct count 14 - Null count 0
"Ship Date" DATE, --
"Order Date" DATE, --
"Order ID" TEXT, --
"Row ID" INTEGER primary key,
"Product ID" TEXT, --
foreign key ("Customer ID", Region) references people("Customer ID",Region),
Sales REAL, --
foreign key ("Product ID", Region) references product("Product ID",Region),
Profit REAL, --
"Customer ID" TEXT, --
Discount REAL, -- Example Values: `0.2`, `0.8`, `0.6`, `0.0`, `0.1` | Value Statics: Total count 4646 - Distinct count 9 - Null count 0
Region TEXT, -- Example Values: `Central` | Value Statics: Total count 4646 - Distinct count 1 - Null count 0
);
CREATE TABLE east_superstore
(
"Row ID" INTEGER primary key,
Region TEXT, -- Example Values: `East` | Value Statics: Total count 5696 - Distinct count 1 - Null count 0
"Order ID" TEXT, --
"Product ID" TEXT, --
Sales REAL, --
foreign key ("Product ID", Region) references product("Product ID",Region),
Discount REAL, -- Example Values: `0.2`, `0.0`, `0.7`, `0.5`, `0.4` | Value Statics: Total count 5696 - Distinct count 7 - Null count 0
Quantity INTEGER, -- Example Values: `3`, `2`, `7`, `4`, `6` | Value Statics: Total count 5696 - Distinct count 14 - Null count 0
Profit REAL, --
foreign key ("Customer ID", Region) references people("Customer ID",Region),
"Ship Mode" TEXT, -- Example Values: `Standard Class`, `First Class`, `Second Class`, `Same Day` | Value Statics: Total count 5696 - Distinct count 4 - Null count 0
"Customer ID" TEXT, --
"Order Date" DATE, --
"Ship Date" DATE, --
);
CREATE TABLE south_superstore
(
"Product ID" TEXT, --
Profit REAL, --
Sales REAL, --
"Order Date" DATE, --
"Customer ID" TEXT, --
Discount REAL, -- Example Values: `0.0`, `0.7`, `0.2`, `0.5`, `0.45` | Value Statics: Total count 3240 - Distinct count 6 - Null count 0
Region TEXT, -- Example Values: `South` | Value Statics: Total count 3240 - Distinct count 1 - Null count 0
"Ship Date" DATE, --
foreign key ("Product ID", Region) references product("Product ID",Region),
foreign key ("Customer ID", Region) references people("Customer ID",Region),
Quantity INTEGER, -- Example Values: `3`, `9`, `2`, `4`, `1` | Value Statics: Total count 3240 - Distinct count 14 - Null count 0
"Order ID" TEXT, --
"Row ID" INTEGER primary key,
"Ship Mode" TEXT, -- Example Values: `First Class`, `Standard Class`, `Second Class`, `Same Day` | Value Statics: Total count 3240 - Distinct count 4 - Null count 0
); |
synthea | What are the full names of the patients who started taking Yaz 28 Day Pack in 2011? | full name refers to first, last; Yaz 28 Day Pack refers to DESCRIPTION = 'Yaz 28 Day Pack' from medications; started taking in 2011 refers to START like '2011%'; | SELECT DISTINCT T1.first, T1.last, T1.suffix FROM patients AS T1 INNER JOIN medications AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Yaz 28 Day Pack' AND strftime('%Y', T2.START) = '2011' | CREATE TABLE immunizations
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
DATE DATE, --
primary key (DATE, PATIENT, ENCOUNTER, CODE),
DESCRIPTION TEXT, -- Example Values: `Influenza seasonal injectable preservative free`, `Td (adult) preservative free`, `meningococcal MCV4P`, `Tdap`, `HPV quadrivalent` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
);
CREATE TABLE allergies
(
CODE INTEGER, -- Example Values: `232347008`, `300916003`, `419474003`, `424213003`, `300913006` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
foreign key (ENCOUNTER) references encounters(ID),
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
primary key (PATIENT, ENCOUNTER, CODE),
STOP TEXT, -- Example Values: `12/22/14`, `4/21/10`, `10/15/11`, `3/17/10`, `5/26/08` | Value Statics: Total count 16 - Distinct count 11 - Null count 556
START TEXT, --
DESCRIPTION TEXT, -- Example Values: `Allergy to dairy product`, `Allergy to tree pollen`, `Allergy to grass pollen`, `Dander (animal) allergy`, `House dust mite allergy` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
);
CREATE TABLE observations
(
DATE DATE, --
ENCOUNTER TEXT, --
VALUE REAL, --
UNITS TEXT, -- Example Values: `cm`, `kg`, `kg/m2`, `mmHg`, `Cel` | Value Statics: Total count 78444 - Distinct count 17 - Null count 455
DESCRIPTION TEXT, --
CODE TEXT, --
PATIENT TEXT, --
foreign key (PATIENT) references patients(patient),
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE medications
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, --
PATIENT TEXT, --
STOP DATE, --
START DATE, --
REASONDESCRIPTION TEXT, --
DESCRIPTION TEXT, --
primary key (START, PATIENT, ENCOUNTER, CODE),
foreign key (PATIENT) references patients(patient),
REASONCODE INTEGER, --
ENCOUNTER TEXT, --
);
CREATE TABLE careplans
(
START DATE, --
STOP DATE, --
ID TEXT, --
REASONCODE INTEGER, --
REASONDESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
DESCRIPTION TEXT, --
CODE REAL, --
ENCOUNTER TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE encounters
(
DATE DATE, --
REASONCODE INTEGER, --
CODE INTEGER, --
ID TEXT primary key,
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
REASONDESCRIPTION TEXT, --
);
CREATE TABLE procedures
(
foreign key (PATIENT) references patients(patient),
REASONDESCRIPTION TEXT, --
PATIENT TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
DATE DATE, --
DESCRIPTION TEXT, --
ENCOUNTER TEXT, --
CODE INTEGER, --
REASONCODE INTEGER, --
);
CREATE TABLE patients
(
suffix TEXT, -- Example Values: `PhD`, `JD`, `MD` | Value Statics: Total count 45 - Distinct count 3 - Null count 1417
prefix TEXT, -- Example Values: `Mr.`, `Mrs.`, `Ms.` | Value Statics: Total count 1166 - Distinct count 3 - Null count 296
deathdate DATE, --
ethnicity TEXT, --
race TEXT, -- Example Values: `black`, `white`, `hispanic`, `asian` | Value Statics: Total count 1462 - Distinct count 4 - Null count 0
address TEXT, --
birthplace TEXT, --
passport TEXT, --
maiden TEXT, --
birthdate DATE, --
marital TEXT, -- Example Values: `S`, `M` | Value Statics: Total count 1033 - Distinct count 2 - Null count 429
gender TEXT, -- Example Values: `F`, `M` | Value Statics: Total count 1462 - Distinct count 2 - Null count 0
drivers TEXT, --
first TEXT, --
last TEXT, --
patient TEXT primary key,
ssn TEXT, --
);
CREATE TABLE claims
(
ENCOUNTER TEXT references encounters, --
PATIENT TEXT references patients, --
ORGANIZATION TEXT, -- Example Values: `temp organization` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
TOTAL INTEGER, -- Example Values: `100` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
BILLABLEPERIOD DATE, --
DIAGNOSIS TEXT, --
ID TEXT primary key,
);
CREATE TABLE conditions
(
START DATE, --
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
CODE INTEGER, --
ENCOUNTER TEXT, --
STOP DATE, --
foreign key (ENCOUNTER) references encounters(ID),
foreign key (DESCRIPTION) references all_prevalences(ITEM),
);
CREATE TABLE all_prevalences
(
"POPULATION TYPE" TEXT, -- Example Values: `LIVING` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
"POPULATION COUNT" INTEGER, -- Example Values: `1000` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
ITEM TEXT primary key,
"PREVALENCE PERCENTAGE" REAL, --
"PREVALENCE RATE" REAL, --
OCCURRENCES INTEGER, --
); |
software_company | Of the first 60,000 customers' responses to the incentive mailing sent by the marketing department, how many of them are considered a true response? | RESPONSE = 'true'; | SELECT COUNT(REFID) custmoer_number FROM Mailings1_2 WHERE RESPONSE = 'true' | CREATE TABLE Customers
(
EDUCATIONNUM INTEGER, -- Example Values: `7`, `3`, `4`, `11`, `5` | Value Statics: Total count 100000 - Distinct count 17 - Null count 0
MARITAL_STATUS TEXT, -- Example Values: `Never-married`, `Married-civ-spouse`, `Divorced`, `Widowed`, `Other` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
ID INTEGER constraint Customers_pk primary key,
SEX TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
OCCUPATION TEXT, -- Example Values: `Machine-op-inspct`, `Handlers-cleaners`, `Exec-managerial`, `Farming-fishing`, `Other-service` | Value Statics: Total count 100000 - Distinct count 8 - Null count 0
age INTEGER, --
GEOID INTEGER constraint Customers_Demog_GEOID_fk references Demog, --
);
CREATE TABLE Mailings1_2
(
RESPONSE TEXT, -- Example Values: `false`, `true` | Value Statics: Total count 60000 - Distinct count 2 - Null count 0
REFID INTEGER constraint Mailings1_2_pk primary key constraint Mailings1_2_Customers_ID_fk references Customers,
REF_DATE DATETIME, -- Example Values: `2007-02-01 12:00:00.0`, `2007-03-01 12:00:00.0` | Value Statics: Total count 60000 - Distinct count 2 - Null count 0
);
CREATE TABLE Sales
(
REFID INTEGER references Customers, --
EVENT_DATE DATETIME, --
AMOUNT REAL, --
EVENTID INTEGER constraint Sales_pk primary key,
);
CREATE TABLE Demog
(
A_VAR1 REAL, --
A_VAR2 REAL, --
A_VAR14 REAL, --
A_VAR8 REAL, --
A_VAR12 REAL, --
A_VAR6 REAL, --
A_VAR17 REAL, --
A_VAR15 REAL, --
A_VAR10 REAL, --
A_VAR16 REAL, --
INHABITANTS_K REAL, --
A_VAR3 REAL, --
A_VAR7 REAL, --
A_VAR4 REAL, --
A_VAR5 REAL, --
A_VAR13 REAL, --
A_VAR9 REAL, --
INCOME_K REAL, --
GEOID INTEGER constraint Demog_pk primary key,
A_VAR18 REAL, --
A_VAR11 REAL, --
);
CREATE TABLE mailings3
(
RESPONSE TEXT, -- Example Values: `false`, `true` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
REF_DATE DATETIME, -- Example Values: `2007-07-01 12:00:00.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
REFID INTEGER constraint mailings3_pk primary key,
); |
retail_world | In 1996, how many orders were from customers in the UK? | in 1996 refers to YEAR (OrderDate) = 1996; 'UK' is the Country; | SELECT COUNT(T1.CustomerID) FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE STRFTIME('%Y', T2.OrderDate) = '1996' AND T1.Country = 'UK' | CREATE TABLE Products
(
CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0
Unit TEXT, --
ReorderLevel INT, --
ProductName TEXT, --
Price REAL DEFAULT 0, --
FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),
SupplierID INTEGER, --
ProductID INTEGER PRIMARY KEY AUTOINCREMENT,
FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID),
);
CREATE TABLE Customers
(
ContactName TEXT, --
Country TEXT, --
Address TEXT, --
City TEXT, --
CustomerID INTEGER PRIMARY KEY AUTOINCREMENT,
PostalCode TEXT, --
CustomerName TEXT, --
);
CREATE TABLE EmployeeTerritories
(
TerritoryID INT, --
EmployeeID INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE OrderDetails
(
Quantity INTEGER, --
FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),
OrderID INTEGER, --
FOREIGN KEY (ProductID) REFERENCES Products (ProductID),
OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT,
ProductID INTEGER, --
);
CREATE TABLE Shippers
(
ShipperID INTEGER PRIMARY KEY AUTOINCREMENT,
ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
);
CREATE TABLE Territory
(
TerritoryDescription TEXT, --
RegionID INTEGER, --
TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT,
);
CREATE TABLE EmployeeDetails
(
EmployeeID INT PRIMARY KEY,
Title TEXT, --
Salary INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE Categories
(
CategoryID INTEGER PRIMARY KEY AUTOINCREMENT,
CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
);
CREATE TABLE Employees
(
Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT,
FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
);
CREATE TABLE Suppliers
(
PostalCode TEXT, --
Address TEXT, --
SupplierID INTEGER PRIMARY KEY AUTOINCREMENT,
City TEXT, --
Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0
Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0
ContactName TEXT, --
Phone TEXT, --
SupplierName TEXT, --
);
CREATE TABLE EmployeesExtra
(
Salary INTEGER, --
Title TEXT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
EmployeeID INTEGER PRIMARY KEY,
);
CREATE TABLE discontinued_products
(
Discontinued INTEGER, --
ProductID INTEGER PRIMARY KEY,
);
CREATE TABLE Orders
(
OrderID INTEGER PRIMARY KEY AUTOINCREMENT,
CustomerID INTEGER, --
FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),
FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID),
FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),
ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0
OrderDate DATETIME, --
EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0
);
CREATE TABLE Territories
(
TerritoryDescription TEXT, --
RegionDescription TEXT, --
);
CREATE TABLE ShippingInfo
(
ShipCountry TEXT, --
ShippedDate DATETIME, --
FOREIGN KEY (OrderID) REFERENCES Orders(OrderID),
OrderID INTEGER PRIMARY KEY,
); |
synthea | How many stroke patients have married? | stroke refers to conditions where DESCRIPTION = 'Stroke'; married refers to the marital status of the patient in which marital = 'M'; | SELECT COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Stroke' AND T1.marital = 'M' | CREATE TABLE immunizations
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
DATE DATE, --
primary key (DATE, PATIENT, ENCOUNTER, CODE),
DESCRIPTION TEXT, -- Example Values: `Influenza seasonal injectable preservative free`, `Td (adult) preservative free`, `meningococcal MCV4P`, `Tdap`, `HPV quadrivalent` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
);
CREATE TABLE allergies
(
CODE INTEGER, -- Example Values: `232347008`, `300916003`, `419474003`, `424213003`, `300913006` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
foreign key (ENCOUNTER) references encounters(ID),
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
primary key (PATIENT, ENCOUNTER, CODE),
STOP TEXT, -- Example Values: `12/22/14`, `4/21/10`, `10/15/11`, `3/17/10`, `5/26/08` | Value Statics: Total count 16 - Distinct count 11 - Null count 556
START TEXT, --
DESCRIPTION TEXT, -- Example Values: `Allergy to dairy product`, `Allergy to tree pollen`, `Allergy to grass pollen`, `Dander (animal) allergy`, `House dust mite allergy` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
);
CREATE TABLE observations
(
DATE DATE, --
ENCOUNTER TEXT, --
VALUE REAL, --
UNITS TEXT, -- Example Values: `cm`, `kg`, `kg/m2`, `mmHg`, `Cel` | Value Statics: Total count 78444 - Distinct count 17 - Null count 455
DESCRIPTION TEXT, --
CODE TEXT, --
PATIENT TEXT, --
foreign key (PATIENT) references patients(patient),
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE medications
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, --
PATIENT TEXT, --
STOP DATE, --
START DATE, --
REASONDESCRIPTION TEXT, --
DESCRIPTION TEXT, --
primary key (START, PATIENT, ENCOUNTER, CODE),
foreign key (PATIENT) references patients(patient),
REASONCODE INTEGER, --
ENCOUNTER TEXT, --
);
CREATE TABLE careplans
(
START DATE, --
STOP DATE, --
ID TEXT, --
REASONCODE INTEGER, --
REASONDESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
DESCRIPTION TEXT, --
CODE REAL, --
ENCOUNTER TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE encounters
(
DATE DATE, --
REASONCODE INTEGER, --
CODE INTEGER, --
ID TEXT primary key,
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
REASONDESCRIPTION TEXT, --
);
CREATE TABLE procedures
(
foreign key (PATIENT) references patients(patient),
REASONDESCRIPTION TEXT, --
PATIENT TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
DATE DATE, --
DESCRIPTION TEXT, --
ENCOUNTER TEXT, --
CODE INTEGER, --
REASONCODE INTEGER, --
);
CREATE TABLE patients
(
suffix TEXT, -- Example Values: `PhD`, `JD`, `MD` | Value Statics: Total count 45 - Distinct count 3 - Null count 1417
prefix TEXT, -- Example Values: `Mr.`, `Mrs.`, `Ms.` | Value Statics: Total count 1166 - Distinct count 3 - Null count 296
deathdate DATE, --
ethnicity TEXT, --
race TEXT, -- Example Values: `black`, `white`, `hispanic`, `asian` | Value Statics: Total count 1462 - Distinct count 4 - Null count 0
address TEXT, --
birthplace TEXT, --
passport TEXT, --
maiden TEXT, --
birthdate DATE, --
marital TEXT, -- Example Values: `S`, `M` | Value Statics: Total count 1033 - Distinct count 2 - Null count 429
gender TEXT, -- Example Values: `F`, `M` | Value Statics: Total count 1462 - Distinct count 2 - Null count 0
drivers TEXT, --
first TEXT, --
last TEXT, --
patient TEXT primary key,
ssn TEXT, --
);
CREATE TABLE claims
(
ENCOUNTER TEXT references encounters, --
PATIENT TEXT references patients, --
ORGANIZATION TEXT, -- Example Values: `temp organization` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
TOTAL INTEGER, -- Example Values: `100` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
BILLABLEPERIOD DATE, --
DIAGNOSIS TEXT, --
ID TEXT primary key,
);
CREATE TABLE conditions
(
START DATE, --
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
CODE INTEGER, --
ENCOUNTER TEXT, --
STOP DATE, --
foreign key (ENCOUNTER) references encounters(ID),
foreign key (DESCRIPTION) references all_prevalences(ITEM),
);
CREATE TABLE all_prevalences
(
"POPULATION TYPE" TEXT, -- Example Values: `LIVING` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
"POPULATION COUNT" INTEGER, -- Example Values: `1000` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
ITEM TEXT primary key,
"PREVALENCE PERCENTAGE" REAL, --
"PREVALENCE RATE" REAL, --
OCCURRENCES INTEGER, --
); |
software_company | Please list the occupations of the customers with an education level of 11. | education level of 11 refers to EDUCATIONNUM = 11; | SELECT DISTINCT OCCUPATION FROM Customers WHERE EDUCATIONNUM = 11 | CREATE TABLE Customers
(
EDUCATIONNUM INTEGER, -- Example Values: `7`, `3`, `4`, `11`, `5` | Value Statics: Total count 100000 - Distinct count 17 - Null count 0
MARITAL_STATUS TEXT, -- Example Values: `Never-married`, `Married-civ-spouse`, `Divorced`, `Widowed`, `Other` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
ID INTEGER constraint Customers_pk primary key,
SEX TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
OCCUPATION TEXT, -- Example Values: `Machine-op-inspct`, `Handlers-cleaners`, `Exec-managerial`, `Farming-fishing`, `Other-service` | Value Statics: Total count 100000 - Distinct count 8 - Null count 0
age INTEGER, --
GEOID INTEGER constraint Customers_Demog_GEOID_fk references Demog, --
);
CREATE TABLE Mailings1_2
(
RESPONSE TEXT, -- Example Values: `false`, `true` | Value Statics: Total count 60000 - Distinct count 2 - Null count 0
REFID INTEGER constraint Mailings1_2_pk primary key constraint Mailings1_2_Customers_ID_fk references Customers,
REF_DATE DATETIME, -- Example Values: `2007-02-01 12:00:00.0`, `2007-03-01 12:00:00.0` | Value Statics: Total count 60000 - Distinct count 2 - Null count 0
);
CREATE TABLE Sales
(
REFID INTEGER references Customers, --
EVENT_DATE DATETIME, --
AMOUNT REAL, --
EVENTID INTEGER constraint Sales_pk primary key,
);
CREATE TABLE Demog
(
A_VAR1 REAL, --
A_VAR2 REAL, --
A_VAR14 REAL, --
A_VAR8 REAL, --
A_VAR12 REAL, --
A_VAR6 REAL, --
A_VAR17 REAL, --
A_VAR15 REAL, --
A_VAR10 REAL, --
A_VAR16 REAL, --
INHABITANTS_K REAL, --
A_VAR3 REAL, --
A_VAR7 REAL, --
A_VAR4 REAL, --
A_VAR5 REAL, --
A_VAR13 REAL, --
A_VAR9 REAL, --
INCOME_K REAL, --
GEOID INTEGER constraint Demog_pk primary key,
A_VAR18 REAL, --
A_VAR11 REAL, --
);
CREATE TABLE mailings3
(
RESPONSE TEXT, -- Example Values: `false`, `true` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
REF_DATE DATETIME, -- Example Values: `2007-07-01 12:00:00.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
REFID INTEGER constraint mailings3_pk primary key,
); |
retail_world | How many sales representatives whose salaries are higher than 2000? | "Sales Representative" is the Title; higher than 2000 refers to Salary > 2000 | SELECT COUNT(Title) FROM Employees WHERE Salary > 2000 AND Title = 'Sales Representative' | CREATE TABLE Products
(
CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0
Unit TEXT, --
ReorderLevel INT, --
ProductName TEXT, --
Price REAL DEFAULT 0, --
FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),
SupplierID INTEGER, --
ProductID INTEGER PRIMARY KEY AUTOINCREMENT,
FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID),
);
CREATE TABLE Customers
(
ContactName TEXT, --
Country TEXT, --
Address TEXT, --
City TEXT, --
CustomerID INTEGER PRIMARY KEY AUTOINCREMENT,
PostalCode TEXT, --
CustomerName TEXT, --
);
CREATE TABLE EmployeeTerritories
(
TerritoryID INT, --
EmployeeID INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE OrderDetails
(
Quantity INTEGER, --
FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),
OrderID INTEGER, --
FOREIGN KEY (ProductID) REFERENCES Products (ProductID),
OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT,
ProductID INTEGER, --
);
CREATE TABLE Shippers
(
ShipperID INTEGER PRIMARY KEY AUTOINCREMENT,
ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
);
CREATE TABLE Territory
(
TerritoryDescription TEXT, --
RegionID INTEGER, --
TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT,
);
CREATE TABLE EmployeeDetails
(
EmployeeID INT PRIMARY KEY,
Title TEXT, --
Salary INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE Categories
(
CategoryID INTEGER PRIMARY KEY AUTOINCREMENT,
CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
);
CREATE TABLE Employees
(
Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT,
FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
);
CREATE TABLE Suppliers
(
PostalCode TEXT, --
Address TEXT, --
SupplierID INTEGER PRIMARY KEY AUTOINCREMENT,
City TEXT, --
Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0
Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0
ContactName TEXT, --
Phone TEXT, --
SupplierName TEXT, --
);
CREATE TABLE EmployeesExtra
(
Salary INTEGER, --
Title TEXT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
EmployeeID INTEGER PRIMARY KEY,
);
CREATE TABLE discontinued_products
(
Discontinued INTEGER, --
ProductID INTEGER PRIMARY KEY,
);
CREATE TABLE Orders
(
OrderID INTEGER PRIMARY KEY AUTOINCREMENT,
CustomerID INTEGER, --
FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),
FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID),
FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),
ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0
OrderDate DATETIME, --
EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0
);
CREATE TABLE Territories
(
TerritoryDescription TEXT, --
RegionDescription TEXT, --
);
CREATE TABLE ShippingInfo
(
ShipCountry TEXT, --
ShippedDate DATETIME, --
FOREIGN KEY (OrderID) REFERENCES Orders(OrderID),
OrderID INTEGER PRIMARY KEY,
); |
professional_basketball | How many players received Most Valuable Player award from 1969 to 1975? | Most Valuable Player award refers to award = 'Most Valuable Player'; from 1969 to 1975 refers to year between 1969 and 1975 | SELECT COUNT(DISTINCT playerID) FROM awards_players WHERE year BETWEEN 1969 AND 1975 AND award = 'Most Valuable Player' | CREATE TABLE players_teams
(
PostGS INTEGER, --
PostdRebounds INTEGER, --
PostPF INTEGER, --
tmID TEXT, --
threeAttempted INTEGER, --
PostRebounds INTEGER, --
assists INTEGER, --
threeMade INTEGER, --
PostBlocks INTEGER, --
PostTurnovers INTEGER, --
GP INTEGER, --
lgID TEXT, -- Example Values: `NBA`, `NBL`, `ABA`, `ABL1`, `NPBL` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0
foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade,
PostfgMade INTEGER, --
steals INTEGER, --
oRebounds INTEGER, --
PostftAttempted INTEGER, --
ftAttempted INTEGER, --
ftMade INTEGER, --
points INTEGER, --
PostfgAttempted INTEGER, --
PostftMade INTEGER, --
note TEXT, -- Example Values: `C` | Value Statics: Total count 43 - Distinct count 1 - Null count 23708
dRebounds INTEGER, --
PostSteals INTEGER, --
blocks INTEGER, --
PostAssists INTEGER, --
minutes INTEGER, --
fgAttempted INTEGER, --
playerID TEXT not null references players on update cascade on delete cascade, --
PostthreeMade INTEGER, --
PostPoints INTEGER, --
year INTEGER, --
PF INTEGER, --
fgMade INTEGER, --
PostthreeAttempted INTEGER, --
rebounds INTEGER, --
id INTEGER primary key autoincrement,
stint INTEGER, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0
PostMinutes INTEGER, --
PostGP INTEGER, --
turnovers INTEGER, --
PostoRebounds INTEGER, --
GS INTEGER, --
);
CREATE TABLE awards_coaches
(
award TEXT, -- Example Values: `NBA Coach of the Year`, `ABA Coach of the Year` | Value Statics: Total count 61 - Distinct count 2 - Null count 0
id INTEGER primary key autoincrement,
note TEXT, -- Example Values: `tie` | Value Statics: Total count 4 - Distinct count 1 - Null count 57
coachID TEXT, --
lgID TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 61 - Distinct count 2 - Null count 0
foreign key (coachID, year) references coaches (coachID, year) on update cascade on delete cascade,
year INTEGER, --
);
CREATE TABLE draft
(
draftOverall INTEGER null, --
lgID TEXT null, -- Example Values: `ABA`, `NBA` | Value Statics: Total count 8621 - Distinct count 2 - Null count 0
suffixName TEXT null, -- Example Values: `Jr.` | Value Statics: Total count 2 - Distinct count 1 - Null count 8619
draftYear INTEGER null, --
draftSelection INTEGER null, --
tmID TEXT null, --
draftRound INTEGER null, --
lastName TEXT null, --
playerID TEXT null, --
draftFrom TEXT null, --
id INTEGER default 0 not null primary key,
firstName TEXT null, --
foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade,
foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade,
);
CREATE TABLE player_allstar
(
rebounds INTEGER null, --
playerID TEXT not null, --
season_id INTEGER not null, --
assists INTEGER null, --
conference TEXT null, -- Example Values: `East`, `West`, `Weset`, `Allstars`, `Denver` | Value Statics: Total count 1608 - Distinct count 5 - Null count 0
points INTEGER null, --
personal_fouls INTEGER null, -- Example Values: `3`, `2`, `0`, `1`, `5` | Value Statics: Total count 540 - Distinct count 8 - Null count 1068
ft_attempted INTEGER null, -- Example Values: `2`, `4`, `0`, `6`, `3` | Value Statics: Total count 1561 - Distinct count 17 - Null count 47
fg_attempted INTEGER null, --
league_id TEXT null, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 1608 - Distinct count 2 - Null count 0
foreign key (playerID) references players (playerID) on update cascade on delete cascade,
fg_made INTEGER null, -- Example Values: `4`, `8`, `5`, `7`, `3` | Value Statics: Total count 1561 - Distinct count 18 - Null count 47
ft_made INTEGER null, -- Example Values: `2`, `3`, `0`, `1`, `4` | Value Statics: Total count 1561 - Distinct count 13 - Null count 47
steals INTEGER null, -- Example Values: `3`, `0`, `1`, `2`, `5` | Value Statics: Total count 398 - Distinct count 7 - Null count 1210
games_played INTEGER null, -- Example Values: `1` | Value Statics: Total count 1608 - Distinct count 1 - Null count 0
first_name TEXT null, --
d_rebounds INTEGER null, -- Example Values: `2`, `5`, `0`, `1`, `4` | Value Statics: Total count 493 - Distinct count 14 - Null count 1115
last_name TEXT null, --
primary key (playerID, season_id),
turnovers INTEGER null, -- Example Values: `1`, `0`, `3`, `2`, `4` | Value Statics: Total count 493 - Distinct count 9 - Null count 1115
three_made INTEGER null, -- Example Values: `0`, `1`, `3`, `5`, `4` | Value Statics: Total count 566 - Distinct count 7 - Null count 1042
minutes INTEGER null, --
blocks INTEGER null, -- Example Values: `2`, `0`, `1`, `3`, `5` | Value Statics: Total count 398 - Distinct count 6 - Null count 1210
three_attempted INTEGER null, -- Example Values: `0`, `1`, `6`, `7`, `10` | Value Statics: Total count 540 - Distinct count 12 - Null count 1068
o_rebounds INTEGER null, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 493 - Distinct count 10 - Null count 1115
);
CREATE TABLE awards_players
(
foreign key (playerID) references players (playerID) on update cascade on delete cascade,
year INTEGER not null, --
pos TEXT null, -- Example Values: `C`, `F`, `G`, `F/G`, `F/C` | Value Statics: Total count 833 - Distinct count 5 - Null count 886
primary key (playerID, year, award),
lgID TEXT null, -- Example Values: `NBA`, `ABA`, `NBL`, `ABL1` | Value Statics: Total count 1719 - Distinct count 4 - Null count 0
award TEXT not null, --
playerID TEXT not null, --
note TEXT null, -- Example Values: `tie` | Value Statics: Total count 37 - Distinct count 1 - Null count 1682
);
CREATE TABLE series_post
(
tmIDLoser TEXT, --
id INTEGER primary key autoincrement,
series TEXT, -- Example Values: `O`, `M`, `N`, `A`, `K` | Value Statics: Total count 775 - Distinct count 11 - Null count 0
tmIDWinner TEXT, --
round TEXT, -- Example Values: `F`, `QF`, `SF`, `DT`, `DF` | Value Statics: Total count 775 - Distinct count 11 - Null count 0
year INTEGER, --
foreign key (tmIDLoser, year) references teams (tmID, year) on update cascade on delete cascade,
foreign key (tmIDWinner, year) references teams (tmID, year) on update cascade on delete cascade,
W INTEGER, -- Example Values: `4`, `2`, `1`, `3`, `0` | Value Statics: Total count 775 - Distinct count 5 - Null count 0
lgIDLoser TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0
lgIDWinner TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0
L INTEGER, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 775 - Distinct count 5 - Null count 0
);
CREATE TABLE players
(
nameGiven TEXT null, -- Example Values: `nameGiven`, `Mort`, `Robert`, `Jim`, `Mike` | Value Statics: Total count 10 - Distinct count 9 - Null count 5052
lastseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15
hsCountry TEXT null, --
firstName TEXT null, --
hsCity TEXT null, --
firstseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15
weight INTEGER null, --
birthCountry TEXT null, --
race TEXT null, -- Example Values: `B`, `W`, `O`, `1`, `r` | Value Statics: Total count 4903 - Distinct count 5 - Null count 159
lastName TEXT null, --
birthDate DATE null, --
collegeOther TEXT null, --
birthState TEXT null, --
useFirst TEXT null, --
pos TEXT null, -- Example Values: `F-C`, `C`, `G`, `G-F`, `C-F` | Value Statics: Total count 4880 - Distinct count 14 - Null count 182
playerID TEXT not null primary key,
college TEXT null, --
highSchool TEXT null, --
hsState TEXT null, --
height REAL null, --
deathDate DATE null, --
nameSuffix TEXT null, -- Example Values: `Jr.`, `III`, `nameSuffix`, `II`, `IV` | Value Statics: Total count 324 - Distinct count 6 - Null count 4738
nameNick TEXT null, --
fullGivenName TEXT null, --
birthCity TEXT null, --
middleName TEXT null, --
);
CREATE TABLE teams
(
d_pts INTEGER null, --
name TEXT null, --
homeLost INTEGER null, --
o_ftm INTEGER null, --
franchID TEXT null, --
tmID TEXT not null, --
awayWon INTEGER null, --
primary key (year, tmID),
o_fgm INTEGER null, --
year INTEGER not null, --
awayLost INTEGER null, --
arena TEXT null, --
confID TEXT null, -- Example Values: `EC`, `WC` | Value Statics: Total count 1064 - Distinct count 2 - Null count 472
games INTEGER null, --
lost INTEGER null, --
divID TEXT null, -- Example Values: `EA`, `WE`, `ED`, `WD`, `SO` | Value Statics: Total count 1498 - Distinct count 13 - Null count 38
lgID TEXT null, -- Example Values: `NBL`, `NBA`, `PBLA`, `NPBL`, `ABL1` | Value Statics: Total count 1536 - Distinct count 6 - Null count 0
homeWon INTEGER null, --
confRank INTEGER null, -- Example Values: `0`, `4`, `3`, `5`, `7` | Value Statics: Total count 1536 - Distinct count 16 - Null count 0
o_pts INTEGER null, --
`rank` INTEGER null, -- Example Values: `1`, `2`, `4`, `5`, `6` | Value Statics: Total count 1536 - Distinct count 10 - Null count 0
playoff TEXT null, -- Example Values: `CF`, `WC`, `LC`, `CS`, `F` | Value Statics: Total count 901 - Distinct count 15 - Null count 635
won INTEGER null, --
);
CREATE TABLE coaches
(
primary key (coachID, year, tmID, stint),
lgID TEXT null, -- Example Values: `NBA`, `ABA`, `ABL1`, `PBLA`, `NPBL` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0
post_losses INTEGER null, -- Example Values: `3`, `9`, `7`, `8`, `0` | Value Statics: Total count 1649 - Distinct count 12 - Null count 40
year INTEGER not null, --
won INTEGER null, --
foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade,
post_wins INTEGER null, -- Example Values: `0`, `12`, `9`, `13`, `1` | Value Statics: Total count 1649 - Distinct count 17 - Null count 40
coachID TEXT not null, --
tmID TEXT not null, --
lost INTEGER null, --
stint INTEGER not null, -- Example Values: `2`, `1`, `4`, `5`, `3` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0
); |
superstore | Name 10 products that were shipped first class from the East region. | shipped first class refers to "Ship Mode" = 'First Class'; Region = 'East' | SELECT T2.`Product Name` FROM east_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T1.`Ship Mode` = 'First Class' AND T2.Region = 'East' LIMIT 10 | CREATE TABLE west_superstore
(
Profit REAL, --
Region TEXT, -- Example Values: `West` | Value Statics: Total count 6406 - Distinct count 1 - Null count 0
"Product ID" TEXT, --
foreign key ("Product ID", Region) references product("Product ID",Region),
"Order Date" DATE, --
foreign key ("Customer ID", Region) references people("Customer ID",Region),
"Ship Mode" TEXT, -- Example Values: `Second Class`, `Standard Class`, `First Class`, `Same Day` | Value Statics: Total count 6406 - Distinct count 4 - Null count 0
"Customer ID" TEXT, --
"Order ID" TEXT, --
"Row ID" INTEGER primary key,
Sales REAL, --
Quantity INTEGER, -- Example Values: `3`, `5`, `4`, `10`, `2` | Value Statics: Total count 6406 - Distinct count 14 - Null count 0
Discount REAL, -- Example Values: `0.0`, `0.15`, `0.2`, `0.7`, `0.5` | Value Statics: Total count 6406 - Distinct count 5 - Null count 0
"Ship Date" DATE, --
);
CREATE TABLE people
(
Region TEXT, -- Example Values: `Central`, `East`, `West`, `South` | Value Statics: Total count 2501 - Distinct count 4 - Null count 0
Country TEXT, -- Example Values: `United States` | Value Statics: Total count 2501 - Distinct count 1 - Null count 0
State TEXT, --
primary key ("Customer ID", Region),
City TEXT, --
Segment TEXT, -- Example Values: `Consumer`, `Home Office`, `Corporate` | Value Statics: Total count 2501 - Distinct count 3 - Null count 0
"Customer ID" TEXT, --
"Postal Code" INTEGER, --
"Customer Name" TEXT, --
);
CREATE TABLE product
(
"Product ID" TEXT, --
Region TEXT, -- Example Values: `Central`, `South`, `West`, `East` | Value Statics: Total count 5298 - Distinct count 4 - Null count 0
"Sub-Category" TEXT, -- Example Values: `Bookcases`, `Chairs`, `Furnishings`, `Tables`, `Appliances` | Value Statics: Total count 5298 - Distinct count 17 - Null count 0
Category TEXT, -- Example Values: `Furniture`, `Office Supplies`, `Technology` | Value Statics: Total count 5298 - Distinct count 3 - Null count 0
"Product Name" TEXT, --
primary key ("Product ID", Region),
);
CREATE TABLE central_superstore
(
"Ship Mode" TEXT, -- Example Values: `Standard Class`, `First Class`, `Second Class`, `Same Day` | Value Statics: Total count 4646 - Distinct count 4 - Null count 0
Quantity INTEGER, -- Example Values: `2`, `3`, `7`, `1`, `5` | Value Statics: Total count 4646 - Distinct count 14 - Null count 0
"Ship Date" DATE, --
"Order Date" DATE, --
"Order ID" TEXT, --
"Row ID" INTEGER primary key,
"Product ID" TEXT, --
foreign key ("Customer ID", Region) references people("Customer ID",Region),
Sales REAL, --
foreign key ("Product ID", Region) references product("Product ID",Region),
Profit REAL, --
"Customer ID" TEXT, --
Discount REAL, -- Example Values: `0.2`, `0.8`, `0.6`, `0.0`, `0.1` | Value Statics: Total count 4646 - Distinct count 9 - Null count 0
Region TEXT, -- Example Values: `Central` | Value Statics: Total count 4646 - Distinct count 1 - Null count 0
);
CREATE TABLE east_superstore
(
"Row ID" INTEGER primary key,
Region TEXT, -- Example Values: `East` | Value Statics: Total count 5696 - Distinct count 1 - Null count 0
"Order ID" TEXT, --
"Product ID" TEXT, --
Sales REAL, --
foreign key ("Product ID", Region) references product("Product ID",Region),
Discount REAL, -- Example Values: `0.2`, `0.0`, `0.7`, `0.5`, `0.4` | Value Statics: Total count 5696 - Distinct count 7 - Null count 0
Quantity INTEGER, -- Example Values: `3`, `2`, `7`, `4`, `6` | Value Statics: Total count 5696 - Distinct count 14 - Null count 0
Profit REAL, --
foreign key ("Customer ID", Region) references people("Customer ID",Region),
"Ship Mode" TEXT, -- Example Values: `Standard Class`, `First Class`, `Second Class`, `Same Day` | Value Statics: Total count 5696 - Distinct count 4 - Null count 0
"Customer ID" TEXT, --
"Order Date" DATE, --
"Ship Date" DATE, --
);
CREATE TABLE south_superstore
(
"Product ID" TEXT, --
Profit REAL, --
Sales REAL, --
"Order Date" DATE, --
"Customer ID" TEXT, --
Discount REAL, -- Example Values: `0.0`, `0.7`, `0.2`, `0.5`, `0.45` | Value Statics: Total count 3240 - Distinct count 6 - Null count 0
Region TEXT, -- Example Values: `South` | Value Statics: Total count 3240 - Distinct count 1 - Null count 0
"Ship Date" DATE, --
foreign key ("Product ID", Region) references product("Product ID",Region),
foreign key ("Customer ID", Region) references people("Customer ID",Region),
Quantity INTEGER, -- Example Values: `3`, `9`, `2`, `4`, `1` | Value Statics: Total count 3240 - Distinct count 14 - Null count 0
"Order ID" TEXT, --
"Row ID" INTEGER primary key,
"Ship Mode" TEXT, -- Example Values: `First Class`, `Standard Class`, `Second Class`, `Same Day` | Value Statics: Total count 3240 - Distinct count 4 - Null count 0
); |
synthea | How many Black patients were immunized with DTaP in 2013? | Black patients refer to patient where race = 'black'; immunized with DTaP refers to DESCRIPTION = 'DTaP' from immunizations; in 2013 refers to DATE like '2013%'; | SELECT COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN immunizations AS T2 ON T1.patient = T2.PATIENT WHERE T1.race = 'black' AND T2.DESCRIPTION = 'DTaP' AND strftime('%Y', T2.DATE) = '2013' | CREATE TABLE immunizations
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
DATE DATE, --
primary key (DATE, PATIENT, ENCOUNTER, CODE),
DESCRIPTION TEXT, -- Example Values: `Influenza seasonal injectable preservative free`, `Td (adult) preservative free`, `meningococcal MCV4P`, `Tdap`, `HPV quadrivalent` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
);
CREATE TABLE allergies
(
CODE INTEGER, -- Example Values: `232347008`, `300916003`, `419474003`, `424213003`, `300913006` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
foreign key (ENCOUNTER) references encounters(ID),
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
primary key (PATIENT, ENCOUNTER, CODE),
STOP TEXT, -- Example Values: `12/22/14`, `4/21/10`, `10/15/11`, `3/17/10`, `5/26/08` | Value Statics: Total count 16 - Distinct count 11 - Null count 556
START TEXT, --
DESCRIPTION TEXT, -- Example Values: `Allergy to dairy product`, `Allergy to tree pollen`, `Allergy to grass pollen`, `Dander (animal) allergy`, `House dust mite allergy` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
);
CREATE TABLE observations
(
DATE DATE, --
ENCOUNTER TEXT, --
VALUE REAL, --
UNITS TEXT, -- Example Values: `cm`, `kg`, `kg/m2`, `mmHg`, `Cel` | Value Statics: Total count 78444 - Distinct count 17 - Null count 455
DESCRIPTION TEXT, --
CODE TEXT, --
PATIENT TEXT, --
foreign key (PATIENT) references patients(patient),
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE medications
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, --
PATIENT TEXT, --
STOP DATE, --
START DATE, --
REASONDESCRIPTION TEXT, --
DESCRIPTION TEXT, --
primary key (START, PATIENT, ENCOUNTER, CODE),
foreign key (PATIENT) references patients(patient),
REASONCODE INTEGER, --
ENCOUNTER TEXT, --
);
CREATE TABLE careplans
(
START DATE, --
STOP DATE, --
ID TEXT, --
REASONCODE INTEGER, --
REASONDESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
DESCRIPTION TEXT, --
CODE REAL, --
ENCOUNTER TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE encounters
(
DATE DATE, --
REASONCODE INTEGER, --
CODE INTEGER, --
ID TEXT primary key,
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
REASONDESCRIPTION TEXT, --
);
CREATE TABLE procedures
(
foreign key (PATIENT) references patients(patient),
REASONDESCRIPTION TEXT, --
PATIENT TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
DATE DATE, --
DESCRIPTION TEXT, --
ENCOUNTER TEXT, --
CODE INTEGER, --
REASONCODE INTEGER, --
);
CREATE TABLE patients
(
suffix TEXT, -- Example Values: `PhD`, `JD`, `MD` | Value Statics: Total count 45 - Distinct count 3 - Null count 1417
prefix TEXT, -- Example Values: `Mr.`, `Mrs.`, `Ms.` | Value Statics: Total count 1166 - Distinct count 3 - Null count 296
deathdate DATE, --
ethnicity TEXT, --
race TEXT, -- Example Values: `black`, `white`, `hispanic`, `asian` | Value Statics: Total count 1462 - Distinct count 4 - Null count 0
address TEXT, --
birthplace TEXT, --
passport TEXT, --
maiden TEXT, --
birthdate DATE, --
marital TEXT, -- Example Values: `S`, `M` | Value Statics: Total count 1033 - Distinct count 2 - Null count 429
gender TEXT, -- Example Values: `F`, `M` | Value Statics: Total count 1462 - Distinct count 2 - Null count 0
drivers TEXT, --
first TEXT, --
last TEXT, --
patient TEXT primary key,
ssn TEXT, --
);
CREATE TABLE claims
(
ENCOUNTER TEXT references encounters, --
PATIENT TEXT references patients, --
ORGANIZATION TEXT, -- Example Values: `temp organization` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
TOTAL INTEGER, -- Example Values: `100` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
BILLABLEPERIOD DATE, --
DIAGNOSIS TEXT, --
ID TEXT primary key,
);
CREATE TABLE conditions
(
START DATE, --
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
CODE INTEGER, --
ENCOUNTER TEXT, --
STOP DATE, --
foreign key (ENCOUNTER) references encounters(ID),
foreign key (DESCRIPTION) references all_prevalences(ITEM),
);
CREATE TABLE all_prevalences
(
"POPULATION TYPE" TEXT, -- Example Values: `LIVING` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
"POPULATION COUNT" INTEGER, -- Example Values: `1000` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
ITEM TEXT primary key,
"PREVALENCE PERCENTAGE" REAL, --
"PREVALENCE RATE" REAL, --
OCCURRENCES INTEGER, --
); |
software_company | Among all the customers, how many of them are teenagers? | teenager is a person aged between 13 and 19 years; | SELECT COUNT(ID) FROM Customers WHERE age >= 13 AND age <= 19 | CREATE TABLE Customers
(
EDUCATIONNUM INTEGER, -- Example Values: `7`, `3`, `4`, `11`, `5` | Value Statics: Total count 100000 - Distinct count 17 - Null count 0
MARITAL_STATUS TEXT, -- Example Values: `Never-married`, `Married-civ-spouse`, `Divorced`, `Widowed`, `Other` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
ID INTEGER constraint Customers_pk primary key,
SEX TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
OCCUPATION TEXT, -- Example Values: `Machine-op-inspct`, `Handlers-cleaners`, `Exec-managerial`, `Farming-fishing`, `Other-service` | Value Statics: Total count 100000 - Distinct count 8 - Null count 0
age INTEGER, --
GEOID INTEGER constraint Customers_Demog_GEOID_fk references Demog, --
);
CREATE TABLE Mailings1_2
(
RESPONSE TEXT, -- Example Values: `false`, `true` | Value Statics: Total count 60000 - Distinct count 2 - Null count 0
REFID INTEGER constraint Mailings1_2_pk primary key constraint Mailings1_2_Customers_ID_fk references Customers,
REF_DATE DATETIME, -- Example Values: `2007-02-01 12:00:00.0`, `2007-03-01 12:00:00.0` | Value Statics: Total count 60000 - Distinct count 2 - Null count 0
);
CREATE TABLE Sales
(
REFID INTEGER references Customers, --
EVENT_DATE DATETIME, --
AMOUNT REAL, --
EVENTID INTEGER constraint Sales_pk primary key,
);
CREATE TABLE Demog
(
A_VAR1 REAL, --
A_VAR2 REAL, --
A_VAR14 REAL, --
A_VAR8 REAL, --
A_VAR12 REAL, --
A_VAR6 REAL, --
A_VAR17 REAL, --
A_VAR15 REAL, --
A_VAR10 REAL, --
A_VAR16 REAL, --
INHABITANTS_K REAL, --
A_VAR3 REAL, --
A_VAR7 REAL, --
A_VAR4 REAL, --
A_VAR5 REAL, --
A_VAR13 REAL, --
A_VAR9 REAL, --
INCOME_K REAL, --
GEOID INTEGER constraint Demog_pk primary key,
A_VAR18 REAL, --
A_VAR11 REAL, --
);
CREATE TABLE mailings3
(
RESPONSE TEXT, -- Example Values: `false`, `true` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
REF_DATE DATETIME, -- Example Values: `2007-07-01 12:00:00.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
REFID INTEGER constraint mailings3_pk primary key,
); |
retail_world | Who has the highest salary? Please give their first name. | highest salary refers to Max(Salary) | SELECT FirstName, LastName FROM Employees WHERE Salary = ( SELECT MAX(Salary) FROM Employees ) | CREATE TABLE Products
(
CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0
Unit TEXT, --
ReorderLevel INT, --
ProductName TEXT, --
Price REAL DEFAULT 0, --
FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),
SupplierID INTEGER, --
ProductID INTEGER PRIMARY KEY AUTOINCREMENT,
FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID),
);
CREATE TABLE Customers
(
ContactName TEXT, --
Country TEXT, --
Address TEXT, --
City TEXT, --
CustomerID INTEGER PRIMARY KEY AUTOINCREMENT,
PostalCode TEXT, --
CustomerName TEXT, --
);
CREATE TABLE EmployeeTerritories
(
TerritoryID INT, --
EmployeeID INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE OrderDetails
(
Quantity INTEGER, --
FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),
OrderID INTEGER, --
FOREIGN KEY (ProductID) REFERENCES Products (ProductID),
OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT,
ProductID INTEGER, --
);
CREATE TABLE Shippers
(
ShipperID INTEGER PRIMARY KEY AUTOINCREMENT,
ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
);
CREATE TABLE Territory
(
TerritoryDescription TEXT, --
RegionID INTEGER, --
TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT,
);
CREATE TABLE EmployeeDetails
(
EmployeeID INT PRIMARY KEY,
Title TEXT, --
Salary INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE Categories
(
CategoryID INTEGER PRIMARY KEY AUTOINCREMENT,
CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
);
CREATE TABLE Employees
(
Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT,
FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
);
CREATE TABLE Suppliers
(
PostalCode TEXT, --
Address TEXT, --
SupplierID INTEGER PRIMARY KEY AUTOINCREMENT,
City TEXT, --
Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0
Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0
ContactName TEXT, --
Phone TEXT, --
SupplierName TEXT, --
);
CREATE TABLE EmployeesExtra
(
Salary INTEGER, --
Title TEXT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
EmployeeID INTEGER PRIMARY KEY,
);
CREATE TABLE discontinued_products
(
Discontinued INTEGER, --
ProductID INTEGER PRIMARY KEY,
);
CREATE TABLE Orders
(
OrderID INTEGER PRIMARY KEY AUTOINCREMENT,
CustomerID INTEGER, --
FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),
FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID),
FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),
ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0
OrderDate DATETIME, --
EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0
);
CREATE TABLE Territories
(
TerritoryDescription TEXT, --
RegionDescription TEXT, --
);
CREATE TABLE ShippingInfo
(
ShipCountry TEXT, --
ShippedDate DATETIME, --
FOREIGN KEY (OrderID) REFERENCES Orders(OrderID),
OrderID INTEGER PRIMARY KEY,
); |
professional_basketball | What is the full name of the team that selected Mike Lynn? | full name refers to teams.name | SELECT T1.name FROM teams AS T1 INNER JOIN draft AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.draftYear WHERE T2.firstName = 'Mike' AND T2.lastName = 'Lynn' | CREATE TABLE players_teams
(
PostGS INTEGER, --
PostdRebounds INTEGER, --
PostPF INTEGER, --
tmID TEXT, --
threeAttempted INTEGER, --
PostRebounds INTEGER, --
assists INTEGER, --
threeMade INTEGER, --
PostBlocks INTEGER, --
PostTurnovers INTEGER, --
GP INTEGER, --
lgID TEXT, -- Example Values: `NBA`, `NBL`, `ABA`, `ABL1`, `NPBL` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0
foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade,
PostfgMade INTEGER, --
steals INTEGER, --
oRebounds INTEGER, --
PostftAttempted INTEGER, --
ftAttempted INTEGER, --
ftMade INTEGER, --
points INTEGER, --
PostfgAttempted INTEGER, --
PostftMade INTEGER, --
note TEXT, -- Example Values: `C` | Value Statics: Total count 43 - Distinct count 1 - Null count 23708
dRebounds INTEGER, --
PostSteals INTEGER, --
blocks INTEGER, --
PostAssists INTEGER, --
minutes INTEGER, --
fgAttempted INTEGER, --
playerID TEXT not null references players on update cascade on delete cascade, --
PostthreeMade INTEGER, --
PostPoints INTEGER, --
year INTEGER, --
PF INTEGER, --
fgMade INTEGER, --
PostthreeAttempted INTEGER, --
rebounds INTEGER, --
id INTEGER primary key autoincrement,
stint INTEGER, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0
PostMinutes INTEGER, --
PostGP INTEGER, --
turnovers INTEGER, --
PostoRebounds INTEGER, --
GS INTEGER, --
);
CREATE TABLE awards_coaches
(
award TEXT, -- Example Values: `NBA Coach of the Year`, `ABA Coach of the Year` | Value Statics: Total count 61 - Distinct count 2 - Null count 0
id INTEGER primary key autoincrement,
note TEXT, -- Example Values: `tie` | Value Statics: Total count 4 - Distinct count 1 - Null count 57
coachID TEXT, --
lgID TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 61 - Distinct count 2 - Null count 0
foreign key (coachID, year) references coaches (coachID, year) on update cascade on delete cascade,
year INTEGER, --
);
CREATE TABLE draft
(
draftOverall INTEGER null, --
lgID TEXT null, -- Example Values: `ABA`, `NBA` | Value Statics: Total count 8621 - Distinct count 2 - Null count 0
suffixName TEXT null, -- Example Values: `Jr.` | Value Statics: Total count 2 - Distinct count 1 - Null count 8619
draftYear INTEGER null, --
draftSelection INTEGER null, --
tmID TEXT null, --
draftRound INTEGER null, --
lastName TEXT null, --
playerID TEXT null, --
draftFrom TEXT null, --
id INTEGER default 0 not null primary key,
firstName TEXT null, --
foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade,
foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade,
);
CREATE TABLE player_allstar
(
rebounds INTEGER null, --
playerID TEXT not null, --
season_id INTEGER not null, --
assists INTEGER null, --
conference TEXT null, -- Example Values: `East`, `West`, `Weset`, `Allstars`, `Denver` | Value Statics: Total count 1608 - Distinct count 5 - Null count 0
points INTEGER null, --
personal_fouls INTEGER null, -- Example Values: `3`, `2`, `0`, `1`, `5` | Value Statics: Total count 540 - Distinct count 8 - Null count 1068
ft_attempted INTEGER null, -- Example Values: `2`, `4`, `0`, `6`, `3` | Value Statics: Total count 1561 - Distinct count 17 - Null count 47
fg_attempted INTEGER null, --
league_id TEXT null, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 1608 - Distinct count 2 - Null count 0
foreign key (playerID) references players (playerID) on update cascade on delete cascade,
fg_made INTEGER null, -- Example Values: `4`, `8`, `5`, `7`, `3` | Value Statics: Total count 1561 - Distinct count 18 - Null count 47
ft_made INTEGER null, -- Example Values: `2`, `3`, `0`, `1`, `4` | Value Statics: Total count 1561 - Distinct count 13 - Null count 47
steals INTEGER null, -- Example Values: `3`, `0`, `1`, `2`, `5` | Value Statics: Total count 398 - Distinct count 7 - Null count 1210
games_played INTEGER null, -- Example Values: `1` | Value Statics: Total count 1608 - Distinct count 1 - Null count 0
first_name TEXT null, --
d_rebounds INTEGER null, -- Example Values: `2`, `5`, `0`, `1`, `4` | Value Statics: Total count 493 - Distinct count 14 - Null count 1115
last_name TEXT null, --
primary key (playerID, season_id),
turnovers INTEGER null, -- Example Values: `1`, `0`, `3`, `2`, `4` | Value Statics: Total count 493 - Distinct count 9 - Null count 1115
three_made INTEGER null, -- Example Values: `0`, `1`, `3`, `5`, `4` | Value Statics: Total count 566 - Distinct count 7 - Null count 1042
minutes INTEGER null, --
blocks INTEGER null, -- Example Values: `2`, `0`, `1`, `3`, `5` | Value Statics: Total count 398 - Distinct count 6 - Null count 1210
three_attempted INTEGER null, -- Example Values: `0`, `1`, `6`, `7`, `10` | Value Statics: Total count 540 - Distinct count 12 - Null count 1068
o_rebounds INTEGER null, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 493 - Distinct count 10 - Null count 1115
);
CREATE TABLE awards_players
(
foreign key (playerID) references players (playerID) on update cascade on delete cascade,
year INTEGER not null, --
pos TEXT null, -- Example Values: `C`, `F`, `G`, `F/G`, `F/C` | Value Statics: Total count 833 - Distinct count 5 - Null count 886
primary key (playerID, year, award),
lgID TEXT null, -- Example Values: `NBA`, `ABA`, `NBL`, `ABL1` | Value Statics: Total count 1719 - Distinct count 4 - Null count 0
award TEXT not null, --
playerID TEXT not null, --
note TEXT null, -- Example Values: `tie` | Value Statics: Total count 37 - Distinct count 1 - Null count 1682
);
CREATE TABLE series_post
(
tmIDLoser TEXT, --
id INTEGER primary key autoincrement,
series TEXT, -- Example Values: `O`, `M`, `N`, `A`, `K` | Value Statics: Total count 775 - Distinct count 11 - Null count 0
tmIDWinner TEXT, --
round TEXT, -- Example Values: `F`, `QF`, `SF`, `DT`, `DF` | Value Statics: Total count 775 - Distinct count 11 - Null count 0
year INTEGER, --
foreign key (tmIDLoser, year) references teams (tmID, year) on update cascade on delete cascade,
foreign key (tmIDWinner, year) references teams (tmID, year) on update cascade on delete cascade,
W INTEGER, -- Example Values: `4`, `2`, `1`, `3`, `0` | Value Statics: Total count 775 - Distinct count 5 - Null count 0
lgIDLoser TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0
lgIDWinner TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0
L INTEGER, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 775 - Distinct count 5 - Null count 0
);
CREATE TABLE players
(
nameGiven TEXT null, -- Example Values: `nameGiven`, `Mort`, `Robert`, `Jim`, `Mike` | Value Statics: Total count 10 - Distinct count 9 - Null count 5052
lastseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15
hsCountry TEXT null, --
firstName TEXT null, --
hsCity TEXT null, --
firstseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15
weight INTEGER null, --
birthCountry TEXT null, --
race TEXT null, -- Example Values: `B`, `W`, `O`, `1`, `r` | Value Statics: Total count 4903 - Distinct count 5 - Null count 159
lastName TEXT null, --
birthDate DATE null, --
collegeOther TEXT null, --
birthState TEXT null, --
useFirst TEXT null, --
pos TEXT null, -- Example Values: `F-C`, `C`, `G`, `G-F`, `C-F` | Value Statics: Total count 4880 - Distinct count 14 - Null count 182
playerID TEXT not null primary key,
college TEXT null, --
highSchool TEXT null, --
hsState TEXT null, --
height REAL null, --
deathDate DATE null, --
nameSuffix TEXT null, -- Example Values: `Jr.`, `III`, `nameSuffix`, `II`, `IV` | Value Statics: Total count 324 - Distinct count 6 - Null count 4738
nameNick TEXT null, --
fullGivenName TEXT null, --
birthCity TEXT null, --
middleName TEXT null, --
);
CREATE TABLE teams
(
d_pts INTEGER null, --
name TEXT null, --
homeLost INTEGER null, --
o_ftm INTEGER null, --
franchID TEXT null, --
tmID TEXT not null, --
awayWon INTEGER null, --
primary key (year, tmID),
o_fgm INTEGER null, --
year INTEGER not null, --
awayLost INTEGER null, --
arena TEXT null, --
confID TEXT null, -- Example Values: `EC`, `WC` | Value Statics: Total count 1064 - Distinct count 2 - Null count 472
games INTEGER null, --
lost INTEGER null, --
divID TEXT null, -- Example Values: `EA`, `WE`, `ED`, `WD`, `SO` | Value Statics: Total count 1498 - Distinct count 13 - Null count 38
lgID TEXT null, -- Example Values: `NBL`, `NBA`, `PBLA`, `NPBL`, `ABL1` | Value Statics: Total count 1536 - Distinct count 6 - Null count 0
homeWon INTEGER null, --
confRank INTEGER null, -- Example Values: `0`, `4`, `3`, `5`, `7` | Value Statics: Total count 1536 - Distinct count 16 - Null count 0
o_pts INTEGER null, --
`rank` INTEGER null, -- Example Values: `1`, `2`, `4`, `5`, `6` | Value Statics: Total count 1536 - Distinct count 10 - Null count 0
playoff TEXT null, -- Example Values: `CF`, `WC`, `LC`, `CS`, `F` | Value Statics: Total count 901 - Distinct count 15 - Null count 635
won INTEGER null, --
);
CREATE TABLE coaches
(
primary key (coachID, year, tmID, stint),
lgID TEXT null, -- Example Values: `NBA`, `ABA`, `ABL1`, `PBLA`, `NPBL` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0
post_losses INTEGER null, -- Example Values: `3`, `9`, `7`, `8`, `0` | Value Statics: Total count 1649 - Distinct count 12 - Null count 40
year INTEGER not null, --
won INTEGER null, --
foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade,
post_wins INTEGER null, -- Example Values: `0`, `12`, `9`, `13`, `1` | Value Statics: Total count 1649 - Distinct count 17 - Null count 40
coachID TEXT not null, --
tmID TEXT not null, --
lost INTEGER null, --
stint INTEGER not null, -- Example Values: `2`, `1`, `4`, `5`, `3` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0
); |
synthea | List down the first name of patients who have cystitis condition. | cystitis refers to conditions where DESCRIPTION = 'Cystitis'; | SELECT DISTINCT T1.first FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Cystitis' | CREATE TABLE immunizations
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
DATE DATE, --
primary key (DATE, PATIENT, ENCOUNTER, CODE),
DESCRIPTION TEXT, -- Example Values: `Influenza seasonal injectable preservative free`, `Td (adult) preservative free`, `meningococcal MCV4P`, `Tdap`, `HPV quadrivalent` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
);
CREATE TABLE allergies
(
CODE INTEGER, -- Example Values: `232347008`, `300916003`, `419474003`, `424213003`, `300913006` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
foreign key (ENCOUNTER) references encounters(ID),
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
primary key (PATIENT, ENCOUNTER, CODE),
STOP TEXT, -- Example Values: `12/22/14`, `4/21/10`, `10/15/11`, `3/17/10`, `5/26/08` | Value Statics: Total count 16 - Distinct count 11 - Null count 556
START TEXT, --
DESCRIPTION TEXT, -- Example Values: `Allergy to dairy product`, `Allergy to tree pollen`, `Allergy to grass pollen`, `Dander (animal) allergy`, `House dust mite allergy` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
);
CREATE TABLE observations
(
DATE DATE, --
ENCOUNTER TEXT, --
VALUE REAL, --
UNITS TEXT, -- Example Values: `cm`, `kg`, `kg/m2`, `mmHg`, `Cel` | Value Statics: Total count 78444 - Distinct count 17 - Null count 455
DESCRIPTION TEXT, --
CODE TEXT, --
PATIENT TEXT, --
foreign key (PATIENT) references patients(patient),
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE medications
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, --
PATIENT TEXT, --
STOP DATE, --
START DATE, --
REASONDESCRIPTION TEXT, --
DESCRIPTION TEXT, --
primary key (START, PATIENT, ENCOUNTER, CODE),
foreign key (PATIENT) references patients(patient),
REASONCODE INTEGER, --
ENCOUNTER TEXT, --
);
CREATE TABLE careplans
(
START DATE, --
STOP DATE, --
ID TEXT, --
REASONCODE INTEGER, --
REASONDESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
DESCRIPTION TEXT, --
CODE REAL, --
ENCOUNTER TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE encounters
(
DATE DATE, --
REASONCODE INTEGER, --
CODE INTEGER, --
ID TEXT primary key,
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
REASONDESCRIPTION TEXT, --
);
CREATE TABLE procedures
(
foreign key (PATIENT) references patients(patient),
REASONDESCRIPTION TEXT, --
PATIENT TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
DATE DATE, --
DESCRIPTION TEXT, --
ENCOUNTER TEXT, --
CODE INTEGER, --
REASONCODE INTEGER, --
);
CREATE TABLE patients
(
suffix TEXT, -- Example Values: `PhD`, `JD`, `MD` | Value Statics: Total count 45 - Distinct count 3 - Null count 1417
prefix TEXT, -- Example Values: `Mr.`, `Mrs.`, `Ms.` | Value Statics: Total count 1166 - Distinct count 3 - Null count 296
deathdate DATE, --
ethnicity TEXT, --
race TEXT, -- Example Values: `black`, `white`, `hispanic`, `asian` | Value Statics: Total count 1462 - Distinct count 4 - Null count 0
address TEXT, --
birthplace TEXT, --
passport TEXT, --
maiden TEXT, --
birthdate DATE, --
marital TEXT, -- Example Values: `S`, `M` | Value Statics: Total count 1033 - Distinct count 2 - Null count 429
gender TEXT, -- Example Values: `F`, `M` | Value Statics: Total count 1462 - Distinct count 2 - Null count 0
drivers TEXT, --
first TEXT, --
last TEXT, --
patient TEXT primary key,
ssn TEXT, --
);
CREATE TABLE claims
(
ENCOUNTER TEXT references encounters, --
PATIENT TEXT references patients, --
ORGANIZATION TEXT, -- Example Values: `temp organization` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
TOTAL INTEGER, -- Example Values: `100` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
BILLABLEPERIOD DATE, --
DIAGNOSIS TEXT, --
ID TEXT primary key,
);
CREATE TABLE conditions
(
START DATE, --
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
CODE INTEGER, --
ENCOUNTER TEXT, --
STOP DATE, --
foreign key (ENCOUNTER) references encounters(ID),
foreign key (DESCRIPTION) references all_prevalences(ITEM),
);
CREATE TABLE all_prevalences
(
"POPULATION TYPE" TEXT, -- Example Values: `LIVING` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
"POPULATION COUNT" INTEGER, -- Example Values: `1000` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
ITEM TEXT primary key,
"PREVALENCE PERCENTAGE" REAL, --
"PREVALENCE RATE" REAL, --
OCCURRENCES INTEGER, --
); |
software_company | How many customers have never married? | MARITAL_STATUS = 'Never-married'; | SELECT COUNT(ID) FROM Customers WHERE MARITAL_STATUS = 'Never-married' | CREATE TABLE Customers
(
EDUCATIONNUM INTEGER, -- Example Values: `7`, `3`, `4`, `11`, `5` | Value Statics: Total count 100000 - Distinct count 17 - Null count 0
MARITAL_STATUS TEXT, -- Example Values: `Never-married`, `Married-civ-spouse`, `Divorced`, `Widowed`, `Other` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
ID INTEGER constraint Customers_pk primary key,
SEX TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
OCCUPATION TEXT, -- Example Values: `Machine-op-inspct`, `Handlers-cleaners`, `Exec-managerial`, `Farming-fishing`, `Other-service` | Value Statics: Total count 100000 - Distinct count 8 - Null count 0
age INTEGER, --
GEOID INTEGER constraint Customers_Demog_GEOID_fk references Demog, --
);
CREATE TABLE Mailings1_2
(
RESPONSE TEXT, -- Example Values: `false`, `true` | Value Statics: Total count 60000 - Distinct count 2 - Null count 0
REFID INTEGER constraint Mailings1_2_pk primary key constraint Mailings1_2_Customers_ID_fk references Customers,
REF_DATE DATETIME, -- Example Values: `2007-02-01 12:00:00.0`, `2007-03-01 12:00:00.0` | Value Statics: Total count 60000 - Distinct count 2 - Null count 0
);
CREATE TABLE Sales
(
REFID INTEGER references Customers, --
EVENT_DATE DATETIME, --
AMOUNT REAL, --
EVENTID INTEGER constraint Sales_pk primary key,
);
CREATE TABLE Demog
(
A_VAR1 REAL, --
A_VAR2 REAL, --
A_VAR14 REAL, --
A_VAR8 REAL, --
A_VAR12 REAL, --
A_VAR6 REAL, --
A_VAR17 REAL, --
A_VAR15 REAL, --
A_VAR10 REAL, --
A_VAR16 REAL, --
INHABITANTS_K REAL, --
A_VAR3 REAL, --
A_VAR7 REAL, --
A_VAR4 REAL, --
A_VAR5 REAL, --
A_VAR13 REAL, --
A_VAR9 REAL, --
INCOME_K REAL, --
GEOID INTEGER constraint Demog_pk primary key,
A_VAR18 REAL, --
A_VAR11 REAL, --
);
CREATE TABLE mailings3
(
RESPONSE TEXT, -- Example Values: `false`, `true` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
REF_DATE DATETIME, -- Example Values: `2007-07-01 12:00:00.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
REFID INTEGER constraint mailings3_pk primary key,
); |
retail_world | Please list the full names and titles of all employees. | full name refers to LastName, FirstName | SELECT FirstName, LastName, Title FROM Employees | CREATE TABLE Products
(
CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0
Unit TEXT, --
ReorderLevel INT, --
ProductName TEXT, --
Price REAL DEFAULT 0, --
FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),
SupplierID INTEGER, --
ProductID INTEGER PRIMARY KEY AUTOINCREMENT,
FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID),
);
CREATE TABLE Customers
(
ContactName TEXT, --
Country TEXT, --
Address TEXT, --
City TEXT, --
CustomerID INTEGER PRIMARY KEY AUTOINCREMENT,
PostalCode TEXT, --
CustomerName TEXT, --
);
CREATE TABLE EmployeeTerritories
(
TerritoryID INT, --
EmployeeID INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE OrderDetails
(
Quantity INTEGER, --
FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),
OrderID INTEGER, --
FOREIGN KEY (ProductID) REFERENCES Products (ProductID),
OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT,
ProductID INTEGER, --
);
CREATE TABLE Shippers
(
ShipperID INTEGER PRIMARY KEY AUTOINCREMENT,
ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
);
CREATE TABLE Territory
(
TerritoryDescription TEXT, --
RegionID INTEGER, --
TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT,
);
CREATE TABLE EmployeeDetails
(
EmployeeID INT PRIMARY KEY,
Title TEXT, --
Salary INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE Categories
(
CategoryID INTEGER PRIMARY KEY AUTOINCREMENT,
CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
);
CREATE TABLE Employees
(
Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT,
FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
);
CREATE TABLE Suppliers
(
PostalCode TEXT, --
Address TEXT, --
SupplierID INTEGER PRIMARY KEY AUTOINCREMENT,
City TEXT, --
Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0
Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0
ContactName TEXT, --
Phone TEXT, --
SupplierName TEXT, --
);
CREATE TABLE EmployeesExtra
(
Salary INTEGER, --
Title TEXT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
EmployeeID INTEGER PRIMARY KEY,
);
CREATE TABLE discontinued_products
(
Discontinued INTEGER, --
ProductID INTEGER PRIMARY KEY,
);
CREATE TABLE Orders
(
OrderID INTEGER PRIMARY KEY AUTOINCREMENT,
CustomerID INTEGER, --
FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),
FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID),
FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),
ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0
OrderDate DATETIME, --
EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0
);
CREATE TABLE Territories
(
TerritoryDescription TEXT, --
RegionDescription TEXT, --
);
CREATE TABLE ShippingInfo
(
ShipCountry TEXT, --
ShippedDate DATETIME, --
FOREIGN KEY (OrderID) REFERENCES Orders(OrderID),
OrderID INTEGER PRIMARY KEY,
); |
professional_basketball | From 1950 to 1970, how many coaches who received more than 1 award? | from 1950 to 1970 refers to year between 1950 and 1970; more than 3 awards refers to count(award) > 3 | SELECT COUNT(coachID) FROM awards_coaches WHERE year BETWEEN 1950 AND 1970 GROUP BY coachID HAVING COUNT(coachID) > 1 | CREATE TABLE players_teams
(
PostGS INTEGER, --
PostdRebounds INTEGER, --
PostPF INTEGER, --
tmID TEXT, --
threeAttempted INTEGER, --
PostRebounds INTEGER, --
assists INTEGER, --
threeMade INTEGER, --
PostBlocks INTEGER, --
PostTurnovers INTEGER, --
GP INTEGER, --
lgID TEXT, -- Example Values: `NBA`, `NBL`, `ABA`, `ABL1`, `NPBL` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0
foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade,
PostfgMade INTEGER, --
steals INTEGER, --
oRebounds INTEGER, --
PostftAttempted INTEGER, --
ftAttempted INTEGER, --
ftMade INTEGER, --
points INTEGER, --
PostfgAttempted INTEGER, --
PostftMade INTEGER, --
note TEXT, -- Example Values: `C` | Value Statics: Total count 43 - Distinct count 1 - Null count 23708
dRebounds INTEGER, --
PostSteals INTEGER, --
blocks INTEGER, --
PostAssists INTEGER, --
minutes INTEGER, --
fgAttempted INTEGER, --
playerID TEXT not null references players on update cascade on delete cascade, --
PostthreeMade INTEGER, --
PostPoints INTEGER, --
year INTEGER, --
PF INTEGER, --
fgMade INTEGER, --
PostthreeAttempted INTEGER, --
rebounds INTEGER, --
id INTEGER primary key autoincrement,
stint INTEGER, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0
PostMinutes INTEGER, --
PostGP INTEGER, --
turnovers INTEGER, --
PostoRebounds INTEGER, --
GS INTEGER, --
);
CREATE TABLE awards_coaches
(
award TEXT, -- Example Values: `NBA Coach of the Year`, `ABA Coach of the Year` | Value Statics: Total count 61 - Distinct count 2 - Null count 0
id INTEGER primary key autoincrement,
note TEXT, -- Example Values: `tie` | Value Statics: Total count 4 - Distinct count 1 - Null count 57
coachID TEXT, --
lgID TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 61 - Distinct count 2 - Null count 0
foreign key (coachID, year) references coaches (coachID, year) on update cascade on delete cascade,
year INTEGER, --
);
CREATE TABLE draft
(
draftOverall INTEGER null, --
lgID TEXT null, -- Example Values: `ABA`, `NBA` | Value Statics: Total count 8621 - Distinct count 2 - Null count 0
suffixName TEXT null, -- Example Values: `Jr.` | Value Statics: Total count 2 - Distinct count 1 - Null count 8619
draftYear INTEGER null, --
draftSelection INTEGER null, --
tmID TEXT null, --
draftRound INTEGER null, --
lastName TEXT null, --
playerID TEXT null, --
draftFrom TEXT null, --
id INTEGER default 0 not null primary key,
firstName TEXT null, --
foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade,
foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade,
);
CREATE TABLE player_allstar
(
rebounds INTEGER null, --
playerID TEXT not null, --
season_id INTEGER not null, --
assists INTEGER null, --
conference TEXT null, -- Example Values: `East`, `West`, `Weset`, `Allstars`, `Denver` | Value Statics: Total count 1608 - Distinct count 5 - Null count 0
points INTEGER null, --
personal_fouls INTEGER null, -- Example Values: `3`, `2`, `0`, `1`, `5` | Value Statics: Total count 540 - Distinct count 8 - Null count 1068
ft_attempted INTEGER null, -- Example Values: `2`, `4`, `0`, `6`, `3` | Value Statics: Total count 1561 - Distinct count 17 - Null count 47
fg_attempted INTEGER null, --
league_id TEXT null, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 1608 - Distinct count 2 - Null count 0
foreign key (playerID) references players (playerID) on update cascade on delete cascade,
fg_made INTEGER null, -- Example Values: `4`, `8`, `5`, `7`, `3` | Value Statics: Total count 1561 - Distinct count 18 - Null count 47
ft_made INTEGER null, -- Example Values: `2`, `3`, `0`, `1`, `4` | Value Statics: Total count 1561 - Distinct count 13 - Null count 47
steals INTEGER null, -- Example Values: `3`, `0`, `1`, `2`, `5` | Value Statics: Total count 398 - Distinct count 7 - Null count 1210
games_played INTEGER null, -- Example Values: `1` | Value Statics: Total count 1608 - Distinct count 1 - Null count 0
first_name TEXT null, --
d_rebounds INTEGER null, -- Example Values: `2`, `5`, `0`, `1`, `4` | Value Statics: Total count 493 - Distinct count 14 - Null count 1115
last_name TEXT null, --
primary key (playerID, season_id),
turnovers INTEGER null, -- Example Values: `1`, `0`, `3`, `2`, `4` | Value Statics: Total count 493 - Distinct count 9 - Null count 1115
three_made INTEGER null, -- Example Values: `0`, `1`, `3`, `5`, `4` | Value Statics: Total count 566 - Distinct count 7 - Null count 1042
minutes INTEGER null, --
blocks INTEGER null, -- Example Values: `2`, `0`, `1`, `3`, `5` | Value Statics: Total count 398 - Distinct count 6 - Null count 1210
three_attempted INTEGER null, -- Example Values: `0`, `1`, `6`, `7`, `10` | Value Statics: Total count 540 - Distinct count 12 - Null count 1068
o_rebounds INTEGER null, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 493 - Distinct count 10 - Null count 1115
);
CREATE TABLE awards_players
(
foreign key (playerID) references players (playerID) on update cascade on delete cascade,
year INTEGER not null, --
pos TEXT null, -- Example Values: `C`, `F`, `G`, `F/G`, `F/C` | Value Statics: Total count 833 - Distinct count 5 - Null count 886
primary key (playerID, year, award),
lgID TEXT null, -- Example Values: `NBA`, `ABA`, `NBL`, `ABL1` | Value Statics: Total count 1719 - Distinct count 4 - Null count 0
award TEXT not null, --
playerID TEXT not null, --
note TEXT null, -- Example Values: `tie` | Value Statics: Total count 37 - Distinct count 1 - Null count 1682
);
CREATE TABLE series_post
(
tmIDLoser TEXT, --
id INTEGER primary key autoincrement,
series TEXT, -- Example Values: `O`, `M`, `N`, `A`, `K` | Value Statics: Total count 775 - Distinct count 11 - Null count 0
tmIDWinner TEXT, --
round TEXT, -- Example Values: `F`, `QF`, `SF`, `DT`, `DF` | Value Statics: Total count 775 - Distinct count 11 - Null count 0
year INTEGER, --
foreign key (tmIDLoser, year) references teams (tmID, year) on update cascade on delete cascade,
foreign key (tmIDWinner, year) references teams (tmID, year) on update cascade on delete cascade,
W INTEGER, -- Example Values: `4`, `2`, `1`, `3`, `0` | Value Statics: Total count 775 - Distinct count 5 - Null count 0
lgIDLoser TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0
lgIDWinner TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0
L INTEGER, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 775 - Distinct count 5 - Null count 0
);
CREATE TABLE players
(
nameGiven TEXT null, -- Example Values: `nameGiven`, `Mort`, `Robert`, `Jim`, `Mike` | Value Statics: Total count 10 - Distinct count 9 - Null count 5052
lastseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15
hsCountry TEXT null, --
firstName TEXT null, --
hsCity TEXT null, --
firstseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15
weight INTEGER null, --
birthCountry TEXT null, --
race TEXT null, -- Example Values: `B`, `W`, `O`, `1`, `r` | Value Statics: Total count 4903 - Distinct count 5 - Null count 159
lastName TEXT null, --
birthDate DATE null, --
collegeOther TEXT null, --
birthState TEXT null, --
useFirst TEXT null, --
pos TEXT null, -- Example Values: `F-C`, `C`, `G`, `G-F`, `C-F` | Value Statics: Total count 4880 - Distinct count 14 - Null count 182
playerID TEXT not null primary key,
college TEXT null, --
highSchool TEXT null, --
hsState TEXT null, --
height REAL null, --
deathDate DATE null, --
nameSuffix TEXT null, -- Example Values: `Jr.`, `III`, `nameSuffix`, `II`, `IV` | Value Statics: Total count 324 - Distinct count 6 - Null count 4738
nameNick TEXT null, --
fullGivenName TEXT null, --
birthCity TEXT null, --
middleName TEXT null, --
);
CREATE TABLE teams
(
d_pts INTEGER null, --
name TEXT null, --
homeLost INTEGER null, --
o_ftm INTEGER null, --
franchID TEXT null, --
tmID TEXT not null, --
awayWon INTEGER null, --
primary key (year, tmID),
o_fgm INTEGER null, --
year INTEGER not null, --
awayLost INTEGER null, --
arena TEXT null, --
confID TEXT null, -- Example Values: `EC`, `WC` | Value Statics: Total count 1064 - Distinct count 2 - Null count 472
games INTEGER null, --
lost INTEGER null, --
divID TEXT null, -- Example Values: `EA`, `WE`, `ED`, `WD`, `SO` | Value Statics: Total count 1498 - Distinct count 13 - Null count 38
lgID TEXT null, -- Example Values: `NBL`, `NBA`, `PBLA`, `NPBL`, `ABL1` | Value Statics: Total count 1536 - Distinct count 6 - Null count 0
homeWon INTEGER null, --
confRank INTEGER null, -- Example Values: `0`, `4`, `3`, `5`, `7` | Value Statics: Total count 1536 - Distinct count 16 - Null count 0
o_pts INTEGER null, --
`rank` INTEGER null, -- Example Values: `1`, `2`, `4`, `5`, `6` | Value Statics: Total count 1536 - Distinct count 10 - Null count 0
playoff TEXT null, -- Example Values: `CF`, `WC`, `LC`, `CS`, `F` | Value Statics: Total count 901 - Distinct count 15 - Null count 635
won INTEGER null, --
);
CREATE TABLE coaches
(
primary key (coachID, year, tmID, stint),
lgID TEXT null, -- Example Values: `NBA`, `ABA`, `ABL1`, `PBLA`, `NPBL` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0
post_losses INTEGER null, -- Example Values: `3`, `9`, `7`, `8`, `0` | Value Statics: Total count 1649 - Distinct count 12 - Null count 40
year INTEGER not null, --
won INTEGER null, --
foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade,
post_wins INTEGER null, -- Example Values: `0`, `12`, `9`, `13`, `1` | Value Statics: Total count 1649 - Distinct count 17 - Null count 40
coachID TEXT not null, --
tmID TEXT not null, --
lost INTEGER null, --
stint INTEGER not null, -- Example Values: `2`, `1`, `4`, `5`, `3` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0
); |
synthea | List the ids of all the patients with condition that has a prevalence percentage of 18.8%. | ids of the patients refer to PATIENT from conditions; condition that has a prevalence percentage of 18.8% refers to PREVALENCE PERCENTAGE = 18.8; | SELECT DISTINCT T1.PATIENT FROM conditions AS T1 INNER JOIN all_prevalences AS T2 ON lower(T2.ITEM) = lower(T1.DESCRIPTION) WHERE T2."PREVALENCE PERCENTAGE" = CAST(18.8 AS float) | CREATE TABLE immunizations
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
DATE DATE, --
primary key (DATE, PATIENT, ENCOUNTER, CODE),
DESCRIPTION TEXT, -- Example Values: `Influenza seasonal injectable preservative free`, `Td (adult) preservative free`, `meningococcal MCV4P`, `Tdap`, `HPV quadrivalent` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
);
CREATE TABLE allergies
(
CODE INTEGER, -- Example Values: `232347008`, `300916003`, `419474003`, `424213003`, `300913006` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
foreign key (ENCOUNTER) references encounters(ID),
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
primary key (PATIENT, ENCOUNTER, CODE),
STOP TEXT, -- Example Values: `12/22/14`, `4/21/10`, `10/15/11`, `3/17/10`, `5/26/08` | Value Statics: Total count 16 - Distinct count 11 - Null count 556
START TEXT, --
DESCRIPTION TEXT, -- Example Values: `Allergy to dairy product`, `Allergy to tree pollen`, `Allergy to grass pollen`, `Dander (animal) allergy`, `House dust mite allergy` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
);
CREATE TABLE observations
(
DATE DATE, --
ENCOUNTER TEXT, --
VALUE REAL, --
UNITS TEXT, -- Example Values: `cm`, `kg`, `kg/m2`, `mmHg`, `Cel` | Value Statics: Total count 78444 - Distinct count 17 - Null count 455
DESCRIPTION TEXT, --
CODE TEXT, --
PATIENT TEXT, --
foreign key (PATIENT) references patients(patient),
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE medications
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, --
PATIENT TEXT, --
STOP DATE, --
START DATE, --
REASONDESCRIPTION TEXT, --
DESCRIPTION TEXT, --
primary key (START, PATIENT, ENCOUNTER, CODE),
foreign key (PATIENT) references patients(patient),
REASONCODE INTEGER, --
ENCOUNTER TEXT, --
);
CREATE TABLE careplans
(
START DATE, --
STOP DATE, --
ID TEXT, --
REASONCODE INTEGER, --
REASONDESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
DESCRIPTION TEXT, --
CODE REAL, --
ENCOUNTER TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE encounters
(
DATE DATE, --
REASONCODE INTEGER, --
CODE INTEGER, --
ID TEXT primary key,
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
REASONDESCRIPTION TEXT, --
);
CREATE TABLE procedures
(
foreign key (PATIENT) references patients(patient),
REASONDESCRIPTION TEXT, --
PATIENT TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
DATE DATE, --
DESCRIPTION TEXT, --
ENCOUNTER TEXT, --
CODE INTEGER, --
REASONCODE INTEGER, --
);
CREATE TABLE patients
(
suffix TEXT, -- Example Values: `PhD`, `JD`, `MD` | Value Statics: Total count 45 - Distinct count 3 - Null count 1417
prefix TEXT, -- Example Values: `Mr.`, `Mrs.`, `Ms.` | Value Statics: Total count 1166 - Distinct count 3 - Null count 296
deathdate DATE, --
ethnicity TEXT, --
race TEXT, -- Example Values: `black`, `white`, `hispanic`, `asian` | Value Statics: Total count 1462 - Distinct count 4 - Null count 0
address TEXT, --
birthplace TEXT, --
passport TEXT, --
maiden TEXT, --
birthdate DATE, --
marital TEXT, -- Example Values: `S`, `M` | Value Statics: Total count 1033 - Distinct count 2 - Null count 429
gender TEXT, -- Example Values: `F`, `M` | Value Statics: Total count 1462 - Distinct count 2 - Null count 0
drivers TEXT, --
first TEXT, --
last TEXT, --
patient TEXT primary key,
ssn TEXT, --
);
CREATE TABLE claims
(
ENCOUNTER TEXT references encounters, --
PATIENT TEXT references patients, --
ORGANIZATION TEXT, -- Example Values: `temp organization` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
TOTAL INTEGER, -- Example Values: `100` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
BILLABLEPERIOD DATE, --
DIAGNOSIS TEXT, --
ID TEXT primary key,
);
CREATE TABLE conditions
(
START DATE, --
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
CODE INTEGER, --
ENCOUNTER TEXT, --
STOP DATE, --
foreign key (ENCOUNTER) references encounters(ID),
foreign key (DESCRIPTION) references all_prevalences(ITEM),
);
CREATE TABLE all_prevalences
(
"POPULATION TYPE" TEXT, -- Example Values: `LIVING` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
"POPULATION COUNT" INTEGER, -- Example Values: `1000` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
ITEM TEXT primary key,
"PREVALENCE PERCENTAGE" REAL, --
"PREVALENCE RATE" REAL, --
OCCURRENCES INTEGER, --
); |
mondial_geo | What is the provincial capital of the province with a population of less than 80,000 that has the highest average population per area? | Average population per area = population / area | SELECT CapProv FROM province WHERE Population < 80000 ORDER BY Population / Area DESC LIMIT 1 | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200
);
CREATE TABLE river
(
River TEXT, --
Mountains TEXT, --
SourceAltitude REAL, --
Length REAL, --
EstuaryLatitude REAL, --
SourceLongitude REAL, --
Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, --
EstuaryLongitude REAL, --
Sea TEXT, --
Name TEXT default '' not null primary key,
SourceLatitude REAL, --
);
CREATE TABLE mountainOnIsland
(
Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, --
primary key (Mountain, Island),
Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, --
);
CREATE TABLE organization
(
City TEXT, --
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, --
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
Abbreviation TEXT not null primary key,
Province TEXT, --
Name TEXT not null constraint ix_organization_OrgNameUnique unique, --
Established DATE, --
);
CREATE TABLE geo_desert
(
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, --
Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, --
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Desert),
);
CREATE TABLE geo_source
(
River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (Province, Country, River),
);
CREATE TABLE geo_sea
(
Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, --
Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, --
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Sea),
Province TEXT default '' not null, --
);
CREATE TABLE geo_estuary
(
primary key (Province, Country, River),
River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, --
);
CREATE TABLE located
(
River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, --
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, --
Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, --
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
City TEXT, --
Province TEXT, --
);
CREATE TABLE lake
(
Depth REAL, --
Altitude REAL, --
Name TEXT default '' not null primary key,
Longitude REAL, --
Latitude REAL, --
Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74
River TEXT, --
Area REAL, --
);
CREATE TABLE desert
(
Longitude REAL, --
Area REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
);
CREATE TABLE geo_mountain
(
Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, --
primary key (Province, Country, Mountain),
Province TEXT default '' not null, --
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, --
);
CREATE TABLE ethnicGroup
(
primary key (Name, Country),
Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, --
Name TEXT default '' not null, --
Percentage REAL, --
);
CREATE TABLE economy
(
Industry REAL, --
GDP REAL, --
Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade,
Inflation REAL, --
Service REAL, --
Agriculture REAL, --
);
CREATE TABLE borders
(
primary key (Country1, Country2),
Country2 TEXT default '' not null constraint borders_ibfk_2 references country, --
Length REAL, --
Country1 TEXT default '' not null constraint borders_ibfk_1 references country, --
);
CREATE TABLE language
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE islandIn
(
Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, --
River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349
Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, --
Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344
);
CREATE TABLE country
(
Area REAL, --
Capital TEXT, --
Population INTEGER, --
Name TEXT not null constraint ix_county_Name unique, --
Province TEXT, --
Code TEXT default '' not null primary key,
);
CREATE TABLE city
(
Longitude REAL, --
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Population INTEGER, --
Province TEXT default '' not null, --
primary key (Name, Province),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, --
Latitude REAL, --
);
CREATE TABLE island
(
Name TEXT default '' not null primary key,
Islands TEXT, --
Area REAL, --
Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185
Longitude REAL, --
Height REAL, --
Latitude REAL, --
);
CREATE TABLE geo_lake
(
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, --
primary key (Province, Country, Lake),
Province TEXT default '' not null, --
);
CREATE TABLE mountain
(
Longitude REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
Type TEXT, --
Height REAL, --
Mountains TEXT, --
);
CREATE TABLE province
(
Capital TEXT, --
Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, --
primary key (Name, Country),
Population INTEGER, --
Area REAL, --
Name TEXT not null, --
CapProv TEXT, --
);
CREATE TABLE population
(
Infant_Mortality REAL, --
Population_Growth REAL, --
Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade,
);
CREATE TABLE isMember
(
primary key (Country, Organization),
Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, --
Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, --
Type TEXT default 'member', --
);
CREATE TABLE locatedOn
(
Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, --
Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (City, Province, Country, Island),
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
City TEXT default '' not null, --
);
CREATE TABLE mergesWith
(
Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, --
Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, --
primary key (Sea1, Sea2),
);
CREATE TABLE encompasses
(
Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0
Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0
primary key (Country, Continent),
);
CREATE TABLE continent
(
Name TEXT default '' not null primary key,
Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0
);
CREATE TABLE religion
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE geo_river
(
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, River),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, --
River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, --
);
CREATE TABLE sea
(
Depth REAL, --
Name TEXT default '' not null primary key,
);
CREATE TABLE target
(
Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade,
Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0
);
CREATE TABLE geo_island
(
Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, --
primary key (Province, Country, Island),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, --
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
); |
retail_world | What percentage of orders were placed by customers in Madrid city in 1996? | "Madrid" is the City; in 1996 refers to YEAR (OrderDate) = 1996; percentage = Divide (Count (CustomerID where City = 'Madrid'), Count (CustomerID)) * 100 | SELECT CAST(COUNT(CASE WHEN T1.City = 'Madrid' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.City) FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE STRFTIME('%Y', T2.OrderDate) = 1996 | CREATE TABLE Products
(
CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0
Unit TEXT, --
ReorderLevel INT, --
ProductName TEXT, --
Price REAL DEFAULT 0, --
FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),
SupplierID INTEGER, --
ProductID INTEGER PRIMARY KEY AUTOINCREMENT,
FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID),
);
CREATE TABLE Customers
(
ContactName TEXT, --
Country TEXT, --
Address TEXT, --
City TEXT, --
CustomerID INTEGER PRIMARY KEY AUTOINCREMENT,
PostalCode TEXT, --
CustomerName TEXT, --
);
CREATE TABLE EmployeeTerritories
(
TerritoryID INT, --
EmployeeID INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE OrderDetails
(
Quantity INTEGER, --
FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),
OrderID INTEGER, --
FOREIGN KEY (ProductID) REFERENCES Products (ProductID),
OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT,
ProductID INTEGER, --
);
CREATE TABLE Shippers
(
ShipperID INTEGER PRIMARY KEY AUTOINCREMENT,
ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
);
CREATE TABLE Territory
(
TerritoryDescription TEXT, --
RegionID INTEGER, --
TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT,
);
CREATE TABLE EmployeeDetails
(
EmployeeID INT PRIMARY KEY,
Title TEXT, --
Salary INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE Categories
(
CategoryID INTEGER PRIMARY KEY AUTOINCREMENT,
CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
);
CREATE TABLE Employees
(
Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT,
FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
);
CREATE TABLE Suppliers
(
PostalCode TEXT, --
Address TEXT, --
SupplierID INTEGER PRIMARY KEY AUTOINCREMENT,
City TEXT, --
Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0
Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0
ContactName TEXT, --
Phone TEXT, --
SupplierName TEXT, --
);
CREATE TABLE EmployeesExtra
(
Salary INTEGER, --
Title TEXT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
EmployeeID INTEGER PRIMARY KEY,
);
CREATE TABLE discontinued_products
(
Discontinued INTEGER, --
ProductID INTEGER PRIMARY KEY,
);
CREATE TABLE Orders
(
OrderID INTEGER PRIMARY KEY AUTOINCREMENT,
CustomerID INTEGER, --
FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),
FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID),
FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),
ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0
OrderDate DATETIME, --
EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0
);
CREATE TABLE Territories
(
TerritoryDescription TEXT, --
RegionDescription TEXT, --
);
CREATE TABLE ShippingInfo
(
ShipCountry TEXT, --
ShippedDate DATETIME, --
FOREIGN KEY (OrderID) REFERENCES Orders(OrderID),
OrderID INTEGER PRIMARY KEY,
); |
professional_basketball | How many teams in the NBA which has at least 3 all-star players? | NBA refers to lgID = 'NBA'; have at least 3 all-star players refers to count(player_allstar.playerID) > 3 | SELECT COUNT(*) FROM ( SELECT tmID FROM players_teams AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T1.lgID = 'NBA' GROUP BY T1.tmID HAVING COUNT(DISTINCT T1.playerID) > 3 ) AS T3 | CREATE TABLE players_teams
(
PostGS INTEGER, --
PostdRebounds INTEGER, --
PostPF INTEGER, --
tmID TEXT, --
threeAttempted INTEGER, --
PostRebounds INTEGER, --
assists INTEGER, --
threeMade INTEGER, --
PostBlocks INTEGER, --
PostTurnovers INTEGER, --
GP INTEGER, --
lgID TEXT, -- Example Values: `NBA`, `NBL`, `ABA`, `ABL1`, `NPBL` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0
foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade,
PostfgMade INTEGER, --
steals INTEGER, --
oRebounds INTEGER, --
PostftAttempted INTEGER, --
ftAttempted INTEGER, --
ftMade INTEGER, --
points INTEGER, --
PostfgAttempted INTEGER, --
PostftMade INTEGER, --
note TEXT, -- Example Values: `C` | Value Statics: Total count 43 - Distinct count 1 - Null count 23708
dRebounds INTEGER, --
PostSteals INTEGER, --
blocks INTEGER, --
PostAssists INTEGER, --
minutes INTEGER, --
fgAttempted INTEGER, --
playerID TEXT not null references players on update cascade on delete cascade, --
PostthreeMade INTEGER, --
PostPoints INTEGER, --
year INTEGER, --
PF INTEGER, --
fgMade INTEGER, --
PostthreeAttempted INTEGER, --
rebounds INTEGER, --
id INTEGER primary key autoincrement,
stint INTEGER, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0
PostMinutes INTEGER, --
PostGP INTEGER, --
turnovers INTEGER, --
PostoRebounds INTEGER, --
GS INTEGER, --
);
CREATE TABLE awards_coaches
(
award TEXT, -- Example Values: `NBA Coach of the Year`, `ABA Coach of the Year` | Value Statics: Total count 61 - Distinct count 2 - Null count 0
id INTEGER primary key autoincrement,
note TEXT, -- Example Values: `tie` | Value Statics: Total count 4 - Distinct count 1 - Null count 57
coachID TEXT, --
lgID TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 61 - Distinct count 2 - Null count 0
foreign key (coachID, year) references coaches (coachID, year) on update cascade on delete cascade,
year INTEGER, --
);
CREATE TABLE draft
(
draftOverall INTEGER null, --
lgID TEXT null, -- Example Values: `ABA`, `NBA` | Value Statics: Total count 8621 - Distinct count 2 - Null count 0
suffixName TEXT null, -- Example Values: `Jr.` | Value Statics: Total count 2 - Distinct count 1 - Null count 8619
draftYear INTEGER null, --
draftSelection INTEGER null, --
tmID TEXT null, --
draftRound INTEGER null, --
lastName TEXT null, --
playerID TEXT null, --
draftFrom TEXT null, --
id INTEGER default 0 not null primary key,
firstName TEXT null, --
foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade,
foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade,
);
CREATE TABLE player_allstar
(
rebounds INTEGER null, --
playerID TEXT not null, --
season_id INTEGER not null, --
assists INTEGER null, --
conference TEXT null, -- Example Values: `East`, `West`, `Weset`, `Allstars`, `Denver` | Value Statics: Total count 1608 - Distinct count 5 - Null count 0
points INTEGER null, --
personal_fouls INTEGER null, -- Example Values: `3`, `2`, `0`, `1`, `5` | Value Statics: Total count 540 - Distinct count 8 - Null count 1068
ft_attempted INTEGER null, -- Example Values: `2`, `4`, `0`, `6`, `3` | Value Statics: Total count 1561 - Distinct count 17 - Null count 47
fg_attempted INTEGER null, --
league_id TEXT null, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 1608 - Distinct count 2 - Null count 0
foreign key (playerID) references players (playerID) on update cascade on delete cascade,
fg_made INTEGER null, -- Example Values: `4`, `8`, `5`, `7`, `3` | Value Statics: Total count 1561 - Distinct count 18 - Null count 47
ft_made INTEGER null, -- Example Values: `2`, `3`, `0`, `1`, `4` | Value Statics: Total count 1561 - Distinct count 13 - Null count 47
steals INTEGER null, -- Example Values: `3`, `0`, `1`, `2`, `5` | Value Statics: Total count 398 - Distinct count 7 - Null count 1210
games_played INTEGER null, -- Example Values: `1` | Value Statics: Total count 1608 - Distinct count 1 - Null count 0
first_name TEXT null, --
d_rebounds INTEGER null, -- Example Values: `2`, `5`, `0`, `1`, `4` | Value Statics: Total count 493 - Distinct count 14 - Null count 1115
last_name TEXT null, --
primary key (playerID, season_id),
turnovers INTEGER null, -- Example Values: `1`, `0`, `3`, `2`, `4` | Value Statics: Total count 493 - Distinct count 9 - Null count 1115
three_made INTEGER null, -- Example Values: `0`, `1`, `3`, `5`, `4` | Value Statics: Total count 566 - Distinct count 7 - Null count 1042
minutes INTEGER null, --
blocks INTEGER null, -- Example Values: `2`, `0`, `1`, `3`, `5` | Value Statics: Total count 398 - Distinct count 6 - Null count 1210
three_attempted INTEGER null, -- Example Values: `0`, `1`, `6`, `7`, `10` | Value Statics: Total count 540 - Distinct count 12 - Null count 1068
o_rebounds INTEGER null, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 493 - Distinct count 10 - Null count 1115
);
CREATE TABLE awards_players
(
foreign key (playerID) references players (playerID) on update cascade on delete cascade,
year INTEGER not null, --
pos TEXT null, -- Example Values: `C`, `F`, `G`, `F/G`, `F/C` | Value Statics: Total count 833 - Distinct count 5 - Null count 886
primary key (playerID, year, award),
lgID TEXT null, -- Example Values: `NBA`, `ABA`, `NBL`, `ABL1` | Value Statics: Total count 1719 - Distinct count 4 - Null count 0
award TEXT not null, --
playerID TEXT not null, --
note TEXT null, -- Example Values: `tie` | Value Statics: Total count 37 - Distinct count 1 - Null count 1682
);
CREATE TABLE series_post
(
tmIDLoser TEXT, --
id INTEGER primary key autoincrement,
series TEXT, -- Example Values: `O`, `M`, `N`, `A`, `K` | Value Statics: Total count 775 - Distinct count 11 - Null count 0
tmIDWinner TEXT, --
round TEXT, -- Example Values: `F`, `QF`, `SF`, `DT`, `DF` | Value Statics: Total count 775 - Distinct count 11 - Null count 0
year INTEGER, --
foreign key (tmIDLoser, year) references teams (tmID, year) on update cascade on delete cascade,
foreign key (tmIDWinner, year) references teams (tmID, year) on update cascade on delete cascade,
W INTEGER, -- Example Values: `4`, `2`, `1`, `3`, `0` | Value Statics: Total count 775 - Distinct count 5 - Null count 0
lgIDLoser TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0
lgIDWinner TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0
L INTEGER, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 775 - Distinct count 5 - Null count 0
);
CREATE TABLE players
(
nameGiven TEXT null, -- Example Values: `nameGiven`, `Mort`, `Robert`, `Jim`, `Mike` | Value Statics: Total count 10 - Distinct count 9 - Null count 5052
lastseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15
hsCountry TEXT null, --
firstName TEXT null, --
hsCity TEXT null, --
firstseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15
weight INTEGER null, --
birthCountry TEXT null, --
race TEXT null, -- Example Values: `B`, `W`, `O`, `1`, `r` | Value Statics: Total count 4903 - Distinct count 5 - Null count 159
lastName TEXT null, --
birthDate DATE null, --
collegeOther TEXT null, --
birthState TEXT null, --
useFirst TEXT null, --
pos TEXT null, -- Example Values: `F-C`, `C`, `G`, `G-F`, `C-F` | Value Statics: Total count 4880 - Distinct count 14 - Null count 182
playerID TEXT not null primary key,
college TEXT null, --
highSchool TEXT null, --
hsState TEXT null, --
height REAL null, --
deathDate DATE null, --
nameSuffix TEXT null, -- Example Values: `Jr.`, `III`, `nameSuffix`, `II`, `IV` | Value Statics: Total count 324 - Distinct count 6 - Null count 4738
nameNick TEXT null, --
fullGivenName TEXT null, --
birthCity TEXT null, --
middleName TEXT null, --
);
CREATE TABLE teams
(
d_pts INTEGER null, --
name TEXT null, --
homeLost INTEGER null, --
o_ftm INTEGER null, --
franchID TEXT null, --
tmID TEXT not null, --
awayWon INTEGER null, --
primary key (year, tmID),
o_fgm INTEGER null, --
year INTEGER not null, --
awayLost INTEGER null, --
arena TEXT null, --
confID TEXT null, -- Example Values: `EC`, `WC` | Value Statics: Total count 1064 - Distinct count 2 - Null count 472
games INTEGER null, --
lost INTEGER null, --
divID TEXT null, -- Example Values: `EA`, `WE`, `ED`, `WD`, `SO` | Value Statics: Total count 1498 - Distinct count 13 - Null count 38
lgID TEXT null, -- Example Values: `NBL`, `NBA`, `PBLA`, `NPBL`, `ABL1` | Value Statics: Total count 1536 - Distinct count 6 - Null count 0
homeWon INTEGER null, --
confRank INTEGER null, -- Example Values: `0`, `4`, `3`, `5`, `7` | Value Statics: Total count 1536 - Distinct count 16 - Null count 0
o_pts INTEGER null, --
`rank` INTEGER null, -- Example Values: `1`, `2`, `4`, `5`, `6` | Value Statics: Total count 1536 - Distinct count 10 - Null count 0
playoff TEXT null, -- Example Values: `CF`, `WC`, `LC`, `CS`, `F` | Value Statics: Total count 901 - Distinct count 15 - Null count 635
won INTEGER null, --
);
CREATE TABLE coaches
(
primary key (coachID, year, tmID, stint),
lgID TEXT null, -- Example Values: `NBA`, `ABA`, `ABL1`, `PBLA`, `NPBL` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0
post_losses INTEGER null, -- Example Values: `3`, `9`, `7`, `8`, `0` | Value Statics: Total count 1649 - Distinct count 12 - Null count 40
year INTEGER not null, --
won INTEGER null, --
foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade,
post_wins INTEGER null, -- Example Values: `0`, `12`, `9`, `13`, `1` | Value Statics: Total count 1649 - Distinct count 17 - Null count 40
coachID TEXT not null, --
tmID TEXT not null, --
lost INTEGER null, --
stint INTEGER not null, -- Example Values: `2`, `1`, `4`, `5`, `3` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0
); |
synthea | List down the last name of patients who are allergic to dairy products. | allergic to dairy products refers to allergies where DESCRIPTION = 'Allergy to dairy product'; | SELECT DISTINCT T1.last FROM patients AS T1 INNER JOIN allergies AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Allergy to dairy product' | CREATE TABLE immunizations
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
DATE DATE, --
primary key (DATE, PATIENT, ENCOUNTER, CODE),
DESCRIPTION TEXT, -- Example Values: `Influenza seasonal injectable preservative free`, `Td (adult) preservative free`, `meningococcal MCV4P`, `Tdap`, `HPV quadrivalent` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
);
CREATE TABLE allergies
(
CODE INTEGER, -- Example Values: `232347008`, `300916003`, `419474003`, `424213003`, `300913006` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
foreign key (ENCOUNTER) references encounters(ID),
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
primary key (PATIENT, ENCOUNTER, CODE),
STOP TEXT, -- Example Values: `12/22/14`, `4/21/10`, `10/15/11`, `3/17/10`, `5/26/08` | Value Statics: Total count 16 - Distinct count 11 - Null count 556
START TEXT, --
DESCRIPTION TEXT, -- Example Values: `Allergy to dairy product`, `Allergy to tree pollen`, `Allergy to grass pollen`, `Dander (animal) allergy`, `House dust mite allergy` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
);
CREATE TABLE observations
(
DATE DATE, --
ENCOUNTER TEXT, --
VALUE REAL, --
UNITS TEXT, -- Example Values: `cm`, `kg`, `kg/m2`, `mmHg`, `Cel` | Value Statics: Total count 78444 - Distinct count 17 - Null count 455
DESCRIPTION TEXT, --
CODE TEXT, --
PATIENT TEXT, --
foreign key (PATIENT) references patients(patient),
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE medications
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, --
PATIENT TEXT, --
STOP DATE, --
START DATE, --
REASONDESCRIPTION TEXT, --
DESCRIPTION TEXT, --
primary key (START, PATIENT, ENCOUNTER, CODE),
foreign key (PATIENT) references patients(patient),
REASONCODE INTEGER, --
ENCOUNTER TEXT, --
);
CREATE TABLE careplans
(
START DATE, --
STOP DATE, --
ID TEXT, --
REASONCODE INTEGER, --
REASONDESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
DESCRIPTION TEXT, --
CODE REAL, --
ENCOUNTER TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE encounters
(
DATE DATE, --
REASONCODE INTEGER, --
CODE INTEGER, --
ID TEXT primary key,
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
REASONDESCRIPTION TEXT, --
);
CREATE TABLE procedures
(
foreign key (PATIENT) references patients(patient),
REASONDESCRIPTION TEXT, --
PATIENT TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
DATE DATE, --
DESCRIPTION TEXT, --
ENCOUNTER TEXT, --
CODE INTEGER, --
REASONCODE INTEGER, --
);
CREATE TABLE patients
(
suffix TEXT, -- Example Values: `PhD`, `JD`, `MD` | Value Statics: Total count 45 - Distinct count 3 - Null count 1417
prefix TEXT, -- Example Values: `Mr.`, `Mrs.`, `Ms.` | Value Statics: Total count 1166 - Distinct count 3 - Null count 296
deathdate DATE, --
ethnicity TEXT, --
race TEXT, -- Example Values: `black`, `white`, `hispanic`, `asian` | Value Statics: Total count 1462 - Distinct count 4 - Null count 0
address TEXT, --
birthplace TEXT, --
passport TEXT, --
maiden TEXT, --
birthdate DATE, --
marital TEXT, -- Example Values: `S`, `M` | Value Statics: Total count 1033 - Distinct count 2 - Null count 429
gender TEXT, -- Example Values: `F`, `M` | Value Statics: Total count 1462 - Distinct count 2 - Null count 0
drivers TEXT, --
first TEXT, --
last TEXT, --
patient TEXT primary key,
ssn TEXT, --
);
CREATE TABLE claims
(
ENCOUNTER TEXT references encounters, --
PATIENT TEXT references patients, --
ORGANIZATION TEXT, -- Example Values: `temp organization` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
TOTAL INTEGER, -- Example Values: `100` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
BILLABLEPERIOD DATE, --
DIAGNOSIS TEXT, --
ID TEXT primary key,
);
CREATE TABLE conditions
(
START DATE, --
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
CODE INTEGER, --
ENCOUNTER TEXT, --
STOP DATE, --
foreign key (ENCOUNTER) references encounters(ID),
foreign key (DESCRIPTION) references all_prevalences(ITEM),
);
CREATE TABLE all_prevalences
(
"POPULATION TYPE" TEXT, -- Example Values: `LIVING` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
"POPULATION COUNT" INTEGER, -- Example Values: `1000` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
ITEM TEXT primary key,
"PREVALENCE PERCENTAGE" REAL, --
"PREVALENCE RATE" REAL, --
OCCURRENCES INTEGER, --
); |
mondial_geo | Indicate the coordinates of all the deserts whose area is in more than one country. | coordinates consists of Latitude, Longitude | SELECT T1.Latitude, T1.Longitude FROM desert AS T1 INNER JOIN geo_desert AS T2 ON T1.Name = T2.Desert GROUP BY T1.Name, T1.Latitude, T1.Longitude HAVING COUNT(T1.Name) > 1 | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200
);
CREATE TABLE river
(
River TEXT, --
Mountains TEXT, --
SourceAltitude REAL, --
Length REAL, --
EstuaryLatitude REAL, --
SourceLongitude REAL, --
Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, --
EstuaryLongitude REAL, --
Sea TEXT, --
Name TEXT default '' not null primary key,
SourceLatitude REAL, --
);
CREATE TABLE mountainOnIsland
(
Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, --
primary key (Mountain, Island),
Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, --
);
CREATE TABLE organization
(
City TEXT, --
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, --
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
Abbreviation TEXT not null primary key,
Province TEXT, --
Name TEXT not null constraint ix_organization_OrgNameUnique unique, --
Established DATE, --
);
CREATE TABLE geo_desert
(
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, --
Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, --
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Desert),
);
CREATE TABLE geo_source
(
River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (Province, Country, River),
);
CREATE TABLE geo_sea
(
Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, --
Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, --
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Sea),
Province TEXT default '' not null, --
);
CREATE TABLE geo_estuary
(
primary key (Province, Country, River),
River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, --
);
CREATE TABLE located
(
River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, --
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, --
Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, --
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
City TEXT, --
Province TEXT, --
);
CREATE TABLE lake
(
Depth REAL, --
Altitude REAL, --
Name TEXT default '' not null primary key,
Longitude REAL, --
Latitude REAL, --
Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74
River TEXT, --
Area REAL, --
);
CREATE TABLE desert
(
Longitude REAL, --
Area REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
);
CREATE TABLE geo_mountain
(
Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, --
primary key (Province, Country, Mountain),
Province TEXT default '' not null, --
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, --
);
CREATE TABLE ethnicGroup
(
primary key (Name, Country),
Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, --
Name TEXT default '' not null, --
Percentage REAL, --
);
CREATE TABLE economy
(
Industry REAL, --
GDP REAL, --
Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade,
Inflation REAL, --
Service REAL, --
Agriculture REAL, --
);
CREATE TABLE borders
(
primary key (Country1, Country2),
Country2 TEXT default '' not null constraint borders_ibfk_2 references country, --
Length REAL, --
Country1 TEXT default '' not null constraint borders_ibfk_1 references country, --
);
CREATE TABLE language
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE islandIn
(
Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, --
River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349
Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, --
Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344
);
CREATE TABLE country
(
Area REAL, --
Capital TEXT, --
Population INTEGER, --
Name TEXT not null constraint ix_county_Name unique, --
Province TEXT, --
Code TEXT default '' not null primary key,
);
CREATE TABLE city
(
Longitude REAL, --
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Population INTEGER, --
Province TEXT default '' not null, --
primary key (Name, Province),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, --
Latitude REAL, --
);
CREATE TABLE island
(
Name TEXT default '' not null primary key,
Islands TEXT, --
Area REAL, --
Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185
Longitude REAL, --
Height REAL, --
Latitude REAL, --
);
CREATE TABLE geo_lake
(
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, --
primary key (Province, Country, Lake),
Province TEXT default '' not null, --
);
CREATE TABLE mountain
(
Longitude REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
Type TEXT, --
Height REAL, --
Mountains TEXT, --
);
CREATE TABLE province
(
Capital TEXT, --
Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, --
primary key (Name, Country),
Population INTEGER, --
Area REAL, --
Name TEXT not null, --
CapProv TEXT, --
);
CREATE TABLE population
(
Infant_Mortality REAL, --
Population_Growth REAL, --
Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade,
);
CREATE TABLE isMember
(
primary key (Country, Organization),
Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, --
Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, --
Type TEXT default 'member', --
);
CREATE TABLE locatedOn
(
Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, --
Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (City, Province, Country, Island),
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
City TEXT default '' not null, --
);
CREATE TABLE mergesWith
(
Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, --
Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, --
primary key (Sea1, Sea2),
);
CREATE TABLE encompasses
(
Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0
Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0
primary key (Country, Continent),
);
CREATE TABLE continent
(
Name TEXT default '' not null primary key,
Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0
);
CREATE TABLE religion
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE geo_river
(
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, River),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, --
River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, --
);
CREATE TABLE sea
(
Depth REAL, --
Name TEXT default '' not null primary key,
);
CREATE TABLE target
(
Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade,
Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0
);
CREATE TABLE geo_island
(
Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, --
primary key (Province, Country, Island),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, --
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
); |
retail_world | Which region does territory id 2116 belong to? | region refers to RegionDescription | SELECT T2.RegionDescription FROM Territories AS T1 INNER JOIN Region AS T2 ON T1.RegionID = T2.RegionID WHERE T1.TerritoryID = 2116 | CREATE TABLE Products
(
CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0
Unit TEXT, --
ReorderLevel INT, --
ProductName TEXT, --
Price REAL DEFAULT 0, --
FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),
SupplierID INTEGER, --
ProductID INTEGER PRIMARY KEY AUTOINCREMENT,
FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID),
);
CREATE TABLE Customers
(
ContactName TEXT, --
Country TEXT, --
Address TEXT, --
City TEXT, --
CustomerID INTEGER PRIMARY KEY AUTOINCREMENT,
PostalCode TEXT, --
CustomerName TEXT, --
);
CREATE TABLE EmployeeTerritories
(
TerritoryID INT, --
EmployeeID INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE OrderDetails
(
Quantity INTEGER, --
FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),
OrderID INTEGER, --
FOREIGN KEY (ProductID) REFERENCES Products (ProductID),
OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT,
ProductID INTEGER, --
);
CREATE TABLE Shippers
(
ShipperID INTEGER PRIMARY KEY AUTOINCREMENT,
ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
);
CREATE TABLE Territory
(
TerritoryDescription TEXT, --
RegionID INTEGER, --
TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT,
);
CREATE TABLE EmployeeDetails
(
EmployeeID INT PRIMARY KEY,
Title TEXT, --
Salary INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE Categories
(
CategoryID INTEGER PRIMARY KEY AUTOINCREMENT,
CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
);
CREATE TABLE Employees
(
Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT,
FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
);
CREATE TABLE Suppliers
(
PostalCode TEXT, --
Address TEXT, --
SupplierID INTEGER PRIMARY KEY AUTOINCREMENT,
City TEXT, --
Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0
Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0
ContactName TEXT, --
Phone TEXT, --
SupplierName TEXT, --
);
CREATE TABLE EmployeesExtra
(
Salary INTEGER, --
Title TEXT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
EmployeeID INTEGER PRIMARY KEY,
);
CREATE TABLE discontinued_products
(
Discontinued INTEGER, --
ProductID INTEGER PRIMARY KEY,
);
CREATE TABLE Orders
(
OrderID INTEGER PRIMARY KEY AUTOINCREMENT,
CustomerID INTEGER, --
FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),
FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID),
FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),
ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0
OrderDate DATETIME, --
EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0
);
CREATE TABLE Territories
(
TerritoryDescription TEXT, --
RegionDescription TEXT, --
);
CREATE TABLE ShippingInfo
(
ShipCountry TEXT, --
ShippedDate DATETIME, --
FOREIGN KEY (OrderID) REFERENCES Orders(OrderID),
OrderID INTEGER PRIMARY KEY,
); |
synthea | How many immunizations did the patient with the most prevalent condition that started recently get? | patient with the most prevalent condition refers to patient where MAX(PREVALENCE RATE); started recently refers to MAX(START); | SELECT COUNT(T2.patient) FROM all_prevalences AS T1 INNER JOIN conditions AS T2 ON lower(T1.ITEM) = lower(T2.DESCRIPTION) INNER JOIN immunizations AS T3 ON T2.PATIENT = T3.PATIENT GROUP BY T2.PATIENT ORDER BY T2.START DESC, T1."PREVALENCE RATE" DESC LIMIT 1 | CREATE TABLE immunizations
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
DATE DATE, --
primary key (DATE, PATIENT, ENCOUNTER, CODE),
DESCRIPTION TEXT, -- Example Values: `Influenza seasonal injectable preservative free`, `Td (adult) preservative free`, `meningococcal MCV4P`, `Tdap`, `HPV quadrivalent` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
);
CREATE TABLE allergies
(
CODE INTEGER, -- Example Values: `232347008`, `300916003`, `419474003`, `424213003`, `300913006` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
foreign key (ENCOUNTER) references encounters(ID),
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
primary key (PATIENT, ENCOUNTER, CODE),
STOP TEXT, -- Example Values: `12/22/14`, `4/21/10`, `10/15/11`, `3/17/10`, `5/26/08` | Value Statics: Total count 16 - Distinct count 11 - Null count 556
START TEXT, --
DESCRIPTION TEXT, -- Example Values: `Allergy to dairy product`, `Allergy to tree pollen`, `Allergy to grass pollen`, `Dander (animal) allergy`, `House dust mite allergy` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
);
CREATE TABLE observations
(
DATE DATE, --
ENCOUNTER TEXT, --
VALUE REAL, --
UNITS TEXT, -- Example Values: `cm`, `kg`, `kg/m2`, `mmHg`, `Cel` | Value Statics: Total count 78444 - Distinct count 17 - Null count 455
DESCRIPTION TEXT, --
CODE TEXT, --
PATIENT TEXT, --
foreign key (PATIENT) references patients(patient),
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE medications
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, --
PATIENT TEXT, --
STOP DATE, --
START DATE, --
REASONDESCRIPTION TEXT, --
DESCRIPTION TEXT, --
primary key (START, PATIENT, ENCOUNTER, CODE),
foreign key (PATIENT) references patients(patient),
REASONCODE INTEGER, --
ENCOUNTER TEXT, --
);
CREATE TABLE careplans
(
START DATE, --
STOP DATE, --
ID TEXT, --
REASONCODE INTEGER, --
REASONDESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
DESCRIPTION TEXT, --
CODE REAL, --
ENCOUNTER TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE encounters
(
DATE DATE, --
REASONCODE INTEGER, --
CODE INTEGER, --
ID TEXT primary key,
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
REASONDESCRIPTION TEXT, --
);
CREATE TABLE procedures
(
foreign key (PATIENT) references patients(patient),
REASONDESCRIPTION TEXT, --
PATIENT TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
DATE DATE, --
DESCRIPTION TEXT, --
ENCOUNTER TEXT, --
CODE INTEGER, --
REASONCODE INTEGER, --
);
CREATE TABLE patients
(
suffix TEXT, -- Example Values: `PhD`, `JD`, `MD` | Value Statics: Total count 45 - Distinct count 3 - Null count 1417
prefix TEXT, -- Example Values: `Mr.`, `Mrs.`, `Ms.` | Value Statics: Total count 1166 - Distinct count 3 - Null count 296
deathdate DATE, --
ethnicity TEXT, --
race TEXT, -- Example Values: `black`, `white`, `hispanic`, `asian` | Value Statics: Total count 1462 - Distinct count 4 - Null count 0
address TEXT, --
birthplace TEXT, --
passport TEXT, --
maiden TEXT, --
birthdate DATE, --
marital TEXT, -- Example Values: `S`, `M` | Value Statics: Total count 1033 - Distinct count 2 - Null count 429
gender TEXT, -- Example Values: `F`, `M` | Value Statics: Total count 1462 - Distinct count 2 - Null count 0
drivers TEXT, --
first TEXT, --
last TEXT, --
patient TEXT primary key,
ssn TEXT, --
);
CREATE TABLE claims
(
ENCOUNTER TEXT references encounters, --
PATIENT TEXT references patients, --
ORGANIZATION TEXT, -- Example Values: `temp organization` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
TOTAL INTEGER, -- Example Values: `100` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
BILLABLEPERIOD DATE, --
DIAGNOSIS TEXT, --
ID TEXT primary key,
);
CREATE TABLE conditions
(
START DATE, --
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
CODE INTEGER, --
ENCOUNTER TEXT, --
STOP DATE, --
foreign key (ENCOUNTER) references encounters(ID),
foreign key (DESCRIPTION) references all_prevalences(ITEM),
);
CREATE TABLE all_prevalences
(
"POPULATION TYPE" TEXT, -- Example Values: `LIVING` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
"POPULATION COUNT" INTEGER, -- Example Values: `1000` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
ITEM TEXT primary key,
"PREVALENCE PERCENTAGE" REAL, --
"PREVALENCE RATE" REAL, --
OCCURRENCES INTEGER, --
); |
mondial_geo | List all deserts that are not between latitudes 30 and 40. | null | SELECT Name FROM desert WHERE Latitude < 30 OR Latitude > 40 | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200
);
CREATE TABLE river
(
River TEXT, --
Mountains TEXT, --
SourceAltitude REAL, --
Length REAL, --
EstuaryLatitude REAL, --
SourceLongitude REAL, --
Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, --
EstuaryLongitude REAL, --
Sea TEXT, --
Name TEXT default '' not null primary key,
SourceLatitude REAL, --
);
CREATE TABLE mountainOnIsland
(
Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, --
primary key (Mountain, Island),
Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, --
);
CREATE TABLE organization
(
City TEXT, --
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, --
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
Abbreviation TEXT not null primary key,
Province TEXT, --
Name TEXT not null constraint ix_organization_OrgNameUnique unique, --
Established DATE, --
);
CREATE TABLE geo_desert
(
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, --
Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, --
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Desert),
);
CREATE TABLE geo_source
(
River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (Province, Country, River),
);
CREATE TABLE geo_sea
(
Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, --
Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, --
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Sea),
Province TEXT default '' not null, --
);
CREATE TABLE geo_estuary
(
primary key (Province, Country, River),
River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, --
);
CREATE TABLE located
(
River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, --
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, --
Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, --
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
City TEXT, --
Province TEXT, --
);
CREATE TABLE lake
(
Depth REAL, --
Altitude REAL, --
Name TEXT default '' not null primary key,
Longitude REAL, --
Latitude REAL, --
Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74
River TEXT, --
Area REAL, --
);
CREATE TABLE desert
(
Longitude REAL, --
Area REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
);
CREATE TABLE geo_mountain
(
Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, --
primary key (Province, Country, Mountain),
Province TEXT default '' not null, --
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, --
);
CREATE TABLE ethnicGroup
(
primary key (Name, Country),
Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, --
Name TEXT default '' not null, --
Percentage REAL, --
);
CREATE TABLE economy
(
Industry REAL, --
GDP REAL, --
Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade,
Inflation REAL, --
Service REAL, --
Agriculture REAL, --
);
CREATE TABLE borders
(
primary key (Country1, Country2),
Country2 TEXT default '' not null constraint borders_ibfk_2 references country, --
Length REAL, --
Country1 TEXT default '' not null constraint borders_ibfk_1 references country, --
);
CREATE TABLE language
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE islandIn
(
Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, --
River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349
Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, --
Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344
);
CREATE TABLE country
(
Area REAL, --
Capital TEXT, --
Population INTEGER, --
Name TEXT not null constraint ix_county_Name unique, --
Province TEXT, --
Code TEXT default '' not null primary key,
);
CREATE TABLE city
(
Longitude REAL, --
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Population INTEGER, --
Province TEXT default '' not null, --
primary key (Name, Province),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, --
Latitude REAL, --
);
CREATE TABLE island
(
Name TEXT default '' not null primary key,
Islands TEXT, --
Area REAL, --
Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185
Longitude REAL, --
Height REAL, --
Latitude REAL, --
);
CREATE TABLE geo_lake
(
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, --
primary key (Province, Country, Lake),
Province TEXT default '' not null, --
);
CREATE TABLE mountain
(
Longitude REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
Type TEXT, --
Height REAL, --
Mountains TEXT, --
);
CREATE TABLE province
(
Capital TEXT, --
Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, --
primary key (Name, Country),
Population INTEGER, --
Area REAL, --
Name TEXT not null, --
CapProv TEXT, --
);
CREATE TABLE population
(
Infant_Mortality REAL, --
Population_Growth REAL, --
Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade,
);
CREATE TABLE isMember
(
primary key (Country, Organization),
Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, --
Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, --
Type TEXT default 'member', --
);
CREATE TABLE locatedOn
(
Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, --
Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (City, Province, Country, Island),
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
City TEXT default '' not null, --
);
CREATE TABLE mergesWith
(
Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, --
Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, --
primary key (Sea1, Sea2),
);
CREATE TABLE encompasses
(
Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0
Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0
primary key (Country, Continent),
);
CREATE TABLE continent
(
Name TEXT default '' not null primary key,
Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0
);
CREATE TABLE religion
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE geo_river
(
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, River),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, --
River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, --
);
CREATE TABLE sea
(
Depth REAL, --
Name TEXT default '' not null primary key,
);
CREATE TABLE target
(
Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade,
Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0
);
CREATE TABLE geo_island
(
Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, --
primary key (Province, Country, Island),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, --
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
); |
retail_world | Which region has the most territories? | region refers to RegionDescription; most territories refers to Max(Count(TerritoryID)) | SELECT T2.RegionID FROM Territories AS T1 INNER JOIN Region AS T2 ON T1.RegionID = T2.RegionID GROUP BY T2.RegionID ORDER BY COUNT(T1.TerritoryID) DESC LIMIT 1 | CREATE TABLE Products
(
CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0
Unit TEXT, --
ReorderLevel INT, --
ProductName TEXT, --
Price REAL DEFAULT 0, --
FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),
SupplierID INTEGER, --
ProductID INTEGER PRIMARY KEY AUTOINCREMENT,
FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID),
);
CREATE TABLE Customers
(
ContactName TEXT, --
Country TEXT, --
Address TEXT, --
City TEXT, --
CustomerID INTEGER PRIMARY KEY AUTOINCREMENT,
PostalCode TEXT, --
CustomerName TEXT, --
);
CREATE TABLE EmployeeTerritories
(
TerritoryID INT, --
EmployeeID INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE OrderDetails
(
Quantity INTEGER, --
FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),
OrderID INTEGER, --
FOREIGN KEY (ProductID) REFERENCES Products (ProductID),
OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT,
ProductID INTEGER, --
);
CREATE TABLE Shippers
(
ShipperID INTEGER PRIMARY KEY AUTOINCREMENT,
ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
);
CREATE TABLE Territory
(
TerritoryDescription TEXT, --
RegionID INTEGER, --
TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT,
);
CREATE TABLE EmployeeDetails
(
EmployeeID INT PRIMARY KEY,
Title TEXT, --
Salary INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE Categories
(
CategoryID INTEGER PRIMARY KEY AUTOINCREMENT,
CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
);
CREATE TABLE Employees
(
Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT,
FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
);
CREATE TABLE Suppliers
(
PostalCode TEXT, --
Address TEXT, --
SupplierID INTEGER PRIMARY KEY AUTOINCREMENT,
City TEXT, --
Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0
Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0
ContactName TEXT, --
Phone TEXT, --
SupplierName TEXT, --
);
CREATE TABLE EmployeesExtra
(
Salary INTEGER, --
Title TEXT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
EmployeeID INTEGER PRIMARY KEY,
);
CREATE TABLE discontinued_products
(
Discontinued INTEGER, --
ProductID INTEGER PRIMARY KEY,
);
CREATE TABLE Orders
(
OrderID INTEGER PRIMARY KEY AUTOINCREMENT,
CustomerID INTEGER, --
FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),
FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID),
FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),
ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0
OrderDate DATETIME, --
EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0
);
CREATE TABLE Territories
(
TerritoryDescription TEXT, --
RegionDescription TEXT, --
);
CREATE TABLE ShippingInfo
(
ShipCountry TEXT, --
ShippedDate DATETIME, --
FOREIGN KEY (OrderID) REFERENCES Orders(OrderID),
OrderID INTEGER PRIMARY KEY,
); |
professional_basketball | Please list out the first name and last name of player who attended California college and have been selected as all stars? | California college refers to college = 'California' | SELECT DISTINCT T1.firstName, T1.lastName FROM players AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T1.college = 'California' | CREATE TABLE players_teams
(
PostGS INTEGER, --
PostdRebounds INTEGER, --
PostPF INTEGER, --
tmID TEXT, --
threeAttempted INTEGER, --
PostRebounds INTEGER, --
assists INTEGER, --
threeMade INTEGER, --
PostBlocks INTEGER, --
PostTurnovers INTEGER, --
GP INTEGER, --
lgID TEXT, -- Example Values: `NBA`, `NBL`, `ABA`, `ABL1`, `NPBL` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0
foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade,
PostfgMade INTEGER, --
steals INTEGER, --
oRebounds INTEGER, --
PostftAttempted INTEGER, --
ftAttempted INTEGER, --
ftMade INTEGER, --
points INTEGER, --
PostfgAttempted INTEGER, --
PostftMade INTEGER, --
note TEXT, -- Example Values: `C` | Value Statics: Total count 43 - Distinct count 1 - Null count 23708
dRebounds INTEGER, --
PostSteals INTEGER, --
blocks INTEGER, --
PostAssists INTEGER, --
minutes INTEGER, --
fgAttempted INTEGER, --
playerID TEXT not null references players on update cascade on delete cascade, --
PostthreeMade INTEGER, --
PostPoints INTEGER, --
year INTEGER, --
PF INTEGER, --
fgMade INTEGER, --
PostthreeAttempted INTEGER, --
rebounds INTEGER, --
id INTEGER primary key autoincrement,
stint INTEGER, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0
PostMinutes INTEGER, --
PostGP INTEGER, --
turnovers INTEGER, --
PostoRebounds INTEGER, --
GS INTEGER, --
);
CREATE TABLE awards_coaches
(
award TEXT, -- Example Values: `NBA Coach of the Year`, `ABA Coach of the Year` | Value Statics: Total count 61 - Distinct count 2 - Null count 0
id INTEGER primary key autoincrement,
note TEXT, -- Example Values: `tie` | Value Statics: Total count 4 - Distinct count 1 - Null count 57
coachID TEXT, --
lgID TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 61 - Distinct count 2 - Null count 0
foreign key (coachID, year) references coaches (coachID, year) on update cascade on delete cascade,
year INTEGER, --
);
CREATE TABLE draft
(
draftOverall INTEGER null, --
lgID TEXT null, -- Example Values: `ABA`, `NBA` | Value Statics: Total count 8621 - Distinct count 2 - Null count 0
suffixName TEXT null, -- Example Values: `Jr.` | Value Statics: Total count 2 - Distinct count 1 - Null count 8619
draftYear INTEGER null, --
draftSelection INTEGER null, --
tmID TEXT null, --
draftRound INTEGER null, --
lastName TEXT null, --
playerID TEXT null, --
draftFrom TEXT null, --
id INTEGER default 0 not null primary key,
firstName TEXT null, --
foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade,
foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade,
);
CREATE TABLE player_allstar
(
rebounds INTEGER null, --
playerID TEXT not null, --
season_id INTEGER not null, --
assists INTEGER null, --
conference TEXT null, -- Example Values: `East`, `West`, `Weset`, `Allstars`, `Denver` | Value Statics: Total count 1608 - Distinct count 5 - Null count 0
points INTEGER null, --
personal_fouls INTEGER null, -- Example Values: `3`, `2`, `0`, `1`, `5` | Value Statics: Total count 540 - Distinct count 8 - Null count 1068
ft_attempted INTEGER null, -- Example Values: `2`, `4`, `0`, `6`, `3` | Value Statics: Total count 1561 - Distinct count 17 - Null count 47
fg_attempted INTEGER null, --
league_id TEXT null, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 1608 - Distinct count 2 - Null count 0
foreign key (playerID) references players (playerID) on update cascade on delete cascade,
fg_made INTEGER null, -- Example Values: `4`, `8`, `5`, `7`, `3` | Value Statics: Total count 1561 - Distinct count 18 - Null count 47
ft_made INTEGER null, -- Example Values: `2`, `3`, `0`, `1`, `4` | Value Statics: Total count 1561 - Distinct count 13 - Null count 47
steals INTEGER null, -- Example Values: `3`, `0`, `1`, `2`, `5` | Value Statics: Total count 398 - Distinct count 7 - Null count 1210
games_played INTEGER null, -- Example Values: `1` | Value Statics: Total count 1608 - Distinct count 1 - Null count 0
first_name TEXT null, --
d_rebounds INTEGER null, -- Example Values: `2`, `5`, `0`, `1`, `4` | Value Statics: Total count 493 - Distinct count 14 - Null count 1115
last_name TEXT null, --
primary key (playerID, season_id),
turnovers INTEGER null, -- Example Values: `1`, `0`, `3`, `2`, `4` | Value Statics: Total count 493 - Distinct count 9 - Null count 1115
three_made INTEGER null, -- Example Values: `0`, `1`, `3`, `5`, `4` | Value Statics: Total count 566 - Distinct count 7 - Null count 1042
minutes INTEGER null, --
blocks INTEGER null, -- Example Values: `2`, `0`, `1`, `3`, `5` | Value Statics: Total count 398 - Distinct count 6 - Null count 1210
three_attempted INTEGER null, -- Example Values: `0`, `1`, `6`, `7`, `10` | Value Statics: Total count 540 - Distinct count 12 - Null count 1068
o_rebounds INTEGER null, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 493 - Distinct count 10 - Null count 1115
);
CREATE TABLE awards_players
(
foreign key (playerID) references players (playerID) on update cascade on delete cascade,
year INTEGER not null, --
pos TEXT null, -- Example Values: `C`, `F`, `G`, `F/G`, `F/C` | Value Statics: Total count 833 - Distinct count 5 - Null count 886
primary key (playerID, year, award),
lgID TEXT null, -- Example Values: `NBA`, `ABA`, `NBL`, `ABL1` | Value Statics: Total count 1719 - Distinct count 4 - Null count 0
award TEXT not null, --
playerID TEXT not null, --
note TEXT null, -- Example Values: `tie` | Value Statics: Total count 37 - Distinct count 1 - Null count 1682
);
CREATE TABLE series_post
(
tmIDLoser TEXT, --
id INTEGER primary key autoincrement,
series TEXT, -- Example Values: `O`, `M`, `N`, `A`, `K` | Value Statics: Total count 775 - Distinct count 11 - Null count 0
tmIDWinner TEXT, --
round TEXT, -- Example Values: `F`, `QF`, `SF`, `DT`, `DF` | Value Statics: Total count 775 - Distinct count 11 - Null count 0
year INTEGER, --
foreign key (tmIDLoser, year) references teams (tmID, year) on update cascade on delete cascade,
foreign key (tmIDWinner, year) references teams (tmID, year) on update cascade on delete cascade,
W INTEGER, -- Example Values: `4`, `2`, `1`, `3`, `0` | Value Statics: Total count 775 - Distinct count 5 - Null count 0
lgIDLoser TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0
lgIDWinner TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0
L INTEGER, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 775 - Distinct count 5 - Null count 0
);
CREATE TABLE players
(
nameGiven TEXT null, -- Example Values: `nameGiven`, `Mort`, `Robert`, `Jim`, `Mike` | Value Statics: Total count 10 - Distinct count 9 - Null count 5052
lastseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15
hsCountry TEXT null, --
firstName TEXT null, --
hsCity TEXT null, --
firstseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15
weight INTEGER null, --
birthCountry TEXT null, --
race TEXT null, -- Example Values: `B`, `W`, `O`, `1`, `r` | Value Statics: Total count 4903 - Distinct count 5 - Null count 159
lastName TEXT null, --
birthDate DATE null, --
collegeOther TEXT null, --
birthState TEXT null, --
useFirst TEXT null, --
pos TEXT null, -- Example Values: `F-C`, `C`, `G`, `G-F`, `C-F` | Value Statics: Total count 4880 - Distinct count 14 - Null count 182
playerID TEXT not null primary key,
college TEXT null, --
highSchool TEXT null, --
hsState TEXT null, --
height REAL null, --
deathDate DATE null, --
nameSuffix TEXT null, -- Example Values: `Jr.`, `III`, `nameSuffix`, `II`, `IV` | Value Statics: Total count 324 - Distinct count 6 - Null count 4738
nameNick TEXT null, --
fullGivenName TEXT null, --
birthCity TEXT null, --
middleName TEXT null, --
);
CREATE TABLE teams
(
d_pts INTEGER null, --
name TEXT null, --
homeLost INTEGER null, --
o_ftm INTEGER null, --
franchID TEXT null, --
tmID TEXT not null, --
awayWon INTEGER null, --
primary key (year, tmID),
o_fgm INTEGER null, --
year INTEGER not null, --
awayLost INTEGER null, --
arena TEXT null, --
confID TEXT null, -- Example Values: `EC`, `WC` | Value Statics: Total count 1064 - Distinct count 2 - Null count 472
games INTEGER null, --
lost INTEGER null, --
divID TEXT null, -- Example Values: `EA`, `WE`, `ED`, `WD`, `SO` | Value Statics: Total count 1498 - Distinct count 13 - Null count 38
lgID TEXT null, -- Example Values: `NBL`, `NBA`, `PBLA`, `NPBL`, `ABL1` | Value Statics: Total count 1536 - Distinct count 6 - Null count 0
homeWon INTEGER null, --
confRank INTEGER null, -- Example Values: `0`, `4`, `3`, `5`, `7` | Value Statics: Total count 1536 - Distinct count 16 - Null count 0
o_pts INTEGER null, --
`rank` INTEGER null, -- Example Values: `1`, `2`, `4`, `5`, `6` | Value Statics: Total count 1536 - Distinct count 10 - Null count 0
playoff TEXT null, -- Example Values: `CF`, `WC`, `LC`, `CS`, `F` | Value Statics: Total count 901 - Distinct count 15 - Null count 635
won INTEGER null, --
);
CREATE TABLE coaches
(
primary key (coachID, year, tmID, stint),
lgID TEXT null, -- Example Values: `NBA`, `ABA`, `ABL1`, `PBLA`, `NPBL` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0
post_losses INTEGER null, -- Example Values: `3`, `9`, `7`, `8`, `0` | Value Statics: Total count 1649 - Distinct count 12 - Null count 40
year INTEGER not null, --
won INTEGER null, --
foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade,
post_wins INTEGER null, -- Example Values: `0`, `12`, `9`, `13`, `1` | Value Statics: Total count 1649 - Distinct count 17 - Null count 40
coachID TEXT not null, --
tmID TEXT not null, --
lost INTEGER null, --
stint INTEGER not null, -- Example Values: `2`, `1`, `4`, `5`, `3` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0
); |
mondial_geo | What percentage of countries became independent during the year 1960? | Percentage = count(countries independent 1960) / total num of countries | SELECT CAST(SUM(CASE WHEN STRFTIME('%Y', Independence) = '1960' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(Country) FROM politics | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200
);
CREATE TABLE river
(
River TEXT, --
Mountains TEXT, --
SourceAltitude REAL, --
Length REAL, --
EstuaryLatitude REAL, --
SourceLongitude REAL, --
Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, --
EstuaryLongitude REAL, --
Sea TEXT, --
Name TEXT default '' not null primary key,
SourceLatitude REAL, --
);
CREATE TABLE mountainOnIsland
(
Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, --
primary key (Mountain, Island),
Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, --
);
CREATE TABLE organization
(
City TEXT, --
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, --
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
Abbreviation TEXT not null primary key,
Province TEXT, --
Name TEXT not null constraint ix_organization_OrgNameUnique unique, --
Established DATE, --
);
CREATE TABLE geo_desert
(
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, --
Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, --
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Desert),
);
CREATE TABLE geo_source
(
River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (Province, Country, River),
);
CREATE TABLE geo_sea
(
Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, --
Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, --
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Sea),
Province TEXT default '' not null, --
);
CREATE TABLE geo_estuary
(
primary key (Province, Country, River),
River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, --
);
CREATE TABLE located
(
River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, --
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, --
Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, --
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
City TEXT, --
Province TEXT, --
);
CREATE TABLE lake
(
Depth REAL, --
Altitude REAL, --
Name TEXT default '' not null primary key,
Longitude REAL, --
Latitude REAL, --
Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74
River TEXT, --
Area REAL, --
);
CREATE TABLE desert
(
Longitude REAL, --
Area REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
);
CREATE TABLE geo_mountain
(
Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, --
primary key (Province, Country, Mountain),
Province TEXT default '' not null, --
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, --
);
CREATE TABLE ethnicGroup
(
primary key (Name, Country),
Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, --
Name TEXT default '' not null, --
Percentage REAL, --
);
CREATE TABLE economy
(
Industry REAL, --
GDP REAL, --
Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade,
Inflation REAL, --
Service REAL, --
Agriculture REAL, --
);
CREATE TABLE borders
(
primary key (Country1, Country2),
Country2 TEXT default '' not null constraint borders_ibfk_2 references country, --
Length REAL, --
Country1 TEXT default '' not null constraint borders_ibfk_1 references country, --
);
CREATE TABLE language
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE islandIn
(
Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, --
River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349
Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, --
Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344
);
CREATE TABLE country
(
Area REAL, --
Capital TEXT, --
Population INTEGER, --
Name TEXT not null constraint ix_county_Name unique, --
Province TEXT, --
Code TEXT default '' not null primary key,
);
CREATE TABLE city
(
Longitude REAL, --
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Population INTEGER, --
Province TEXT default '' not null, --
primary key (Name, Province),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, --
Latitude REAL, --
);
CREATE TABLE island
(
Name TEXT default '' not null primary key,
Islands TEXT, --
Area REAL, --
Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185
Longitude REAL, --
Height REAL, --
Latitude REAL, --
);
CREATE TABLE geo_lake
(
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, --
primary key (Province, Country, Lake),
Province TEXT default '' not null, --
);
CREATE TABLE mountain
(
Longitude REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
Type TEXT, --
Height REAL, --
Mountains TEXT, --
);
CREATE TABLE province
(
Capital TEXT, --
Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, --
primary key (Name, Country),
Population INTEGER, --
Area REAL, --
Name TEXT not null, --
CapProv TEXT, --
);
CREATE TABLE population
(
Infant_Mortality REAL, --
Population_Growth REAL, --
Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade,
);
CREATE TABLE isMember
(
primary key (Country, Organization),
Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, --
Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, --
Type TEXT default 'member', --
);
CREATE TABLE locatedOn
(
Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, --
Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (City, Province, Country, Island),
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
City TEXT default '' not null, --
);
CREATE TABLE mergesWith
(
Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, --
Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, --
primary key (Sea1, Sea2),
);
CREATE TABLE encompasses
(
Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0
Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0
primary key (Country, Continent),
);
CREATE TABLE continent
(
Name TEXT default '' not null primary key,
Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0
);
CREATE TABLE religion
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE geo_river
(
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, River),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, --
River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, --
);
CREATE TABLE sea
(
Depth REAL, --
Name TEXT default '' not null primary key,
);
CREATE TABLE target
(
Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade,
Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0
);
CREATE TABLE geo_island
(
Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, --
primary key (Province, Country, Island),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, --
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
); |
retail_world | How many territories are there in the Eastern region? | "Eastern" is the RegionDescription | SELECT COUNT(T1.RegionID) FROM Territories AS T1 INNER JOIN Region AS T2 ON T1.RegionID = T2.RegionID WHERE T2.RegionDescription = 'Eastern' | CREATE TABLE Products
(
CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0
Unit TEXT, --
ReorderLevel INT, --
ProductName TEXT, --
Price REAL DEFAULT 0, --
FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),
SupplierID INTEGER, --
ProductID INTEGER PRIMARY KEY AUTOINCREMENT,
FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID),
);
CREATE TABLE Customers
(
ContactName TEXT, --
Country TEXT, --
Address TEXT, --
City TEXT, --
CustomerID INTEGER PRIMARY KEY AUTOINCREMENT,
PostalCode TEXT, --
CustomerName TEXT, --
);
CREATE TABLE EmployeeTerritories
(
TerritoryID INT, --
EmployeeID INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE OrderDetails
(
Quantity INTEGER, --
FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),
OrderID INTEGER, --
FOREIGN KEY (ProductID) REFERENCES Products (ProductID),
OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT,
ProductID INTEGER, --
);
CREATE TABLE Shippers
(
ShipperID INTEGER PRIMARY KEY AUTOINCREMENT,
ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
);
CREATE TABLE Territory
(
TerritoryDescription TEXT, --
RegionID INTEGER, --
TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT,
);
CREATE TABLE EmployeeDetails
(
EmployeeID INT PRIMARY KEY,
Title TEXT, --
Salary INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE Categories
(
CategoryID INTEGER PRIMARY KEY AUTOINCREMENT,
CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
);
CREATE TABLE Employees
(
Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT,
FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
);
CREATE TABLE Suppliers
(
PostalCode TEXT, --
Address TEXT, --
SupplierID INTEGER PRIMARY KEY AUTOINCREMENT,
City TEXT, --
Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0
Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0
ContactName TEXT, --
Phone TEXT, --
SupplierName TEXT, --
);
CREATE TABLE EmployeesExtra
(
Salary INTEGER, --
Title TEXT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
EmployeeID INTEGER PRIMARY KEY,
);
CREATE TABLE discontinued_products
(
Discontinued INTEGER, --
ProductID INTEGER PRIMARY KEY,
);
CREATE TABLE Orders
(
OrderID INTEGER PRIMARY KEY AUTOINCREMENT,
CustomerID INTEGER, --
FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),
FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID),
FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),
ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0
OrderDate DATETIME, --
EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0
);
CREATE TABLE Territories
(
TerritoryDescription TEXT, --
RegionDescription TEXT, --
);
CREATE TABLE ShippingInfo
(
ShipCountry TEXT, --
ShippedDate DATETIME, --
FOREIGN KEY (OrderID) REFERENCES Orders(OrderID),
OrderID INTEGER PRIMARY KEY,
); |
professional_basketball | Please list the team names which have at least 5 players were born in the same state. | team name refers to teams.name; state that a player is born refers to birthState | SELECT DISTINCT name FROM teams WHERE tmID IN ( SELECT tmID FROM players_teams AS T1 INNER JOIN players AS T2 ON T1.playerID = T2.playerID WHERE T2.birthState IS NOT NULL GROUP BY T1.tmID, T2.birthState HAVING COUNT(*) > 5 ) | CREATE TABLE players_teams
(
PostGS INTEGER, --
PostdRebounds INTEGER, --
PostPF INTEGER, --
tmID TEXT, --
threeAttempted INTEGER, --
PostRebounds INTEGER, --
assists INTEGER, --
threeMade INTEGER, --
PostBlocks INTEGER, --
PostTurnovers INTEGER, --
GP INTEGER, --
lgID TEXT, -- Example Values: `NBA`, `NBL`, `ABA`, `ABL1`, `NPBL` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0
foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade,
PostfgMade INTEGER, --
steals INTEGER, --
oRebounds INTEGER, --
PostftAttempted INTEGER, --
ftAttempted INTEGER, --
ftMade INTEGER, --
points INTEGER, --
PostfgAttempted INTEGER, --
PostftMade INTEGER, --
note TEXT, -- Example Values: `C` | Value Statics: Total count 43 - Distinct count 1 - Null count 23708
dRebounds INTEGER, --
PostSteals INTEGER, --
blocks INTEGER, --
PostAssists INTEGER, --
minutes INTEGER, --
fgAttempted INTEGER, --
playerID TEXT not null references players on update cascade on delete cascade, --
PostthreeMade INTEGER, --
PostPoints INTEGER, --
year INTEGER, --
PF INTEGER, --
fgMade INTEGER, --
PostthreeAttempted INTEGER, --
rebounds INTEGER, --
id INTEGER primary key autoincrement,
stint INTEGER, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0
PostMinutes INTEGER, --
PostGP INTEGER, --
turnovers INTEGER, --
PostoRebounds INTEGER, --
GS INTEGER, --
);
CREATE TABLE awards_coaches
(
award TEXT, -- Example Values: `NBA Coach of the Year`, `ABA Coach of the Year` | Value Statics: Total count 61 - Distinct count 2 - Null count 0
id INTEGER primary key autoincrement,
note TEXT, -- Example Values: `tie` | Value Statics: Total count 4 - Distinct count 1 - Null count 57
coachID TEXT, --
lgID TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 61 - Distinct count 2 - Null count 0
foreign key (coachID, year) references coaches (coachID, year) on update cascade on delete cascade,
year INTEGER, --
);
CREATE TABLE draft
(
draftOverall INTEGER null, --
lgID TEXT null, -- Example Values: `ABA`, `NBA` | Value Statics: Total count 8621 - Distinct count 2 - Null count 0
suffixName TEXT null, -- Example Values: `Jr.` | Value Statics: Total count 2 - Distinct count 1 - Null count 8619
draftYear INTEGER null, --
draftSelection INTEGER null, --
tmID TEXT null, --
draftRound INTEGER null, --
lastName TEXT null, --
playerID TEXT null, --
draftFrom TEXT null, --
id INTEGER default 0 not null primary key,
firstName TEXT null, --
foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade,
foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade,
);
CREATE TABLE player_allstar
(
rebounds INTEGER null, --
playerID TEXT not null, --
season_id INTEGER not null, --
assists INTEGER null, --
conference TEXT null, -- Example Values: `East`, `West`, `Weset`, `Allstars`, `Denver` | Value Statics: Total count 1608 - Distinct count 5 - Null count 0
points INTEGER null, --
personal_fouls INTEGER null, -- Example Values: `3`, `2`, `0`, `1`, `5` | Value Statics: Total count 540 - Distinct count 8 - Null count 1068
ft_attempted INTEGER null, -- Example Values: `2`, `4`, `0`, `6`, `3` | Value Statics: Total count 1561 - Distinct count 17 - Null count 47
fg_attempted INTEGER null, --
league_id TEXT null, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 1608 - Distinct count 2 - Null count 0
foreign key (playerID) references players (playerID) on update cascade on delete cascade,
fg_made INTEGER null, -- Example Values: `4`, `8`, `5`, `7`, `3` | Value Statics: Total count 1561 - Distinct count 18 - Null count 47
ft_made INTEGER null, -- Example Values: `2`, `3`, `0`, `1`, `4` | Value Statics: Total count 1561 - Distinct count 13 - Null count 47
steals INTEGER null, -- Example Values: `3`, `0`, `1`, `2`, `5` | Value Statics: Total count 398 - Distinct count 7 - Null count 1210
games_played INTEGER null, -- Example Values: `1` | Value Statics: Total count 1608 - Distinct count 1 - Null count 0
first_name TEXT null, --
d_rebounds INTEGER null, -- Example Values: `2`, `5`, `0`, `1`, `4` | Value Statics: Total count 493 - Distinct count 14 - Null count 1115
last_name TEXT null, --
primary key (playerID, season_id),
turnovers INTEGER null, -- Example Values: `1`, `0`, `3`, `2`, `4` | Value Statics: Total count 493 - Distinct count 9 - Null count 1115
three_made INTEGER null, -- Example Values: `0`, `1`, `3`, `5`, `4` | Value Statics: Total count 566 - Distinct count 7 - Null count 1042
minutes INTEGER null, --
blocks INTEGER null, -- Example Values: `2`, `0`, `1`, `3`, `5` | Value Statics: Total count 398 - Distinct count 6 - Null count 1210
three_attempted INTEGER null, -- Example Values: `0`, `1`, `6`, `7`, `10` | Value Statics: Total count 540 - Distinct count 12 - Null count 1068
o_rebounds INTEGER null, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 493 - Distinct count 10 - Null count 1115
);
CREATE TABLE awards_players
(
foreign key (playerID) references players (playerID) on update cascade on delete cascade,
year INTEGER not null, --
pos TEXT null, -- Example Values: `C`, `F`, `G`, `F/G`, `F/C` | Value Statics: Total count 833 - Distinct count 5 - Null count 886
primary key (playerID, year, award),
lgID TEXT null, -- Example Values: `NBA`, `ABA`, `NBL`, `ABL1` | Value Statics: Total count 1719 - Distinct count 4 - Null count 0
award TEXT not null, --
playerID TEXT not null, --
note TEXT null, -- Example Values: `tie` | Value Statics: Total count 37 - Distinct count 1 - Null count 1682
);
CREATE TABLE series_post
(
tmIDLoser TEXT, --
id INTEGER primary key autoincrement,
series TEXT, -- Example Values: `O`, `M`, `N`, `A`, `K` | Value Statics: Total count 775 - Distinct count 11 - Null count 0
tmIDWinner TEXT, --
round TEXT, -- Example Values: `F`, `QF`, `SF`, `DT`, `DF` | Value Statics: Total count 775 - Distinct count 11 - Null count 0
year INTEGER, --
foreign key (tmIDLoser, year) references teams (tmID, year) on update cascade on delete cascade,
foreign key (tmIDWinner, year) references teams (tmID, year) on update cascade on delete cascade,
W INTEGER, -- Example Values: `4`, `2`, `1`, `3`, `0` | Value Statics: Total count 775 - Distinct count 5 - Null count 0
lgIDLoser TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0
lgIDWinner TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0
L INTEGER, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 775 - Distinct count 5 - Null count 0
);
CREATE TABLE players
(
nameGiven TEXT null, -- Example Values: `nameGiven`, `Mort`, `Robert`, `Jim`, `Mike` | Value Statics: Total count 10 - Distinct count 9 - Null count 5052
lastseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15
hsCountry TEXT null, --
firstName TEXT null, --
hsCity TEXT null, --
firstseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15
weight INTEGER null, --
birthCountry TEXT null, --
race TEXT null, -- Example Values: `B`, `W`, `O`, `1`, `r` | Value Statics: Total count 4903 - Distinct count 5 - Null count 159
lastName TEXT null, --
birthDate DATE null, --
collegeOther TEXT null, --
birthState TEXT null, --
useFirst TEXT null, --
pos TEXT null, -- Example Values: `F-C`, `C`, `G`, `G-F`, `C-F` | Value Statics: Total count 4880 - Distinct count 14 - Null count 182
playerID TEXT not null primary key,
college TEXT null, --
highSchool TEXT null, --
hsState TEXT null, --
height REAL null, --
deathDate DATE null, --
nameSuffix TEXT null, -- Example Values: `Jr.`, `III`, `nameSuffix`, `II`, `IV` | Value Statics: Total count 324 - Distinct count 6 - Null count 4738
nameNick TEXT null, --
fullGivenName TEXT null, --
birthCity TEXT null, --
middleName TEXT null, --
);
CREATE TABLE teams
(
d_pts INTEGER null, --
name TEXT null, --
homeLost INTEGER null, --
o_ftm INTEGER null, --
franchID TEXT null, --
tmID TEXT not null, --
awayWon INTEGER null, --
primary key (year, tmID),
o_fgm INTEGER null, --
year INTEGER not null, --
awayLost INTEGER null, --
arena TEXT null, --
confID TEXT null, -- Example Values: `EC`, `WC` | Value Statics: Total count 1064 - Distinct count 2 - Null count 472
games INTEGER null, --
lost INTEGER null, --
divID TEXT null, -- Example Values: `EA`, `WE`, `ED`, `WD`, `SO` | Value Statics: Total count 1498 - Distinct count 13 - Null count 38
lgID TEXT null, -- Example Values: `NBL`, `NBA`, `PBLA`, `NPBL`, `ABL1` | Value Statics: Total count 1536 - Distinct count 6 - Null count 0
homeWon INTEGER null, --
confRank INTEGER null, -- Example Values: `0`, `4`, `3`, `5`, `7` | Value Statics: Total count 1536 - Distinct count 16 - Null count 0
o_pts INTEGER null, --
`rank` INTEGER null, -- Example Values: `1`, `2`, `4`, `5`, `6` | Value Statics: Total count 1536 - Distinct count 10 - Null count 0
playoff TEXT null, -- Example Values: `CF`, `WC`, `LC`, `CS`, `F` | Value Statics: Total count 901 - Distinct count 15 - Null count 635
won INTEGER null, --
);
CREATE TABLE coaches
(
primary key (coachID, year, tmID, stint),
lgID TEXT null, -- Example Values: `NBA`, `ABA`, `ABL1`, `PBLA`, `NPBL` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0
post_losses INTEGER null, -- Example Values: `3`, `9`, `7`, `8`, `0` | Value Statics: Total count 1649 - Distinct count 12 - Null count 40
year INTEGER not null, --
won INTEGER null, --
foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade,
post_wins INTEGER null, -- Example Values: `0`, `12`, `9`, `13`, `1` | Value Statics: Total count 1649 - Distinct count 17 - Null count 40
coachID TEXT not null, --
tmID TEXT not null, --
lost INTEGER null, --
stint INTEGER not null, -- Example Values: `2`, `1`, `4`, `5`, `3` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0
); |
synthea | List down the address of patients who have billable period in 2010. | null | SELECT DISTINCT T1.address FROM patients AS T1 INNER JOIN claims AS T2 ON T1.patient = T2.PATIENT WHERE T2.BILLABLEPERIOD LIKE '2010%' | CREATE TABLE immunizations
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
DATE DATE, --
primary key (DATE, PATIENT, ENCOUNTER, CODE),
DESCRIPTION TEXT, -- Example Values: `Influenza seasonal injectable preservative free`, `Td (adult) preservative free`, `meningococcal MCV4P`, `Tdap`, `HPV quadrivalent` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
);
CREATE TABLE allergies
(
CODE INTEGER, -- Example Values: `232347008`, `300916003`, `419474003`, `424213003`, `300913006` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
foreign key (ENCOUNTER) references encounters(ID),
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
primary key (PATIENT, ENCOUNTER, CODE),
STOP TEXT, -- Example Values: `12/22/14`, `4/21/10`, `10/15/11`, `3/17/10`, `5/26/08` | Value Statics: Total count 16 - Distinct count 11 - Null count 556
START TEXT, --
DESCRIPTION TEXT, -- Example Values: `Allergy to dairy product`, `Allergy to tree pollen`, `Allergy to grass pollen`, `Dander (animal) allergy`, `House dust mite allergy` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
);
CREATE TABLE observations
(
DATE DATE, --
ENCOUNTER TEXT, --
VALUE REAL, --
UNITS TEXT, -- Example Values: `cm`, `kg`, `kg/m2`, `mmHg`, `Cel` | Value Statics: Total count 78444 - Distinct count 17 - Null count 455
DESCRIPTION TEXT, --
CODE TEXT, --
PATIENT TEXT, --
foreign key (PATIENT) references patients(patient),
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE medications
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, --
PATIENT TEXT, --
STOP DATE, --
START DATE, --
REASONDESCRIPTION TEXT, --
DESCRIPTION TEXT, --
primary key (START, PATIENT, ENCOUNTER, CODE),
foreign key (PATIENT) references patients(patient),
REASONCODE INTEGER, --
ENCOUNTER TEXT, --
);
CREATE TABLE careplans
(
START DATE, --
STOP DATE, --
ID TEXT, --
REASONCODE INTEGER, --
REASONDESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
DESCRIPTION TEXT, --
CODE REAL, --
ENCOUNTER TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE encounters
(
DATE DATE, --
REASONCODE INTEGER, --
CODE INTEGER, --
ID TEXT primary key,
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
REASONDESCRIPTION TEXT, --
);
CREATE TABLE procedures
(
foreign key (PATIENT) references patients(patient),
REASONDESCRIPTION TEXT, --
PATIENT TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
DATE DATE, --
DESCRIPTION TEXT, --
ENCOUNTER TEXT, --
CODE INTEGER, --
REASONCODE INTEGER, --
);
CREATE TABLE patients
(
suffix TEXT, -- Example Values: `PhD`, `JD`, `MD` | Value Statics: Total count 45 - Distinct count 3 - Null count 1417
prefix TEXT, -- Example Values: `Mr.`, `Mrs.`, `Ms.` | Value Statics: Total count 1166 - Distinct count 3 - Null count 296
deathdate DATE, --
ethnicity TEXT, --
race TEXT, -- Example Values: `black`, `white`, `hispanic`, `asian` | Value Statics: Total count 1462 - Distinct count 4 - Null count 0
address TEXT, --
birthplace TEXT, --
passport TEXT, --
maiden TEXT, --
birthdate DATE, --
marital TEXT, -- Example Values: `S`, `M` | Value Statics: Total count 1033 - Distinct count 2 - Null count 429
gender TEXT, -- Example Values: `F`, `M` | Value Statics: Total count 1462 - Distinct count 2 - Null count 0
drivers TEXT, --
first TEXT, --
last TEXT, --
patient TEXT primary key,
ssn TEXT, --
);
CREATE TABLE claims
(
ENCOUNTER TEXT references encounters, --
PATIENT TEXT references patients, --
ORGANIZATION TEXT, -- Example Values: `temp organization` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
TOTAL INTEGER, -- Example Values: `100` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
BILLABLEPERIOD DATE, --
DIAGNOSIS TEXT, --
ID TEXT primary key,
);
CREATE TABLE conditions
(
START DATE, --
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
CODE INTEGER, --
ENCOUNTER TEXT, --
STOP DATE, --
foreign key (ENCOUNTER) references encounters(ID),
foreign key (DESCRIPTION) references all_prevalences(ITEM),
);
CREATE TABLE all_prevalences
(
"POPULATION TYPE" TEXT, -- Example Values: `LIVING` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
"POPULATION COUNT" INTEGER, -- Example Values: `1000` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
ITEM TEXT primary key,
"PREVALENCE PERCENTAGE" REAL, --
"PREVALENCE RATE" REAL, --
OCCURRENCES INTEGER, --
); |
mondial_geo | Lists all governments with a parliamentary democracy that achieved their independence between 01/01/1950 and 12/31/1999. | Inhabitants, synonymous with population | SELECT * FROM politics WHERE STRFTIME('%Y', Independence) BETWEEN '1950' AND '1999' AND Government = 'parliamentary democracy' | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200
);
CREATE TABLE river
(
River TEXT, --
Mountains TEXT, --
SourceAltitude REAL, --
Length REAL, --
EstuaryLatitude REAL, --
SourceLongitude REAL, --
Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, --
EstuaryLongitude REAL, --
Sea TEXT, --
Name TEXT default '' not null primary key,
SourceLatitude REAL, --
);
CREATE TABLE mountainOnIsland
(
Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, --
primary key (Mountain, Island),
Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, --
);
CREATE TABLE organization
(
City TEXT, --
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, --
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
Abbreviation TEXT not null primary key,
Province TEXT, --
Name TEXT not null constraint ix_organization_OrgNameUnique unique, --
Established DATE, --
);
CREATE TABLE geo_desert
(
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, --
Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, --
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Desert),
);
CREATE TABLE geo_source
(
River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (Province, Country, River),
);
CREATE TABLE geo_sea
(
Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, --
Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, --
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Sea),
Province TEXT default '' not null, --
);
CREATE TABLE geo_estuary
(
primary key (Province, Country, River),
River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, --
);
CREATE TABLE located
(
River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, --
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, --
Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, --
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
City TEXT, --
Province TEXT, --
);
CREATE TABLE lake
(
Depth REAL, --
Altitude REAL, --
Name TEXT default '' not null primary key,
Longitude REAL, --
Latitude REAL, --
Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74
River TEXT, --
Area REAL, --
);
CREATE TABLE desert
(
Longitude REAL, --
Area REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
);
CREATE TABLE geo_mountain
(
Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, --
primary key (Province, Country, Mountain),
Province TEXT default '' not null, --
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, --
);
CREATE TABLE ethnicGroup
(
primary key (Name, Country),
Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, --
Name TEXT default '' not null, --
Percentage REAL, --
);
CREATE TABLE economy
(
Industry REAL, --
GDP REAL, --
Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade,
Inflation REAL, --
Service REAL, --
Agriculture REAL, --
);
CREATE TABLE borders
(
primary key (Country1, Country2),
Country2 TEXT default '' not null constraint borders_ibfk_2 references country, --
Length REAL, --
Country1 TEXT default '' not null constraint borders_ibfk_1 references country, --
);
CREATE TABLE language
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE islandIn
(
Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, --
River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349
Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, --
Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344
);
CREATE TABLE country
(
Area REAL, --
Capital TEXT, --
Population INTEGER, --
Name TEXT not null constraint ix_county_Name unique, --
Province TEXT, --
Code TEXT default '' not null primary key,
);
CREATE TABLE city
(
Longitude REAL, --
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Population INTEGER, --
Province TEXT default '' not null, --
primary key (Name, Province),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, --
Latitude REAL, --
);
CREATE TABLE island
(
Name TEXT default '' not null primary key,
Islands TEXT, --
Area REAL, --
Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185
Longitude REAL, --
Height REAL, --
Latitude REAL, --
);
CREATE TABLE geo_lake
(
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, --
primary key (Province, Country, Lake),
Province TEXT default '' not null, --
);
CREATE TABLE mountain
(
Longitude REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
Type TEXT, --
Height REAL, --
Mountains TEXT, --
);
CREATE TABLE province
(
Capital TEXT, --
Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, --
primary key (Name, Country),
Population INTEGER, --
Area REAL, --
Name TEXT not null, --
CapProv TEXT, --
);
CREATE TABLE population
(
Infant_Mortality REAL, --
Population_Growth REAL, --
Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade,
);
CREATE TABLE isMember
(
primary key (Country, Organization),
Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, --
Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, --
Type TEXT default 'member', --
);
CREATE TABLE locatedOn
(
Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, --
Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (City, Province, Country, Island),
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
City TEXT default '' not null, --
);
CREATE TABLE mergesWith
(
Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, --
Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, --
primary key (Sea1, Sea2),
);
CREATE TABLE encompasses
(
Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0
Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0
primary key (Country, Continent),
);
CREATE TABLE continent
(
Name TEXT default '' not null primary key,
Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0
);
CREATE TABLE religion
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE geo_river
(
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, River),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, --
River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, --
);
CREATE TABLE sea
(
Depth REAL, --
Name TEXT default '' not null primary key,
);
CREATE TABLE target
(
Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade,
Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0
);
CREATE TABLE geo_island
(
Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, --
primary key (Province, Country, Island),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, --
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
); |
retail_world | What is the average unit price of Tokyo Traders' products? | "Tokyo Traders" is the CompanyName; average unit price = AVG(UnitPrice) | SELECT SUM(T1.UnitPrice) / COUNT(T2.SupplierID) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Tokyo Traders' | CREATE TABLE Products
(
CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0
Unit TEXT, --
ReorderLevel INT, --
ProductName TEXT, --
Price REAL DEFAULT 0, --
FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),
SupplierID INTEGER, --
ProductID INTEGER PRIMARY KEY AUTOINCREMENT,
FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID),
);
CREATE TABLE Customers
(
ContactName TEXT, --
Country TEXT, --
Address TEXT, --
City TEXT, --
CustomerID INTEGER PRIMARY KEY AUTOINCREMENT,
PostalCode TEXT, --
CustomerName TEXT, --
);
CREATE TABLE EmployeeTerritories
(
TerritoryID INT, --
EmployeeID INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE OrderDetails
(
Quantity INTEGER, --
FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),
OrderID INTEGER, --
FOREIGN KEY (ProductID) REFERENCES Products (ProductID),
OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT,
ProductID INTEGER, --
);
CREATE TABLE Shippers
(
ShipperID INTEGER PRIMARY KEY AUTOINCREMENT,
ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
);
CREATE TABLE Territory
(
TerritoryDescription TEXT, --
RegionID INTEGER, --
TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT,
);
CREATE TABLE EmployeeDetails
(
EmployeeID INT PRIMARY KEY,
Title TEXT, --
Salary INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE Categories
(
CategoryID INTEGER PRIMARY KEY AUTOINCREMENT,
CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
);
CREATE TABLE Employees
(
Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT,
FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
);
CREATE TABLE Suppliers
(
PostalCode TEXT, --
Address TEXT, --
SupplierID INTEGER PRIMARY KEY AUTOINCREMENT,
City TEXT, --
Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0
Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0
ContactName TEXT, --
Phone TEXT, --
SupplierName TEXT, --
);
CREATE TABLE EmployeesExtra
(
Salary INTEGER, --
Title TEXT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
EmployeeID INTEGER PRIMARY KEY,
);
CREATE TABLE discontinued_products
(
Discontinued INTEGER, --
ProductID INTEGER PRIMARY KEY,
);
CREATE TABLE Orders
(
OrderID INTEGER PRIMARY KEY AUTOINCREMENT,
CustomerID INTEGER, --
FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),
FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID),
FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),
ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0
OrderDate DATETIME, --
EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0
);
CREATE TABLE Territories
(
TerritoryDescription TEXT, --
RegionDescription TEXT, --
);
CREATE TABLE ShippingInfo
(
ShipCountry TEXT, --
ShippedDate DATETIME, --
FOREIGN KEY (OrderID) REFERENCES Orders(OrderID),
OrderID INTEGER PRIMARY KEY,
); |
synthea | Among the patients with hypertension, what is the average of their diastolic blood pressure? | hypertension refers to conditions where DESCRIPTION = 'Hypertension'; average diastolic blood pressure refers to AVG(VALUE) where DESCRIPTION = 'Diastolic Blood Pressure' from observations; | SELECT AVG(T1.VALUE) FROM observations AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient INNER JOIN conditions AS T3 ON T2.patient = T3.PATIENT WHERE T3.DESCRIPTION = 'Hypertension' AND T1.DESCRIPTION = 'Diastolic Blood Pressure' | CREATE TABLE immunizations
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
DATE DATE, --
primary key (DATE, PATIENT, ENCOUNTER, CODE),
DESCRIPTION TEXT, -- Example Values: `Influenza seasonal injectable preservative free`, `Td (adult) preservative free`, `meningococcal MCV4P`, `Tdap`, `HPV quadrivalent` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
);
CREATE TABLE allergies
(
CODE INTEGER, -- Example Values: `232347008`, `300916003`, `419474003`, `424213003`, `300913006` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
foreign key (ENCOUNTER) references encounters(ID),
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
primary key (PATIENT, ENCOUNTER, CODE),
STOP TEXT, -- Example Values: `12/22/14`, `4/21/10`, `10/15/11`, `3/17/10`, `5/26/08` | Value Statics: Total count 16 - Distinct count 11 - Null count 556
START TEXT, --
DESCRIPTION TEXT, -- Example Values: `Allergy to dairy product`, `Allergy to tree pollen`, `Allergy to grass pollen`, `Dander (animal) allergy`, `House dust mite allergy` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
);
CREATE TABLE observations
(
DATE DATE, --
ENCOUNTER TEXT, --
VALUE REAL, --
UNITS TEXT, -- Example Values: `cm`, `kg`, `kg/m2`, `mmHg`, `Cel` | Value Statics: Total count 78444 - Distinct count 17 - Null count 455
DESCRIPTION TEXT, --
CODE TEXT, --
PATIENT TEXT, --
foreign key (PATIENT) references patients(patient),
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE medications
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, --
PATIENT TEXT, --
STOP DATE, --
START DATE, --
REASONDESCRIPTION TEXT, --
DESCRIPTION TEXT, --
primary key (START, PATIENT, ENCOUNTER, CODE),
foreign key (PATIENT) references patients(patient),
REASONCODE INTEGER, --
ENCOUNTER TEXT, --
);
CREATE TABLE careplans
(
START DATE, --
STOP DATE, --
ID TEXT, --
REASONCODE INTEGER, --
REASONDESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
DESCRIPTION TEXT, --
CODE REAL, --
ENCOUNTER TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE encounters
(
DATE DATE, --
REASONCODE INTEGER, --
CODE INTEGER, --
ID TEXT primary key,
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
REASONDESCRIPTION TEXT, --
);
CREATE TABLE procedures
(
foreign key (PATIENT) references patients(patient),
REASONDESCRIPTION TEXT, --
PATIENT TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
DATE DATE, --
DESCRIPTION TEXT, --
ENCOUNTER TEXT, --
CODE INTEGER, --
REASONCODE INTEGER, --
);
CREATE TABLE patients
(
suffix TEXT, -- Example Values: `PhD`, `JD`, `MD` | Value Statics: Total count 45 - Distinct count 3 - Null count 1417
prefix TEXT, -- Example Values: `Mr.`, `Mrs.`, `Ms.` | Value Statics: Total count 1166 - Distinct count 3 - Null count 296
deathdate DATE, --
ethnicity TEXT, --
race TEXT, -- Example Values: `black`, `white`, `hispanic`, `asian` | Value Statics: Total count 1462 - Distinct count 4 - Null count 0
address TEXT, --
birthplace TEXT, --
passport TEXT, --
maiden TEXT, --
birthdate DATE, --
marital TEXT, -- Example Values: `S`, `M` | Value Statics: Total count 1033 - Distinct count 2 - Null count 429
gender TEXT, -- Example Values: `F`, `M` | Value Statics: Total count 1462 - Distinct count 2 - Null count 0
drivers TEXT, --
first TEXT, --
last TEXT, --
patient TEXT primary key,
ssn TEXT, --
);
CREATE TABLE claims
(
ENCOUNTER TEXT references encounters, --
PATIENT TEXT references patients, --
ORGANIZATION TEXT, -- Example Values: `temp organization` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
TOTAL INTEGER, -- Example Values: `100` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
BILLABLEPERIOD DATE, --
DIAGNOSIS TEXT, --
ID TEXT primary key,
);
CREATE TABLE conditions
(
START DATE, --
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
CODE INTEGER, --
ENCOUNTER TEXT, --
STOP DATE, --
foreign key (ENCOUNTER) references encounters(ID),
foreign key (DESCRIPTION) references all_prevalences(ITEM),
);
CREATE TABLE all_prevalences
(
"POPULATION TYPE" TEXT, -- Example Values: `LIVING` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
"POPULATION COUNT" INTEGER, -- Example Values: `1000` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
ITEM TEXT primary key,
"PREVALENCE PERCENTAGE" REAL, --
"PREVALENCE RATE" REAL, --
OCCURRENCES INTEGER, --
); |
mondial_geo | What is the population density of the nation whose capital city is in the Distrito Federal province, and what portion of its gross domestic product is devoted to its industries? | ation and country are synonyms; Gross domestic product = GDP; Portion of GDP devoted to industries appears in economy.Industry; Population Density = Population / Area | SELECT T1.Population / T1.Area, T2.Industry FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country WHERE T1.Province = 'Distrito Federal' | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200
);
CREATE TABLE river
(
River TEXT, --
Mountains TEXT, --
SourceAltitude REAL, --
Length REAL, --
EstuaryLatitude REAL, --
SourceLongitude REAL, --
Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, --
EstuaryLongitude REAL, --
Sea TEXT, --
Name TEXT default '' not null primary key,
SourceLatitude REAL, --
);
CREATE TABLE mountainOnIsland
(
Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, --
primary key (Mountain, Island),
Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, --
);
CREATE TABLE organization
(
City TEXT, --
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, --
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
Abbreviation TEXT not null primary key,
Province TEXT, --
Name TEXT not null constraint ix_organization_OrgNameUnique unique, --
Established DATE, --
);
CREATE TABLE geo_desert
(
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, --
Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, --
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Desert),
);
CREATE TABLE geo_source
(
River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (Province, Country, River),
);
CREATE TABLE geo_sea
(
Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, --
Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, --
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Sea),
Province TEXT default '' not null, --
);
CREATE TABLE geo_estuary
(
primary key (Province, Country, River),
River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, --
);
CREATE TABLE located
(
River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, --
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, --
Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, --
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
City TEXT, --
Province TEXT, --
);
CREATE TABLE lake
(
Depth REAL, --
Altitude REAL, --
Name TEXT default '' not null primary key,
Longitude REAL, --
Latitude REAL, --
Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74
River TEXT, --
Area REAL, --
);
CREATE TABLE desert
(
Longitude REAL, --
Area REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
);
CREATE TABLE geo_mountain
(
Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, --
primary key (Province, Country, Mountain),
Province TEXT default '' not null, --
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, --
);
CREATE TABLE ethnicGroup
(
primary key (Name, Country),
Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, --
Name TEXT default '' not null, --
Percentage REAL, --
);
CREATE TABLE economy
(
Industry REAL, --
GDP REAL, --
Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade,
Inflation REAL, --
Service REAL, --
Agriculture REAL, --
);
CREATE TABLE borders
(
primary key (Country1, Country2),
Country2 TEXT default '' not null constraint borders_ibfk_2 references country, --
Length REAL, --
Country1 TEXT default '' not null constraint borders_ibfk_1 references country, --
);
CREATE TABLE language
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE islandIn
(
Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, --
River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349
Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, --
Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344
);
CREATE TABLE country
(
Area REAL, --
Capital TEXT, --
Population INTEGER, --
Name TEXT not null constraint ix_county_Name unique, --
Province TEXT, --
Code TEXT default '' not null primary key,
);
CREATE TABLE city
(
Longitude REAL, --
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Population INTEGER, --
Province TEXT default '' not null, --
primary key (Name, Province),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, --
Latitude REAL, --
);
CREATE TABLE island
(
Name TEXT default '' not null primary key,
Islands TEXT, --
Area REAL, --
Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185
Longitude REAL, --
Height REAL, --
Latitude REAL, --
);
CREATE TABLE geo_lake
(
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, --
primary key (Province, Country, Lake),
Province TEXT default '' not null, --
);
CREATE TABLE mountain
(
Longitude REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
Type TEXT, --
Height REAL, --
Mountains TEXT, --
);
CREATE TABLE province
(
Capital TEXT, --
Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, --
primary key (Name, Country),
Population INTEGER, --
Area REAL, --
Name TEXT not null, --
CapProv TEXT, --
);
CREATE TABLE population
(
Infant_Mortality REAL, --
Population_Growth REAL, --
Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade,
);
CREATE TABLE isMember
(
primary key (Country, Organization),
Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, --
Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, --
Type TEXT default 'member', --
);
CREATE TABLE locatedOn
(
Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, --
Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (City, Province, Country, Island),
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
City TEXT default '' not null, --
);
CREATE TABLE mergesWith
(
Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, --
Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, --
primary key (Sea1, Sea2),
);
CREATE TABLE encompasses
(
Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0
Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0
primary key (Country, Continent),
);
CREATE TABLE continent
(
Name TEXT default '' not null primary key,
Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0
);
CREATE TABLE religion
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE geo_river
(
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, River),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, --
River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, --
);
CREATE TABLE sea
(
Depth REAL, --
Name TEXT default '' not null primary key,
);
CREATE TABLE target
(
Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade,
Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0
);
CREATE TABLE geo_island
(
Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, --
primary key (Province, Country, Island),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, --
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
); |
retail_world | Which company has the lowest unit price? Please give the company name and the product name. | lowest unit price refers to Min(UnitPrice) | SELECT T2.CompanyName, T1.ProductName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.UnitPrice = ( SELECT MIN(UnitPrice) FROM Products ) | CREATE TABLE Products
(
CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0
Unit TEXT, --
ReorderLevel INT, --
ProductName TEXT, --
Price REAL DEFAULT 0, --
FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),
SupplierID INTEGER, --
ProductID INTEGER PRIMARY KEY AUTOINCREMENT,
FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID),
);
CREATE TABLE Customers
(
ContactName TEXT, --
Country TEXT, --
Address TEXT, --
City TEXT, --
CustomerID INTEGER PRIMARY KEY AUTOINCREMENT,
PostalCode TEXT, --
CustomerName TEXT, --
);
CREATE TABLE EmployeeTerritories
(
TerritoryID INT, --
EmployeeID INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE OrderDetails
(
Quantity INTEGER, --
FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),
OrderID INTEGER, --
FOREIGN KEY (ProductID) REFERENCES Products (ProductID),
OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT,
ProductID INTEGER, --
);
CREATE TABLE Shippers
(
ShipperID INTEGER PRIMARY KEY AUTOINCREMENT,
ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
);
CREATE TABLE Territory
(
TerritoryDescription TEXT, --
RegionID INTEGER, --
TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT,
);
CREATE TABLE EmployeeDetails
(
EmployeeID INT PRIMARY KEY,
Title TEXT, --
Salary INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE Categories
(
CategoryID INTEGER PRIMARY KEY AUTOINCREMENT,
CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
);
CREATE TABLE Employees
(
Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT,
FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
);
CREATE TABLE Suppliers
(
PostalCode TEXT, --
Address TEXT, --
SupplierID INTEGER PRIMARY KEY AUTOINCREMENT,
City TEXT, --
Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0
Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0
ContactName TEXT, --
Phone TEXT, --
SupplierName TEXT, --
);
CREATE TABLE EmployeesExtra
(
Salary INTEGER, --
Title TEXT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
EmployeeID INTEGER PRIMARY KEY,
);
CREATE TABLE discontinued_products
(
Discontinued INTEGER, --
ProductID INTEGER PRIMARY KEY,
);
CREATE TABLE Orders
(
OrderID INTEGER PRIMARY KEY AUTOINCREMENT,
CustomerID INTEGER, --
FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),
FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID),
FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),
ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0
OrderDate DATETIME, --
EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0
);
CREATE TABLE Territories
(
TerritoryDescription TEXT, --
RegionDescription TEXT, --
);
CREATE TABLE ShippingInfo
(
ShipCountry TEXT, --
ShippedDate DATETIME, --
FOREIGN KEY (OrderID) REFERENCES Orders(OrderID),
OrderID INTEGER PRIMARY KEY,
); |
professional_basketball | How many players whose teams were ranked 6 in 1937? | ranked 6 refers to rank = 6; in 1937 refers to year = 1937 | SELECT COUNT(DISTINCT T1.playerID) FROM players AS T1 INNER JOIN players_teams AS T2 ON T1.playerID = T2.playerID INNER JOIN teams AS T3 ON T3.tmID = T2.tmID WHERE T3.year = 1937 AND T3.rank = 6 | CREATE TABLE players_teams
(
PostGS INTEGER, --
PostdRebounds INTEGER, --
PostPF INTEGER, --
tmID TEXT, --
threeAttempted INTEGER, --
PostRebounds INTEGER, --
assists INTEGER, --
threeMade INTEGER, --
PostBlocks INTEGER, --
PostTurnovers INTEGER, --
GP INTEGER, --
lgID TEXT, -- Example Values: `NBA`, `NBL`, `ABA`, `ABL1`, `NPBL` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0
foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade,
PostfgMade INTEGER, --
steals INTEGER, --
oRebounds INTEGER, --
PostftAttempted INTEGER, --
ftAttempted INTEGER, --
ftMade INTEGER, --
points INTEGER, --
PostfgAttempted INTEGER, --
PostftMade INTEGER, --
note TEXT, -- Example Values: `C` | Value Statics: Total count 43 - Distinct count 1 - Null count 23708
dRebounds INTEGER, --
PostSteals INTEGER, --
blocks INTEGER, --
PostAssists INTEGER, --
minutes INTEGER, --
fgAttempted INTEGER, --
playerID TEXT not null references players on update cascade on delete cascade, --
PostthreeMade INTEGER, --
PostPoints INTEGER, --
year INTEGER, --
PF INTEGER, --
fgMade INTEGER, --
PostthreeAttempted INTEGER, --
rebounds INTEGER, --
id INTEGER primary key autoincrement,
stint INTEGER, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0
PostMinutes INTEGER, --
PostGP INTEGER, --
turnovers INTEGER, --
PostoRebounds INTEGER, --
GS INTEGER, --
);
CREATE TABLE awards_coaches
(
award TEXT, -- Example Values: `NBA Coach of the Year`, `ABA Coach of the Year` | Value Statics: Total count 61 - Distinct count 2 - Null count 0
id INTEGER primary key autoincrement,
note TEXT, -- Example Values: `tie` | Value Statics: Total count 4 - Distinct count 1 - Null count 57
coachID TEXT, --
lgID TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 61 - Distinct count 2 - Null count 0
foreign key (coachID, year) references coaches (coachID, year) on update cascade on delete cascade,
year INTEGER, --
);
CREATE TABLE draft
(
draftOverall INTEGER null, --
lgID TEXT null, -- Example Values: `ABA`, `NBA` | Value Statics: Total count 8621 - Distinct count 2 - Null count 0
suffixName TEXT null, -- Example Values: `Jr.` | Value Statics: Total count 2 - Distinct count 1 - Null count 8619
draftYear INTEGER null, --
draftSelection INTEGER null, --
tmID TEXT null, --
draftRound INTEGER null, --
lastName TEXT null, --
playerID TEXT null, --
draftFrom TEXT null, --
id INTEGER default 0 not null primary key,
firstName TEXT null, --
foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade,
foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade,
);
CREATE TABLE player_allstar
(
rebounds INTEGER null, --
playerID TEXT not null, --
season_id INTEGER not null, --
assists INTEGER null, --
conference TEXT null, -- Example Values: `East`, `West`, `Weset`, `Allstars`, `Denver` | Value Statics: Total count 1608 - Distinct count 5 - Null count 0
points INTEGER null, --
personal_fouls INTEGER null, -- Example Values: `3`, `2`, `0`, `1`, `5` | Value Statics: Total count 540 - Distinct count 8 - Null count 1068
ft_attempted INTEGER null, -- Example Values: `2`, `4`, `0`, `6`, `3` | Value Statics: Total count 1561 - Distinct count 17 - Null count 47
fg_attempted INTEGER null, --
league_id TEXT null, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 1608 - Distinct count 2 - Null count 0
foreign key (playerID) references players (playerID) on update cascade on delete cascade,
fg_made INTEGER null, -- Example Values: `4`, `8`, `5`, `7`, `3` | Value Statics: Total count 1561 - Distinct count 18 - Null count 47
ft_made INTEGER null, -- Example Values: `2`, `3`, `0`, `1`, `4` | Value Statics: Total count 1561 - Distinct count 13 - Null count 47
steals INTEGER null, -- Example Values: `3`, `0`, `1`, `2`, `5` | Value Statics: Total count 398 - Distinct count 7 - Null count 1210
games_played INTEGER null, -- Example Values: `1` | Value Statics: Total count 1608 - Distinct count 1 - Null count 0
first_name TEXT null, --
d_rebounds INTEGER null, -- Example Values: `2`, `5`, `0`, `1`, `4` | Value Statics: Total count 493 - Distinct count 14 - Null count 1115
last_name TEXT null, --
primary key (playerID, season_id),
turnovers INTEGER null, -- Example Values: `1`, `0`, `3`, `2`, `4` | Value Statics: Total count 493 - Distinct count 9 - Null count 1115
three_made INTEGER null, -- Example Values: `0`, `1`, `3`, `5`, `4` | Value Statics: Total count 566 - Distinct count 7 - Null count 1042
minutes INTEGER null, --
blocks INTEGER null, -- Example Values: `2`, `0`, `1`, `3`, `5` | Value Statics: Total count 398 - Distinct count 6 - Null count 1210
three_attempted INTEGER null, -- Example Values: `0`, `1`, `6`, `7`, `10` | Value Statics: Total count 540 - Distinct count 12 - Null count 1068
o_rebounds INTEGER null, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 493 - Distinct count 10 - Null count 1115
);
CREATE TABLE awards_players
(
foreign key (playerID) references players (playerID) on update cascade on delete cascade,
year INTEGER not null, --
pos TEXT null, -- Example Values: `C`, `F`, `G`, `F/G`, `F/C` | Value Statics: Total count 833 - Distinct count 5 - Null count 886
primary key (playerID, year, award),
lgID TEXT null, -- Example Values: `NBA`, `ABA`, `NBL`, `ABL1` | Value Statics: Total count 1719 - Distinct count 4 - Null count 0
award TEXT not null, --
playerID TEXT not null, --
note TEXT null, -- Example Values: `tie` | Value Statics: Total count 37 - Distinct count 1 - Null count 1682
);
CREATE TABLE series_post
(
tmIDLoser TEXT, --
id INTEGER primary key autoincrement,
series TEXT, -- Example Values: `O`, `M`, `N`, `A`, `K` | Value Statics: Total count 775 - Distinct count 11 - Null count 0
tmIDWinner TEXT, --
round TEXT, -- Example Values: `F`, `QF`, `SF`, `DT`, `DF` | Value Statics: Total count 775 - Distinct count 11 - Null count 0
year INTEGER, --
foreign key (tmIDLoser, year) references teams (tmID, year) on update cascade on delete cascade,
foreign key (tmIDWinner, year) references teams (tmID, year) on update cascade on delete cascade,
W INTEGER, -- Example Values: `4`, `2`, `1`, `3`, `0` | Value Statics: Total count 775 - Distinct count 5 - Null count 0
lgIDLoser TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0
lgIDWinner TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0
L INTEGER, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 775 - Distinct count 5 - Null count 0
);
CREATE TABLE players
(
nameGiven TEXT null, -- Example Values: `nameGiven`, `Mort`, `Robert`, `Jim`, `Mike` | Value Statics: Total count 10 - Distinct count 9 - Null count 5052
lastseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15
hsCountry TEXT null, --
firstName TEXT null, --
hsCity TEXT null, --
firstseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15
weight INTEGER null, --
birthCountry TEXT null, --
race TEXT null, -- Example Values: `B`, `W`, `O`, `1`, `r` | Value Statics: Total count 4903 - Distinct count 5 - Null count 159
lastName TEXT null, --
birthDate DATE null, --
collegeOther TEXT null, --
birthState TEXT null, --
useFirst TEXT null, --
pos TEXT null, -- Example Values: `F-C`, `C`, `G`, `G-F`, `C-F` | Value Statics: Total count 4880 - Distinct count 14 - Null count 182
playerID TEXT not null primary key,
college TEXT null, --
highSchool TEXT null, --
hsState TEXT null, --
height REAL null, --
deathDate DATE null, --
nameSuffix TEXT null, -- Example Values: `Jr.`, `III`, `nameSuffix`, `II`, `IV` | Value Statics: Total count 324 - Distinct count 6 - Null count 4738
nameNick TEXT null, --
fullGivenName TEXT null, --
birthCity TEXT null, --
middleName TEXT null, --
);
CREATE TABLE teams
(
d_pts INTEGER null, --
name TEXT null, --
homeLost INTEGER null, --
o_ftm INTEGER null, --
franchID TEXT null, --
tmID TEXT not null, --
awayWon INTEGER null, --
primary key (year, tmID),
o_fgm INTEGER null, --
year INTEGER not null, --
awayLost INTEGER null, --
arena TEXT null, --
confID TEXT null, -- Example Values: `EC`, `WC` | Value Statics: Total count 1064 - Distinct count 2 - Null count 472
games INTEGER null, --
lost INTEGER null, --
divID TEXT null, -- Example Values: `EA`, `WE`, `ED`, `WD`, `SO` | Value Statics: Total count 1498 - Distinct count 13 - Null count 38
lgID TEXT null, -- Example Values: `NBL`, `NBA`, `PBLA`, `NPBL`, `ABL1` | Value Statics: Total count 1536 - Distinct count 6 - Null count 0
homeWon INTEGER null, --
confRank INTEGER null, -- Example Values: `0`, `4`, `3`, `5`, `7` | Value Statics: Total count 1536 - Distinct count 16 - Null count 0
o_pts INTEGER null, --
`rank` INTEGER null, -- Example Values: `1`, `2`, `4`, `5`, `6` | Value Statics: Total count 1536 - Distinct count 10 - Null count 0
playoff TEXT null, -- Example Values: `CF`, `WC`, `LC`, `CS`, `F` | Value Statics: Total count 901 - Distinct count 15 - Null count 635
won INTEGER null, --
);
CREATE TABLE coaches
(
primary key (coachID, year, tmID, stint),
lgID TEXT null, -- Example Values: `NBA`, `ABA`, `ABL1`, `PBLA`, `NPBL` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0
post_losses INTEGER null, -- Example Values: `3`, `9`, `7`, `8`, `0` | Value Statics: Total count 1649 - Distinct count 12 - Null count 40
year INTEGER not null, --
won INTEGER null, --
foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade,
post_wins INTEGER null, -- Example Values: `0`, `12`, `9`, `13`, `1` | Value Statics: Total count 1649 - Distinct count 17 - Null count 40
coachID TEXT not null, --
tmID TEXT not null, --
lost INTEGER null, --
stint INTEGER not null, -- Example Values: `2`, `1`, `4`, `5`, `3` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0
); |
synthea | How many of the male patients are allergic to house dust mites? | male patients refer to PATIENT where gender = 'M'; allergic to house dust mites refers to allergies where DESCRIPTION = 'House dust mite allergy'; | SELECT COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN allergies AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'House dust mite allergy' AND T1.gender = 'M' | CREATE TABLE immunizations
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
DATE DATE, --
primary key (DATE, PATIENT, ENCOUNTER, CODE),
DESCRIPTION TEXT, -- Example Values: `Influenza seasonal injectable preservative free`, `Td (adult) preservative free`, `meningococcal MCV4P`, `Tdap`, `HPV quadrivalent` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
);
CREATE TABLE allergies
(
CODE INTEGER, -- Example Values: `232347008`, `300916003`, `419474003`, `424213003`, `300913006` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
foreign key (ENCOUNTER) references encounters(ID),
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
primary key (PATIENT, ENCOUNTER, CODE),
STOP TEXT, -- Example Values: `12/22/14`, `4/21/10`, `10/15/11`, `3/17/10`, `5/26/08` | Value Statics: Total count 16 - Distinct count 11 - Null count 556
START TEXT, --
DESCRIPTION TEXT, -- Example Values: `Allergy to dairy product`, `Allergy to tree pollen`, `Allergy to grass pollen`, `Dander (animal) allergy`, `House dust mite allergy` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
);
CREATE TABLE observations
(
DATE DATE, --
ENCOUNTER TEXT, --
VALUE REAL, --
UNITS TEXT, -- Example Values: `cm`, `kg`, `kg/m2`, `mmHg`, `Cel` | Value Statics: Total count 78444 - Distinct count 17 - Null count 455
DESCRIPTION TEXT, --
CODE TEXT, --
PATIENT TEXT, --
foreign key (PATIENT) references patients(patient),
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE medications
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, --
PATIENT TEXT, --
STOP DATE, --
START DATE, --
REASONDESCRIPTION TEXT, --
DESCRIPTION TEXT, --
primary key (START, PATIENT, ENCOUNTER, CODE),
foreign key (PATIENT) references patients(patient),
REASONCODE INTEGER, --
ENCOUNTER TEXT, --
);
CREATE TABLE careplans
(
START DATE, --
STOP DATE, --
ID TEXT, --
REASONCODE INTEGER, --
REASONDESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
DESCRIPTION TEXT, --
CODE REAL, --
ENCOUNTER TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE encounters
(
DATE DATE, --
REASONCODE INTEGER, --
CODE INTEGER, --
ID TEXT primary key,
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
REASONDESCRIPTION TEXT, --
);
CREATE TABLE procedures
(
foreign key (PATIENT) references patients(patient),
REASONDESCRIPTION TEXT, --
PATIENT TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
DATE DATE, --
DESCRIPTION TEXT, --
ENCOUNTER TEXT, --
CODE INTEGER, --
REASONCODE INTEGER, --
);
CREATE TABLE patients
(
suffix TEXT, -- Example Values: `PhD`, `JD`, `MD` | Value Statics: Total count 45 - Distinct count 3 - Null count 1417
prefix TEXT, -- Example Values: `Mr.`, `Mrs.`, `Ms.` | Value Statics: Total count 1166 - Distinct count 3 - Null count 296
deathdate DATE, --
ethnicity TEXT, --
race TEXT, -- Example Values: `black`, `white`, `hispanic`, `asian` | Value Statics: Total count 1462 - Distinct count 4 - Null count 0
address TEXT, --
birthplace TEXT, --
passport TEXT, --
maiden TEXT, --
birthdate DATE, --
marital TEXT, -- Example Values: `S`, `M` | Value Statics: Total count 1033 - Distinct count 2 - Null count 429
gender TEXT, -- Example Values: `F`, `M` | Value Statics: Total count 1462 - Distinct count 2 - Null count 0
drivers TEXT, --
first TEXT, --
last TEXT, --
patient TEXT primary key,
ssn TEXT, --
);
CREATE TABLE claims
(
ENCOUNTER TEXT references encounters, --
PATIENT TEXT references patients, --
ORGANIZATION TEXT, -- Example Values: `temp organization` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
TOTAL INTEGER, -- Example Values: `100` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
BILLABLEPERIOD DATE, --
DIAGNOSIS TEXT, --
ID TEXT primary key,
);
CREATE TABLE conditions
(
START DATE, --
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
CODE INTEGER, --
ENCOUNTER TEXT, --
STOP DATE, --
foreign key (ENCOUNTER) references encounters(ID),
foreign key (DESCRIPTION) references all_prevalences(ITEM),
);
CREATE TABLE all_prevalences
(
"POPULATION TYPE" TEXT, -- Example Values: `LIVING` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
"POPULATION COUNT" INTEGER, -- Example Values: `1000` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
ITEM TEXT primary key,
"PREVALENCE PERCENTAGE" REAL, --
"PREVALENCE RATE" REAL, --
OCCURRENCES INTEGER, --
); |
mondial_geo | What other country does the most populated nation in the world share a border with and how long is the border between the two nations? | Nation and country are synonyms | SELECT T2.Country2, T2.Length FROM country AS T1 INNER JOIN borders AS T2 ON T1.Code = T2.Country1 INNER JOIN country AS T3 ON T3.Code = T2.Country2 WHERE T1.Name = ( SELECT Name FROM country ORDER BY Population DESC LIMIT 1 ) | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200
);
CREATE TABLE river
(
River TEXT, --
Mountains TEXT, --
SourceAltitude REAL, --
Length REAL, --
EstuaryLatitude REAL, --
SourceLongitude REAL, --
Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, --
EstuaryLongitude REAL, --
Sea TEXT, --
Name TEXT default '' not null primary key,
SourceLatitude REAL, --
);
CREATE TABLE mountainOnIsland
(
Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, --
primary key (Mountain, Island),
Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, --
);
CREATE TABLE organization
(
City TEXT, --
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, --
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
Abbreviation TEXT not null primary key,
Province TEXT, --
Name TEXT not null constraint ix_organization_OrgNameUnique unique, --
Established DATE, --
);
CREATE TABLE geo_desert
(
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, --
Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, --
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Desert),
);
CREATE TABLE geo_source
(
River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (Province, Country, River),
);
CREATE TABLE geo_sea
(
Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, --
Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, --
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Sea),
Province TEXT default '' not null, --
);
CREATE TABLE geo_estuary
(
primary key (Province, Country, River),
River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, --
);
CREATE TABLE located
(
River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, --
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, --
Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, --
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
City TEXT, --
Province TEXT, --
);
CREATE TABLE lake
(
Depth REAL, --
Altitude REAL, --
Name TEXT default '' not null primary key,
Longitude REAL, --
Latitude REAL, --
Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74
River TEXT, --
Area REAL, --
);
CREATE TABLE desert
(
Longitude REAL, --
Area REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
);
CREATE TABLE geo_mountain
(
Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, --
primary key (Province, Country, Mountain),
Province TEXT default '' not null, --
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, --
);
CREATE TABLE ethnicGroup
(
primary key (Name, Country),
Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, --
Name TEXT default '' not null, --
Percentage REAL, --
);
CREATE TABLE economy
(
Industry REAL, --
GDP REAL, --
Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade,
Inflation REAL, --
Service REAL, --
Agriculture REAL, --
);
CREATE TABLE borders
(
primary key (Country1, Country2),
Country2 TEXT default '' not null constraint borders_ibfk_2 references country, --
Length REAL, --
Country1 TEXT default '' not null constraint borders_ibfk_1 references country, --
);
CREATE TABLE language
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE islandIn
(
Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, --
River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349
Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, --
Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344
);
CREATE TABLE country
(
Area REAL, --
Capital TEXT, --
Population INTEGER, --
Name TEXT not null constraint ix_county_Name unique, --
Province TEXT, --
Code TEXT default '' not null primary key,
);
CREATE TABLE city
(
Longitude REAL, --
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Population INTEGER, --
Province TEXT default '' not null, --
primary key (Name, Province),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, --
Latitude REAL, --
);
CREATE TABLE island
(
Name TEXT default '' not null primary key,
Islands TEXT, --
Area REAL, --
Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185
Longitude REAL, --
Height REAL, --
Latitude REAL, --
);
CREATE TABLE geo_lake
(
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, --
primary key (Province, Country, Lake),
Province TEXT default '' not null, --
);
CREATE TABLE mountain
(
Longitude REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
Type TEXT, --
Height REAL, --
Mountains TEXT, --
);
CREATE TABLE province
(
Capital TEXT, --
Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, --
primary key (Name, Country),
Population INTEGER, --
Area REAL, --
Name TEXT not null, --
CapProv TEXT, --
);
CREATE TABLE population
(
Infant_Mortality REAL, --
Population_Growth REAL, --
Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade,
);
CREATE TABLE isMember
(
primary key (Country, Organization),
Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, --
Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, --
Type TEXT default 'member', --
);
CREATE TABLE locatedOn
(
Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, --
Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (City, Province, Country, Island),
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
City TEXT default '' not null, --
);
CREATE TABLE mergesWith
(
Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, --
Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, --
primary key (Sea1, Sea2),
);
CREATE TABLE encompasses
(
Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0
Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0
primary key (Country, Continent),
);
CREATE TABLE continent
(
Name TEXT default '' not null primary key,
Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0
);
CREATE TABLE religion
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE geo_river
(
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, River),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, --
River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, --
);
CREATE TABLE sea
(
Depth REAL, --
Name TEXT default '' not null primary key,
);
CREATE TABLE target
(
Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade,
Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0
);
CREATE TABLE geo_island
(
Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, --
primary key (Province, Country, Island),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, --
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
); |
retail_world | How many products does the company Exotic Liquids supply? | "Exotic Liquids" is the CompanyName of supplier | SELECT COUNT(T1.ProductName) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Exotic Liquids' | CREATE TABLE Products
(
CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0
Unit TEXT, --
ReorderLevel INT, --
ProductName TEXT, --
Price REAL DEFAULT 0, --
FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),
SupplierID INTEGER, --
ProductID INTEGER PRIMARY KEY AUTOINCREMENT,
FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID),
);
CREATE TABLE Customers
(
ContactName TEXT, --
Country TEXT, --
Address TEXT, --
City TEXT, --
CustomerID INTEGER PRIMARY KEY AUTOINCREMENT,
PostalCode TEXT, --
CustomerName TEXT, --
);
CREATE TABLE EmployeeTerritories
(
TerritoryID INT, --
EmployeeID INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE OrderDetails
(
Quantity INTEGER, --
FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),
OrderID INTEGER, --
FOREIGN KEY (ProductID) REFERENCES Products (ProductID),
OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT,
ProductID INTEGER, --
);
CREATE TABLE Shippers
(
ShipperID INTEGER PRIMARY KEY AUTOINCREMENT,
ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
);
CREATE TABLE Territory
(
TerritoryDescription TEXT, --
RegionID INTEGER, --
TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT,
);
CREATE TABLE EmployeeDetails
(
EmployeeID INT PRIMARY KEY,
Title TEXT, --
Salary INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE Categories
(
CategoryID INTEGER PRIMARY KEY AUTOINCREMENT,
CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
);
CREATE TABLE Employees
(
Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT,
FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
);
CREATE TABLE Suppliers
(
PostalCode TEXT, --
Address TEXT, --
SupplierID INTEGER PRIMARY KEY AUTOINCREMENT,
City TEXT, --
Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0
Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0
ContactName TEXT, --
Phone TEXT, --
SupplierName TEXT, --
);
CREATE TABLE EmployeesExtra
(
Salary INTEGER, --
Title TEXT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
EmployeeID INTEGER PRIMARY KEY,
);
CREATE TABLE discontinued_products
(
Discontinued INTEGER, --
ProductID INTEGER PRIMARY KEY,
);
CREATE TABLE Orders
(
OrderID INTEGER PRIMARY KEY AUTOINCREMENT,
CustomerID INTEGER, --
FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),
FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID),
FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),
ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0
OrderDate DATETIME, --
EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0
);
CREATE TABLE Territories
(
TerritoryDescription TEXT, --
RegionDescription TEXT, --
);
CREATE TABLE ShippingInfo
(
ShipCountry TEXT, --
ShippedDate DATETIME, --
FOREIGN KEY (OrderID) REFERENCES Orders(OrderID),
OrderID INTEGER PRIMARY KEY,
); |
professional_basketball | Which player from "AFS" team has the tallest height? | "AFS" is the tmID; tallest height refers to Max(height) | SELECT T1.firstName, T1.middleName, T1.lastName FROM players AS T1 INNER JOIN players_teams AS T2 ON T1.playerID = T2.playerID WHERE T2.tmID = 'AFS' ORDER BY T1.height DESC LIMIT 1 | CREATE TABLE players_teams
(
PostGS INTEGER, --
PostdRebounds INTEGER, --
PostPF INTEGER, --
tmID TEXT, --
threeAttempted INTEGER, --
PostRebounds INTEGER, --
assists INTEGER, --
threeMade INTEGER, --
PostBlocks INTEGER, --
PostTurnovers INTEGER, --
GP INTEGER, --
lgID TEXT, -- Example Values: `NBA`, `NBL`, `ABA`, `ABL1`, `NPBL` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0
foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade,
PostfgMade INTEGER, --
steals INTEGER, --
oRebounds INTEGER, --
PostftAttempted INTEGER, --
ftAttempted INTEGER, --
ftMade INTEGER, --
points INTEGER, --
PostfgAttempted INTEGER, --
PostftMade INTEGER, --
note TEXT, -- Example Values: `C` | Value Statics: Total count 43 - Distinct count 1 - Null count 23708
dRebounds INTEGER, --
PostSteals INTEGER, --
blocks INTEGER, --
PostAssists INTEGER, --
minutes INTEGER, --
fgAttempted INTEGER, --
playerID TEXT not null references players on update cascade on delete cascade, --
PostthreeMade INTEGER, --
PostPoints INTEGER, --
year INTEGER, --
PF INTEGER, --
fgMade INTEGER, --
PostthreeAttempted INTEGER, --
rebounds INTEGER, --
id INTEGER primary key autoincrement,
stint INTEGER, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0
PostMinutes INTEGER, --
PostGP INTEGER, --
turnovers INTEGER, --
PostoRebounds INTEGER, --
GS INTEGER, --
);
CREATE TABLE awards_coaches
(
award TEXT, -- Example Values: `NBA Coach of the Year`, `ABA Coach of the Year` | Value Statics: Total count 61 - Distinct count 2 - Null count 0
id INTEGER primary key autoincrement,
note TEXT, -- Example Values: `tie` | Value Statics: Total count 4 - Distinct count 1 - Null count 57
coachID TEXT, --
lgID TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 61 - Distinct count 2 - Null count 0
foreign key (coachID, year) references coaches (coachID, year) on update cascade on delete cascade,
year INTEGER, --
);
CREATE TABLE draft
(
draftOverall INTEGER null, --
lgID TEXT null, -- Example Values: `ABA`, `NBA` | Value Statics: Total count 8621 - Distinct count 2 - Null count 0
suffixName TEXT null, -- Example Values: `Jr.` | Value Statics: Total count 2 - Distinct count 1 - Null count 8619
draftYear INTEGER null, --
draftSelection INTEGER null, --
tmID TEXT null, --
draftRound INTEGER null, --
lastName TEXT null, --
playerID TEXT null, --
draftFrom TEXT null, --
id INTEGER default 0 not null primary key,
firstName TEXT null, --
foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade,
foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade,
);
CREATE TABLE player_allstar
(
rebounds INTEGER null, --
playerID TEXT not null, --
season_id INTEGER not null, --
assists INTEGER null, --
conference TEXT null, -- Example Values: `East`, `West`, `Weset`, `Allstars`, `Denver` | Value Statics: Total count 1608 - Distinct count 5 - Null count 0
points INTEGER null, --
personal_fouls INTEGER null, -- Example Values: `3`, `2`, `0`, `1`, `5` | Value Statics: Total count 540 - Distinct count 8 - Null count 1068
ft_attempted INTEGER null, -- Example Values: `2`, `4`, `0`, `6`, `3` | Value Statics: Total count 1561 - Distinct count 17 - Null count 47
fg_attempted INTEGER null, --
league_id TEXT null, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 1608 - Distinct count 2 - Null count 0
foreign key (playerID) references players (playerID) on update cascade on delete cascade,
fg_made INTEGER null, -- Example Values: `4`, `8`, `5`, `7`, `3` | Value Statics: Total count 1561 - Distinct count 18 - Null count 47
ft_made INTEGER null, -- Example Values: `2`, `3`, `0`, `1`, `4` | Value Statics: Total count 1561 - Distinct count 13 - Null count 47
steals INTEGER null, -- Example Values: `3`, `0`, `1`, `2`, `5` | Value Statics: Total count 398 - Distinct count 7 - Null count 1210
games_played INTEGER null, -- Example Values: `1` | Value Statics: Total count 1608 - Distinct count 1 - Null count 0
first_name TEXT null, --
d_rebounds INTEGER null, -- Example Values: `2`, `5`, `0`, `1`, `4` | Value Statics: Total count 493 - Distinct count 14 - Null count 1115
last_name TEXT null, --
primary key (playerID, season_id),
turnovers INTEGER null, -- Example Values: `1`, `0`, `3`, `2`, `4` | Value Statics: Total count 493 - Distinct count 9 - Null count 1115
three_made INTEGER null, -- Example Values: `0`, `1`, `3`, `5`, `4` | Value Statics: Total count 566 - Distinct count 7 - Null count 1042
minutes INTEGER null, --
blocks INTEGER null, -- Example Values: `2`, `0`, `1`, `3`, `5` | Value Statics: Total count 398 - Distinct count 6 - Null count 1210
three_attempted INTEGER null, -- Example Values: `0`, `1`, `6`, `7`, `10` | Value Statics: Total count 540 - Distinct count 12 - Null count 1068
o_rebounds INTEGER null, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 493 - Distinct count 10 - Null count 1115
);
CREATE TABLE awards_players
(
foreign key (playerID) references players (playerID) on update cascade on delete cascade,
year INTEGER not null, --
pos TEXT null, -- Example Values: `C`, `F`, `G`, `F/G`, `F/C` | Value Statics: Total count 833 - Distinct count 5 - Null count 886
primary key (playerID, year, award),
lgID TEXT null, -- Example Values: `NBA`, `ABA`, `NBL`, `ABL1` | Value Statics: Total count 1719 - Distinct count 4 - Null count 0
award TEXT not null, --
playerID TEXT not null, --
note TEXT null, -- Example Values: `tie` | Value Statics: Total count 37 - Distinct count 1 - Null count 1682
);
CREATE TABLE series_post
(
tmIDLoser TEXT, --
id INTEGER primary key autoincrement,
series TEXT, -- Example Values: `O`, `M`, `N`, `A`, `K` | Value Statics: Total count 775 - Distinct count 11 - Null count 0
tmIDWinner TEXT, --
round TEXT, -- Example Values: `F`, `QF`, `SF`, `DT`, `DF` | Value Statics: Total count 775 - Distinct count 11 - Null count 0
year INTEGER, --
foreign key (tmIDLoser, year) references teams (tmID, year) on update cascade on delete cascade,
foreign key (tmIDWinner, year) references teams (tmID, year) on update cascade on delete cascade,
W INTEGER, -- Example Values: `4`, `2`, `1`, `3`, `0` | Value Statics: Total count 775 - Distinct count 5 - Null count 0
lgIDLoser TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0
lgIDWinner TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0
L INTEGER, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 775 - Distinct count 5 - Null count 0
);
CREATE TABLE players
(
nameGiven TEXT null, -- Example Values: `nameGiven`, `Mort`, `Robert`, `Jim`, `Mike` | Value Statics: Total count 10 - Distinct count 9 - Null count 5052
lastseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15
hsCountry TEXT null, --
firstName TEXT null, --
hsCity TEXT null, --
firstseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15
weight INTEGER null, --
birthCountry TEXT null, --
race TEXT null, -- Example Values: `B`, `W`, `O`, `1`, `r` | Value Statics: Total count 4903 - Distinct count 5 - Null count 159
lastName TEXT null, --
birthDate DATE null, --
collegeOther TEXT null, --
birthState TEXT null, --
useFirst TEXT null, --
pos TEXT null, -- Example Values: `F-C`, `C`, `G`, `G-F`, `C-F` | Value Statics: Total count 4880 - Distinct count 14 - Null count 182
playerID TEXT not null primary key,
college TEXT null, --
highSchool TEXT null, --
hsState TEXT null, --
height REAL null, --
deathDate DATE null, --
nameSuffix TEXT null, -- Example Values: `Jr.`, `III`, `nameSuffix`, `II`, `IV` | Value Statics: Total count 324 - Distinct count 6 - Null count 4738
nameNick TEXT null, --
fullGivenName TEXT null, --
birthCity TEXT null, --
middleName TEXT null, --
);
CREATE TABLE teams
(
d_pts INTEGER null, --
name TEXT null, --
homeLost INTEGER null, --
o_ftm INTEGER null, --
franchID TEXT null, --
tmID TEXT not null, --
awayWon INTEGER null, --
primary key (year, tmID),
o_fgm INTEGER null, --
year INTEGER not null, --
awayLost INTEGER null, --
arena TEXT null, --
confID TEXT null, -- Example Values: `EC`, `WC` | Value Statics: Total count 1064 - Distinct count 2 - Null count 472
games INTEGER null, --
lost INTEGER null, --
divID TEXT null, -- Example Values: `EA`, `WE`, `ED`, `WD`, `SO` | Value Statics: Total count 1498 - Distinct count 13 - Null count 38
lgID TEXT null, -- Example Values: `NBL`, `NBA`, `PBLA`, `NPBL`, `ABL1` | Value Statics: Total count 1536 - Distinct count 6 - Null count 0
homeWon INTEGER null, --
confRank INTEGER null, -- Example Values: `0`, `4`, `3`, `5`, `7` | Value Statics: Total count 1536 - Distinct count 16 - Null count 0
o_pts INTEGER null, --
`rank` INTEGER null, -- Example Values: `1`, `2`, `4`, `5`, `6` | Value Statics: Total count 1536 - Distinct count 10 - Null count 0
playoff TEXT null, -- Example Values: `CF`, `WC`, `LC`, `CS`, `F` | Value Statics: Total count 901 - Distinct count 15 - Null count 635
won INTEGER null, --
);
CREATE TABLE coaches
(
primary key (coachID, year, tmID, stint),
lgID TEXT null, -- Example Values: `NBA`, `ABA`, `ABL1`, `PBLA`, `NPBL` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0
post_losses INTEGER null, -- Example Values: `3`, `9`, `7`, `8`, `0` | Value Statics: Total count 1649 - Distinct count 12 - Null count 40
year INTEGER not null, --
won INTEGER null, --
foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade,
post_wins INTEGER null, -- Example Values: `0`, `12`, `9`, `13`, `1` | Value Statics: Total count 1649 - Distinct count 17 - Null count 40
coachID TEXT not null, --
tmID TEXT not null, --
lost INTEGER null, --
stint INTEGER not null, -- Example Values: `2`, `1`, `4`, `5`, `3` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0
); |
synthea | What is the total number of Asian patients who are allergic to peanuts? | Asian refers to race like 'asian%'; allergic to peanuts refers to allergies where DESCRIPTION = 'Allergy to peanuts';
| SELECT COUNT(T2.patient) FROM allergies AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T1.DESCRIPTION = 'Allergy to peanuts' AND T2.race = 'asian' | CREATE TABLE immunizations
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
DATE DATE, --
primary key (DATE, PATIENT, ENCOUNTER, CODE),
DESCRIPTION TEXT, -- Example Values: `Influenza seasonal injectable preservative free`, `Td (adult) preservative free`, `meningococcal MCV4P`, `Tdap`, `HPV quadrivalent` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0
);
CREATE TABLE allergies
(
CODE INTEGER, -- Example Values: `232347008`, `300916003`, `419474003`, `424213003`, `300913006` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
foreign key (ENCOUNTER) references encounters(ID),
foreign key (PATIENT) references patients(patient),
ENCOUNTER TEXT, --
PATIENT TEXT, --
primary key (PATIENT, ENCOUNTER, CODE),
STOP TEXT, -- Example Values: `12/22/14`, `4/21/10`, `10/15/11`, `3/17/10`, `5/26/08` | Value Statics: Total count 16 - Distinct count 11 - Null count 556
START TEXT, --
DESCRIPTION TEXT, -- Example Values: `Allergy to dairy product`, `Allergy to tree pollen`, `Allergy to grass pollen`, `Dander (animal) allergy`, `House dust mite allergy` | Value Statics: Total count 572 - Distinct count 15 - Null count 0
);
CREATE TABLE observations
(
DATE DATE, --
ENCOUNTER TEXT, --
VALUE REAL, --
UNITS TEXT, -- Example Values: `cm`, `kg`, `kg/m2`, `mmHg`, `Cel` | Value Statics: Total count 78444 - Distinct count 17 - Null count 455
DESCRIPTION TEXT, --
CODE TEXT, --
PATIENT TEXT, --
foreign key (PATIENT) references patients(patient),
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE medications
(
foreign key (ENCOUNTER) references encounters(ID),
CODE INTEGER, --
PATIENT TEXT, --
STOP DATE, --
START DATE, --
REASONDESCRIPTION TEXT, --
DESCRIPTION TEXT, --
primary key (START, PATIENT, ENCOUNTER, CODE),
foreign key (PATIENT) references patients(patient),
REASONCODE INTEGER, --
ENCOUNTER TEXT, --
);
CREATE TABLE careplans
(
START DATE, --
STOP DATE, --
ID TEXT, --
REASONCODE INTEGER, --
REASONDESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
DESCRIPTION TEXT, --
CODE REAL, --
ENCOUNTER TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
);
CREATE TABLE encounters
(
DATE DATE, --
REASONCODE INTEGER, --
CODE INTEGER, --
ID TEXT primary key,
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
REASONDESCRIPTION TEXT, --
);
CREATE TABLE procedures
(
foreign key (PATIENT) references patients(patient),
REASONDESCRIPTION TEXT, --
PATIENT TEXT, --
foreign key (ENCOUNTER) references encounters(ID),
DATE DATE, --
DESCRIPTION TEXT, --
ENCOUNTER TEXT, --
CODE INTEGER, --
REASONCODE INTEGER, --
);
CREATE TABLE patients
(
suffix TEXT, -- Example Values: `PhD`, `JD`, `MD` | Value Statics: Total count 45 - Distinct count 3 - Null count 1417
prefix TEXT, -- Example Values: `Mr.`, `Mrs.`, `Ms.` | Value Statics: Total count 1166 - Distinct count 3 - Null count 296
deathdate DATE, --
ethnicity TEXT, --
race TEXT, -- Example Values: `black`, `white`, `hispanic`, `asian` | Value Statics: Total count 1462 - Distinct count 4 - Null count 0
address TEXT, --
birthplace TEXT, --
passport TEXT, --
maiden TEXT, --
birthdate DATE, --
marital TEXT, -- Example Values: `S`, `M` | Value Statics: Total count 1033 - Distinct count 2 - Null count 429
gender TEXT, -- Example Values: `F`, `M` | Value Statics: Total count 1462 - Distinct count 2 - Null count 0
drivers TEXT, --
first TEXT, --
last TEXT, --
patient TEXT primary key,
ssn TEXT, --
);
CREATE TABLE claims
(
ENCOUNTER TEXT references encounters, --
PATIENT TEXT references patients, --
ORGANIZATION TEXT, -- Example Values: `temp organization` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
TOTAL INTEGER, -- Example Values: `100` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0
BILLABLEPERIOD DATE, --
DIAGNOSIS TEXT, --
ID TEXT primary key,
);
CREATE TABLE conditions
(
START DATE, --
DESCRIPTION TEXT, --
foreign key (PATIENT) references patients(patient),
PATIENT TEXT, --
CODE INTEGER, --
ENCOUNTER TEXT, --
STOP DATE, --
foreign key (ENCOUNTER) references encounters(ID),
foreign key (DESCRIPTION) references all_prevalences(ITEM),
);
CREATE TABLE all_prevalences
(
"POPULATION TYPE" TEXT, -- Example Values: `LIVING` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
"POPULATION COUNT" INTEGER, -- Example Values: `1000` | Value Statics: Total count 244 - Distinct count 1 - Null count 0
ITEM TEXT primary key,
"PREVALENCE PERCENTAGE" REAL, --
"PREVALENCE RATE" REAL, --
OCCURRENCES INTEGER, --
); |
mondial_geo | What year saw the greatest number of organizations created on the European continent? | null | SELECT STRFTIME('%Y', T4.Established) FROM continent AS T1 INNER JOIN encompasses AS T2 ON T1.Name = T2.Continent INNER JOIN country AS T3 ON T2.Country = T3.Code INNER JOIN organization AS T4 ON T4.Country = T3.Code WHERE T1.Name = 'Europe' GROUP BY STRFTIME('%Y', T4.Established) ORDER BY COUNT(T4.Name) DESC LIMIT 1 | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200
);
CREATE TABLE river
(
River TEXT, --
Mountains TEXT, --
SourceAltitude REAL, --
Length REAL, --
EstuaryLatitude REAL, --
SourceLongitude REAL, --
Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, --
EstuaryLongitude REAL, --
Sea TEXT, --
Name TEXT default '' not null primary key,
SourceLatitude REAL, --
);
CREATE TABLE mountainOnIsland
(
Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, --
primary key (Mountain, Island),
Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, --
);
CREATE TABLE organization
(
City TEXT, --
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, --
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
Abbreviation TEXT not null primary key,
Province TEXT, --
Name TEXT not null constraint ix_organization_OrgNameUnique unique, --
Established DATE, --
);
CREATE TABLE geo_desert
(
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, --
Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, --
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Desert),
);
CREATE TABLE geo_source
(
River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (Province, Country, River),
);
CREATE TABLE geo_sea
(
Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, --
Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, --
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Sea),
Province TEXT default '' not null, --
);
CREATE TABLE geo_estuary
(
primary key (Province, Country, River),
River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, --
);
CREATE TABLE located
(
River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, --
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, --
Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, --
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
City TEXT, --
Province TEXT, --
);
CREATE TABLE lake
(
Depth REAL, --
Altitude REAL, --
Name TEXT default '' not null primary key,
Longitude REAL, --
Latitude REAL, --
Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74
River TEXT, --
Area REAL, --
);
CREATE TABLE desert
(
Longitude REAL, --
Area REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
);
CREATE TABLE geo_mountain
(
Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, --
primary key (Province, Country, Mountain),
Province TEXT default '' not null, --
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, --
);
CREATE TABLE ethnicGroup
(
primary key (Name, Country),
Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, --
Name TEXT default '' not null, --
Percentage REAL, --
);
CREATE TABLE economy
(
Industry REAL, --
GDP REAL, --
Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade,
Inflation REAL, --
Service REAL, --
Agriculture REAL, --
);
CREATE TABLE borders
(
primary key (Country1, Country2),
Country2 TEXT default '' not null constraint borders_ibfk_2 references country, --
Length REAL, --
Country1 TEXT default '' not null constraint borders_ibfk_1 references country, --
);
CREATE TABLE language
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE islandIn
(
Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, --
River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349
Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, --
Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344
);
CREATE TABLE country
(
Area REAL, --
Capital TEXT, --
Population INTEGER, --
Name TEXT not null constraint ix_county_Name unique, --
Province TEXT, --
Code TEXT default '' not null primary key,
);
CREATE TABLE city
(
Longitude REAL, --
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Population INTEGER, --
Province TEXT default '' not null, --
primary key (Name, Province),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, --
Latitude REAL, --
);
CREATE TABLE island
(
Name TEXT default '' not null primary key,
Islands TEXT, --
Area REAL, --
Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185
Longitude REAL, --
Height REAL, --
Latitude REAL, --
);
CREATE TABLE geo_lake
(
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, --
primary key (Province, Country, Lake),
Province TEXT default '' not null, --
);
CREATE TABLE mountain
(
Longitude REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
Type TEXT, --
Height REAL, --
Mountains TEXT, --
);
CREATE TABLE province
(
Capital TEXT, --
Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, --
primary key (Name, Country),
Population INTEGER, --
Area REAL, --
Name TEXT not null, --
CapProv TEXT, --
);
CREATE TABLE population
(
Infant_Mortality REAL, --
Population_Growth REAL, --
Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade,
);
CREATE TABLE isMember
(
primary key (Country, Organization),
Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, --
Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, --
Type TEXT default 'member', --
);
CREATE TABLE locatedOn
(
Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, --
Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (City, Province, Country, Island),
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
City TEXT default '' not null, --
);
CREATE TABLE mergesWith
(
Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, --
Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, --
primary key (Sea1, Sea2),
);
CREATE TABLE encompasses
(
Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0
Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0
primary key (Country, Continent),
);
CREATE TABLE continent
(
Name TEXT default '' not null primary key,
Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0
);
CREATE TABLE religion
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE geo_river
(
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, River),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, --
River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, --
);
CREATE TABLE sea
(
Depth REAL, --
Name TEXT default '' not null primary key,
);
CREATE TABLE target
(
Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade,
Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0
);
CREATE TABLE geo_island
(
Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, --
primary key (Province, Country, Island),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, --
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.