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 customers are there in Berlin, Germany? | "Berlin" is the City; 'Germany' is the Country | SELECT COUNT(City) FROM Customers WHERE Country = 'Germany' AND City = 'Berlin' | 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 | When the allergy starts for Angelo Buckridge. | null | SELECT T2.START FROM patients AS T1 INNER JOIN allergies AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Adolfo' AND T1.last = 'Schmitt' AND T2.STOP IS NOT NULL | 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 form of governance does the least prosperous nation in the world have? | Nation and country are synonyms; Form of governance was mentioned in politics.Government; Least prosperous means lowest GDP | SELECT T3.Government FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country INNER JOIN politics AS T3 ON T3.Country = T2.Country WHERE T2.GDP IS NOT NULL ORDER BY T2.GDP ASC LIMIT 1 | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200
);
CREATE TABLE river
(
River TEXT, --
Mountains TEXT, --
SourceAltitude REAL, --
Length REAL, --
EstuaryLatitude REAL, --
SourceLongitude REAL, --
Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, --
EstuaryLongitude REAL, --
Sea TEXT, --
Name TEXT default '' not null primary key,
SourceLatitude REAL, --
);
CREATE TABLE mountainOnIsland
(
Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, --
primary key (Mountain, Island),
Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, --
);
CREATE TABLE organization
(
City TEXT, --
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, --
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
Abbreviation TEXT not null primary key,
Province TEXT, --
Name TEXT not null constraint ix_organization_OrgNameUnique unique, --
Established DATE, --
);
CREATE TABLE geo_desert
(
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, --
Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, --
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Desert),
);
CREATE TABLE geo_source
(
River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (Province, Country, River),
);
CREATE TABLE geo_sea
(
Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, --
Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, --
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Sea),
Province TEXT default '' not null, --
);
CREATE TABLE geo_estuary
(
primary key (Province, Country, River),
River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, --
);
CREATE TABLE located
(
River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, --
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, --
Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, --
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
City TEXT, --
Province TEXT, --
);
CREATE TABLE lake
(
Depth REAL, --
Altitude REAL, --
Name TEXT default '' not null primary key,
Longitude REAL, --
Latitude REAL, --
Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74
River TEXT, --
Area REAL, --
);
CREATE TABLE desert
(
Longitude REAL, --
Area REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
);
CREATE TABLE geo_mountain
(
Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, --
primary key (Province, Country, Mountain),
Province TEXT default '' not null, --
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, --
);
CREATE TABLE ethnicGroup
(
primary key (Name, Country),
Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, --
Name TEXT default '' not null, --
Percentage REAL, --
);
CREATE TABLE economy
(
Industry REAL, --
GDP REAL, --
Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade,
Inflation REAL, --
Service REAL, --
Agriculture REAL, --
);
CREATE TABLE borders
(
primary key (Country1, Country2),
Country2 TEXT default '' not null constraint borders_ibfk_2 references country, --
Length REAL, --
Country1 TEXT default '' not null constraint borders_ibfk_1 references country, --
);
CREATE TABLE language
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE islandIn
(
Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, --
River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349
Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, --
Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344
);
CREATE TABLE country
(
Area REAL, --
Capital TEXT, --
Population INTEGER, --
Name TEXT not null constraint ix_county_Name unique, --
Province TEXT, --
Code TEXT default '' not null primary key,
);
CREATE TABLE city
(
Longitude REAL, --
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Population INTEGER, --
Province TEXT default '' not null, --
primary key (Name, Province),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, --
Latitude REAL, --
);
CREATE TABLE island
(
Name TEXT default '' not null primary key,
Islands TEXT, --
Area REAL, --
Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185
Longitude REAL, --
Height REAL, --
Latitude REAL, --
);
CREATE TABLE geo_lake
(
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, --
primary key (Province, Country, Lake),
Province TEXT default '' not null, --
);
CREATE TABLE mountain
(
Longitude REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
Type TEXT, --
Height REAL, --
Mountains TEXT, --
);
CREATE TABLE province
(
Capital TEXT, --
Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, --
primary key (Name, Country),
Population INTEGER, --
Area REAL, --
Name TEXT not null, --
CapProv TEXT, --
);
CREATE TABLE population
(
Infant_Mortality REAL, --
Population_Growth REAL, --
Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade,
);
CREATE TABLE isMember
(
primary key (Country, Organization),
Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, --
Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, --
Type TEXT default 'member', --
);
CREATE TABLE locatedOn
(
Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, --
Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (City, Province, Country, Island),
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
City TEXT default '' not null, --
);
CREATE TABLE mergesWith
(
Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, --
Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, --
primary key (Sea1, Sea2),
);
CREATE TABLE encompasses
(
Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0
Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0
primary key (Country, Continent),
);
CREATE TABLE continent
(
Name TEXT default '' not null primary key,
Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0
);
CREATE TABLE religion
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE geo_river
(
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, River),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, --
River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, --
);
CREATE TABLE sea
(
Depth REAL, --
Name TEXT default '' not null primary key,
);
CREATE TABLE target
(
Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade,
Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0
);
CREATE TABLE geo_island
(
Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, --
primary key (Province, Country, Island),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, --
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
); |
retail_world | Who is the sales representative of the customer who has made the highest payment? Include the full name of employee and his/her supervisor. | highest payment refers to Max(Multiply(Quantity, UnitPrice, Subtract(1, Discount))); full name refers to FirstName, LastName; his/her supervisor refers to 'ReportsTo' | SELECT T4.LastName, T4.FirstName, T4.ReportsTo , T1.Quantity * T1.UnitPrice * (1 - T1.Discount) AS payment FROM `Order Details` AS T1 INNER JOIN Orders AS T2 ON T1.OrderID = T2.OrderID INNER JOIN Customers AS T3 ON T2.CustomerID = T3.CustomerID INNER JOIN Employees AS T4 ON T2.EmployeeID = T4.EmployeeID ORDER BY payment 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 | From which city and state does the customer that bought the product with the highest sales? | highest sales refers to max(Sales) | SELECT T5.City, T5.State FROM west_superstore AS T1 INNER JOIN east_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN central_superstore AS T3 ON T3.`Customer ID` = T2.`Customer ID` INNER JOIN south_superstore AS T4 ON T4.`Customer ID` = T3.`Customer ID` INNER JOIN people AS T5 ON T5.`Customer ID` = T4.`Customer ID` ORDER BY T2.Sales 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
); |
computer_student | In total, all the students in the 3rd year of their program are advised by how many professors? | 3rd year of their program refers to yearsInProgram = 'Year_3'; professors refers to p_id_dummy | SELECT COUNT(DISTINCT T1.p_id_dummy) FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.yearsInProgram = 'Year_3' | CREATE TABLE course
(
course_id INTEGER constraint course_pk primary key,
courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0
);
CREATE TABLE advisedBy
(
p_id INTEGER, --
constraint advisedBy_pk primary key (p_id, p_id_dummy),
p_id_dummy INTEGER, --
constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id),
constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id),
);
CREATE TABLE person
(
student INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 278 - Distinct count 2 - Null count 0
p_id INTEGER constraint person_pk primary key,
hasPosition TEXT, -- Example Values: `0`, `Faculty`, `Faculty_adj`, `Faculty_eme`, `Faculty_aff` | Value Statics: Total count 278 - Distinct count 5 - Null count 0
professor INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 278 - Distinct count 2 - Null count 0
yearsInProgram TEXT, -- Example Values: `0`, `Year_2`, `Year_5`, `Year_7`, `Year_10` | Value Statics: Total count 278 - Distinct count 12 - Null count 0
inPhase TEXT, -- Example Values: `0`, `Post_Quals`, `Post_Generals`, `Pre_Quals` | Value Statics: Total count 278 - Distinct count 4 - Null count 0
);
CREATE TABLE taughtBy
(
foreign key (p_id) references person(p_id),
p_id INTEGER, --
primary key (course_id, p_id),
foreign key (course_id) references course(course_id),
course_id INTEGER, --
); |
mondial_geo | Which Asian country gave its agricultural sector the largest share of its gross domestic product? | Gross domestic product = GDP; Largest share of GDP in agricultural sector was mentioned in economy.Agriculture | SELECT T2.Country 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 economy AS T4 ON T4.Country = T3.Code WHERE T1.Name = 'Asia' ORDER BY T4.Agriculture 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 is the contact name and phone number of the customer who has made the most total payment on the order to date? | most total payment = Max(Multiply(Quantity, UnitPrice, Subtract(1, Discount))) | SELECT T1.ContactName, T1.Phone FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN `Order Details` AS T3 ON T2.OrderID = T3.OrderID GROUP BY T2.OrderID, T1.ContactName, T1.Phone ORDER BY SUM(T3.UnitPrice * T3.Quantity * (1 - T3.Discount)) 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 | Count all of the living patients that had a stroke. | if deathdate is null, it means this patient is still alive or living; stroke refers to conditions where DESCRIPTION = 'Stroke'; | SELECT COUNT(DISTINCT T2.patient) FROM conditions AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T1.description = 'Stroke' AND T2.deathdate IS NULL | 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 | Which nation, with a population ranging from 60,000,000 to 99,000,000, has the greatest gross domestic product? | GDP refers to gross domestic product; Nation and country are synonyms | SELECT T1.Name, T2.GDP FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country WHERE T1.Population BETWEEN 60000000 AND 90000000 ORDER BY T2.GDP 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 | Which of the American customers have experienced a delay in the shipment and how long was the longest? | "American" refers to Country = 'USA'; longest delay in shipment refers to Max(Subtract(RequiredDate, ShippedDate)); customer refers to CustomerID | SELECT T1.CompanyName, TIMESTAMPDIFF(DAY, T2.ShippedDate, T2.RequiredDate) FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Country = 'USA' AND TIMESTAMPDIFF(DAY, T2.ShippedDate, T2.RequiredDate) < 0 | 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,
); |
mondial_geo | What is the maximal elevation of the summit of the shortest mountain that can be found in the island of Madagaskar? Indicate what type of mountain it is. | The elevation of the summit refers to height | SELECT T3.Height, T3.Type FROM island AS T1 INNER JOIN mountainOnIsland AS T2 ON T1.Name = T2.Island INNER JOIN mountain AS T3 ON T3.Name = T2.Mountain WHERE T1.Name = 'Madagaskar' ORDER BY T3.Height 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 territories are owned by Anne Dodsworth? | null | SELECT COUNT(T2.TerritoryID) FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T1.FirstName = 'Anne' AND T1.LastName = 'Dodsworth' | 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 | Among the customers from Chicago, Illinois, what is the highest quantity of products bought in a single order? | from Chicago refers to City = 'Chicago'; Illinois refers to State = 'Illinois'; highest quantity refers to max(Quantity) | SELECT T1.Quantity FROM west_superstore AS T1 INNER JOIN east_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN central_superstore AS T3 ON T3.`Customer ID` = T2.`Customer ID` INNER JOIN south_superstore AS T4 ON T4.`Customer ID` = T3.`Customer ID` INNER JOIN people AS T5 ON T5.`Customer ID` = T4.`Customer ID` WHERE T5.City = 'Chicago' AND T5.State = 'Illinois' ORDER BY T1.Quantity 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 | List down the first name of patients who received "Influenza seasonal injectable preservative free" immunization. | "Influenza seasonal injectable preservative free" immunization refers to immunizations where DESCRIPTION = 'Influenza seasonal injectable preservative free'; | SELECT DISTINCT T1.first, T1.last FROM patients AS T1 INNER JOIN immunizations AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Influenza seasonal injectable preservative free' | 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 | Which Zaire region is home to the country's deepest lake's Name it and list its depth. | null | SELECT T3.Name, T1.Name, T1.Depth FROM lake AS T1 INNER JOIN located AS T2 ON T1.Name = T2.Lake INNER JOIN province AS T3 ON T3.Name = T2.Province INNER JOIN country AS T4 ON T4.Code = T3.Country WHERE T4.Name = 'Zaire' | 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 stock value of every condiments? | "Condiments" is the CategoryName; Stock value = MULTIPLY( UnitPrice, UnitInStock) | SELECT T1.UnitPrice * T1.UnitsInStock FROM Products AS T1 INNER JOIN Categories AS T2 ON T1.CategoryID = T2.CategoryID | 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 | List the full name of players who are born outside USA. | full name refers to firstName, middleName, lastName; born outside USA refers to birthCountry ! = 'USA' | SELECT firstName, middleName, lastName FROM players WHERE birthCountry != 'USA' | 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 product was ordered in the Central region on April 26, 2018, and shipped by April 27, 2018? | on April 26, 2018 refers to "Order Date" = date('2018-04-26'); shipped by April 27, 2018 refers to "Ship Date" = date('2018-04-27'); | SELECT T2.`Product Name` FROM central_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T1.`Order Date` = '2018-04-26' AND T1.`Ship Date` = '2018-04-27' AND T2.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 | What is the medicine prescribed for the patient with social security number 999-94-3751? | medicine prescribed refers to DESCRIPTION from medications; social security number 999-94-3751 refers to ssn = '999-94-3751'; | SELECT T1.DESCRIPTION FROM medications AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T2.ssn = '999-94-3751' | 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 name of the country with the smallest population, and what is its gross domestic product? | GDP refers to gross domestic product | SELECT T1.Name, T2.GDP FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country ORDER BY T1.Population ASC 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 is the re-order level of products that have an order quantity of 1? | order quantity of 1 refers to Quantity = 1 | SELECT T1.ReorderLevel FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Quantity = 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 | List down the customers that purchased the product named Xerox 23 in the South region. | product named Xerox 23 refers to "Product Name" = 'Xerox 23'; customers refers to "Customer Name" | SELECT DISTINCT T2.`Customer Name` FROM south_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 T1.Region = 'South' AND T3.`Product Name` = 'Xerox 23' | 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
); |
mondial_geo | When did the country whose capital is Nouakchott attained it's independence? | null | SELECT T2.Independence FROM country AS T1 INNER JOIN politics AS T2 ON T1.Code = T2.Country WHERE T1.Capital = 'Nouakchott' | 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 | Tally the customer ID of orders that were shipped to Brazil by Margaret Peacock from 3/31/97 to 12/10/97. | "Brazil" is the ShipCountry; from 3/31/97 to 12/10/97 refers to 1997-03-31 < ShippedDate < 1997-10-12 | SELECT DISTINCT T2.CustomerID FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T1.LastName = 'Peacock' AND T1.FirstName = 'Margaret' AND T2.ShipCountry = 'Brazil' AND T2.ShippedDate BETWEEN '1997-03-31 00:00:00' AND '1997-12-10 23:59:59' | 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 state has the most players selected as all stars? | state refers to birthState; the most players refers to max(count(playerID)) | SELECT T1.birthState FROM players AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID GROUP BY T1.birthState 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
); |
mondial_geo | What river has the 17th-longest length overall? Specify it's length. | null | SELECT Name, Length FROM river ORDER BY Length DESC LIMIT 16, 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 | From 1/3/97 to 8/10/97, how many orders were shipped via Federal Shipping? | from 1/3/97 to 8/10/97 refers to 1997-03-01 < ShippedDate < 1997-10-08; 'Federal Shipping' is the CompanyName | SELECT COUNT(T1.OrderID) FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T2.CompanyName = 'Federal Shipping' AND T1.ShippedDate BETWEEN '1997-03-01 00:00:00' AND '1997-10-08 23:59:59' | 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 | Who is the customer from the East region that purchased the order with the highest profit? | highest profit refers to MAX(profit); Region = 'East' | SELECT T2.`Customer Name` FROM east_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T1.Region = 'East' ORDER BY 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
); |
synthea | What kind of allergy is most common among white people? | kind of allergy is most common refers to MAX(COUNT(DESCRIPTION)) from allergies; white refers to race = 'white'; | SELECT T2.DESCRIPTION FROM patients AS T1 INNER JOIN allergies AS T2 ON T1.patient = T2.PATIENT WHERE T1.race = 'white' 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, --
); |
mondial_geo | Which country has the widest range of religious practices? | null | SELECT T1.Name FROM country AS T1 INNER JOIN religion AS T2 ON T1.Code = T2.Country GROUP BY T1.Name ORDER BY COUNT(DISTINCT T2.Name) DESC LIMIT 1 | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200
);
CREATE TABLE river
(
River TEXT, --
Mountains TEXT, --
SourceAltitude REAL, --
Length REAL, --
EstuaryLatitude REAL, --
SourceLongitude REAL, --
Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, --
EstuaryLongitude REAL, --
Sea TEXT, --
Name TEXT default '' not null primary key,
SourceLatitude REAL, --
);
CREATE TABLE mountainOnIsland
(
Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, --
primary key (Mountain, Island),
Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, --
);
CREATE TABLE organization
(
City TEXT, --
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, --
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
Abbreviation TEXT not null primary key,
Province TEXT, --
Name TEXT not null constraint ix_organization_OrgNameUnique unique, --
Established DATE, --
);
CREATE TABLE geo_desert
(
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, --
Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, --
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Desert),
);
CREATE TABLE geo_source
(
River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (Province, Country, River),
);
CREATE TABLE geo_sea
(
Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, --
Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, --
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Sea),
Province TEXT default '' not null, --
);
CREATE TABLE geo_estuary
(
primary key (Province, Country, River),
River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, --
);
CREATE TABLE located
(
River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, --
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, --
Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, --
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
City TEXT, --
Province TEXT, --
);
CREATE TABLE lake
(
Depth REAL, --
Altitude REAL, --
Name TEXT default '' not null primary key,
Longitude REAL, --
Latitude REAL, --
Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74
River TEXT, --
Area REAL, --
);
CREATE TABLE desert
(
Longitude REAL, --
Area REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
);
CREATE TABLE geo_mountain
(
Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, --
primary key (Province, Country, Mountain),
Province TEXT default '' not null, --
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, --
);
CREATE TABLE ethnicGroup
(
primary key (Name, Country),
Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, --
Name TEXT default '' not null, --
Percentage REAL, --
);
CREATE TABLE economy
(
Industry REAL, --
GDP REAL, --
Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade,
Inflation REAL, --
Service REAL, --
Agriculture REAL, --
);
CREATE TABLE borders
(
primary key (Country1, Country2),
Country2 TEXT default '' not null constraint borders_ibfk_2 references country, --
Length REAL, --
Country1 TEXT default '' not null constraint borders_ibfk_1 references country, --
);
CREATE TABLE language
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE islandIn
(
Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, --
River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349
Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, --
Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344
);
CREATE TABLE country
(
Area REAL, --
Capital TEXT, --
Population INTEGER, --
Name TEXT not null constraint ix_county_Name unique, --
Province TEXT, --
Code TEXT default '' not null primary key,
);
CREATE TABLE city
(
Longitude REAL, --
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Population INTEGER, --
Province TEXT default '' not null, --
primary key (Name, Province),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, --
Latitude REAL, --
);
CREATE TABLE island
(
Name TEXT default '' not null primary key,
Islands TEXT, --
Area REAL, --
Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185
Longitude REAL, --
Height REAL, --
Latitude REAL, --
);
CREATE TABLE geo_lake
(
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, --
primary key (Province, Country, Lake),
Province TEXT default '' not null, --
);
CREATE TABLE mountain
(
Longitude REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
Type TEXT, --
Height REAL, --
Mountains TEXT, --
);
CREATE TABLE province
(
Capital TEXT, --
Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, --
primary key (Name, Country),
Population INTEGER, --
Area REAL, --
Name TEXT not null, --
CapProv TEXT, --
);
CREATE TABLE population
(
Infant_Mortality REAL, --
Population_Growth REAL, --
Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade,
);
CREATE TABLE isMember
(
primary key (Country, Organization),
Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, --
Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, --
Type TEXT default 'member', --
);
CREATE TABLE locatedOn
(
Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, --
Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (City, Province, Country, Island),
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
City TEXT default '' not null, --
);
CREATE TABLE mergesWith
(
Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, --
Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, --
primary key (Sea1, Sea2),
);
CREATE TABLE encompasses
(
Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0
Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0
primary key (Country, Continent),
);
CREATE TABLE continent
(
Name TEXT default '' not null primary key,
Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0
);
CREATE TABLE religion
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE geo_river
(
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, River),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, --
River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, --
);
CREATE TABLE sea
(
Depth REAL, --
Name TEXT default '' not null primary key,
);
CREATE TABLE target
(
Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade,
Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0
);
CREATE TABLE geo_island
(
Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, --
primary key (Province, Country, Island),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, --
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
); |
retail_world | How many employees have territories in the Eastern region? | "Eastern" is the RegionDescription | SELECT COUNT(DISTINCT T1.FirstName) FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID INNER JOIN Territories AS T3 ON T2.TerritoryID = T3.TerritoryID INNER JOIN Region AS T4 ON T3.RegionID = T4.RegionID WHERE T4.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,
); |
superstore | Who is the customer from the West region that received the highest discount? | received the highest discount refers to MAX(discount); customer refers to "Customer Name" | SELECT T2.`Customer Name` FROM west_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T1.Region = 'West' ORDER BY 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
); |
mondial_geo | Which country has the 5th highest infant mortality rate? | null | SELECT T2.Name FROM population AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code ORDER BY T1.Infant_Mortality DESC LIMIT 4, 1 | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200
);
CREATE TABLE river
(
River TEXT, --
Mountains TEXT, --
SourceAltitude REAL, --
Length REAL, --
EstuaryLatitude REAL, --
SourceLongitude REAL, --
Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, --
EstuaryLongitude REAL, --
Sea TEXT, --
Name TEXT default '' not null primary key,
SourceLatitude REAL, --
);
CREATE TABLE mountainOnIsland
(
Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, --
primary key (Mountain, Island),
Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, --
);
CREATE TABLE organization
(
City TEXT, --
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, --
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
Abbreviation TEXT not null primary key,
Province TEXT, --
Name TEXT not null constraint ix_organization_OrgNameUnique unique, --
Established DATE, --
);
CREATE TABLE geo_desert
(
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, --
Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, --
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Desert),
);
CREATE TABLE geo_source
(
River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (Province, Country, River),
);
CREATE TABLE geo_sea
(
Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, --
Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, --
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Sea),
Province TEXT default '' not null, --
);
CREATE TABLE geo_estuary
(
primary key (Province, Country, River),
River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, --
);
CREATE TABLE located
(
River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, --
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, --
Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, --
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
City TEXT, --
Province TEXT, --
);
CREATE TABLE lake
(
Depth REAL, --
Altitude REAL, --
Name TEXT default '' not null primary key,
Longitude REAL, --
Latitude REAL, --
Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74
River TEXT, --
Area REAL, --
);
CREATE TABLE desert
(
Longitude REAL, --
Area REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
);
CREATE TABLE geo_mountain
(
Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, --
primary key (Province, Country, Mountain),
Province TEXT default '' not null, --
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, --
);
CREATE TABLE ethnicGroup
(
primary key (Name, Country),
Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, --
Name TEXT default '' not null, --
Percentage REAL, --
);
CREATE TABLE economy
(
Industry REAL, --
GDP REAL, --
Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade,
Inflation REAL, --
Service REAL, --
Agriculture REAL, --
);
CREATE TABLE borders
(
primary key (Country1, Country2),
Country2 TEXT default '' not null constraint borders_ibfk_2 references country, --
Length REAL, --
Country1 TEXT default '' not null constraint borders_ibfk_1 references country, --
);
CREATE TABLE language
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE islandIn
(
Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, --
River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349
Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, --
Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344
);
CREATE TABLE country
(
Area REAL, --
Capital TEXT, --
Population INTEGER, --
Name TEXT not null constraint ix_county_Name unique, --
Province TEXT, --
Code TEXT default '' not null primary key,
);
CREATE TABLE city
(
Longitude REAL, --
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Population INTEGER, --
Province TEXT default '' not null, --
primary key (Name, Province),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, --
Latitude REAL, --
);
CREATE TABLE island
(
Name TEXT default '' not null primary key,
Islands TEXT, --
Area REAL, --
Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185
Longitude REAL, --
Height REAL, --
Latitude REAL, --
);
CREATE TABLE geo_lake
(
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, --
primary key (Province, Country, Lake),
Province TEXT default '' not null, --
);
CREATE TABLE mountain
(
Longitude REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
Type TEXT, --
Height REAL, --
Mountains TEXT, --
);
CREATE TABLE province
(
Capital TEXT, --
Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, --
primary key (Name, Country),
Population INTEGER, --
Area REAL, --
Name TEXT not null, --
CapProv TEXT, --
);
CREATE TABLE population
(
Infant_Mortality REAL, --
Population_Growth REAL, --
Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade,
);
CREATE TABLE isMember
(
primary key (Country, Organization),
Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, --
Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, --
Type TEXT default 'member', --
);
CREATE TABLE locatedOn
(
Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, --
Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (City, Province, Country, Island),
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
City TEXT default '' not null, --
);
CREATE TABLE mergesWith
(
Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, --
Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, --
primary key (Sea1, Sea2),
);
CREATE TABLE encompasses
(
Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0
Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0
primary key (Country, Continent),
);
CREATE TABLE continent
(
Name TEXT default '' not null primary key,
Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0
);
CREATE TABLE religion
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE geo_river
(
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, River),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, --
River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, --
);
CREATE TABLE sea
(
Depth REAL, --
Name TEXT default '' not null primary key,
);
CREATE TABLE target
(
Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade,
Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0
);
CREATE TABLE geo_island
(
Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, --
primary key (Province, Country, Island),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, --
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
); |
retail_world | Among the employees, give me the full names of those who have less than 4 territories. | less than 4 territories refers to EmployeeID where Count(TerritoryID) < 4 | SELECT T1.FirstName, T1.LastName FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T2.EmployeeID < 4 | CREATE TABLE Products
(
CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0
Unit TEXT, --
ReorderLevel INT, --
ProductName TEXT, --
Price REAL DEFAULT 0, --
FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),
SupplierID INTEGER, --
ProductID INTEGER PRIMARY KEY AUTOINCREMENT,
FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID),
);
CREATE TABLE Customers
(
ContactName TEXT, --
Country TEXT, --
Address TEXT, --
City TEXT, --
CustomerID INTEGER PRIMARY KEY AUTOINCREMENT,
PostalCode TEXT, --
CustomerName TEXT, --
);
CREATE TABLE EmployeeTerritories
(
TerritoryID INT, --
EmployeeID INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE OrderDetails
(
Quantity INTEGER, --
FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),
OrderID INTEGER, --
FOREIGN KEY (ProductID) REFERENCES Products (ProductID),
OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT,
ProductID INTEGER, --
);
CREATE TABLE Shippers
(
ShipperID INTEGER PRIMARY KEY AUTOINCREMENT,
ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
);
CREATE TABLE Territory
(
TerritoryDescription TEXT, --
RegionID INTEGER, --
TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT,
);
CREATE TABLE EmployeeDetails
(
EmployeeID INT PRIMARY KEY,
Title TEXT, --
Salary INT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
);
CREATE TABLE Categories
(
CategoryID INTEGER PRIMARY KEY AUTOINCREMENT,
CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0
);
CREATE TABLE Employees
(
Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT,
FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
);
CREATE TABLE Suppliers
(
PostalCode TEXT, --
Address TEXT, --
SupplierID INTEGER PRIMARY KEY AUTOINCREMENT,
City TEXT, --
Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0
Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0
ContactName TEXT, --
Phone TEXT, --
SupplierName TEXT, --
);
CREATE TABLE EmployeesExtra
(
Salary INTEGER, --
Title TEXT, --
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID),
EmployeeID INTEGER PRIMARY KEY,
);
CREATE TABLE discontinued_products
(
Discontinued INTEGER, --
ProductID INTEGER PRIMARY KEY,
);
CREATE TABLE Orders
(
OrderID INTEGER PRIMARY KEY AUTOINCREMENT,
CustomerID INTEGER, --
FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),
FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID),
FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),
ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0
OrderDate DATETIME, --
EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0
);
CREATE TABLE Territories
(
TerritoryDescription TEXT, --
RegionDescription TEXT, --
);
CREATE TABLE ShippingInfo
(
ShipCountry TEXT, --
ShippedDate DATETIME, --
FOREIGN KEY (OrderID) REFERENCES Orders(OrderID),
OrderID INTEGER PRIMARY KEY,
); |
professional_basketball | Name the team in which the coach won the title 'NBA Coach of the Year' in 2010. | team name refers to teams.name; won the title 'NBA Coach of the Year' refers to award = 'NBA Coach of the Year'; in 2010 refers to year = 2010 | SELECT DISTINCT T1.tmID FROM coaches AS T1 INNER JOIN awards_coaches AS T2 ON T1.coachID = T2.coachID WHERE T2.year = 2010 AND T2.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
); |
superstore | What are the order date and product name of the order ID CA-2011-137274 from the Central region? | null | SELECT T1.`Order Date`, T2.`Product Name` FROM central_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T1.`Order ID` = 'CA-2011-137274' AND T2.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
); |
mondial_geo | What is the name of the most recently founded organization in Saudi Arabia? | Saudi Arabia is a country | SELECT T1.Name FROM organization AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code WHERE T2.Name = 'Saudi Arabia' ORDER BY T1.Established DESC LIMIT 1 | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200
);
CREATE TABLE river
(
River TEXT, --
Mountains TEXT, --
SourceAltitude REAL, --
Length REAL, --
EstuaryLatitude REAL, --
SourceLongitude REAL, --
Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, --
EstuaryLongitude REAL, --
Sea TEXT, --
Name TEXT default '' not null primary key,
SourceLatitude REAL, --
);
CREATE TABLE mountainOnIsland
(
Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, --
primary key (Mountain, Island),
Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, --
);
CREATE TABLE organization
(
City TEXT, --
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, --
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
Abbreviation TEXT not null primary key,
Province TEXT, --
Name TEXT not null constraint ix_organization_OrgNameUnique unique, --
Established DATE, --
);
CREATE TABLE geo_desert
(
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, --
Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, --
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Desert),
);
CREATE TABLE geo_source
(
River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (Province, Country, River),
);
CREATE TABLE geo_sea
(
Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, --
Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, --
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Sea),
Province TEXT default '' not null, --
);
CREATE TABLE geo_estuary
(
primary key (Province, Country, River),
River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, --
);
CREATE TABLE located
(
River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, --
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, --
Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, --
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
City TEXT, --
Province TEXT, --
);
CREATE TABLE lake
(
Depth REAL, --
Altitude REAL, --
Name TEXT default '' not null primary key,
Longitude REAL, --
Latitude REAL, --
Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74
River TEXT, --
Area REAL, --
);
CREATE TABLE desert
(
Longitude REAL, --
Area REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
);
CREATE TABLE geo_mountain
(
Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, --
primary key (Province, Country, Mountain),
Province TEXT default '' not null, --
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, --
);
CREATE TABLE ethnicGroup
(
primary key (Name, Country),
Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, --
Name TEXT default '' not null, --
Percentage REAL, --
);
CREATE TABLE economy
(
Industry REAL, --
GDP REAL, --
Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade,
Inflation REAL, --
Service REAL, --
Agriculture REAL, --
);
CREATE TABLE borders
(
primary key (Country1, Country2),
Country2 TEXT default '' not null constraint borders_ibfk_2 references country, --
Length REAL, --
Country1 TEXT default '' not null constraint borders_ibfk_1 references country, --
);
CREATE TABLE language
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE islandIn
(
Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, --
River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349
Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, --
Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344
);
CREATE TABLE country
(
Area REAL, --
Capital TEXT, --
Population INTEGER, --
Name TEXT not null constraint ix_county_Name unique, --
Province TEXT, --
Code TEXT default '' not null primary key,
);
CREATE TABLE city
(
Longitude REAL, --
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Population INTEGER, --
Province TEXT default '' not null, --
primary key (Name, Province),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, --
Latitude REAL, --
);
CREATE TABLE island
(
Name TEXT default '' not null primary key,
Islands TEXT, --
Area REAL, --
Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185
Longitude REAL, --
Height REAL, --
Latitude REAL, --
);
CREATE TABLE geo_lake
(
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, --
primary key (Province, Country, Lake),
Province TEXT default '' not null, --
);
CREATE TABLE mountain
(
Longitude REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
Type TEXT, --
Height REAL, --
Mountains TEXT, --
);
CREATE TABLE province
(
Capital TEXT, --
Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, --
primary key (Name, Country),
Population INTEGER, --
Area REAL, --
Name TEXT not null, --
CapProv TEXT, --
);
CREATE TABLE population
(
Infant_Mortality REAL, --
Population_Growth REAL, --
Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade,
);
CREATE TABLE isMember
(
primary key (Country, Organization),
Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, --
Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, --
Type TEXT default 'member', --
);
CREATE TABLE locatedOn
(
Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, --
Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (City, Province, Country, Island),
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
City TEXT default '' not null, --
);
CREATE TABLE mergesWith
(
Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, --
Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, --
primary key (Sea1, Sea2),
);
CREATE TABLE encompasses
(
Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0
Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0
primary key (Country, Continent),
);
CREATE TABLE continent
(
Name TEXT default '' not null primary key,
Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0
);
CREATE TABLE religion
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE geo_river
(
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, River),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, --
River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, --
);
CREATE TABLE sea
(
Depth REAL, --
Name TEXT default '' not null primary key,
);
CREATE TABLE target
(
Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade,
Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0
);
CREATE TABLE geo_island
(
Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, --
primary key (Province, Country, Island),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, --
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
); |
retail_world | Who are the suppliers of the discontinued products? | discontinued product refers to Discontinued = 1; supplier refers to CompanyName | SELECT DISTINCT T2.CompanyName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID 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,
); |
professional_basketball | In 1950, how many players whose teams have the losing rate less than 20%? | in 1950 refers to year = 1950; losing rate less than 20% refers to divide(lost, add(won, lost)) < 0.2 | 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 CAST(T3.lost AS REAL) * 100 / (T3.lost + T3.won) < 20 | 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 the customers from the Eastern region whose orders cost above 80000. | cost above 80000 refers to SUTRACT(MULTIPLY(DIVIDE(Sales, SUTRACT(1, discount)), Quantity), Profit) > 80000 | SELECT DISTINCT T2.`Customer Name` FROM east_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T1.Region = 'East' AND T1.Sales / (1 - T1.Discount) * T1.Quantity - T1.Profit > 80000 | 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 with prediabetes, how many are female? | patients with prediabetes refer to PATIENT from conditions where DESCRIPTION = 'Prediabetes'; female refers to gender = 'F'; | SELECT COUNT(DISTINCT T2.patient) FROM conditions AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T2.gender = 'F' AND T1.DESCRIPTION = 'Prediabetes' | 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 peak height of the highest volcanic type of mountain? Give it's name. | peak means the highest | SELECT Height, Name FROM mountain WHERE Type = 'volcanic' ORDER BY Height 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 | List the products whose supplier is Pavlova, Ltd. Please include the product ID and re-order level. | "Pavlova, Ltd" is the CompanyName; products refers to ProductName | SELECT T1.ProductName, T1.ProductID, T1.ReorderLevel FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Pavlova, Ltd.' | 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 | Among the products under the office supplies category, what is the product that made the highest sales in the Central region? | made the highest sales refers to MAX(Sales) | SELECT T2.`Product Name` FROM central_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T2.Category = 'Office Supplies' AND T2.Region = 'Central' ORDER BY T1.Sales 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
); |
mondial_geo | When did the United States of America attained it's Independence? | null | SELECT T1.Independence FROM politics AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code WHERE T2.Name = 'United States' | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200
);
CREATE TABLE river
(
River TEXT, --
Mountains TEXT, --
SourceAltitude REAL, --
Length REAL, --
EstuaryLatitude REAL, --
SourceLongitude REAL, --
Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, --
EstuaryLongitude REAL, --
Sea TEXT, --
Name TEXT default '' not null primary key,
SourceLatitude REAL, --
);
CREATE TABLE mountainOnIsland
(
Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, --
primary key (Mountain, Island),
Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, --
);
CREATE TABLE organization
(
City TEXT, --
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, --
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
Abbreviation TEXT not null primary key,
Province TEXT, --
Name TEXT not null constraint ix_organization_OrgNameUnique unique, --
Established DATE, --
);
CREATE TABLE geo_desert
(
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, --
Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, --
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Desert),
);
CREATE TABLE geo_source
(
River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (Province, Country, River),
);
CREATE TABLE geo_sea
(
Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, --
Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, --
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Sea),
Province TEXT default '' not null, --
);
CREATE TABLE geo_estuary
(
primary key (Province, Country, River),
River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, --
);
CREATE TABLE located
(
River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, --
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, --
Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, --
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
City TEXT, --
Province TEXT, --
);
CREATE TABLE lake
(
Depth REAL, --
Altitude REAL, --
Name TEXT default '' not null primary key,
Longitude REAL, --
Latitude REAL, --
Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74
River TEXT, --
Area REAL, --
);
CREATE TABLE desert
(
Longitude REAL, --
Area REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
);
CREATE TABLE geo_mountain
(
Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, --
primary key (Province, Country, Mountain),
Province TEXT default '' not null, --
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, --
);
CREATE TABLE ethnicGroup
(
primary key (Name, Country),
Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, --
Name TEXT default '' not null, --
Percentage REAL, --
);
CREATE TABLE economy
(
Industry REAL, --
GDP REAL, --
Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade,
Inflation REAL, --
Service REAL, --
Agriculture REAL, --
);
CREATE TABLE borders
(
primary key (Country1, Country2),
Country2 TEXT default '' not null constraint borders_ibfk_2 references country, --
Length REAL, --
Country1 TEXT default '' not null constraint borders_ibfk_1 references country, --
);
CREATE TABLE language
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE islandIn
(
Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, --
River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349
Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, --
Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344
);
CREATE TABLE country
(
Area REAL, --
Capital TEXT, --
Population INTEGER, --
Name TEXT not null constraint ix_county_Name unique, --
Province TEXT, --
Code TEXT default '' not null primary key,
);
CREATE TABLE city
(
Longitude REAL, --
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Population INTEGER, --
Province TEXT default '' not null, --
primary key (Name, Province),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, --
Latitude REAL, --
);
CREATE TABLE island
(
Name TEXT default '' not null primary key,
Islands TEXT, --
Area REAL, --
Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185
Longitude REAL, --
Height REAL, --
Latitude REAL, --
);
CREATE TABLE geo_lake
(
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, --
primary key (Province, Country, Lake),
Province TEXT default '' not null, --
);
CREATE TABLE mountain
(
Longitude REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
Type TEXT, --
Height REAL, --
Mountains TEXT, --
);
CREATE TABLE province
(
Capital TEXT, --
Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, --
primary key (Name, Country),
Population INTEGER, --
Area REAL, --
Name TEXT not null, --
CapProv TEXT, --
);
CREATE TABLE population
(
Infant_Mortality REAL, --
Population_Growth REAL, --
Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade,
);
CREATE TABLE isMember
(
primary key (Country, Organization),
Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, --
Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, --
Type TEXT default 'member', --
);
CREATE TABLE locatedOn
(
Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, --
Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (City, Province, Country, Island),
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
City TEXT default '' not null, --
);
CREATE TABLE mergesWith
(
Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, --
Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, --
primary key (Sea1, Sea2),
);
CREATE TABLE encompasses
(
Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0
Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0
primary key (Country, Continent),
);
CREATE TABLE continent
(
Name TEXT default '' not null primary key,
Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0
);
CREATE TABLE religion
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE geo_river
(
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, River),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, --
River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, --
);
CREATE TABLE sea
(
Depth REAL, --
Name TEXT default '' not null primary key,
);
CREATE TABLE target
(
Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade,
Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0
);
CREATE TABLE geo_island
(
Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, --
primary key (Province, Country, Island),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, --
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
); |
retail_world | Among the seafoods, how many of them have an order quantity of more than 50? | "Seafood" is the CategoryName; order quantity of more than 50 refers to Quantity > 50 | SELECT COUNT(T1.ProductID) FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID INNER JOIN Categories AS T3 ON T1.CategoryID = T3.CategoryID WHERE T3.CategoryName = 'Seafood' AND T2.Quantity > 50 | 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 the most 'won' than 'lost' in year '1988'? | in year '1988' refers to year = 1988; the most 'won' than 'lost' refers to max(subtract(won, lost)) | SELECT coachID FROM coaches WHERE year = 1988 ORDER BY won - 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
); |
superstore | Who ordered the Bush Mission Pointe Library in the Central Region? | Bush Mission Pointe Library' is the "Product Name"; | SELECT DISTINCT T2.`Customer Name` FROM central_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` = 'Bush Mission Pointe Library' 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 | List down the encounter descriptions of patients who were born in Pittsfield MA US. | born in Pittsfield MA US refers to birthplace = 'Pittsfield MA US'; | SELECT DISTINCT T2.DESCRIPTION FROM patients AS T1 INNER JOIN encounters AS T2 ON T1.patient = T2.PATIENT WHERE T1.birthplace = 'Pittsfield MA US' | 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 | In which city has the greatest population, what is its percentage to its country population? | null | SELECT T3.Name, CAST(T3.Population AS REAL) * 100 / T1.Population FROM country AS T1 INNER JOIN province AS T2 ON T1.Code = T2.Country INNER JOIN city AS T3 ON T3.Country = T2.Country ORDER BY T3.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 | Compute the total order quantity for Uncle Bob's Organic Dried Pears so far. | "Uncle Bob's Organic Dried Pears" is the ProductName; total order quantity refers to Sum(Quantity) | SELECT SUM(T2.Quantity) FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductName LIKE 'Uncle Bob%s Organic Dried Pears' | 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 1962 to 1975, how many coaches received the award? | from 1960 to 1975 refers to year between 1960 and 1975 | SELECT COUNT(DISTINCT coachID) FROM awards_coaches WHERE year BETWEEN 1962 AND 1975 | 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 | Among the patients who were immunized with meningococcal MCV4P, how many have viral sinusitis disorder after getting the immunization? | immunized with meningococcal MCV4P refers to DESCRIPTION = 'meningococcal MCV4P' from immunizations; viral sinusitis disorder refers to DESCRIPTION = 'Viral sinusitis (disorder)' from conditions; | SELECT COUNT(DISTINCT T1.patient) FROM immunizations AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE T1.DESCRIPTION = 'meningococcal MCV4P' AND T2.DESCRIPTION = 'Viral sinusitis (disorder)' | 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, --
); |
computer_student | What is the average number of courses taught by a professor? | professor refers to professor = 1; average number of courses = divide(count(taughtBy.course_id), count(taughtBy.p_id) where professor = 1 ) | SELECT CAST(COUNT(T1.course_id) AS REAL) / COUNT(DISTINCT T2.p_id) AS num FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.professor = 1 | CREATE TABLE course
(
course_id INTEGER constraint course_pk primary key,
courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0
);
CREATE TABLE advisedBy
(
p_id INTEGER, --
constraint advisedBy_pk primary key (p_id, p_id_dummy),
p_id_dummy INTEGER, --
constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id),
constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id),
);
CREATE TABLE person
(
student INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 278 - Distinct count 2 - Null count 0
p_id INTEGER constraint person_pk primary key,
hasPosition TEXT, -- Example Values: `0`, `Faculty`, `Faculty_adj`, `Faculty_eme`, `Faculty_aff` | Value Statics: Total count 278 - Distinct count 5 - Null count 0
professor INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 278 - Distinct count 2 - Null count 0
yearsInProgram TEXT, -- Example Values: `0`, `Year_2`, `Year_5`, `Year_7`, `Year_10` | Value Statics: Total count 278 - Distinct count 12 - Null count 0
inPhase TEXT, -- Example Values: `0`, `Post_Quals`, `Post_Generals`, `Pre_Quals` | Value Statics: Total count 278 - Distinct count 4 - Null count 0
);
CREATE TABLE taughtBy
(
foreign key (p_id) references person(p_id),
p_id INTEGER, --
primary key (course_id, p_id),
foreign key (course_id) references course(course_id),
course_id INTEGER, --
); |
mondial_geo | Provide a full list of countries and its population with more than 70% of Chinese. | null | SELECT T1.Name, T1.Population * T2.Percentage FROM country AS T1 INNER JOIN ethnicGroup AS T2 ON T1.Code = T2.Country WHERE T2.Name = 'Chinese' AND T2.Percentage > 70 | 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 sales for each categories? | average sales = AVG(ProductSales) | SELECT AVG(ProductSales) FROM `Sales by Category` GROUP BY CategoryName | 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 | Provide the names of the products with a profit greater than 98% of the average profit of all products in the East region. | names of the products refers to "Product Name"; profit greater than 98% of the average profit refers to Profit > MULTIPLY(AVG(Profit), 0.98) | SELECT DISTINCT T2.`Product Name` FROM east_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T2.Region = 'East' AND T1.Profit > ( SELECT AVG(Profit) * 0.98 FROM east_superstore ) | 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
); |
mondial_geo | List the full name its capital of all the countries with parliamentary democracy government. | Parliamentary democracy is a government form | SELECT T1.Capital FROM country AS T1 INNER JOIN politics AS T2 ON T1.Code = T2.Country WHERE T2.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 | Write down the top ten companies with the most total sales by amount. | most total sales refers to Max(SaleAmount); companies refers to CompanyName | SELECT CompanyName FROM `Sales Totals by Amount` ORDER BY SaleAmount DESC LIMIT 10 | 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 | Calculate the number of female patients who accepted "HPV quadrivalent" immunization. | female refers to gender = 'F'; "HPV quadrivalent" immunization refers to immunizations where DESCRIPTION = 'HPV quadrivalent'; | SELECT COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN immunizations AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'HPV quadrivalent' AND T1.gender = 'F' | 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 | Find the government type for the country with the highest percentage GDP in Agriculture. | null | SELECT T3.Government FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country INNER JOIN politics AS T3 ON T3.Country = T2.Country ORDER BY T2.Agriculture 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 is the full name of the Vice President of Sales. Give me the URL of his/her photo. | "Vice Present of Sales" refers to Title = 'Vice President, Sales'; full name refers to FirstName, LastName; url of photo refers to PhotoPath | SELECT FirstName, LastName FROM Employees WHERE Title = 'Vice President, Sales' | 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 | List the first name, last name and team name of players who are drafted from 'Seattle' between year 1965 to 1970. | team name refers to teams.name; drafted from 'Seattle' refers to draftFrom = 'Seattle'; between year 1965 to 1970 refers to draftYear between 1965 and 1970 | SELECT DISTINCT T1.firstName, T1.lastName, T3.name FROM players AS T1 INNER JOIN draft AS T2 ON T1.playerID = T2.playerID INNER JOIN teams AS T3 ON T2.tmID = T3.tmID WHERE T2.draftFrom = 'Seattle' AND T2.draftYear BETWEEN 1965 AND 1970 | 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 orders were made by Maxwell Schwartz in 2015? | Maxwell Schwartz' is the "Customer Name"; in 2015 refers to strftime('%Y', "Order Date") = '2015'; | SELECT COUNT(DISTINCT T1.`Order ID`) FROM east_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T2.`Customer Name` = 'Maxwell Schwartz' AND STRFTIME('%Y', T1.`Order Date`) = '2015' | 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 | Calculate the average age of patients with prediabetes care plan. | SUBTRACT(SUM(deathdate), SUM(birthdate)), COUNT(patient) where REASONDESCRIPTION = 'Prediabetes' from careplans; | SELECT CAST(SUM(CASE WHEN T1.deathdate IS NULL THEN strftime('%Y', T2.STOP) - strftime('%Y', T1.birthdate) ELSE strftime('%Y', T1.deathdate) - strftime('%Y', T1.birthdate) END) AS REAL) / COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN careplans AS T2 ON T1.patient = T2.PATIENT WHERE T2.REASONDESCRIPTION = 'Prediabetes' | 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, --
); |
computer_student | Calculate the percentage of high-level undergraduate course. | high-level undergraduate course refers to courseLevel = 'Level_400'; percentage = divide(count(course.course_id) when courseLevel = 'Level_400', count(course.course_id)) * 100% | SELECT CAST(SUM(CASE WHEN courseLevel = 'Level_400' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) AS per FROM course | CREATE TABLE course
(
course_id INTEGER constraint course_pk primary key,
courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0
);
CREATE TABLE advisedBy
(
p_id INTEGER, --
constraint advisedBy_pk primary key (p_id, p_id_dummy),
p_id_dummy INTEGER, --
constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id),
constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id),
);
CREATE TABLE person
(
student INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 278 - Distinct count 2 - Null count 0
p_id INTEGER constraint person_pk primary key,
hasPosition TEXT, -- Example Values: `0`, `Faculty`, `Faculty_adj`, `Faculty_eme`, `Faculty_aff` | Value Statics: Total count 278 - Distinct count 5 - Null count 0
professor INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 278 - Distinct count 2 - Null count 0
yearsInProgram TEXT, -- Example Values: `0`, `Year_2`, `Year_5`, `Year_7`, `Year_10` | Value Statics: Total count 278 - Distinct count 12 - Null count 0
inPhase TEXT, -- Example Values: `0`, `Post_Quals`, `Post_Generals`, `Pre_Quals` | Value Statics: Total count 278 - Distinct count 4 - Null count 0
);
CREATE TABLE taughtBy
(
foreign key (p_id) references person(p_id),
p_id INTEGER, --
primary key (course_id, p_id),
foreign key (course_id) references course(course_id),
course_id INTEGER, --
); |
mondial_geo | State the inflation rate of Greece. | null | SELECT T2.Inflation FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country WHERE T1.Name = 'Greece' | 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 | Give me the address, home phone and salary of the Sales Manager. | "Sales Manage" is the Title | SELECT Address, HomePhone, Salary 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,
); |
mondial_geo | What is the population of the country with the highest infant mortality rate? | null | SELECT T1.Population FROM country AS T1 INNER JOIN population AS T2 ON T1.Code = T2.Country ORDER BY T2.Infant_Mortality DESC LIMIT 1 | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200
);
CREATE TABLE river
(
River TEXT, --
Mountains TEXT, --
SourceAltitude REAL, --
Length REAL, --
EstuaryLatitude REAL, --
SourceLongitude REAL, --
Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, --
EstuaryLongitude REAL, --
Sea TEXT, --
Name TEXT default '' not null primary key,
SourceLatitude REAL, --
);
CREATE TABLE mountainOnIsland
(
Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, --
primary key (Mountain, Island),
Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, --
);
CREATE TABLE organization
(
City TEXT, --
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, --
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
Abbreviation TEXT not null primary key,
Province TEXT, --
Name TEXT not null constraint ix_organization_OrgNameUnique unique, --
Established DATE, --
);
CREATE TABLE geo_desert
(
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, --
Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, --
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Desert),
);
CREATE TABLE geo_source
(
River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (Province, Country, River),
);
CREATE TABLE geo_sea
(
Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, --
Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, --
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Sea),
Province TEXT default '' not null, --
);
CREATE TABLE geo_estuary
(
primary key (Province, Country, River),
River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, --
);
CREATE TABLE located
(
River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, --
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, --
Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, --
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
City TEXT, --
Province TEXT, --
);
CREATE TABLE lake
(
Depth REAL, --
Altitude REAL, --
Name TEXT default '' not null primary key,
Longitude REAL, --
Latitude REAL, --
Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74
River TEXT, --
Area REAL, --
);
CREATE TABLE desert
(
Longitude REAL, --
Area REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
);
CREATE TABLE geo_mountain
(
Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, --
primary key (Province, Country, Mountain),
Province TEXT default '' not null, --
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, --
);
CREATE TABLE ethnicGroup
(
primary key (Name, Country),
Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, --
Name TEXT default '' not null, --
Percentage REAL, --
);
CREATE TABLE economy
(
Industry REAL, --
GDP REAL, --
Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade,
Inflation REAL, --
Service REAL, --
Agriculture REAL, --
);
CREATE TABLE borders
(
primary key (Country1, Country2),
Country2 TEXT default '' not null constraint borders_ibfk_2 references country, --
Length REAL, --
Country1 TEXT default '' not null constraint borders_ibfk_1 references country, --
);
CREATE TABLE language
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE islandIn
(
Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, --
River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349
Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, --
Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344
);
CREATE TABLE country
(
Area REAL, --
Capital TEXT, --
Population INTEGER, --
Name TEXT not null constraint ix_county_Name unique, --
Province TEXT, --
Code TEXT default '' not null primary key,
);
CREATE TABLE city
(
Longitude REAL, --
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Population INTEGER, --
Province TEXT default '' not null, --
primary key (Name, Province),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, --
Latitude REAL, --
);
CREATE TABLE island
(
Name TEXT default '' not null primary key,
Islands TEXT, --
Area REAL, --
Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185
Longitude REAL, --
Height REAL, --
Latitude REAL, --
);
CREATE TABLE geo_lake
(
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, --
primary key (Province, Country, Lake),
Province TEXT default '' not null, --
);
CREATE TABLE mountain
(
Longitude REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
Type TEXT, --
Height REAL, --
Mountains TEXT, --
);
CREATE TABLE province
(
Capital TEXT, --
Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, --
primary key (Name, Country),
Population INTEGER, --
Area REAL, --
Name TEXT not null, --
CapProv TEXT, --
);
CREATE TABLE population
(
Infant_Mortality REAL, --
Population_Growth REAL, --
Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade,
);
CREATE TABLE isMember
(
primary key (Country, Organization),
Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, --
Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, --
Type TEXT default 'member', --
);
CREATE TABLE locatedOn
(
Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, --
Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (City, Province, Country, Island),
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
City TEXT default '' not null, --
);
CREATE TABLE mergesWith
(
Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, --
Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, --
primary key (Sea1, Sea2),
);
CREATE TABLE encompasses
(
Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0
Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0
primary key (Country, Continent),
);
CREATE TABLE continent
(
Name TEXT default '' not null primary key,
Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0
);
CREATE TABLE religion
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE geo_river
(
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, River),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, --
River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, --
);
CREATE TABLE sea
(
Depth REAL, --
Name TEXT default '' not null primary key,
);
CREATE TABLE target
(
Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade,
Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0
);
CREATE TABLE geo_island
(
Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, --
primary key (Province, Country, Island),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, --
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
); |
retail_world | Among the products, how many of them were discontinued in production? | discontinued refers to Discontinued = 1 | SELECT COUNT(*) FROM Products WHERE 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,
); |
professional_basketball | List out all the coach ID who have served more than 2 different teams. | more than 2 different teams refers to count(tmID) > 2 | SELECT coachID FROM coaches GROUP BY coachID HAVING COUNT(DISTINCT tmID) > 2 | 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 | List 5 customers in the West region who had their item shipped 'Second Class.' | shipped 'Second Class.' refers to "Ship Mode" = 'Second Class'; customers refers to "Customer Name"; Region = 'West' | SELECT DISTINCT T2.`Customer Name` FROM west_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T1.Region = 'West' AND T1.`Ship Mode` = 'Second Class' LIMIT 5 | 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
); |
mondial_geo | List all the name and height of all mountains in Alaska | Alaska is a province | SELECT T1.Name, T1.Height FROM mountain AS T1 INNER JOIN geo_mountain AS T2 ON T1.Name = T2.Mountain WHERE T2.Province = 'Alaska' | 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 | List the product ID of the top five products, by descending order, the number of quantities in stock. | by descending in number of quantity in stock refers to max(UnitsInStock) | SELECT ProductID FROM Products ORDER BY UnitsInStock DESC LIMIT 5 | 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 | Name the teams along with the coaches that went to 'Quarter Final' round in 1946. | team name refers to teams.name; coach refers to coachID; 'Quarter Final' round refers to round = 'QF'; in 1946 refers to year = 1946 | SELECT DISTINCT T1.coachID, T3.name FROM coaches AS T1 JOIN series_post AS T2 ON T1.tmID = T2.tmIDWinner JOIN teams AS T3 ON T3.tmID = T1.tmID WHERE T2.round = 'QF' AND T2.year = 1946 | 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 | Add the total profit of Patrick Gardner in the Central region. | Patrick Gardner is the "Customer Name"; Region = 'Central' | SELECT SUM(T2.Profit) FROM people AS T1 INNER JOIN central_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T1.`Customer Name` = 'Patrick Gardner' AND T1.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 | How many conditions did Tyree Eichmann have? | conditions refer to DESCRIPTION from conditions; | SELECT COUNT(DISTINCT T2.DESCRIPTION) FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Tyree' AND T1.last = 'Eichmann' | 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 height of mountain Dhaulagiri located and in which province is it located? | null | SELECT T1.Height, T2.Province FROM mountain AS T1 INNER JOIN geo_mountain AS T2 ON T1.Name = T2.Mountain WHERE T1.Name = 'Dhaulagiri' | 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 | Calculate the percentage of products supplied by Gai pturage over all products. | "Gai pturage" is the CompanyName; Percentage = Divide (Count(SupplierID where CompanyName = 'Gai pturage'), Count (SupplierID)) * 100 | SELECT CAST(COUNT(CASE WHEN T2.CompanyName = 'Gai pturage' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.SupplierID) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID | 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 total sales of the accumulated orders of Hon Valutask Swivel Chairs in the West region? | 'Hon Valutask Swivel Chairs' is the "Product Name" | SELECT SUM(T1.Sales) FROM west_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T2.`Product Name` = 'Hon Valutask Swivel Chairs' AND T1.Region = 'West' | 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 who underwent a 'bone immobilization' procedure have a driver's license? | patients who underwent a 'bone immobilization' procedure refer to PATIENT from procedures where DESCRIPTION = 'Bone immobilization'; have a driver's license refers to drivers is not null; | SELECT COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN procedures AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Bone immobilization' AND T1.drivers IS NOT NULL | 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, --
); |
computer_student | Provide the position status and IDs of professor who advised student ID "303". | position status refers to hasPosition; IDs of professor refers to p_id_dummy; student ID "303" refers to advisedBy.p_id = 303 | SELECT T2.hasPosition, T1.p_id_dummy FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id_dummy = T2.p_id WHERE T1.p_id = 303 | CREATE TABLE course
(
course_id INTEGER constraint course_pk primary key,
courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0
);
CREATE TABLE advisedBy
(
p_id INTEGER, --
constraint advisedBy_pk primary key (p_id, p_id_dummy),
p_id_dummy INTEGER, --
constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id),
constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id),
);
CREATE TABLE person
(
student INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 278 - Distinct count 2 - Null count 0
p_id INTEGER constraint person_pk primary key,
hasPosition TEXT, -- Example Values: `0`, `Faculty`, `Faculty_adj`, `Faculty_eme`, `Faculty_aff` | Value Statics: Total count 278 - Distinct count 5 - Null count 0
professor INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 278 - Distinct count 2 - Null count 0
yearsInProgram TEXT, -- Example Values: `0`, `Year_2`, `Year_5`, `Year_7`, `Year_10` | Value Statics: Total count 278 - Distinct count 12 - Null count 0
inPhase TEXT, -- Example Values: `0`, `Post_Quals`, `Post_Generals`, `Pre_Quals` | Value Statics: Total count 278 - Distinct count 4 - Null count 0
);
CREATE TABLE taughtBy
(
foreign key (p_id) references person(p_id),
p_id INTEGER, --
primary key (course_id, p_id),
foreign key (course_id) references course(course_id),
course_id INTEGER, --
); |
mondial_geo | Provide the population of the city of the 'World Tourism Organization' headquarter. | null | SELECT T2.Population FROM organization AS T1 INNER JOIN city AS T2 ON T1.City = T2.Name WHERE T1.Name = 'World Tourism Organization' | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200
);
CREATE TABLE river
(
River TEXT, --
Mountains TEXT, --
SourceAltitude REAL, --
Length REAL, --
EstuaryLatitude REAL, --
SourceLongitude REAL, --
Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, --
EstuaryLongitude REAL, --
Sea TEXT, --
Name TEXT default '' not null primary key,
SourceLatitude REAL, --
);
CREATE TABLE mountainOnIsland
(
Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, --
primary key (Mountain, Island),
Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, --
);
CREATE TABLE organization
(
City TEXT, --
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, --
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
Abbreviation TEXT not null primary key,
Province TEXT, --
Name TEXT not null constraint ix_organization_OrgNameUnique unique, --
Established DATE, --
);
CREATE TABLE geo_desert
(
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, --
Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, --
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Desert),
);
CREATE TABLE geo_source
(
River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (Province, Country, River),
);
CREATE TABLE geo_sea
(
Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, --
Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, --
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Sea),
Province TEXT default '' not null, --
);
CREATE TABLE geo_estuary
(
primary key (Province, Country, River),
River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, --
);
CREATE TABLE located
(
River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, --
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, --
Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, --
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
City TEXT, --
Province TEXT, --
);
CREATE TABLE lake
(
Depth REAL, --
Altitude REAL, --
Name TEXT default '' not null primary key,
Longitude REAL, --
Latitude REAL, --
Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74
River TEXT, --
Area REAL, --
);
CREATE TABLE desert
(
Longitude REAL, --
Area REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
);
CREATE TABLE geo_mountain
(
Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, --
primary key (Province, Country, Mountain),
Province TEXT default '' not null, --
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, --
);
CREATE TABLE ethnicGroup
(
primary key (Name, Country),
Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, --
Name TEXT default '' not null, --
Percentage REAL, --
);
CREATE TABLE economy
(
Industry REAL, --
GDP REAL, --
Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade,
Inflation REAL, --
Service REAL, --
Agriculture REAL, --
);
CREATE TABLE borders
(
primary key (Country1, Country2),
Country2 TEXT default '' not null constraint borders_ibfk_2 references country, --
Length REAL, --
Country1 TEXT default '' not null constraint borders_ibfk_1 references country, --
);
CREATE TABLE language
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE islandIn
(
Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, --
River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349
Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, --
Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344
);
CREATE TABLE country
(
Area REAL, --
Capital TEXT, --
Population INTEGER, --
Name TEXT not null constraint ix_county_Name unique, --
Province TEXT, --
Code TEXT default '' not null primary key,
);
CREATE TABLE city
(
Longitude REAL, --
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Population INTEGER, --
Province TEXT default '' not null, --
primary key (Name, Province),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, --
Latitude REAL, --
);
CREATE TABLE island
(
Name TEXT default '' not null primary key,
Islands TEXT, --
Area REAL, --
Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185
Longitude REAL, --
Height REAL, --
Latitude REAL, --
);
CREATE TABLE geo_lake
(
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, --
primary key (Province, Country, Lake),
Province TEXT default '' not null, --
);
CREATE TABLE mountain
(
Longitude REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
Type TEXT, --
Height REAL, --
Mountains TEXT, --
);
CREATE TABLE province
(
Capital TEXT, --
Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, --
primary key (Name, Country),
Population INTEGER, --
Area REAL, --
Name TEXT not null, --
CapProv TEXT, --
);
CREATE TABLE population
(
Infant_Mortality REAL, --
Population_Growth REAL, --
Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade,
);
CREATE TABLE isMember
(
primary key (Country, Organization),
Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, --
Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, --
Type TEXT default 'member', --
);
CREATE TABLE locatedOn
(
Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, --
Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (City, Province, Country, Island),
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
City TEXT default '' not null, --
);
CREATE TABLE mergesWith
(
Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, --
Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, --
primary key (Sea1, Sea2),
);
CREATE TABLE encompasses
(
Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0
Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0
primary key (Country, Continent),
);
CREATE TABLE continent
(
Name TEXT default '' not null primary key,
Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0
);
CREATE TABLE religion
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE geo_river
(
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, River),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, --
River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, --
);
CREATE TABLE sea
(
Depth REAL, --
Name TEXT default '' not null primary key,
);
CREATE TABLE target
(
Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade,
Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0
);
CREATE TABLE geo_island
(
Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, --
primary key (Province, Country, Island),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, --
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
); |
retail_world | What is the total units on order from Exotic Liquids? | "Exotic Liquids" is the CompanyName; total unit on order = Sum(UnitsOnOrder) | SELECT SUM(T1.UnitsOnOrder) 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 | List the first name, last name, height and weight of the players who has all free throw attempted successfully made. | all free throw attempted successfully made refers to ftAttempted > 0 and ftAttempted = ftMade | SELECT DISTINCT T1.firstName, T1.lastName, T1.height, T1.weight FROM players AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T2.ft_attempted > 0 AND ft_attempted = ft_made | 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 | Provide the order ID of Frank Olsen of the South region. | Frank Olsen' is the "Customer Name"; Region = 'South' | SELECT T1.`Order ID` FROM south_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T2.Region = 'South' AND T2.`Customer Name` = 'Frank Olsen' | 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
); |
computer_student | What is the ratio of professors and students? | professors refers to professor = 1; students refers to student = 1; ratio = divide(count(person.p_id) when professor = 1, count(person.p_id) when student = 1) | SELECT CAST(SUM(CASE WHEN professor = 1 THEN 1 ELSE 0 END) AS REAL) * 100 / SUM(CASE WHEN student = 1 THEN 1 ELSE 0 END) AS per FROM person | CREATE TABLE course
(
course_id INTEGER constraint course_pk primary key,
courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0
);
CREATE TABLE advisedBy
(
p_id INTEGER, --
constraint advisedBy_pk primary key (p_id, p_id_dummy),
p_id_dummy INTEGER, --
constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id),
constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id),
);
CREATE TABLE person
(
student INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 278 - Distinct count 2 - Null count 0
p_id INTEGER constraint person_pk primary key,
hasPosition TEXT, -- Example Values: `0`, `Faculty`, `Faculty_adj`, `Faculty_eme`, `Faculty_aff` | Value Statics: Total count 278 - Distinct count 5 - Null count 0
professor INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 278 - Distinct count 2 - Null count 0
yearsInProgram TEXT, -- Example Values: `0`, `Year_2`, `Year_5`, `Year_7`, `Year_10` | Value Statics: Total count 278 - Distinct count 12 - Null count 0
inPhase TEXT, -- Example Values: `0`, `Post_Quals`, `Post_Generals`, `Pre_Quals` | Value Statics: Total count 278 - Distinct count 4 - Null count 0
);
CREATE TABLE taughtBy
(
foreign key (p_id) references person(p_id),
p_id INTEGER, --
primary key (course_id, p_id),
foreign key (course_id) references course(course_id),
course_id INTEGER, --
); |
mondial_geo | What is the newest established organization where Singapore is a member of? | null | SELECT T3.Name FROM country AS T1 INNER JOIN isMember AS T2 ON T1.Code = T2.Country INNER JOIN organization AS T3 ON T3.Country = T2.Country WHERE T1.Name = 'Singapore' ORDER BY T3.Established 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 is the contact title for the person who supplied a product that is 10 boxes x 12 pieces. | "10 boxes x 12 pieces" is the QuantityPerUnit | SELECT T2.ContactTitle FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.QuantityPerUnit = '10 boxes x 12 pieces' | 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 | List the champion (team name) and year from year 1950 to 1960. | champion refers to round = 'F'; team name refers to teams.name; from year 1950 to 1960 refers to year between 1950 and 1960 | SELECT DISTINCT T1.name, T2.year FROM teams AS T1 JOIN series_post AS T2 ON T1.tmID = T2.tmIDWinner WHERE T2.round = 'F' AND T2.year BETWEEN 1950 AND 1960 | 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 ship date of the order by the customer named Ann Chong in the central region? | Ann Chong' is the "Customer Name"; Region = 'Central' | SELECT T2.`Ship Date` FROM people AS T1 INNER JOIN central_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T1.`Customer Name` = 'Ann Chong' AND T1.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 | Calculate the total type of allergies for German people. | type of allergies refers to DESCRIPTION from allergies; German people refer to PATIENT where ethnicity = 'german'; | SELECT COUNT(DISTINCT T2.DESCRIPTION) FROM patients AS T1 INNER JOIN allergies AS T2 ON T1.patient = T2.PATIENT WHERE T1.ethnicity = 'german' | 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 border length between 'USA' and 'MEX' | null | SELECT Length FROM borders WHERE Country1 = 'MEX' AND Country2 = 'USA' | 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 | List down the company names that have the highest reorder level. | Highest reorder level refers to Max(ReorderLevel) | SELECT DISTINCT T2.CompanyName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.ReorderLevel = ( SELECT MAX(ReorderLevel) 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 | Name the youngest player who ever won "Rookie of the Year". | player name refers to playerID; the youngest refers to max(birthDate); won "Rookie of the Year" refers to award = 'Rookie of the Year' | SELECT T1.firstName, T1.middleName, T1.lastName FROM players AS T1 INNER JOIN awards_players AS T2 ON T1.playerID = T2.playerID WHERE T2.award = 'Rookie of the Year' ORDER BY T1.birthDate 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 | Give the customer segment from the West region that orders the order ID CA-2011-108189. | Region = 'West' | SELECT DISTINCT T2.Segment FROM west_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T1.Region = 'West' AND T1.`Order ID` = 'CA-2011-108189' | 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
); |
computer_student | List down all the person IDs who taught course ID of 18. | person IDs refers to taughtBy.p_id; course ID of 18 refers to taughtBy.course_id = 18 | SELECT p_id FROM taughtBy WHERE course_id = 18 | CREATE TABLE course
(
course_id INTEGER constraint course_pk primary key,
courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0
);
CREATE TABLE advisedBy
(
p_id INTEGER, --
constraint advisedBy_pk primary key (p_id, p_id_dummy),
p_id_dummy INTEGER, --
constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id),
constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id),
);
CREATE TABLE person
(
student INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 278 - Distinct count 2 - Null count 0
p_id INTEGER constraint person_pk primary key,
hasPosition TEXT, -- Example Values: `0`, `Faculty`, `Faculty_adj`, `Faculty_eme`, `Faculty_aff` | Value Statics: Total count 278 - Distinct count 5 - Null count 0
professor INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 278 - Distinct count 2 - Null count 0
yearsInProgram TEXT, -- Example Values: `0`, `Year_2`, `Year_5`, `Year_7`, `Year_10` | Value Statics: Total count 278 - Distinct count 12 - Null count 0
inPhase TEXT, -- Example Values: `0`, `Post_Quals`, `Post_Generals`, `Pre_Quals` | Value Statics: Total count 278 - Distinct count 4 - Null count 0
);
CREATE TABLE taughtBy
(
foreign key (p_id) references person(p_id),
p_id INTEGER, --
primary key (course_id, p_id),
foreign key (course_id) references course(course_id),
course_id INTEGER, --
); |
mondial_geo | Among the organizations where headquarters are in the 'USA', what is the percentage of the them are in 'Washington'? | percentage can be computed by [count(City = 'Washington') / count(all cities)] * 100% | SELECT CAST(SUM(CASE WHEN T2.City = 'Washington' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.City) FROM country AS T1 INNER JOIN organization AS T2 ON T1.Code = T2.Country WHERE T2.Country = 'USA' | 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 contact name for product Teatime Chocolate Biscuits? | "Teatime Chocolate Biscuits" is the ProductName | SELECT T2.ContactName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.ProductName = 'Teatime Chocolate Biscuits' | 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,
); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.