db_id
stringclasses
66 values
question
stringlengths
24
325
evidence
stringlengths
1
673
gold_query
stringlengths
23
804
db_schema
stringclasses
66 values
computer_student
Describe the year in program and in phase status for the student with most number in advisor.
student refers to advisedBy.p_id; most number in advisor refers to max(count(p_id_dummy))
SELECT T2.yearsInProgram, T2.inPhase FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id GROUP BY T1.p_id ORDER BY COUNT(*) DESC LIMIT 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
What is the capital of Australia? Is the capital a headquarter to any organization? Name the organization(s).
null
SELECT T2.Capital, T1.Name FROM organization AS T1 INNER JOIN country AS T2 ON T1.City = T2.Capital WHERE T2.Name = 'Australia'
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 total products that are supplied by Japan suppliers.
Japan Supplier refers to Country = 'Japan'; total product refers to Count (ProductName)
SELECT COUNT(T1.SupplierID) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.Country = 'Japan'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
professional_basketball
List the full name and age of the player when he won the "Finals MVP" in 2003.
full name refers to firstName, middleName, lastName; age = subtract(2003, year(birthDate)); won the "Finals MVP" refers to award = 'Finals MVP'; in 2003 refers to year = 2003
SELECT T1.firstName, T1.middleName, T1.lastName , 2003 - strftime('%Y', T1.birthDate) FROM awards_players AS T2 JOIN players AS T1 ON T2.playerID = T1.playerID WHERE T2.award = 'Finals MVP' AND T2.year = 2003
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 category does the item ordered by Katherine Murray on 11/4/2018 in the South region belong to?
ordered by Katherine Murray refers to "Customer Name" = 'Katherine Murray'; on 11/4/2018 refers to "Order Date" = Date('2018-11-04');
SELECT DISTINCT T3.Category 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 T2.`Customer Name` = 'Katherine Murray' AND T1.`Order Date` = '2018-11-04' AND T2.Region = 'South'
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 have stopped taking medication for 'coronary heart disease' are still alive?
patients who have stopped taking medication for 'coronary heart disease' refer to PATIENT where REASONDESCRIPTION = 'Coronary Heart Disease' and STOP is not null from medications; if deathdate is null, it means this patient is still alive;
SELECT COUNT(DISTINCT T2.patient) FROM medications AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T1.REASONDESCRIPTION = 'Coronary Heart Disease' AND T1.STOP IS NOT NULL 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
Name the organizations with the most members.
null
SELECT T1.Name FROM organization AS T1 INNER JOIN isMember AS T2 ON T2.Country = T1.Country INNER JOIN country AS T3 ON T2.Country = T3.Code GROUP BY T1.Name ORDER BY COUNT(T3.Name) DESC LIMIT 1
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200 ); CREATE TABLE river ( River TEXT, -- Mountains TEXT, -- SourceAltitude REAL, -- Length REAL, -- EstuaryLatitude REAL, -- SourceLongitude REAL, -- Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, -- EstuaryLongitude REAL, -- Sea TEXT, -- Name TEXT default '' not null primary key, SourceLatitude REAL, -- ); CREATE TABLE mountainOnIsland ( Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, -- primary key (Mountain, Island), Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, -- ); CREATE TABLE organization ( City TEXT, -- constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, -- constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, Abbreviation TEXT not null primary key, Province TEXT, -- Name TEXT not null constraint ix_organization_OrgNameUnique unique, -- Established DATE, -- ); CREATE TABLE geo_desert ( Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, -- Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, -- constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, Desert), ); CREATE TABLE geo_source ( River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, -- constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, -- Province TEXT default '' not null, -- primary key (Province, Country, River), ); CREATE TABLE geo_sea ( Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, -- Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, -- constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, Sea), Province TEXT default '' not null, -- ); CREATE TABLE geo_estuary ( primary key (Province, Country, River), River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, -- constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, -- ); CREATE TABLE located ( River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, -- constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, -- Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, -- Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, -- constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, City TEXT, -- Province TEXT, -- ); CREATE TABLE lake ( Depth REAL, -- Altitude REAL, -- Name TEXT default '' not null primary key, Longitude REAL, -- Latitude REAL, -- Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74 River TEXT, -- Area REAL, -- ); CREATE TABLE desert ( Longitude REAL, -- Area REAL, -- Name TEXT default '' not null primary key, Latitude REAL, -- ); CREATE TABLE geo_mountain ( Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, -- primary key (Province, Country, Mountain), Province TEXT default '' not null, -- constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, -- ); CREATE TABLE ethnicGroup ( primary key (Name, Country), Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, -- Name TEXT default '' not null, -- Percentage REAL, -- ); CREATE TABLE economy ( Industry REAL, -- GDP REAL, -- Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade, Inflation REAL, -- Service REAL, -- Agriculture REAL, -- ); CREATE TABLE borders ( primary key (Country1, Country2), Country2 TEXT default '' not null constraint borders_ibfk_2 references country, -- Length REAL, -- Country1 TEXT default '' not null constraint borders_ibfk_1 references country, -- ); CREATE TABLE language ( primary key (Name, Country), Name TEXT default '' not null, -- Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- ); CREATE TABLE islandIn ( Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, -- River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349 Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, -- Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344 ); CREATE TABLE country ( Area REAL, -- Capital TEXT, -- Population INTEGER, -- Name TEXT not null constraint ix_county_Name unique, -- Province TEXT, -- Code TEXT default '' not null primary key, ); CREATE TABLE city ( Longitude REAL, -- constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Population INTEGER, -- Province TEXT default '' not null, -- primary key (Name, Province), Name TEXT default '' not null, -- Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, -- Latitude REAL, -- ); CREATE TABLE island ( Name TEXT default '' not null primary key, Islands TEXT, -- Area REAL, -- Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185 Longitude REAL, -- Height REAL, -- Latitude REAL, -- ); CREATE TABLE geo_lake ( constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, -- Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, -- primary key (Province, Country, Lake), Province TEXT default '' not null, -- ); CREATE TABLE mountain ( Longitude REAL, -- Name TEXT default '' not null primary key, Latitude REAL, -- Type TEXT, -- Height REAL, -- Mountains TEXT, -- ); CREATE TABLE province ( Capital TEXT, -- Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, -- primary key (Name, Country), Population INTEGER, -- Area REAL, -- Name TEXT not null, -- CapProv TEXT, -- ); CREATE TABLE population ( Infant_Mortality REAL, -- Population_Growth REAL, -- Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade, ); CREATE TABLE isMember ( primary key (Country, Organization), Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, -- Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, -- Type TEXT default 'member', -- ); CREATE TABLE locatedOn ( Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, -- Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, -- Province TEXT default '' not null, -- primary key (City, Province, Country, Island), constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, City TEXT default '' not null, -- ); CREATE TABLE mergesWith ( Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, -- Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, -- primary key (Sea1, Sea2), ); CREATE TABLE encompasses ( Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0 Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0 primary key (Country, Continent), ); CREATE TABLE continent ( Name TEXT default '' not null primary key, Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 ); CREATE TABLE religion ( primary key (Name, Country), Name TEXT default '' not null, -- Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- ); CREATE TABLE geo_river ( constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, River), Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, -- River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, -- ); CREATE TABLE sea ( Depth REAL, -- Name TEXT default '' not null primary key, ); CREATE TABLE target ( Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade, Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0 ); CREATE TABLE geo_island ( Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, -- primary key (Province, Country, Island), Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, -- constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, );
retail_world
Please calculate the average unit price for products of Formaggi Fortini s.r.l.
"Formaggi Fortini s.r.l." is the CompanyName; average unit price = AVG(UnitPrice)
SELECT SUM(T1.UnitPrice) / COUNT(T1.SupplierID) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Formaggi Fortini s.r.l.'
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 which college was the player who won the most award in 1970.
college refers to highSchool; won the most award refers to max(count(award)); in 1970 refers to year = 1970
SELECT college FROM players WHERE playerID = ( SELECT playerID FROM awards_players WHERE year = 1970 GROUP BY playerID ORDER BY COUNT(award) DESC LIMIT 1 )
CREATE TABLE players_teams ( PostGS INTEGER, -- PostdRebounds INTEGER, -- PostPF INTEGER, -- tmID TEXT, -- threeAttempted INTEGER, -- PostRebounds INTEGER, -- assists INTEGER, -- threeMade INTEGER, -- PostBlocks INTEGER, -- PostTurnovers INTEGER, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NBA`, `NBL`, `ABA`, `ABL1`, `NPBL` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0 foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade, PostfgMade INTEGER, -- steals INTEGER, -- oRebounds INTEGER, -- PostftAttempted INTEGER, -- ftAttempted INTEGER, -- ftMade INTEGER, -- points INTEGER, -- PostfgAttempted INTEGER, -- PostftMade INTEGER, -- note TEXT, -- Example Values: `C` | Value Statics: Total count 43 - Distinct count 1 - Null count 23708 dRebounds INTEGER, -- PostSteals INTEGER, -- blocks INTEGER, -- PostAssists INTEGER, -- minutes INTEGER, -- fgAttempted INTEGER, -- playerID TEXT not null references players on update cascade on delete cascade, -- PostthreeMade INTEGER, -- PostPoints INTEGER, -- year INTEGER, -- PF INTEGER, -- fgMade INTEGER, -- PostthreeAttempted INTEGER, -- rebounds INTEGER, -- id INTEGER primary key autoincrement, stint INTEGER, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0 PostMinutes INTEGER, -- PostGP INTEGER, -- turnovers INTEGER, -- PostoRebounds INTEGER, -- GS INTEGER, -- ); CREATE TABLE awards_coaches ( award TEXT, -- Example Values: `NBA Coach of the Year`, `ABA Coach of the Year` | Value Statics: Total count 61 - Distinct count 2 - Null count 0 id INTEGER primary key autoincrement, note TEXT, -- Example Values: `tie` | Value Statics: Total count 4 - Distinct count 1 - Null count 57 coachID TEXT, -- lgID TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 61 - Distinct count 2 - Null count 0 foreign key (coachID, year) references coaches (coachID, year) on update cascade on delete cascade, year INTEGER, -- ); CREATE TABLE draft ( draftOverall INTEGER null, -- lgID TEXT null, -- Example Values: `ABA`, `NBA` | Value Statics: Total count 8621 - Distinct count 2 - Null count 0 suffixName TEXT null, -- Example Values: `Jr.` | Value Statics: Total count 2 - Distinct count 1 - Null count 8619 draftYear INTEGER null, -- draftSelection INTEGER null, -- tmID TEXT null, -- draftRound INTEGER null, -- lastName TEXT null, -- playerID TEXT null, -- draftFrom TEXT null, -- id INTEGER default 0 not null primary key, firstName TEXT null, -- foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade, foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade, ); CREATE TABLE player_allstar ( rebounds INTEGER null, -- playerID TEXT not null, -- season_id INTEGER not null, -- assists INTEGER null, -- conference TEXT null, -- Example Values: `East`, `West`, `Weset`, `Allstars`, `Denver` | Value Statics: Total count 1608 - Distinct count 5 - Null count 0 points INTEGER null, -- personal_fouls INTEGER null, -- Example Values: `3`, `2`, `0`, `1`, `5` | Value Statics: Total count 540 - Distinct count 8 - Null count 1068 ft_attempted INTEGER null, -- Example Values: `2`, `4`, `0`, `6`, `3` | Value Statics: Total count 1561 - Distinct count 17 - Null count 47 fg_attempted INTEGER null, -- league_id TEXT null, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 1608 - Distinct count 2 - Null count 0 foreign key (playerID) references players (playerID) on update cascade on delete cascade, fg_made INTEGER null, -- Example Values: `4`, `8`, `5`, `7`, `3` | Value Statics: Total count 1561 - Distinct count 18 - Null count 47 ft_made INTEGER null, -- Example Values: `2`, `3`, `0`, `1`, `4` | Value Statics: Total count 1561 - Distinct count 13 - Null count 47 steals INTEGER null, -- Example Values: `3`, `0`, `1`, `2`, `5` | Value Statics: Total count 398 - Distinct count 7 - Null count 1210 games_played INTEGER null, -- Example Values: `1` | Value Statics: Total count 1608 - Distinct count 1 - Null count 0 first_name TEXT null, -- d_rebounds INTEGER null, -- Example Values: `2`, `5`, `0`, `1`, `4` | Value Statics: Total count 493 - Distinct count 14 - Null count 1115 last_name TEXT null, -- primary key (playerID, season_id), turnovers INTEGER null, -- Example Values: `1`, `0`, `3`, `2`, `4` | Value Statics: Total count 493 - Distinct count 9 - Null count 1115 three_made INTEGER null, -- Example Values: `0`, `1`, `3`, `5`, `4` | Value Statics: Total count 566 - Distinct count 7 - Null count 1042 minutes INTEGER null, -- blocks INTEGER null, -- Example Values: `2`, `0`, `1`, `3`, `5` | Value Statics: Total count 398 - Distinct count 6 - Null count 1210 three_attempted INTEGER null, -- Example Values: `0`, `1`, `6`, `7`, `10` | Value Statics: Total count 540 - Distinct count 12 - Null count 1068 o_rebounds INTEGER null, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 493 - Distinct count 10 - Null count 1115 ); CREATE TABLE awards_players ( foreign key (playerID) references players (playerID) on update cascade on delete cascade, year INTEGER not null, -- pos TEXT null, -- Example Values: `C`, `F`, `G`, `F/G`, `F/C` | Value Statics: Total count 833 - Distinct count 5 - Null count 886 primary key (playerID, year, award), lgID TEXT null, -- Example Values: `NBA`, `ABA`, `NBL`, `ABL1` | Value Statics: Total count 1719 - Distinct count 4 - Null count 0 award TEXT not null, -- playerID TEXT not null, -- note TEXT null, -- Example Values: `tie` | Value Statics: Total count 37 - Distinct count 1 - Null count 1682 ); CREATE TABLE series_post ( tmIDLoser TEXT, -- id INTEGER primary key autoincrement, series TEXT, -- Example Values: `O`, `M`, `N`, `A`, `K` | Value Statics: Total count 775 - Distinct count 11 - Null count 0 tmIDWinner TEXT, -- round TEXT, -- Example Values: `F`, `QF`, `SF`, `DT`, `DF` | Value Statics: Total count 775 - Distinct count 11 - Null count 0 year INTEGER, -- foreign key (tmIDLoser, year) references teams (tmID, year) on update cascade on delete cascade, foreign key (tmIDWinner, year) references teams (tmID, year) on update cascade on delete cascade, W INTEGER, -- Example Values: `4`, `2`, `1`, `3`, `0` | Value Statics: Total count 775 - Distinct count 5 - Null count 0 lgIDLoser TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0 lgIDWinner TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0 L INTEGER, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 775 - Distinct count 5 - Null count 0 ); CREATE TABLE players ( nameGiven TEXT null, -- Example Values: `nameGiven`, `Mort`, `Robert`, `Jim`, `Mike` | Value Statics: Total count 10 - Distinct count 9 - Null count 5052 lastseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15 hsCountry TEXT null, -- firstName TEXT null, -- hsCity TEXT null, -- firstseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15 weight INTEGER null, -- birthCountry TEXT null, -- race TEXT null, -- Example Values: `B`, `W`, `O`, `1`, `r` | Value Statics: Total count 4903 - Distinct count 5 - Null count 159 lastName TEXT null, -- birthDate DATE null, -- collegeOther TEXT null, -- birthState TEXT null, -- useFirst TEXT null, -- pos TEXT null, -- Example Values: `F-C`, `C`, `G`, `G-F`, `C-F` | Value Statics: Total count 4880 - Distinct count 14 - Null count 182 playerID TEXT not null primary key, college TEXT null, -- highSchool TEXT null, -- hsState TEXT null, -- height REAL null, -- deathDate DATE null, -- nameSuffix TEXT null, -- Example Values: `Jr.`, `III`, `nameSuffix`, `II`, `IV` | Value Statics: Total count 324 - Distinct count 6 - Null count 4738 nameNick TEXT null, -- fullGivenName TEXT null, -- birthCity TEXT null, -- middleName TEXT null, -- ); CREATE TABLE teams ( d_pts INTEGER null, -- name TEXT null, -- homeLost INTEGER null, -- o_ftm INTEGER null, -- franchID TEXT null, -- tmID TEXT not null, -- awayWon INTEGER null, -- primary key (year, tmID), o_fgm INTEGER null, -- year INTEGER not null, -- awayLost INTEGER null, -- arena TEXT null, -- confID TEXT null, -- Example Values: `EC`, `WC` | Value Statics: Total count 1064 - Distinct count 2 - Null count 472 games INTEGER null, -- lost INTEGER null, -- divID TEXT null, -- Example Values: `EA`, `WE`, `ED`, `WD`, `SO` | Value Statics: Total count 1498 - Distinct count 13 - Null count 38 lgID TEXT null, -- Example Values: `NBL`, `NBA`, `PBLA`, `NPBL`, `ABL1` | Value Statics: Total count 1536 - Distinct count 6 - Null count 0 homeWon INTEGER null, -- confRank INTEGER null, -- Example Values: `0`, `4`, `3`, `5`, `7` | Value Statics: Total count 1536 - Distinct count 16 - Null count 0 o_pts INTEGER null, -- `rank` INTEGER null, -- Example Values: `1`, `2`, `4`, `5`, `6` | Value Statics: Total count 1536 - Distinct count 10 - Null count 0 playoff TEXT null, -- Example Values: `CF`, `WC`, `LC`, `CS`, `F` | Value Statics: Total count 901 - Distinct count 15 - Null count 635 won INTEGER null, -- ); CREATE TABLE coaches ( primary key (coachID, year, tmID, stint), lgID TEXT null, -- Example Values: `NBA`, `ABA`, `ABL1`, `PBLA`, `NPBL` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0 post_losses INTEGER null, -- Example Values: `3`, `9`, `7`, `8`, `0` | Value Statics: Total count 1649 - Distinct count 12 - Null count 40 year INTEGER not null, -- won INTEGER null, -- foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade, post_wins INTEGER null, -- Example Values: `0`, `12`, `9`, `13`, `1` | Value Statics: Total count 1649 - Distinct count 17 - Null count 40 coachID TEXT not null, -- tmID TEXT not null, -- lost INTEGER null, -- stint INTEGER not null, -- Example Values: `2`, `1`, `4`, `5`, `3` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0 );
superstore
What percentage do items under the category of 'Furniture' make up the total number of items ordered that are shipped as standard in the West region?
shipped as standard refers to "Ship Mode" = 'Standard Class'; Region = 'West'; percentage refers to DIVIDE(SUM(Quantity where Category = 'Furniture'), SUM(Quantity)) * 1.0
SELECT CAST(SUM(CASE WHEN T2.Category = 'Furniture' THEN 1 ELSE 0 END) AS REAL) * 100 / SUM(T1.Quantity) FROM west_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T2.Region = 'West' AND T1.`Ship Mode` = 'Standard Class'
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 the course IDs and levels of person IDs from 40 to 50.
course IDs and levels refers to course.course_id and courseLevel; person IDs from 40 to 50 refers to taughtBy.p_id between 40 and 50
SELECT T1.course_id, T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.p_id BETWEEN 40 AND 50
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
List all countries with 'Category III' membership in 'IFAD' organization. Please also provide the capital of the country.
null
SELECT Name, Capital FROM country WHERE Code IN ( SELECT Country FROM isMember WHERE type = 'Category III' AND Organization = 'IFAD' )
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200 ); CREATE TABLE river ( River TEXT, -- Mountains TEXT, -- SourceAltitude REAL, -- Length REAL, -- EstuaryLatitude REAL, -- SourceLongitude REAL, -- Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, -- EstuaryLongitude REAL, -- Sea TEXT, -- Name TEXT default '' not null primary key, SourceLatitude REAL, -- ); CREATE TABLE mountainOnIsland ( Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, -- primary key (Mountain, Island), Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, -- ); CREATE TABLE organization ( City TEXT, -- constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, -- constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, Abbreviation TEXT not null primary key, Province TEXT, -- Name TEXT not null constraint ix_organization_OrgNameUnique unique, -- Established DATE, -- ); CREATE TABLE geo_desert ( Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, -- Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, -- constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, Desert), ); CREATE TABLE geo_source ( River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, -- constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, -- Province TEXT default '' not null, -- primary key (Province, Country, River), ); CREATE TABLE geo_sea ( Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, -- Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, -- constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, Sea), Province TEXT default '' not null, -- ); CREATE TABLE geo_estuary ( primary key (Province, Country, River), River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, -- constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, -- ); CREATE TABLE located ( River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, -- constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, -- Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, -- Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, -- constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, City TEXT, -- Province TEXT, -- ); CREATE TABLE lake ( Depth REAL, -- Altitude REAL, -- Name TEXT default '' not null primary key, Longitude REAL, -- Latitude REAL, -- Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74 River TEXT, -- Area REAL, -- ); CREATE TABLE desert ( Longitude REAL, -- Area REAL, -- Name TEXT default '' not null primary key, Latitude REAL, -- ); CREATE TABLE geo_mountain ( Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, -- primary key (Province, Country, Mountain), Province TEXT default '' not null, -- constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, -- ); CREATE TABLE ethnicGroup ( primary key (Name, Country), Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, -- Name TEXT default '' not null, -- Percentage REAL, -- ); CREATE TABLE economy ( Industry REAL, -- GDP REAL, -- Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade, Inflation REAL, -- Service REAL, -- Agriculture REAL, -- ); CREATE TABLE borders ( primary key (Country1, Country2), Country2 TEXT default '' not null constraint borders_ibfk_2 references country, -- Length REAL, -- Country1 TEXT default '' not null constraint borders_ibfk_1 references country, -- ); CREATE TABLE language ( primary key (Name, Country), Name TEXT default '' not null, -- Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- ); CREATE TABLE islandIn ( Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, -- River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349 Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, -- Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344 ); CREATE TABLE country ( Area REAL, -- Capital TEXT, -- Population INTEGER, -- Name TEXT not null constraint ix_county_Name unique, -- Province TEXT, -- Code TEXT default '' not null primary key, ); CREATE TABLE city ( Longitude REAL, -- constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Population INTEGER, -- Province TEXT default '' not null, -- primary key (Name, Province), Name TEXT default '' not null, -- Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, -- Latitude REAL, -- ); CREATE TABLE island ( Name TEXT default '' not null primary key, Islands TEXT, -- Area REAL, -- Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185 Longitude REAL, -- Height REAL, -- Latitude REAL, -- ); CREATE TABLE geo_lake ( constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, -- Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, -- primary key (Province, Country, Lake), Province TEXT default '' not null, -- ); CREATE TABLE mountain ( Longitude REAL, -- Name TEXT default '' not null primary key, Latitude REAL, -- Type TEXT, -- Height REAL, -- Mountains TEXT, -- ); CREATE TABLE province ( Capital TEXT, -- Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, -- primary key (Name, Country), Population INTEGER, -- Area REAL, -- Name TEXT not null, -- CapProv TEXT, -- ); CREATE TABLE population ( Infant_Mortality REAL, -- Population_Growth REAL, -- Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade, ); CREATE TABLE isMember ( primary key (Country, Organization), Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, -- Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, -- Type TEXT default 'member', -- ); CREATE TABLE locatedOn ( Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, -- Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, -- Province TEXT default '' not null, -- primary key (City, Province, Country, Island), constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, City TEXT default '' not null, -- ); CREATE TABLE mergesWith ( Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, -- Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, -- primary key (Sea1, Sea2), ); CREATE TABLE encompasses ( Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0 Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0 primary key (Country, Continent), ); CREATE TABLE continent ( Name TEXT default '' not null primary key, Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 ); CREATE TABLE religion ( primary key (Name, Country), Name TEXT default '' not null, -- Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- ); CREATE TABLE geo_river ( constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, River), Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, -- River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, -- ); CREATE TABLE sea ( Depth REAL, -- Name TEXT default '' not null primary key, ); CREATE TABLE target ( Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade, Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0 ); CREATE TABLE geo_island ( Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, -- primary key (Province, Country, Island), Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, -- constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, );
retail_world
How many products have been discountinued by New Orleans Cajun Delights?
"New Orleans Cajun Delights" is the CompanyName; discontinued refers to Discontinued = 1
SELECT COUNT(T1.Discontinued) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'New Orleans Cajun Delights'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
professional_basketball
Please list down the last name of players from "BLB" team.
"BLB" is the tmID
SELECT T1.lastName FROM players AS T1 INNER JOIN players_teams AS T2 ON T1.playerID = T2.playerID WHERE T2.tmID = 'BLB'
CREATE TABLE players_teams ( PostGS INTEGER, -- PostdRebounds INTEGER, -- PostPF INTEGER, -- tmID TEXT, -- threeAttempted INTEGER, -- PostRebounds INTEGER, -- assists INTEGER, -- threeMade INTEGER, -- PostBlocks INTEGER, -- PostTurnovers INTEGER, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NBA`, `NBL`, `ABA`, `ABL1`, `NPBL` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0 foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade, PostfgMade INTEGER, -- steals INTEGER, -- oRebounds INTEGER, -- PostftAttempted INTEGER, -- ftAttempted INTEGER, -- ftMade INTEGER, -- points INTEGER, -- PostfgAttempted INTEGER, -- PostftMade INTEGER, -- note TEXT, -- Example Values: `C` | Value Statics: Total count 43 - Distinct count 1 - Null count 23708 dRebounds INTEGER, -- PostSteals INTEGER, -- blocks INTEGER, -- PostAssists INTEGER, -- minutes INTEGER, -- fgAttempted INTEGER, -- playerID TEXT not null references players on update cascade on delete cascade, -- PostthreeMade INTEGER, -- PostPoints INTEGER, -- year INTEGER, -- PF INTEGER, -- fgMade INTEGER, -- PostthreeAttempted INTEGER, -- rebounds INTEGER, -- id INTEGER primary key autoincrement, stint INTEGER, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0 PostMinutes INTEGER, -- PostGP INTEGER, -- turnovers INTEGER, -- PostoRebounds INTEGER, -- GS INTEGER, -- ); CREATE TABLE awards_coaches ( award TEXT, -- Example Values: `NBA Coach of the Year`, `ABA Coach of the Year` | Value Statics: Total count 61 - Distinct count 2 - Null count 0 id INTEGER primary key autoincrement, note TEXT, -- Example Values: `tie` | Value Statics: Total count 4 - Distinct count 1 - Null count 57 coachID TEXT, -- lgID TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 61 - Distinct count 2 - Null count 0 foreign key (coachID, year) references coaches (coachID, year) on update cascade on delete cascade, year INTEGER, -- ); CREATE TABLE draft ( draftOverall INTEGER null, -- lgID TEXT null, -- Example Values: `ABA`, `NBA` | Value Statics: Total count 8621 - Distinct count 2 - Null count 0 suffixName TEXT null, -- Example Values: `Jr.` | Value Statics: Total count 2 - Distinct count 1 - Null count 8619 draftYear INTEGER null, -- draftSelection INTEGER null, -- tmID TEXT null, -- draftRound INTEGER null, -- lastName TEXT null, -- playerID TEXT null, -- draftFrom TEXT null, -- id INTEGER default 0 not null primary key, firstName TEXT null, -- foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade, foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade, ); CREATE TABLE player_allstar ( rebounds INTEGER null, -- playerID TEXT not null, -- season_id INTEGER not null, -- assists INTEGER null, -- conference TEXT null, -- Example Values: `East`, `West`, `Weset`, `Allstars`, `Denver` | Value Statics: Total count 1608 - Distinct count 5 - Null count 0 points INTEGER null, -- personal_fouls INTEGER null, -- Example Values: `3`, `2`, `0`, `1`, `5` | Value Statics: Total count 540 - Distinct count 8 - Null count 1068 ft_attempted INTEGER null, -- Example Values: `2`, `4`, `0`, `6`, `3` | Value Statics: Total count 1561 - Distinct count 17 - Null count 47 fg_attempted INTEGER null, -- league_id TEXT null, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 1608 - Distinct count 2 - Null count 0 foreign key (playerID) references players (playerID) on update cascade on delete cascade, fg_made INTEGER null, -- Example Values: `4`, `8`, `5`, `7`, `3` | Value Statics: Total count 1561 - Distinct count 18 - Null count 47 ft_made INTEGER null, -- Example Values: `2`, `3`, `0`, `1`, `4` | Value Statics: Total count 1561 - Distinct count 13 - Null count 47 steals INTEGER null, -- Example Values: `3`, `0`, `1`, `2`, `5` | Value Statics: Total count 398 - Distinct count 7 - Null count 1210 games_played INTEGER null, -- Example Values: `1` | Value Statics: Total count 1608 - Distinct count 1 - Null count 0 first_name TEXT null, -- d_rebounds INTEGER null, -- Example Values: `2`, `5`, `0`, `1`, `4` | Value Statics: Total count 493 - Distinct count 14 - Null count 1115 last_name TEXT null, -- primary key (playerID, season_id), turnovers INTEGER null, -- Example Values: `1`, `0`, `3`, `2`, `4` | Value Statics: Total count 493 - Distinct count 9 - Null count 1115 three_made INTEGER null, -- Example Values: `0`, `1`, `3`, `5`, `4` | Value Statics: Total count 566 - Distinct count 7 - Null count 1042 minutes INTEGER null, -- blocks INTEGER null, -- Example Values: `2`, `0`, `1`, `3`, `5` | Value Statics: Total count 398 - Distinct count 6 - Null count 1210 three_attempted INTEGER null, -- Example Values: `0`, `1`, `6`, `7`, `10` | Value Statics: Total count 540 - Distinct count 12 - Null count 1068 o_rebounds INTEGER null, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 493 - Distinct count 10 - Null count 1115 ); CREATE TABLE awards_players ( foreign key (playerID) references players (playerID) on update cascade on delete cascade, year INTEGER not null, -- pos TEXT null, -- Example Values: `C`, `F`, `G`, `F/G`, `F/C` | Value Statics: Total count 833 - Distinct count 5 - Null count 886 primary key (playerID, year, award), lgID TEXT null, -- Example Values: `NBA`, `ABA`, `NBL`, `ABL1` | Value Statics: Total count 1719 - Distinct count 4 - Null count 0 award TEXT not null, -- playerID TEXT not null, -- note TEXT null, -- Example Values: `tie` | Value Statics: Total count 37 - Distinct count 1 - Null count 1682 ); CREATE TABLE series_post ( tmIDLoser TEXT, -- id INTEGER primary key autoincrement, series TEXT, -- Example Values: `O`, `M`, `N`, `A`, `K` | Value Statics: Total count 775 - Distinct count 11 - Null count 0 tmIDWinner TEXT, -- round TEXT, -- Example Values: `F`, `QF`, `SF`, `DT`, `DF` | Value Statics: Total count 775 - Distinct count 11 - Null count 0 year INTEGER, -- foreign key (tmIDLoser, year) references teams (tmID, year) on update cascade on delete cascade, foreign key (tmIDWinner, year) references teams (tmID, year) on update cascade on delete cascade, W INTEGER, -- Example Values: `4`, `2`, `1`, `3`, `0` | Value Statics: Total count 775 - Distinct count 5 - Null count 0 lgIDLoser TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0 lgIDWinner TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0 L INTEGER, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 775 - Distinct count 5 - Null count 0 ); CREATE TABLE players ( nameGiven TEXT null, -- Example Values: `nameGiven`, `Mort`, `Robert`, `Jim`, `Mike` | Value Statics: Total count 10 - Distinct count 9 - Null count 5052 lastseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15 hsCountry TEXT null, -- firstName TEXT null, -- hsCity TEXT null, -- firstseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15 weight INTEGER null, -- birthCountry TEXT null, -- race TEXT null, -- Example Values: `B`, `W`, `O`, `1`, `r` | Value Statics: Total count 4903 - Distinct count 5 - Null count 159 lastName TEXT null, -- birthDate DATE null, -- collegeOther TEXT null, -- birthState TEXT null, -- useFirst TEXT null, -- pos TEXT null, -- Example Values: `F-C`, `C`, `G`, `G-F`, `C-F` | Value Statics: Total count 4880 - Distinct count 14 - Null count 182 playerID TEXT not null primary key, college TEXT null, -- highSchool TEXT null, -- hsState TEXT null, -- height REAL null, -- deathDate DATE null, -- nameSuffix TEXT null, -- Example Values: `Jr.`, `III`, `nameSuffix`, `II`, `IV` | Value Statics: Total count 324 - Distinct count 6 - Null count 4738 nameNick TEXT null, -- fullGivenName TEXT null, -- birthCity TEXT null, -- middleName TEXT null, -- ); CREATE TABLE teams ( d_pts INTEGER null, -- name TEXT null, -- homeLost INTEGER null, -- o_ftm INTEGER null, -- franchID TEXT null, -- tmID TEXT not null, -- awayWon INTEGER null, -- primary key (year, tmID), o_fgm INTEGER null, -- year INTEGER not null, -- awayLost INTEGER null, -- arena TEXT null, -- confID TEXT null, -- Example Values: `EC`, `WC` | Value Statics: Total count 1064 - Distinct count 2 - Null count 472 games INTEGER null, -- lost INTEGER null, -- divID TEXT null, -- Example Values: `EA`, `WE`, `ED`, `WD`, `SO` | Value Statics: Total count 1498 - Distinct count 13 - Null count 38 lgID TEXT null, -- Example Values: `NBL`, `NBA`, `PBLA`, `NPBL`, `ABL1` | Value Statics: Total count 1536 - Distinct count 6 - Null count 0 homeWon INTEGER null, -- confRank INTEGER null, -- Example Values: `0`, `4`, `3`, `5`, `7` | Value Statics: Total count 1536 - Distinct count 16 - Null count 0 o_pts INTEGER null, -- `rank` INTEGER null, -- Example Values: `1`, `2`, `4`, `5`, `6` | Value Statics: Total count 1536 - Distinct count 10 - Null count 0 playoff TEXT null, -- Example Values: `CF`, `WC`, `LC`, `CS`, `F` | Value Statics: Total count 901 - Distinct count 15 - Null count 635 won INTEGER null, -- ); CREATE TABLE coaches ( primary key (coachID, year, tmID, stint), lgID TEXT null, -- Example Values: `NBA`, `ABA`, `ABL1`, `PBLA`, `NPBL` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0 post_losses INTEGER null, -- Example Values: `3`, `9`, `7`, `8`, `0` | Value Statics: Total count 1649 - Distinct count 12 - Null count 40 year INTEGER not null, -- won INTEGER null, -- foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade, post_wins INTEGER null, -- Example Values: `0`, `12`, `9`, `13`, `1` | Value Statics: Total count 1649 - Distinct count 17 - Null count 40 coachID TEXT not null, -- tmID TEXT not null, -- lost INTEGER null, -- stint INTEGER not null, -- Example Values: `2`, `1`, `4`, `5`, `3` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0 );
synthea
How many patients with 'allergy to eggs' have been immunized with 'Td (adult) preservative free'?
allergy to eggs' refers to allergies where DESCRIPTION = 'Allergy to eggs'; immunized with 'Td (adult) preservative free' refers to immunizations where DESCRIPTION = 'Td (adult) preservative free';
SELECT COUNT(DISTINCT T2.patient) FROM allergies AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient INNER JOIN immunizations AS T3 ON T2.patient = T3.PATIENT WHERE T1.DESCRIPTION = 'Allergy to eggs' AND T3.DESCRIPTION = 'Td (adult) 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, -- );
computer_student
List the person IDs and course levels of the affiliated professors in faculty.
person IDs refers to person.p_id; affiliated professors in faculty refers to professor = 1 and hasPosition = 'Faculty_aff'
SELECT T1.p_id, T3.courseLevel FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T1.hasPosition = 'Faculty_aff'
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 country has the least organization membership?
null
SELECT country FROM organization WHERE country IN ( SELECT Code FROM country ) GROUP BY country ORDER BY COUNT(NAME) 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 down the quantity per unit for products of Tokyo Traders.
"Tokyo Traders" is the CompanyName
SELECT T1.QuantityPerUnit FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Tokyo Traders'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
superstore
How much is the total quantity of items from the East region shipped on 3/25/2015? Name the products.
shipped on 3/25/2015 refers to "Ship Date" = Date('2015-03-25');
SELECT SUM(T1.Quantity), T2.`Product Name` FROM east_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T1.`Ship Date` = '2015-03-25' AND T2.Region = 'East'
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 the advised student IDs and IDs of employing professor in faculty.
advised student IDs refers to person.p_id; IDs of employing professor in faculty refers to p_id_dummy and hasPosition = 'Faculty_eme'
SELECT T1.p_id, T2.p_id FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id_dummy = T2.p_id WHERE hasPosition = 'Faculty_eme'
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 organization(s) that has 'National Society' as member type.
null
SELECT T1.Name FROM organization AS T1 INNER JOIN isMember AS T2 ON T2.Country = T1.Country INNER JOIN country AS T3 ON T2.Country = T3.Code WHERE T2.Type = 'National Society'
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 are the product names of Exotic Liquids?
"Exotic Liquids" is the CompanyName
SELECT T1.ProductName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Exotic Liquids'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
professional_basketball
What is the percentage of offense rebounds from the total rebounds of the players in year 2000.
in year 2000 refers to year = 2000; percentage = divide(sum(o_rebounds), sum(rebounds)) * 100%
SELECT CAST(SUM(T2.o_rebounds) AS REAL) * 100 / SUM(T2.rebounds) FROM players_teams AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T1.year = 2000
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
Indicate the patient's full name with the lowest body mass index in kg/m2.
full name refers to first, last; the lowest body mass index in kg/m2 refers to DESCRIPTION = Body Mass Index from observations where MIN(VALUE) and UNITS = 'kg/m2';
SELECT T1.first, T1.last FROM patients AS T1 INNER JOIN observations AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Body Mass Index' AND T2.UNITS = 'kg/m2' ORDER BY T2.VALUE 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
State the area and population of the country where Asia Pacific Economic Cooperation headquarter is located.
Asia Pacific Economic Cooperation is an organization name
SELECT T2.Name, T2.Population FROM organization AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code WHERE T1.Name = 'Asia Pacific Economic Cooperation'
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 average salary per order for Andrew Fuller.
average salary = AVG(Salary)
SELECT CAST(SUM(T1.Salary) AS REAL) / COUNT(T2.EmployeeID) FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T1.FirstName = 'Andrew' AND T1.LastName = 'Fuller'
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 players fullname who won the championship in 1970.
full name refers to firstName, middleName, lastName; won the championship refers to round = 'F'; in 1970 refers to year = 1970
SELECT DISTINCT T3.firstName, T3.middleName, T3.lastName FROM series_post AS T1 INNER JOIN players_teams AS T2 ON T1.tmIDWinner = T2.tmID INNER JOIN players AS T3 ON T3.playerID = T2.playerID WHERE T1.year = 1970 AND T1.round = 'F'
CREATE TABLE players_teams ( PostGS INTEGER, -- PostdRebounds INTEGER, -- PostPF INTEGER, -- tmID TEXT, -- threeAttempted INTEGER, -- PostRebounds INTEGER, -- assists INTEGER, -- threeMade INTEGER, -- PostBlocks INTEGER, -- PostTurnovers INTEGER, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NBA`, `NBL`, `ABA`, `ABL1`, `NPBL` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0 foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade, PostfgMade INTEGER, -- steals INTEGER, -- oRebounds INTEGER, -- PostftAttempted INTEGER, -- ftAttempted INTEGER, -- ftMade INTEGER, -- points INTEGER, -- PostfgAttempted INTEGER, -- PostftMade INTEGER, -- note TEXT, -- Example Values: `C` | Value Statics: Total count 43 - Distinct count 1 - Null count 23708 dRebounds INTEGER, -- PostSteals INTEGER, -- blocks INTEGER, -- PostAssists INTEGER, -- minutes INTEGER, -- fgAttempted INTEGER, -- playerID TEXT not null references players on update cascade on delete cascade, -- PostthreeMade INTEGER, -- PostPoints INTEGER, -- year INTEGER, -- PF INTEGER, -- fgMade INTEGER, -- PostthreeAttempted INTEGER, -- rebounds INTEGER, -- id INTEGER primary key autoincrement, stint INTEGER, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0 PostMinutes INTEGER, -- PostGP INTEGER, -- turnovers INTEGER, -- PostoRebounds INTEGER, -- GS INTEGER, -- ); CREATE TABLE awards_coaches ( award TEXT, -- Example Values: `NBA Coach of the Year`, `ABA Coach of the Year` | Value Statics: Total count 61 - Distinct count 2 - Null count 0 id INTEGER primary key autoincrement, note TEXT, -- Example Values: `tie` | Value Statics: Total count 4 - Distinct count 1 - Null count 57 coachID TEXT, -- lgID TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 61 - Distinct count 2 - Null count 0 foreign key (coachID, year) references coaches (coachID, year) on update cascade on delete cascade, year INTEGER, -- ); CREATE TABLE draft ( draftOverall INTEGER null, -- lgID TEXT null, -- Example Values: `ABA`, `NBA` | Value Statics: Total count 8621 - Distinct count 2 - Null count 0 suffixName TEXT null, -- Example Values: `Jr.` | Value Statics: Total count 2 - Distinct count 1 - Null count 8619 draftYear INTEGER null, -- draftSelection INTEGER null, -- tmID TEXT null, -- draftRound INTEGER null, -- lastName TEXT null, -- playerID TEXT null, -- draftFrom TEXT null, -- id INTEGER default 0 not null primary key, firstName TEXT null, -- foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade, foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade, ); CREATE TABLE player_allstar ( rebounds INTEGER null, -- playerID TEXT not null, -- season_id INTEGER not null, -- assists INTEGER null, -- conference TEXT null, -- Example Values: `East`, `West`, `Weset`, `Allstars`, `Denver` | Value Statics: Total count 1608 - Distinct count 5 - Null count 0 points INTEGER null, -- personal_fouls INTEGER null, -- Example Values: `3`, `2`, `0`, `1`, `5` | Value Statics: Total count 540 - Distinct count 8 - Null count 1068 ft_attempted INTEGER null, -- Example Values: `2`, `4`, `0`, `6`, `3` | Value Statics: Total count 1561 - Distinct count 17 - Null count 47 fg_attempted INTEGER null, -- league_id TEXT null, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 1608 - Distinct count 2 - Null count 0 foreign key (playerID) references players (playerID) on update cascade on delete cascade, fg_made INTEGER null, -- Example Values: `4`, `8`, `5`, `7`, `3` | Value Statics: Total count 1561 - Distinct count 18 - Null count 47 ft_made INTEGER null, -- Example Values: `2`, `3`, `0`, `1`, `4` | Value Statics: Total count 1561 - Distinct count 13 - Null count 47 steals INTEGER null, -- Example Values: `3`, `0`, `1`, `2`, `5` | Value Statics: Total count 398 - Distinct count 7 - Null count 1210 games_played INTEGER null, -- Example Values: `1` | Value Statics: Total count 1608 - Distinct count 1 - Null count 0 first_name TEXT null, -- d_rebounds INTEGER null, -- Example Values: `2`, `5`, `0`, `1`, `4` | Value Statics: Total count 493 - Distinct count 14 - Null count 1115 last_name TEXT null, -- primary key (playerID, season_id), turnovers INTEGER null, -- Example Values: `1`, `0`, `3`, `2`, `4` | Value Statics: Total count 493 - Distinct count 9 - Null count 1115 three_made INTEGER null, -- Example Values: `0`, `1`, `3`, `5`, `4` | Value Statics: Total count 566 - Distinct count 7 - Null count 1042 minutes INTEGER null, -- blocks INTEGER null, -- Example Values: `2`, `0`, `1`, `3`, `5` | Value Statics: Total count 398 - Distinct count 6 - Null count 1210 three_attempted INTEGER null, -- Example Values: `0`, `1`, `6`, `7`, `10` | Value Statics: Total count 540 - Distinct count 12 - Null count 1068 o_rebounds INTEGER null, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 493 - Distinct count 10 - Null count 1115 ); CREATE TABLE awards_players ( foreign key (playerID) references players (playerID) on update cascade on delete cascade, year INTEGER not null, -- pos TEXT null, -- Example Values: `C`, `F`, `G`, `F/G`, `F/C` | Value Statics: Total count 833 - Distinct count 5 - Null count 886 primary key (playerID, year, award), lgID TEXT null, -- Example Values: `NBA`, `ABA`, `NBL`, `ABL1` | Value Statics: Total count 1719 - Distinct count 4 - Null count 0 award TEXT not null, -- playerID TEXT not null, -- note TEXT null, -- Example Values: `tie` | Value Statics: Total count 37 - Distinct count 1 - Null count 1682 ); CREATE TABLE series_post ( tmIDLoser TEXT, -- id INTEGER primary key autoincrement, series TEXT, -- Example Values: `O`, `M`, `N`, `A`, `K` | Value Statics: Total count 775 - Distinct count 11 - Null count 0 tmIDWinner TEXT, -- round TEXT, -- Example Values: `F`, `QF`, `SF`, `DT`, `DF` | Value Statics: Total count 775 - Distinct count 11 - Null count 0 year INTEGER, -- foreign key (tmIDLoser, year) references teams (tmID, year) on update cascade on delete cascade, foreign key (tmIDWinner, year) references teams (tmID, year) on update cascade on delete cascade, W INTEGER, -- Example Values: `4`, `2`, `1`, `3`, `0` | Value Statics: Total count 775 - Distinct count 5 - Null count 0 lgIDLoser TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0 lgIDWinner TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0 L INTEGER, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 775 - Distinct count 5 - Null count 0 ); CREATE TABLE players ( nameGiven TEXT null, -- Example Values: `nameGiven`, `Mort`, `Robert`, `Jim`, `Mike` | Value Statics: Total count 10 - Distinct count 9 - Null count 5052 lastseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15 hsCountry TEXT null, -- firstName TEXT null, -- hsCity TEXT null, -- firstseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15 weight INTEGER null, -- birthCountry TEXT null, -- race TEXT null, -- Example Values: `B`, `W`, `O`, `1`, `r` | Value Statics: Total count 4903 - Distinct count 5 - Null count 159 lastName TEXT null, -- birthDate DATE null, -- collegeOther TEXT null, -- birthState TEXT null, -- useFirst TEXT null, -- pos TEXT null, -- Example Values: `F-C`, `C`, `G`, `G-F`, `C-F` | Value Statics: Total count 4880 - Distinct count 14 - Null count 182 playerID TEXT not null primary key, college TEXT null, -- highSchool TEXT null, -- hsState TEXT null, -- height REAL null, -- deathDate DATE null, -- nameSuffix TEXT null, -- Example Values: `Jr.`, `III`, `nameSuffix`, `II`, `IV` | Value Statics: Total count 324 - Distinct count 6 - Null count 4738 nameNick TEXT null, -- fullGivenName TEXT null, -- birthCity TEXT null, -- middleName TEXT null, -- ); CREATE TABLE teams ( d_pts INTEGER null, -- name TEXT null, -- homeLost INTEGER null, -- o_ftm INTEGER null, -- franchID TEXT null, -- tmID TEXT not null, -- awayWon INTEGER null, -- primary key (year, tmID), o_fgm INTEGER null, -- year INTEGER not null, -- awayLost INTEGER null, -- arena TEXT null, -- confID TEXT null, -- Example Values: `EC`, `WC` | Value Statics: Total count 1064 - Distinct count 2 - Null count 472 games INTEGER null, -- lost INTEGER null, -- divID TEXT null, -- Example Values: `EA`, `WE`, `ED`, `WD`, `SO` | Value Statics: Total count 1498 - Distinct count 13 - Null count 38 lgID TEXT null, -- Example Values: `NBL`, `NBA`, `PBLA`, `NPBL`, `ABL1` | Value Statics: Total count 1536 - Distinct count 6 - Null count 0 homeWon INTEGER null, -- confRank INTEGER null, -- Example Values: `0`, `4`, `3`, `5`, `7` | Value Statics: Total count 1536 - Distinct count 16 - Null count 0 o_pts INTEGER null, -- `rank` INTEGER null, -- Example Values: `1`, `2`, `4`, `5`, `6` | Value Statics: Total count 1536 - Distinct count 10 - Null count 0 playoff TEXT null, -- Example Values: `CF`, `WC`, `LC`, `CS`, `F` | Value Statics: Total count 901 - Distinct count 15 - Null count 635 won INTEGER null, -- ); CREATE TABLE coaches ( primary key (coachID, year, tmID, stint), lgID TEXT null, -- Example Values: `NBA`, `ABA`, `ABL1`, `PBLA`, `NPBL` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0 post_losses INTEGER null, -- Example Values: `3`, `9`, `7`, `8`, `0` | Value Statics: Total count 1649 - Distinct count 12 - Null count 40 year INTEGER not null, -- won INTEGER null, -- foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade, post_wins INTEGER null, -- Example Values: `0`, `12`, `9`, `13`, `1` | Value Statics: Total count 1649 - Distinct count 17 - Null count 40 coachID TEXT not null, -- tmID TEXT not null, -- lost INTEGER null, -- stint INTEGER not null, -- Example Values: `2`, `1`, `4`, `5`, `3` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0 );
superstore
Which customer ordered 'Global High-Back Leather Tilter, Burgundy' on 10/13/2013 in the East region?
'Global High-Back Leather Tilter, Burgundy' is the "Product Name"; on 10/13/2013 refers to "Order Date" = Date('2013-10-13'); Region = 'East'
SELECT DISTINCT T2.`Customer Name` FROM east_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` = 'Global High-Back Leather Tilter, Burgundy' AND T1.`Order Date` = '2013-10-13' AND T1.Region = 'East'
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
Mention the person ID of faculty professor who taught course ID 104 and the course level.
person ID refers to person.p_id; faculty professor refers to professor = 1 and hasPosition ! = 0
SELECT T1.p_id, T3.courseLevel FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T3.course_id = 104 AND T1.hasPosition <> 0
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
List all members and member type of the Islamic Development Bank.
null
SELECT T2.Country, T2.Type FROM organization AS T1 INNER JOIN isMember AS T2 ON T1.Abbreviation = T2.Organization INNER JOIN country AS T3 ON T2.Country = T3.Code WHERE T1.Name = 'Islamic Development Bank'
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200 ); CREATE TABLE river ( River TEXT, -- Mountains TEXT, -- SourceAltitude REAL, -- Length REAL, -- EstuaryLatitude REAL, -- SourceLongitude REAL, -- Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, -- EstuaryLongitude REAL, -- Sea TEXT, -- Name TEXT default '' not null primary key, SourceLatitude REAL, -- ); CREATE TABLE mountainOnIsland ( Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, -- primary key (Mountain, Island), Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, -- ); CREATE TABLE organization ( City TEXT, -- constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, -- constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade, Abbreviation TEXT not null primary key, Province TEXT, -- Name TEXT not null constraint ix_organization_OrgNameUnique unique, -- Established DATE, -- ); CREATE TABLE geo_desert ( Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, -- Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, -- constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, Desert), ); CREATE TABLE geo_source ( River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, -- constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, -- Province TEXT default '' not null, -- primary key (Province, Country, River), ); CREATE TABLE geo_sea ( Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, -- Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, -- constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, Sea), Province TEXT default '' not null, -- ); CREATE TABLE geo_estuary ( primary key (Province, Country, River), River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, -- constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, -- ); CREATE TABLE located ( River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, -- constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, -- Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, -- Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, -- constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade, City TEXT, -- Province TEXT, -- ); CREATE TABLE lake ( Depth REAL, -- Altitude REAL, -- Name TEXT default '' not null primary key, Longitude REAL, -- Latitude REAL, -- Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74 River TEXT, -- Area REAL, -- ); CREATE TABLE desert ( Longitude REAL, -- Area REAL, -- Name TEXT default '' not null primary key, Latitude REAL, -- ); CREATE TABLE geo_mountain ( Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, -- primary key (Province, Country, Mountain), Province TEXT default '' not null, -- constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, -- ); CREATE TABLE ethnicGroup ( primary key (Name, Country), Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, -- Name TEXT default '' not null, -- Percentage REAL, -- ); CREATE TABLE economy ( Industry REAL, -- GDP REAL, -- Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade, Inflation REAL, -- Service REAL, -- Agriculture REAL, -- ); CREATE TABLE borders ( primary key (Country1, Country2), Country2 TEXT default '' not null constraint borders_ibfk_2 references country, -- Length REAL, -- Country1 TEXT default '' not null constraint borders_ibfk_1 references country, -- ); CREATE TABLE language ( primary key (Name, Country), Name TEXT default '' not null, -- Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- ); CREATE TABLE islandIn ( Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, -- River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349 Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, -- Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344 ); CREATE TABLE country ( Area REAL, -- Capital TEXT, -- Population INTEGER, -- Name TEXT not null constraint ix_county_Name unique, -- Province TEXT, -- Code TEXT default '' not null primary key, ); CREATE TABLE city ( Longitude REAL, -- constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Population INTEGER, -- Province TEXT default '' not null, -- primary key (Name, Province), Name TEXT default '' not null, -- Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, -- Latitude REAL, -- ); CREATE TABLE island ( Name TEXT default '' not null primary key, Islands TEXT, -- Area REAL, -- Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185 Longitude REAL, -- Height REAL, -- Latitude REAL, -- ); CREATE TABLE geo_lake ( constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, -- Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, -- primary key (Province, Country, Lake), Province TEXT default '' not null, -- ); CREATE TABLE mountain ( Longitude REAL, -- Name TEXT default '' not null primary key, Latitude REAL, -- Type TEXT, -- Height REAL, -- Mountains TEXT, -- ); CREATE TABLE province ( Capital TEXT, -- Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, -- primary key (Name, Country), Population INTEGER, -- Area REAL, -- Name TEXT not null, -- CapProv TEXT, -- ); CREATE TABLE population ( Infant_Mortality REAL, -- Population_Growth REAL, -- Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade, ); CREATE TABLE isMember ( primary key (Country, Organization), Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, -- Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, -- Type TEXT default 'member', -- ); CREATE TABLE locatedOn ( Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, -- Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, -- Province TEXT default '' not null, -- primary key (City, Province, Country, Island), constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade, City TEXT default '' not null, -- ); CREATE TABLE mergesWith ( Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, -- Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, -- primary key (Sea1, Sea2), ); CREATE TABLE encompasses ( Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0 Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0 primary key (Country, Continent), ); CREATE TABLE continent ( Name TEXT default '' not null primary key, Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 ); CREATE TABLE religion ( primary key (Name, Country), Name TEXT default '' not null, -- Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, -- Percentage REAL, -- ); CREATE TABLE geo_river ( constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, primary key (Province, Country, River), Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, -- River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, -- ); CREATE TABLE sea ( Depth REAL, -- Name TEXT default '' not null primary key, ); CREATE TABLE target ( Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade, Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0 ); CREATE TABLE geo_island ( Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, -- primary key (Province, Country, Island), Province TEXT default '' not null, -- Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, -- constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade, );
retail_world
How many orders have Margaret Peacock placed?
null
SELECT COUNT(T2.EmployeeID) FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T1.FirstName = 'Margaret' AND T1.LastName = 'Peacock'
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 all the coatches of the Oklahoma City Thunder
coach refers to coachID; Oklahoma City Thunder refers to name = 'Oklahoma City Thunder'
SELECT DISTINCT coachID FROM coaches AS T1 INNER JOIN teams AS T2 ON T1.tmID = T2.tmID WHERE name = 'Oklahoma City Thunder'
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 total sales of 'Avery Hi-Liter EverBold Pen Style Fluorescent Highlighters, 4/Pack' in the Central region?
'Avery Hi-Liter EverBold Pen Style Fluorescent Highlighters, 4/Pack' is the "Product Name";
SELECT SUM(T1.Sales) FROM central_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T2.`Product Name` = 'Avery Hi-Liter EverBold Pen Style Fluorescent Highlighters, 4/Pack' 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 gender is more prone to 'dander (animal) allergy'?
gender who is more prone to dander (animal) allergy refers to MAX(COUNT(Gender WHERE allergies.DESCRIPTION = 'Dander (animal) allergy'));
SELECT T1.gender FROM patients AS T1 INNER JOIN allergies AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Dander (animal) allergy' GROUP BY T1.gender ORDER BY COUNT(T1.gender) 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
Among the country member of 'IOC' organization, which country has the most population?
null
SELECT T2.Name FROM isMember AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code WHERE T1.Organization = 'IOC' ORDER BY T2.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
Where are the ship countries of orders placed by Janet Leverling?
null
SELECT DISTINCT T2.ShipCountry FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T1.FirstName = 'Janet' AND T1.LastName = 'Leverling'
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
State all countries with border greater than 4,000. List the full country name.
null
SELECT T1.Name FROM country AS T1 INNER JOIN borders AS T2 ON T1.Code = T2.Country1 WHERE T2.Length > 4000
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 customer ids who placed order with Michael Suyama.
null
SELECT T2.CustomerID FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T1.FirstName = 'Michael' AND T1.LastName = 'Suyama'
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 drafted from round 1 in 1973 but not born in USA.
full name refers to firstName, middleName, lastName; in 1973 refers to year = 1973; not born in USA refers to birthCountry <> 'USA'
SELECT T1.firstName, T1.middleName, T1.lastName FROM players AS T1 INNER JOIN draft AS T2 ON T1.playerID = T2.playerID WHERE T2.draftRound = 1 AND T1.birthCountry != 'USA' AND T2.draftYear = 1973
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 item ordered by Jonathan Doherty with the highest quantity in the East region.
Jonathan Doherty is the "Customer Name"; highest quantity refers to MAX(Quantity); Region = 'East'
SELECT T3.`Product Name` FROM east_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T1.`Product ID` WHERE T2.`Customer Name` = 'Jonathan Doherty' AND T2.Region = 'East' 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 );
mondial_geo
Name all countries in which have border with Bulgaria.
Bulgaria is a country name
SELECT T3.Name FROM country AS T1 INNER JOIN borders AS T2 ON T1.Code = T2.Country1 INNER JOIN country AS T3 ON T3.Code = T2.Country2 WHERE T1.Name = 'Bulgaria'
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 notes of employee with the highest salary.
highest salary refers to Max(Salary)
SELECT Notes FROM Employees WHERE Salary = ( SELECT MAX(Salary) FROM Employees )
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
synthea
Indicate the full name of the patients who have 3 different allergies.
full name refers to first, last; have 3 different allergies refer to allergies where COUNT(DESCRIPTION) > 3;
SELECT T1.first, T1.last FROM patients AS T1 INNER JOIN allergies AS T2 ON T1.patient = T2.PATIENT GROUP BY T1.patient ORDER BY COUNT(DISTINCT T2.DESCRIPTION) > 3
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
List the professor ID who taught the course ID from 121 to 130 of basic undergraduate courses.
professor ID refers to taughtBy.p_id; course ID from 121 to 130 of basic undergraduate courses refers to courseLevel = 'Level_300' and course.course_id between 121 and 130
SELECT T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_300' AND T1.course_id > 121 AND T1.course_id < 130
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 2 countries' border span across the longest length? Provide the country's full name.
null
SELECT T1.Name, T3.Name FROM country AS T1 INNER JOIN borders AS T2 ON T1.Code = T2.Country1 INNER JOIN country AS T3 ON T3.Code = T2.Country2 ORDER BY T2.Length 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
Is (206) 555-1189 the home phone number for Laura Callahan?
"Laura Callahan" refers to FirstName = 'Laura AND LastName = 'Callahan
SELECT CASE WHEN HomePhone = '(206) 555-1189' THEN 'YES' ELSE 'NO' END FROM Employees WHERE FirstName = 'Laura' AND LastName = 'Callahan'
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 year, team and coach that with winning rate of above 75%.
team refers to teams.name; coach refers to coachID; winning rate of above 75% refers to divide(won, add(won, lost)) > 0.75
SELECT DISTINCT T1.year, T2.name, T1.coachID FROM coaches AS T1 INNER JOIN teams AS T2 ON T1.tmID = T2.tmID WHERE CAST(T1.won AS REAL) / CAST((T1.won + T1.lost) AS REAL) > 0.75
CREATE TABLE players_teams ( PostGS INTEGER, -- PostdRebounds INTEGER, -- PostPF INTEGER, -- tmID TEXT, -- threeAttempted INTEGER, -- PostRebounds INTEGER, -- assists INTEGER, -- threeMade INTEGER, -- PostBlocks INTEGER, -- PostTurnovers INTEGER, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NBA`, `NBL`, `ABA`, `ABL1`, `NPBL` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0 foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade, PostfgMade INTEGER, -- steals INTEGER, -- oRebounds INTEGER, -- PostftAttempted INTEGER, -- ftAttempted INTEGER, -- ftMade INTEGER, -- points INTEGER, -- PostfgAttempted INTEGER, -- PostftMade INTEGER, -- note TEXT, -- Example Values: `C` | Value Statics: Total count 43 - Distinct count 1 - Null count 23708 dRebounds INTEGER, -- PostSteals INTEGER, -- blocks INTEGER, -- PostAssists INTEGER, -- minutes INTEGER, -- fgAttempted INTEGER, -- playerID TEXT not null references players on update cascade on delete cascade, -- PostthreeMade INTEGER, -- PostPoints INTEGER, -- year INTEGER, -- PF INTEGER, -- fgMade INTEGER, -- PostthreeAttempted INTEGER, -- rebounds INTEGER, -- id INTEGER primary key autoincrement, stint INTEGER, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0 PostMinutes INTEGER, -- PostGP INTEGER, -- turnovers INTEGER, -- PostoRebounds INTEGER, -- GS INTEGER, -- ); CREATE TABLE awards_coaches ( award TEXT, -- Example Values: `NBA Coach of the Year`, `ABA Coach of the Year` | Value Statics: Total count 61 - Distinct count 2 - Null count 0 id INTEGER primary key autoincrement, note TEXT, -- Example Values: `tie` | Value Statics: Total count 4 - Distinct count 1 - Null count 57 coachID TEXT, -- lgID TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 61 - Distinct count 2 - Null count 0 foreign key (coachID, year) references coaches (coachID, year) on update cascade on delete cascade, year INTEGER, -- ); CREATE TABLE draft ( draftOverall INTEGER null, -- lgID TEXT null, -- Example Values: `ABA`, `NBA` | Value Statics: Total count 8621 - Distinct count 2 - Null count 0 suffixName TEXT null, -- Example Values: `Jr.` | Value Statics: Total count 2 - Distinct count 1 - Null count 8619 draftYear INTEGER null, -- draftSelection INTEGER null, -- tmID TEXT null, -- draftRound INTEGER null, -- lastName TEXT null, -- playerID TEXT null, -- draftFrom TEXT null, -- id INTEGER default 0 not null primary key, firstName TEXT null, -- foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade, foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade, ); CREATE TABLE player_allstar ( rebounds INTEGER null, -- playerID TEXT not null, -- season_id INTEGER not null, -- assists INTEGER null, -- conference TEXT null, -- Example Values: `East`, `West`, `Weset`, `Allstars`, `Denver` | Value Statics: Total count 1608 - Distinct count 5 - Null count 0 points INTEGER null, -- personal_fouls INTEGER null, -- Example Values: `3`, `2`, `0`, `1`, `5` | Value Statics: Total count 540 - Distinct count 8 - Null count 1068 ft_attempted INTEGER null, -- Example Values: `2`, `4`, `0`, `6`, `3` | Value Statics: Total count 1561 - Distinct count 17 - Null count 47 fg_attempted INTEGER null, -- league_id TEXT null, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 1608 - Distinct count 2 - Null count 0 foreign key (playerID) references players (playerID) on update cascade on delete cascade, fg_made INTEGER null, -- Example Values: `4`, `8`, `5`, `7`, `3` | Value Statics: Total count 1561 - Distinct count 18 - Null count 47 ft_made INTEGER null, -- Example Values: `2`, `3`, `0`, `1`, `4` | Value Statics: Total count 1561 - Distinct count 13 - Null count 47 steals INTEGER null, -- Example Values: `3`, `0`, `1`, `2`, `5` | Value Statics: Total count 398 - Distinct count 7 - Null count 1210 games_played INTEGER null, -- Example Values: `1` | Value Statics: Total count 1608 - Distinct count 1 - Null count 0 first_name TEXT null, -- d_rebounds INTEGER null, -- Example Values: `2`, `5`, `0`, `1`, `4` | Value Statics: Total count 493 - Distinct count 14 - Null count 1115 last_name TEXT null, -- primary key (playerID, season_id), turnovers INTEGER null, -- Example Values: `1`, `0`, `3`, `2`, `4` | Value Statics: Total count 493 - Distinct count 9 - Null count 1115 three_made INTEGER null, -- Example Values: `0`, `1`, `3`, `5`, `4` | Value Statics: Total count 566 - Distinct count 7 - Null count 1042 minutes INTEGER null, -- blocks INTEGER null, -- Example Values: `2`, `0`, `1`, `3`, `5` | Value Statics: Total count 398 - Distinct count 6 - Null count 1210 three_attempted INTEGER null, -- Example Values: `0`, `1`, `6`, `7`, `10` | Value Statics: Total count 540 - Distinct count 12 - Null count 1068 o_rebounds INTEGER null, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 493 - Distinct count 10 - Null count 1115 ); CREATE TABLE awards_players ( foreign key (playerID) references players (playerID) on update cascade on delete cascade, year INTEGER not null, -- pos TEXT null, -- Example Values: `C`, `F`, `G`, `F/G`, `F/C` | Value Statics: Total count 833 - Distinct count 5 - Null count 886 primary key (playerID, year, award), lgID TEXT null, -- Example Values: `NBA`, `ABA`, `NBL`, `ABL1` | Value Statics: Total count 1719 - Distinct count 4 - Null count 0 award TEXT not null, -- playerID TEXT not null, -- note TEXT null, -- Example Values: `tie` | Value Statics: Total count 37 - Distinct count 1 - Null count 1682 ); CREATE TABLE series_post ( tmIDLoser TEXT, -- id INTEGER primary key autoincrement, series TEXT, -- Example Values: `O`, `M`, `N`, `A`, `K` | Value Statics: Total count 775 - Distinct count 11 - Null count 0 tmIDWinner TEXT, -- round TEXT, -- Example Values: `F`, `QF`, `SF`, `DT`, `DF` | Value Statics: Total count 775 - Distinct count 11 - Null count 0 year INTEGER, -- foreign key (tmIDLoser, year) references teams (tmID, year) on update cascade on delete cascade, foreign key (tmIDWinner, year) references teams (tmID, year) on update cascade on delete cascade, W INTEGER, -- Example Values: `4`, `2`, `1`, `3`, `0` | Value Statics: Total count 775 - Distinct count 5 - Null count 0 lgIDLoser TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0 lgIDWinner TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0 L INTEGER, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 775 - Distinct count 5 - Null count 0 ); CREATE TABLE players ( nameGiven TEXT null, -- Example Values: `nameGiven`, `Mort`, `Robert`, `Jim`, `Mike` | Value Statics: Total count 10 - Distinct count 9 - Null count 5052 lastseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15 hsCountry TEXT null, -- firstName TEXT null, -- hsCity TEXT null, -- firstseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15 weight INTEGER null, -- birthCountry TEXT null, -- race TEXT null, -- Example Values: `B`, `W`, `O`, `1`, `r` | Value Statics: Total count 4903 - Distinct count 5 - Null count 159 lastName TEXT null, -- birthDate DATE null, -- collegeOther TEXT null, -- birthState TEXT null, -- useFirst TEXT null, -- pos TEXT null, -- Example Values: `F-C`, `C`, `G`, `G-F`, `C-F` | Value Statics: Total count 4880 - Distinct count 14 - Null count 182 playerID TEXT not null primary key, college TEXT null, -- highSchool TEXT null, -- hsState TEXT null, -- height REAL null, -- deathDate DATE null, -- nameSuffix TEXT null, -- Example Values: `Jr.`, `III`, `nameSuffix`, `II`, `IV` | Value Statics: Total count 324 - Distinct count 6 - Null count 4738 nameNick TEXT null, -- fullGivenName TEXT null, -- birthCity TEXT null, -- middleName TEXT null, -- ); CREATE TABLE teams ( d_pts INTEGER null, -- name TEXT null, -- homeLost INTEGER null, -- o_ftm INTEGER null, -- franchID TEXT null, -- tmID TEXT not null, -- awayWon INTEGER null, -- primary key (year, tmID), o_fgm INTEGER null, -- year INTEGER not null, -- awayLost INTEGER null, -- arena TEXT null, -- confID TEXT null, -- Example Values: `EC`, `WC` | Value Statics: Total count 1064 - Distinct count 2 - Null count 472 games INTEGER null, -- lost INTEGER null, -- divID TEXT null, -- Example Values: `EA`, `WE`, `ED`, `WD`, `SO` | Value Statics: Total count 1498 - Distinct count 13 - Null count 38 lgID TEXT null, -- Example Values: `NBL`, `NBA`, `PBLA`, `NPBL`, `ABL1` | Value Statics: Total count 1536 - Distinct count 6 - Null count 0 homeWon INTEGER null, -- confRank INTEGER null, -- Example Values: `0`, `4`, `3`, `5`, `7` | Value Statics: Total count 1536 - Distinct count 16 - Null count 0 o_pts INTEGER null, -- `rank` INTEGER null, -- Example Values: `1`, `2`, `4`, `5`, `6` | Value Statics: Total count 1536 - Distinct count 10 - Null count 0 playoff TEXT null, -- Example Values: `CF`, `WC`, `LC`, `CS`, `F` | Value Statics: Total count 901 - Distinct count 15 - Null count 635 won INTEGER null, -- ); CREATE TABLE coaches ( primary key (coachID, year, tmID, stint), lgID TEXT null, -- Example Values: `NBA`, `ABA`, `ABL1`, `PBLA`, `NPBL` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0 post_losses INTEGER null, -- Example Values: `3`, `9`, `7`, `8`, `0` | Value Statics: Total count 1649 - Distinct count 12 - Null count 40 year INTEGER not null, -- won INTEGER null, -- foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade, post_wins INTEGER null, -- Example Values: `0`, `12`, `9`, `13`, `1` | Value Statics: Total count 1649 - Distinct count 17 - Null count 40 coachID TEXT not null, -- tmID TEXT not null, -- lost INTEGER null, -- stint INTEGER not null, -- Example Values: `2`, `1`, `4`, `5`, `3` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0 );
superstore
Which item was shipped on 3/4/2013 and scheduled for same day delivery in the South region?
shipped on 3/4/2013 refers to "Order Date" = date('2013-03-04'); same day delivery refers to "Ship Mode" = 'Same Day'; item refers to "Product Name"
SELECT T2.`Product Name` FROM south_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T1.`Ship Date` = '2013-03-04' AND T2.Region = 'South' AND T1.`Order Date` = '2013-03-04'
CREATE TABLE west_superstore ( Profit REAL, -- Region TEXT, -- Example Values: `West` | Value Statics: Total count 6406 - Distinct count 1 - Null count 0 "Product ID" TEXT, -- foreign key ("Product ID", Region) references product("Product ID",Region), "Order Date" DATE, -- foreign key ("Customer ID", Region) references people("Customer ID",Region), "Ship Mode" TEXT, -- Example Values: `Second Class`, `Standard Class`, `First Class`, `Same Day` | Value Statics: Total count 6406 - Distinct count 4 - Null count 0 "Customer ID" TEXT, -- "Order ID" TEXT, -- "Row ID" INTEGER primary key, Sales REAL, -- Quantity INTEGER, -- Example Values: `3`, `5`, `4`, `10`, `2` | Value Statics: Total count 6406 - Distinct count 14 - Null count 0 Discount REAL, -- Example Values: `0.0`, `0.15`, `0.2`, `0.7`, `0.5` | Value Statics: Total count 6406 - Distinct count 5 - Null count 0 "Ship Date" DATE, -- ); CREATE TABLE people ( Region TEXT, -- Example Values: `Central`, `East`, `West`, `South` | Value Statics: Total count 2501 - Distinct count 4 - Null count 0 Country TEXT, -- Example Values: `United States` | Value Statics: Total count 2501 - Distinct count 1 - Null count 0 State TEXT, -- primary key ("Customer ID", Region), City TEXT, -- Segment TEXT, -- Example Values: `Consumer`, `Home Office`, `Corporate` | Value Statics: Total count 2501 - Distinct count 3 - Null count 0 "Customer ID" TEXT, -- "Postal Code" INTEGER, -- "Customer Name" TEXT, -- ); CREATE TABLE product ( "Product ID" TEXT, -- Region TEXT, -- Example Values: `Central`, `South`, `West`, `East` | Value Statics: Total count 5298 - Distinct count 4 - Null count 0 "Sub-Category" TEXT, -- Example Values: `Bookcases`, `Chairs`, `Furnishings`, `Tables`, `Appliances` | Value Statics: Total count 5298 - Distinct count 17 - Null count 0 Category TEXT, -- Example Values: `Furniture`, `Office Supplies`, `Technology` | Value Statics: Total count 5298 - Distinct count 3 - Null count 0 "Product Name" TEXT, -- primary key ("Product ID", Region), ); CREATE TABLE central_superstore ( "Ship Mode" TEXT, -- Example Values: `Standard Class`, `First Class`, `Second Class`, `Same Day` | Value Statics: Total count 4646 - Distinct count 4 - Null count 0 Quantity INTEGER, -- Example Values: `2`, `3`, `7`, `1`, `5` | Value Statics: Total count 4646 - Distinct count 14 - Null count 0 "Ship Date" DATE, -- "Order Date" DATE, -- "Order ID" TEXT, -- "Row ID" INTEGER primary key, "Product ID" TEXT, -- foreign key ("Customer ID", Region) references people("Customer ID",Region), Sales REAL, -- foreign key ("Product ID", Region) references product("Product ID",Region), Profit REAL, -- "Customer ID" TEXT, -- Discount REAL, -- Example Values: `0.2`, `0.8`, `0.6`, `0.0`, `0.1` | Value Statics: Total count 4646 - Distinct count 9 - Null count 0 Region TEXT, -- Example Values: `Central` | Value Statics: Total count 4646 - Distinct count 1 - Null count 0 ); CREATE TABLE east_superstore ( "Row ID" INTEGER primary key, Region TEXT, -- Example Values: `East` | Value Statics: Total count 5696 - Distinct count 1 - Null count 0 "Order ID" TEXT, -- "Product ID" TEXT, -- Sales REAL, -- foreign key ("Product ID", Region) references product("Product ID",Region), Discount REAL, -- Example Values: `0.2`, `0.0`, `0.7`, `0.5`, `0.4` | Value Statics: Total count 5696 - Distinct count 7 - Null count 0 Quantity INTEGER, -- Example Values: `3`, `2`, `7`, `4`, `6` | Value Statics: Total count 5696 - Distinct count 14 - Null count 0 Profit REAL, -- foreign key ("Customer ID", Region) references people("Customer ID",Region), "Ship Mode" TEXT, -- Example Values: `Standard Class`, `First Class`, `Second Class`, `Same Day` | Value Statics: Total count 5696 - Distinct count 4 - Null count 0 "Customer ID" TEXT, -- "Order Date" DATE, -- "Ship Date" DATE, -- ); CREATE TABLE south_superstore ( "Product ID" TEXT, -- Profit REAL, -- Sales REAL, -- "Order Date" DATE, -- "Customer ID" TEXT, -- Discount REAL, -- Example Values: `0.0`, `0.7`, `0.2`, `0.5`, `0.45` | Value Statics: Total count 3240 - Distinct count 6 - Null count 0 Region TEXT, -- Example Values: `South` | Value Statics: Total count 3240 - Distinct count 1 - Null count 0 "Ship Date" DATE, -- foreign key ("Product ID", Region) references product("Product ID",Region), foreign key ("Customer ID", Region) references people("Customer ID",Region), Quantity INTEGER, -- Example Values: `3`, `9`, `2`, `4`, `1` | Value Statics: Total count 3240 - Distinct count 14 - Null count 0 "Order ID" TEXT, -- "Row ID" INTEGER primary key, "Ship Mode" TEXT, -- Example Values: `First Class`, `Standard Class`, `Second Class`, `Same Day` | Value Statics: Total count 3240 - Distinct count 4 - Null count 0 );
synthea
How many patients with a body weight of more than 100 kg have a 'diabetes self-management plan' care plan?
body weight of more than 100 kg refers to observations.DESCRIPTION = 'Body Weight' AND observations.VALUE > 100 AND observations.UNITS = 'kg'; diabetes self-management plan refers to careplans.DESCRIPTION = 'Diabetes self management plan';
SELECT COUNT(DISTINCT T2.patient) FROM careplans AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient INNER JOIN observations AS T3 ON T2.patient = T3.PATIENT WHERE T3.DESCRIPTION = 'Body Weight' AND T1.DESCRIPTION = 'Diabetes self management plan' AND T3.VALUE > 100 AND T3.UNITS = 'kg'
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE DATE, -- primary key (DATE, PATIENT, ENCOUNTER, CODE), DESCRIPTION TEXT, -- Example Values: `Influenza seasonal injectable preservative free`, `Td (adult) preservative free`, `meningococcal MCV4P`, `Tdap`, `HPV quadrivalent` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 ); CREATE TABLE allergies ( CODE INTEGER, -- Example Values: `232347008`, `300916003`, `419474003`, `424213003`, `300913006` | Value Statics: Total count 572 - Distinct count 15 - Null count 0 foreign key (ENCOUNTER) references encounters(ID), foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- primary key (PATIENT, ENCOUNTER, CODE), STOP TEXT, -- Example Values: `12/22/14`, `4/21/10`, `10/15/11`, `3/17/10`, `5/26/08` | Value Statics: Total count 16 - Distinct count 11 - Null count 556 START TEXT, -- DESCRIPTION TEXT, -- Example Values: `Allergy to dairy product`, `Allergy to tree pollen`, `Allergy to grass pollen`, `Dander (animal) allergy`, `House dust mite allergy` | Value Statics: Total count 572 - Distinct count 15 - Null count 0 ); CREATE TABLE observations ( DATE DATE, -- ENCOUNTER TEXT, -- VALUE REAL, -- UNITS TEXT, -- Example Values: `cm`, `kg`, `kg/m2`, `mmHg`, `Cel` | Value Statics: Total count 78444 - Distinct count 17 - Null count 455 DESCRIPTION TEXT, -- CODE TEXT, -- PATIENT TEXT, -- foreign key (PATIENT) references patients(patient), foreign key (ENCOUNTER) references encounters(ID), ); CREATE TABLE medications ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- PATIENT TEXT, -- STOP DATE, -- START DATE, -- REASONDESCRIPTION TEXT, -- DESCRIPTION TEXT, -- primary key (START, PATIENT, ENCOUNTER, CODE), foreign key (PATIENT) references patients(patient), REASONCODE INTEGER, -- ENCOUNTER TEXT, -- ); CREATE TABLE careplans ( START DATE, -- STOP DATE, -- ID TEXT, -- REASONCODE INTEGER, -- REASONDESCRIPTION TEXT, -- foreign key (PATIENT) references patients(patient), PATIENT TEXT, -- DESCRIPTION TEXT, -- CODE REAL, -- ENCOUNTER TEXT, -- foreign key (ENCOUNTER) references encounters(ID), ); CREATE TABLE encounters ( DATE DATE, -- REASONCODE INTEGER, -- CODE INTEGER, -- ID TEXT primary key, DESCRIPTION TEXT, -- foreign key (PATIENT) references patients(patient), PATIENT TEXT, -- REASONDESCRIPTION TEXT, -- ); CREATE TABLE procedures ( foreign key (PATIENT) references patients(patient), REASONDESCRIPTION TEXT, -- PATIENT TEXT, -- foreign key (ENCOUNTER) references encounters(ID), DATE DATE, -- DESCRIPTION TEXT, -- ENCOUNTER TEXT, -- CODE INTEGER, -- REASONCODE INTEGER, -- ); CREATE TABLE patients ( suffix TEXT, -- Example Values: `PhD`, `JD`, `MD` | Value Statics: Total count 45 - Distinct count 3 - Null count 1417 prefix TEXT, -- Example Values: `Mr.`, `Mrs.`, `Ms.` | Value Statics: Total count 1166 - Distinct count 3 - Null count 296 deathdate DATE, -- ethnicity TEXT, -- race TEXT, -- Example Values: `black`, `white`, `hispanic`, `asian` | Value Statics: Total count 1462 - Distinct count 4 - Null count 0 address TEXT, -- birthplace TEXT, -- passport TEXT, -- maiden TEXT, -- birthdate DATE, -- marital TEXT, -- Example Values: `S`, `M` | Value Statics: Total count 1033 - Distinct count 2 - Null count 429 gender TEXT, -- Example Values: `F`, `M` | Value Statics: Total count 1462 - Distinct count 2 - Null count 0 drivers TEXT, -- first TEXT, -- last TEXT, -- patient TEXT primary key, ssn TEXT, -- ); CREATE TABLE claims ( ENCOUNTER TEXT references encounters, -- PATIENT TEXT references patients, -- ORGANIZATION TEXT, -- Example Values: `temp organization` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0 TOTAL INTEGER, -- Example Values: `100` | Value Statics: Total count 20523 - Distinct count 1 - Null count 0 BILLABLEPERIOD DATE, -- DIAGNOSIS TEXT, -- ID TEXT primary key, ); CREATE TABLE conditions ( START DATE, -- DESCRIPTION TEXT, -- foreign key (PATIENT) references patients(patient), PATIENT TEXT, -- CODE INTEGER, -- ENCOUNTER TEXT, -- STOP DATE, -- foreign key (ENCOUNTER) references encounters(ID), foreign key (DESCRIPTION) references all_prevalences(ITEM), ); CREATE TABLE all_prevalences ( "POPULATION TYPE" TEXT, -- Example Values: `LIVING` | Value Statics: Total count 244 - Distinct count 1 - Null count 0 "POPULATION COUNT" INTEGER, -- Example Values: `1000` | Value Statics: Total count 244 - Distinct count 1 - Null count 0 ITEM TEXT primary key, "PREVALENCE PERCENTAGE" REAL, -- "PREVALENCE RATE" REAL, -- OCCURRENCES INTEGER, -- );
computer_student
Describe the course level and list of person IDs who taught course ID of 147.
person IDs refers to taughtBy.p_id; course ID of 147 refers to course.course_id = 147
SELECT T1.courseLevel, T1.course_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.p_id = 141
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
List all the organisations that where its name contains 'United Nation'. State its full name and its headquarter city.
null
SELECT Name, City FROM organization WHERE Name LIKE '%United Nation%'
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 total salary for employees from UK.
"UK" is the Country; total salary refers to Sum(Salary)
SELECT SUM(Salary) FROM Employees WHERE Country = 'UK'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
professional_basketball
How many players, in games played in 1990, achieved 50% or less of oRebounds than dRebounds.
in 1990 refers to season_id = 1990; 50% or less of oRebounds than dRebounds refers to o_rebounds < = multiply(d_rebounds, 0.5)
SELECT COUNT(playerID) FROM players_teams WHERE CAST(oRebounds AS REAL) * 100 / dRebounds <= 50 AND year = 1990
CREATE TABLE players_teams ( PostGS INTEGER, -- PostdRebounds INTEGER, -- PostPF INTEGER, -- tmID TEXT, -- threeAttempted INTEGER, -- PostRebounds INTEGER, -- assists INTEGER, -- threeMade INTEGER, -- PostBlocks INTEGER, -- PostTurnovers INTEGER, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NBA`, `NBL`, `ABA`, `ABL1`, `NPBL` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0 foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade, PostfgMade INTEGER, -- steals INTEGER, -- oRebounds INTEGER, -- PostftAttempted INTEGER, -- ftAttempted INTEGER, -- ftMade INTEGER, -- points INTEGER, -- PostfgAttempted INTEGER, -- PostftMade INTEGER, -- note TEXT, -- Example Values: `C` | Value Statics: Total count 43 - Distinct count 1 - Null count 23708 dRebounds INTEGER, -- PostSteals INTEGER, -- blocks INTEGER, -- PostAssists INTEGER, -- minutes INTEGER, -- fgAttempted INTEGER, -- playerID TEXT not null references players on update cascade on delete cascade, -- PostthreeMade INTEGER, -- PostPoints INTEGER, -- year INTEGER, -- PF INTEGER, -- fgMade INTEGER, -- PostthreeAttempted INTEGER, -- rebounds INTEGER, -- id INTEGER primary key autoincrement, stint INTEGER, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 23751 - Distinct count 6 - Null count 0 PostMinutes INTEGER, -- PostGP INTEGER, -- turnovers INTEGER, -- PostoRebounds INTEGER, -- GS INTEGER, -- ); CREATE TABLE awards_coaches ( award TEXT, -- Example Values: `NBA Coach of the Year`, `ABA Coach of the Year` | Value Statics: Total count 61 - Distinct count 2 - Null count 0 id INTEGER primary key autoincrement, note TEXT, -- Example Values: `tie` | Value Statics: Total count 4 - Distinct count 1 - Null count 57 coachID TEXT, -- lgID TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 61 - Distinct count 2 - Null count 0 foreign key (coachID, year) references coaches (coachID, year) on update cascade on delete cascade, year INTEGER, -- ); CREATE TABLE draft ( draftOverall INTEGER null, -- lgID TEXT null, -- Example Values: `ABA`, `NBA` | Value Statics: Total count 8621 - Distinct count 2 - Null count 0 suffixName TEXT null, -- Example Values: `Jr.` | Value Statics: Total count 2 - Distinct count 1 - Null count 8619 draftYear INTEGER null, -- draftSelection INTEGER null, -- tmID TEXT null, -- draftRound INTEGER null, -- lastName TEXT null, -- playerID TEXT null, -- draftFrom TEXT null, -- id INTEGER default 0 not null primary key, firstName TEXT null, -- foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade, foreign key (tmID, draftYear) references teams (tmID, year) on update cascade on delete cascade, ); CREATE TABLE player_allstar ( rebounds INTEGER null, -- playerID TEXT not null, -- season_id INTEGER not null, -- assists INTEGER null, -- conference TEXT null, -- Example Values: `East`, `West`, `Weset`, `Allstars`, `Denver` | Value Statics: Total count 1608 - Distinct count 5 - Null count 0 points INTEGER null, -- personal_fouls INTEGER null, -- Example Values: `3`, `2`, `0`, `1`, `5` | Value Statics: Total count 540 - Distinct count 8 - Null count 1068 ft_attempted INTEGER null, -- Example Values: `2`, `4`, `0`, `6`, `3` | Value Statics: Total count 1561 - Distinct count 17 - Null count 47 fg_attempted INTEGER null, -- league_id TEXT null, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 1608 - Distinct count 2 - Null count 0 foreign key (playerID) references players (playerID) on update cascade on delete cascade, fg_made INTEGER null, -- Example Values: `4`, `8`, `5`, `7`, `3` | Value Statics: Total count 1561 - Distinct count 18 - Null count 47 ft_made INTEGER null, -- Example Values: `2`, `3`, `0`, `1`, `4` | Value Statics: Total count 1561 - Distinct count 13 - Null count 47 steals INTEGER null, -- Example Values: `3`, `0`, `1`, `2`, `5` | Value Statics: Total count 398 - Distinct count 7 - Null count 1210 games_played INTEGER null, -- Example Values: `1` | Value Statics: Total count 1608 - Distinct count 1 - Null count 0 first_name TEXT null, -- d_rebounds INTEGER null, -- Example Values: `2`, `5`, `0`, `1`, `4` | Value Statics: Total count 493 - Distinct count 14 - Null count 1115 last_name TEXT null, -- primary key (playerID, season_id), turnovers INTEGER null, -- Example Values: `1`, `0`, `3`, `2`, `4` | Value Statics: Total count 493 - Distinct count 9 - Null count 1115 three_made INTEGER null, -- Example Values: `0`, `1`, `3`, `5`, `4` | Value Statics: Total count 566 - Distinct count 7 - Null count 1042 minutes INTEGER null, -- blocks INTEGER null, -- Example Values: `2`, `0`, `1`, `3`, `5` | Value Statics: Total count 398 - Distinct count 6 - Null count 1210 three_attempted INTEGER null, -- Example Values: `0`, `1`, `6`, `7`, `10` | Value Statics: Total count 540 - Distinct count 12 - Null count 1068 o_rebounds INTEGER null, -- Example Values: `1`, `2`, `0`, `3`, `4` | Value Statics: Total count 493 - Distinct count 10 - Null count 1115 ); CREATE TABLE awards_players ( foreign key (playerID) references players (playerID) on update cascade on delete cascade, year INTEGER not null, -- pos TEXT null, -- Example Values: `C`, `F`, `G`, `F/G`, `F/C` | Value Statics: Total count 833 - Distinct count 5 - Null count 886 primary key (playerID, year, award), lgID TEXT null, -- Example Values: `NBA`, `ABA`, `NBL`, `ABL1` | Value Statics: Total count 1719 - Distinct count 4 - Null count 0 award TEXT not null, -- playerID TEXT not null, -- note TEXT null, -- Example Values: `tie` | Value Statics: Total count 37 - Distinct count 1 - Null count 1682 ); CREATE TABLE series_post ( tmIDLoser TEXT, -- id INTEGER primary key autoincrement, series TEXT, -- Example Values: `O`, `M`, `N`, `A`, `K` | Value Statics: Total count 775 - Distinct count 11 - Null count 0 tmIDWinner TEXT, -- round TEXT, -- Example Values: `F`, `QF`, `SF`, `DT`, `DF` | Value Statics: Total count 775 - Distinct count 11 - Null count 0 year INTEGER, -- foreign key (tmIDLoser, year) references teams (tmID, year) on update cascade on delete cascade, foreign key (tmIDWinner, year) references teams (tmID, year) on update cascade on delete cascade, W INTEGER, -- Example Values: `4`, `2`, `1`, `3`, `0` | Value Statics: Total count 775 - Distinct count 5 - Null count 0 lgIDLoser TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0 lgIDWinner TEXT, -- Example Values: `NBA`, `ABA` | Value Statics: Total count 775 - Distinct count 2 - Null count 0 L INTEGER, -- Example Values: `1`, `0`, `2`, `3`, `4` | Value Statics: Total count 775 - Distinct count 5 - Null count 0 ); CREATE TABLE players ( nameGiven TEXT null, -- Example Values: `nameGiven`, `Mort`, `Robert`, `Jim`, `Mike` | Value Statics: Total count 10 - Distinct count 9 - Null count 5052 lastseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15 hsCountry TEXT null, -- firstName TEXT null, -- hsCity TEXT null, -- firstseason INTEGER null, -- Example Values: `0`, `1951` | Value Statics: Total count 5047 - Distinct count 2 - Null count 15 weight INTEGER null, -- birthCountry TEXT null, -- race TEXT null, -- Example Values: `B`, `W`, `O`, `1`, `r` | Value Statics: Total count 4903 - Distinct count 5 - Null count 159 lastName TEXT null, -- birthDate DATE null, -- collegeOther TEXT null, -- birthState TEXT null, -- useFirst TEXT null, -- pos TEXT null, -- Example Values: `F-C`, `C`, `G`, `G-F`, `C-F` | Value Statics: Total count 4880 - Distinct count 14 - Null count 182 playerID TEXT not null primary key, college TEXT null, -- highSchool TEXT null, -- hsState TEXT null, -- height REAL null, -- deathDate DATE null, -- nameSuffix TEXT null, -- Example Values: `Jr.`, `III`, `nameSuffix`, `II`, `IV` | Value Statics: Total count 324 - Distinct count 6 - Null count 4738 nameNick TEXT null, -- fullGivenName TEXT null, -- birthCity TEXT null, -- middleName TEXT null, -- ); CREATE TABLE teams ( d_pts INTEGER null, -- name TEXT null, -- homeLost INTEGER null, -- o_ftm INTEGER null, -- franchID TEXT null, -- tmID TEXT not null, -- awayWon INTEGER null, -- primary key (year, tmID), o_fgm INTEGER null, -- year INTEGER not null, -- awayLost INTEGER null, -- arena TEXT null, -- confID TEXT null, -- Example Values: `EC`, `WC` | Value Statics: Total count 1064 - Distinct count 2 - Null count 472 games INTEGER null, -- lost INTEGER null, -- divID TEXT null, -- Example Values: `EA`, `WE`, `ED`, `WD`, `SO` | Value Statics: Total count 1498 - Distinct count 13 - Null count 38 lgID TEXT null, -- Example Values: `NBL`, `NBA`, `PBLA`, `NPBL`, `ABL1` | Value Statics: Total count 1536 - Distinct count 6 - Null count 0 homeWon INTEGER null, -- confRank INTEGER null, -- Example Values: `0`, `4`, `3`, `5`, `7` | Value Statics: Total count 1536 - Distinct count 16 - Null count 0 o_pts INTEGER null, -- `rank` INTEGER null, -- Example Values: `1`, `2`, `4`, `5`, `6` | Value Statics: Total count 1536 - Distinct count 10 - Null count 0 playoff TEXT null, -- Example Values: `CF`, `WC`, `LC`, `CS`, `F` | Value Statics: Total count 901 - Distinct count 15 - Null count 635 won INTEGER null, -- ); CREATE TABLE coaches ( primary key (coachID, year, tmID, stint), lgID TEXT null, -- Example Values: `NBA`, `ABA`, `ABL1`, `PBLA`, `NPBL` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0 post_losses INTEGER null, -- Example Values: `3`, `9`, `7`, `8`, `0` | Value Statics: Total count 1649 - Distinct count 12 - Null count 40 year INTEGER not null, -- won INTEGER null, -- foreign key (tmID, year) references teams (tmID, year) on update cascade on delete cascade, post_wins INTEGER null, -- Example Values: `0`, `12`, `9`, `13`, `1` | Value Statics: Total count 1649 - Distinct count 17 - Null count 40 coachID TEXT not null, -- tmID TEXT not null, -- lost INTEGER null, -- stint INTEGER not null, -- Example Values: `2`, `1`, `4`, `5`, `3` | Value Statics: Total count 1689 - Distinct count 5 - Null count 0 );
computer_student
Find the professor ID and position in faculty who taught high-level undergraduate course of less than 10 in ID.
professor ID refers to person.p_id when professor = 1; position in faculty refers to hasPosition; high-level undergraduate course refers to courseLevel = 'Level_400'; less than 10 in ID refers to course.course_id < 10
SELECT T1.p_id, T1.hasPosition FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T3.courseLevel = 'Level_400' AND T2.course_id < 10
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, -- );
ice_hockey_draft
Who is the most valuable player who played in the 2000-2001 season of the International league?
most valuable player refers to MAX(P); 2000-2001 season refers to SEASON = '2000-2001'; International league refers to LEAGUE = 'International';
SELECT DISTINCT T2.PlayerName FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.SEASON = '2000-2001' AND T1.LEAGUE = 'International' ORDER BY T1.P DESC LIMIT 1
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null count 0 sum_7yr_TOI INTEGER, -- overall INTEGER, -- position_info TEXT, -- ELITEID INTEGER primary key, sum_7yr_GP INTEGER, -- weight INTEGER, -- birthdate TEXT, -- birthday INTEGER, -- foreign key (height) references height_info(height_id), birthmonth INTEGER, -- Example Values: `6`, `7`, `3`, `5`, `10` | Value Statics: Total count 2171 - Distinct count 12 - Null count 0 foreign key (weight) references weight_info(weight_id), draftround INTEGER, -- Example Values: `7`, `3`, `5`, `4`, `1` | Value Statics: Total count 2171 - Distinct count 9 - Null count 0 overallby TEXT, -- birthplace TEXT, -- height INTEGER, -- Example Values: `73`, `76`, `72`, `75`, `70` | Value Statics: Total count 2171 - Distinct count 16 - Null count 0 birthyear DATE, -- nation TEXT, -- shoots TEXT, -- Example Values: `L`, `R`, `-` | Value Statics: Total count 2171 - Distinct count 3 - Null count 0 PlayerName TEXT, -- ); CREATE TABLE height_info ( height_in_cm INTEGER, -- Example Values: `165`, `170`, `172`, `174`, `177` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 height_id INTEGER primary key, height_in_inch TEXT, -- Example Values: `5'5"`, `5'7"`, `5'8"`, `5'9"`, `5'10"` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 ); CREATE TABLE weight_info ( weight_id INTEGER primary key, weight_in_kg INTEGER, -- weight_in_lbs INTEGER, -- ); CREATE TABLE SeasonStatus ( A INTEGER, -- SEASON TEXT, -- Example Values: `1997-1998`, `1999-2000`, `1998-1999`, `2000-2001`, `2001-2002` | Value Statics: Total count 5485 - Distinct count 10 - Null count 0 G INTEGER, -- ELITEID INTEGER, -- PIM INTEGER, -- LEAGUE TEXT, -- TEAM TEXT, -- GAMETYPE TEXT, -- Example Values: `Regular Season`, `Playoffs` | Value Statics: Total count 5485 - Distinct count 2 - Null count 0 P INTEGER, -- GP INTEGER, -- foreign key (ELITEID) references PlayerInfo(ELITEID), PLUSMINUS INTEGER, -- );
airline
How many hours in total did all of the Delta Air Lines aircraft were delayed due to a late aircraft in August of 2018? Identify the plane number of the aircraft with the highest delayed hours.
hours in total = DIVIDE(SUM(LATE_AIRCRAFT_DELAY), 60); Delta Air Lines refers to Description = 'Delta Air Lines Inc.: DL'; delayed due to a late aircraft refers to LATE_AIRCRAFT_DELAY; in August of 2018 refers to FL_DATE like '2018/8/%'; plane number refers to TAIL_NUM; highest delayed hours refers to MAX(DIVIDE(SUM(LATE_AIRCRAFT_DELAY),60));
SELECT T1.TAIL_NUM, SUM(CAST(T1.LATE_AIRCRAFT_DELAY AS REAL) / 60) AS delay FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T2.Code = T1.OP_CARRIER_AIRLINE_ID WHERE T1.FL_DATE LIKE '2018/8/%' AND T2.Description = 'Delta Air Lines Inc.: DL' ORDER BY delay DESC LIMIT 1
CREATE TABLE Airlines ( CANCELLED INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 CRS_DEP_TIME INTEGER, -- CRS_ELAPSED_TIME INTEGER, -- CANCELLATION_CODE TEXT, -- Example Values: `A`, `B`, `C` | Value Statics: Total count 3795 - Distinct count 3 - Null count 96205 SECURITY_DELAY INTEGER, -- ORIGIN_CITY_MARKET_ID INTEGER, -- OP_CARRIER_FL_NUM INTEGER, -- ORIGIN_AIRPORT_ID INTEGER, -- LATE_AIRCRAFT_DELAY INTEGER, -- DEP_DELAY INTEGER, -- ORIGIN_AIRPORT_SEQ_ID INTEGER, -- DEP_TIME INTEGER, -- FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code), ARR_DELAY INTEGER, -- ACTUAL_ELAPSED_TIME INTEGER, -- NAS_DELAY INTEGER, -- FOREIGN KEY (DEST) REFERENCES Airports(Code), TAIL_NUM TEXT, -- DEST TEXT, -- DEST_CITY_MARKET_ID INTEGER, -- ARR_DELAY_NEW INTEGER, -- OP_CARRIER_AIRLINE_ID INTEGER, -- ARR_TIME INTEGER, -- FOREIGN KEY (ORIGIN) REFERENCES Airports(Code), DEST_AIRPORT_ID INTEGER, -- WEATHER_DELAY INTEGER, -- DEP_DELAY_NEW INTEGER, -- ORIGIN TEXT, -- FL_DATE TEXT, -- CARRIER_DELAY INTEGER, -- DEST_AIRPORT_SEQ_ID INTEGER, -- ); CREATE TABLE Airports ( Code TEXT primary key, Description TEXT, -- ); CREATE TABLE Air Carriers ( Code INTEGER primary key, Description TEXT, -- );
video_games
Give the game publisher ID of records with platform ID 15.
platform ID 15 refers to platform_id = 15
SELECT T.game_publisher_id FROM game_platform AS T WHERE T.platform_id = 15
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
ice_hockey_draft
List the names of all players from Avangard Omsk that have played for playoffs in season 2000-2001.
names of the players refers to PlayerName; Avangard Omsk refers to TEAM = 'Avangard Omsk'; playoffs refers to GAMETYPE = 'Playoffs'; 2000-2001 season refers to SEASON = '2000-2001';
SELECT DISTINCT T2.PlayerName FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.SEASON = '2000-2001' AND T1.TEAM = 'Avangard Omsk' AND T1.GAMETYPE = 'Playoffs'
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null count 0 sum_7yr_TOI INTEGER, -- overall INTEGER, -- position_info TEXT, -- ELITEID INTEGER primary key, sum_7yr_GP INTEGER, -- weight INTEGER, -- birthdate TEXT, -- birthday INTEGER, -- foreign key (height) references height_info(height_id), birthmonth INTEGER, -- Example Values: `6`, `7`, `3`, `5`, `10` | Value Statics: Total count 2171 - Distinct count 12 - Null count 0 foreign key (weight) references weight_info(weight_id), draftround INTEGER, -- Example Values: `7`, `3`, `5`, `4`, `1` | Value Statics: Total count 2171 - Distinct count 9 - Null count 0 overallby TEXT, -- birthplace TEXT, -- height INTEGER, -- Example Values: `73`, `76`, `72`, `75`, `70` | Value Statics: Total count 2171 - Distinct count 16 - Null count 0 birthyear DATE, -- nation TEXT, -- shoots TEXT, -- Example Values: `L`, `R`, `-` | Value Statics: Total count 2171 - Distinct count 3 - Null count 0 PlayerName TEXT, -- ); CREATE TABLE height_info ( height_in_cm INTEGER, -- Example Values: `165`, `170`, `172`, `174`, `177` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 height_id INTEGER primary key, height_in_inch TEXT, -- Example Values: `5'5"`, `5'7"`, `5'8"`, `5'9"`, `5'10"` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 ); CREATE TABLE weight_info ( weight_id INTEGER primary key, weight_in_kg INTEGER, -- weight_in_lbs INTEGER, -- ); CREATE TABLE SeasonStatus ( A INTEGER, -- SEASON TEXT, -- Example Values: `1997-1998`, `1999-2000`, `1998-1999`, `2000-2001`, `2001-2002` | Value Statics: Total count 5485 - Distinct count 10 - Null count 0 G INTEGER, -- ELITEID INTEGER, -- PIM INTEGER, -- LEAGUE TEXT, -- TEAM TEXT, -- GAMETYPE TEXT, -- Example Values: `Regular Season`, `Playoffs` | Value Statics: Total count 5485 - Distinct count 2 - Null count 0 P INTEGER, -- GP INTEGER, -- foreign key (ELITEID) references PlayerInfo(ELITEID), PLUSMINUS INTEGER, -- );
video_games
State the region id of Japan.
region id refers to region.id; Japan refers to region_name = 'Japan'
SELECT T.id FROM region AS T WHERE T.region_name = 'Japan'
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
soccer_2016
How many matches were there in May, 2008?
in May 2008 refers to SUBSTR(Match_Date, 1, 4) = '2008' AND SUBSTR(Match_Date, 7, 1) = '5'
SELECT COUNT(Match_Id) FROM `Match` WHERE SUBSTR(Match_Date, 1, 4) = '2008' AND SUBSTR(Match_Date, 7, 1) = '5'
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
ice_hockey_draft
How many players were drafted by Arizona Coyotes whose height reaches 195 centimeters?
drafted by Arizona Coyotes refers to overallby = 'Arizona Coyotes'; height reaches 195 centimeters refers to height_in_cm = 195;
SELECT COUNT(T2.ELITEID) FROM height_info AS T1 INNER JOIN PlayerInfo AS T2 ON T1.height_id = T2.height WHERE T2.overallby = 'Arizona Coyotes' AND T1.height_in_cm = 195
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null count 0 sum_7yr_TOI INTEGER, -- overall INTEGER, -- position_info TEXT, -- ELITEID INTEGER primary key, sum_7yr_GP INTEGER, -- weight INTEGER, -- birthdate TEXT, -- birthday INTEGER, -- foreign key (height) references height_info(height_id), birthmonth INTEGER, -- Example Values: `6`, `7`, `3`, `5`, `10` | Value Statics: Total count 2171 - Distinct count 12 - Null count 0 foreign key (weight) references weight_info(weight_id), draftround INTEGER, -- Example Values: `7`, `3`, `5`, `4`, `1` | Value Statics: Total count 2171 - Distinct count 9 - Null count 0 overallby TEXT, -- birthplace TEXT, -- height INTEGER, -- Example Values: `73`, `76`, `72`, `75`, `70` | Value Statics: Total count 2171 - Distinct count 16 - Null count 0 birthyear DATE, -- nation TEXT, -- shoots TEXT, -- Example Values: `L`, `R`, `-` | Value Statics: Total count 2171 - Distinct count 3 - Null count 0 PlayerName TEXT, -- ); CREATE TABLE height_info ( height_in_cm INTEGER, -- Example Values: `165`, `170`, `172`, `174`, `177` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 height_id INTEGER primary key, height_in_inch TEXT, -- Example Values: `5'5"`, `5'7"`, `5'8"`, `5'9"`, `5'10"` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 ); CREATE TABLE weight_info ( weight_id INTEGER primary key, weight_in_kg INTEGER, -- weight_in_lbs INTEGER, -- ); CREATE TABLE SeasonStatus ( A INTEGER, -- SEASON TEXT, -- Example Values: `1997-1998`, `1999-2000`, `1998-1999`, `2000-2001`, `2001-2002` | Value Statics: Total count 5485 - Distinct count 10 - Null count 0 G INTEGER, -- ELITEID INTEGER, -- PIM INTEGER, -- LEAGUE TEXT, -- TEAM TEXT, -- GAMETYPE TEXT, -- Example Values: `Regular Season`, `Playoffs` | Value Statics: Total count 5485 - Distinct count 2 - Null count 0 P INTEGER, -- GP INTEGER, -- foreign key (ELITEID) references PlayerInfo(ELITEID), PLUSMINUS INTEGER, -- );
airline
What is the code of Mississippi Valley Airlines?
Mississippi Valley Airlines refers to Description like 'Mississippi Valley Airlines%';
SELECT Code FROM `Air Carriers` WHERE Description LIKE 'Mississippi Valley Airlines%'
CREATE TABLE Airlines ( CANCELLED INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 CRS_DEP_TIME INTEGER, -- CRS_ELAPSED_TIME INTEGER, -- CANCELLATION_CODE TEXT, -- Example Values: `A`, `B`, `C` | Value Statics: Total count 3795 - Distinct count 3 - Null count 96205 SECURITY_DELAY INTEGER, -- ORIGIN_CITY_MARKET_ID INTEGER, -- OP_CARRIER_FL_NUM INTEGER, -- ORIGIN_AIRPORT_ID INTEGER, -- LATE_AIRCRAFT_DELAY INTEGER, -- DEP_DELAY INTEGER, -- ORIGIN_AIRPORT_SEQ_ID INTEGER, -- DEP_TIME INTEGER, -- FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code), ARR_DELAY INTEGER, -- ACTUAL_ELAPSED_TIME INTEGER, -- NAS_DELAY INTEGER, -- FOREIGN KEY (DEST) REFERENCES Airports(Code), TAIL_NUM TEXT, -- DEST TEXT, -- DEST_CITY_MARKET_ID INTEGER, -- ARR_DELAY_NEW INTEGER, -- OP_CARRIER_AIRLINE_ID INTEGER, -- ARR_TIME INTEGER, -- FOREIGN KEY (ORIGIN) REFERENCES Airports(Code), DEST_AIRPORT_ID INTEGER, -- WEATHER_DELAY INTEGER, -- DEP_DELAY_NEW INTEGER, -- ORIGIN TEXT, -- FL_DATE TEXT, -- CARRIER_DELAY INTEGER, -- DEST_AIRPORT_SEQ_ID INTEGER, -- ); CREATE TABLE Airports ( Code TEXT primary key, Description TEXT, -- ); CREATE TABLE Air Carriers ( Code INTEGER primary key, Description TEXT, -- );
video_games
List down the names of platform where the games released in 2016 can be played on.
name of platform refers to platform_name; released in 2016 refers to release_year = 2016
SELECT DISTINCT T1.platform_name FROM platform AS T1 INNER JOIN game_platform AS T2 ON T1.id = T2.platform_id WHERE T2.release_year = 2016
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
ice_hockey_draft
Who among the players drafted by Arizona Coyotes in 2000 has committed the highest rule violations?
who refers to PlayerName; drafted by Arizona Coyotes refers to overallby = 'Arizona Coyotes'; committed the highest rule violations refers to MAX(PIM); in 2000 refers to draftyear = 2000;
SELECT T2.PlayerName FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T2.overallby = 'Arizona Coyotes' AND T2.draftyear = 2000 ORDER BY T1.PIM DESC LIMIT 1
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null count 0 sum_7yr_TOI INTEGER, -- overall INTEGER, -- position_info TEXT, -- ELITEID INTEGER primary key, sum_7yr_GP INTEGER, -- weight INTEGER, -- birthdate TEXT, -- birthday INTEGER, -- foreign key (height) references height_info(height_id), birthmonth INTEGER, -- Example Values: `6`, `7`, `3`, `5`, `10` | Value Statics: Total count 2171 - Distinct count 12 - Null count 0 foreign key (weight) references weight_info(weight_id), draftround INTEGER, -- Example Values: `7`, `3`, `5`, `4`, `1` | Value Statics: Total count 2171 - Distinct count 9 - Null count 0 overallby TEXT, -- birthplace TEXT, -- height INTEGER, -- Example Values: `73`, `76`, `72`, `75`, `70` | Value Statics: Total count 2171 - Distinct count 16 - Null count 0 birthyear DATE, -- nation TEXT, -- shoots TEXT, -- Example Values: `L`, `R`, `-` | Value Statics: Total count 2171 - Distinct count 3 - Null count 0 PlayerName TEXT, -- ); CREATE TABLE height_info ( height_in_cm INTEGER, -- Example Values: `165`, `170`, `172`, `174`, `177` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 height_id INTEGER primary key, height_in_inch TEXT, -- Example Values: `5'5"`, `5'7"`, `5'8"`, `5'9"`, `5'10"` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 ); CREATE TABLE weight_info ( weight_id INTEGER primary key, weight_in_kg INTEGER, -- weight_in_lbs INTEGER, -- ); CREATE TABLE SeasonStatus ( A INTEGER, -- SEASON TEXT, -- Example Values: `1997-1998`, `1999-2000`, `1998-1999`, `2000-2001`, `2001-2002` | Value Statics: Total count 5485 - Distinct count 10 - Null count 0 G INTEGER, -- ELITEID INTEGER, -- PIM INTEGER, -- LEAGUE TEXT, -- TEAM TEXT, -- GAMETYPE TEXT, -- Example Values: `Regular Season`, `Playoffs` | Value Statics: Total count 5485 - Distinct count 2 - Null count 0 P INTEGER, -- GP INTEGER, -- foreign key (ELITEID) references PlayerInfo(ELITEID), PLUSMINUS INTEGER, -- );
airline
What is the scheduled local departure time and the actual departure time of the flight from Philadelphia to Harrisburg with the plane's tail number N627AE on the 13th of August 2018?
scheduled local departure time refers to CRS_DEP_TIME; actual departure time refers to DEP_TIME; from Philadelphia refers to ORIGIN = 'PHL'; to Harrisburg refers to DEST = 'MDT'; tail number refers to TAIL_NUM; TAIL_NUM = 'N627AE'; on the 13th of August 2018 refers to FL_DATE = '2018/8/13';
SELECT CRS_DEP_TIME, DEP_TIME FROM Airlines WHERE ORIGIN = 'PHL' AND DEST = 'MDT' AND TAIL_NUM = 'N627AE' AND FL_DATE = '2018/8/13'
CREATE TABLE Airlines ( CANCELLED INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 CRS_DEP_TIME INTEGER, -- CRS_ELAPSED_TIME INTEGER, -- CANCELLATION_CODE TEXT, -- Example Values: `A`, `B`, `C` | Value Statics: Total count 3795 - Distinct count 3 - Null count 96205 SECURITY_DELAY INTEGER, -- ORIGIN_CITY_MARKET_ID INTEGER, -- OP_CARRIER_FL_NUM INTEGER, -- ORIGIN_AIRPORT_ID INTEGER, -- LATE_AIRCRAFT_DELAY INTEGER, -- DEP_DELAY INTEGER, -- ORIGIN_AIRPORT_SEQ_ID INTEGER, -- DEP_TIME INTEGER, -- FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code), ARR_DELAY INTEGER, -- ACTUAL_ELAPSED_TIME INTEGER, -- NAS_DELAY INTEGER, -- FOREIGN KEY (DEST) REFERENCES Airports(Code), TAIL_NUM TEXT, -- DEST TEXT, -- DEST_CITY_MARKET_ID INTEGER, -- ARR_DELAY_NEW INTEGER, -- OP_CARRIER_AIRLINE_ID INTEGER, -- ARR_TIME INTEGER, -- FOREIGN KEY (ORIGIN) REFERENCES Airports(Code), DEST_AIRPORT_ID INTEGER, -- WEATHER_DELAY INTEGER, -- DEP_DELAY_NEW INTEGER, -- ORIGIN TEXT, -- FL_DATE TEXT, -- CARRIER_DELAY INTEGER, -- DEST_AIRPORT_SEQ_ID INTEGER, -- ); CREATE TABLE Airports ( Code TEXT primary key, Description TEXT, -- ); CREATE TABLE Air Carriers ( Code INTEGER primary key, Description TEXT, -- );
video_games
Provide the release year of record ID 1 to 10.
record ID 1 to 10 refers to game.id BETWEEN 1 AND 10
SELECT T.release_year FROM game_platform AS T WHERE T.id BETWEEN 1 AND 10
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
ice_hockey_draft
List the names of all players in team Avangard Omsk in season 2000-2001.
names of the players refers to PlayerName; team Avangard Omsk refers to TEAM = 'Avangard Omsk'; 2000-2001 season refers to SEASON = '2000-2001';
SELECT DISTINCT T2.PlayerName FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.SEASON = '2000-2001' AND T1.TEAM = 'Avangard Omsk'
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null count 0 sum_7yr_TOI INTEGER, -- overall INTEGER, -- position_info TEXT, -- ELITEID INTEGER primary key, sum_7yr_GP INTEGER, -- weight INTEGER, -- birthdate TEXT, -- birthday INTEGER, -- foreign key (height) references height_info(height_id), birthmonth INTEGER, -- Example Values: `6`, `7`, `3`, `5`, `10` | Value Statics: Total count 2171 - Distinct count 12 - Null count 0 foreign key (weight) references weight_info(weight_id), draftround INTEGER, -- Example Values: `7`, `3`, `5`, `4`, `1` | Value Statics: Total count 2171 - Distinct count 9 - Null count 0 overallby TEXT, -- birthplace TEXT, -- height INTEGER, -- Example Values: `73`, `76`, `72`, `75`, `70` | Value Statics: Total count 2171 - Distinct count 16 - Null count 0 birthyear DATE, -- nation TEXT, -- shoots TEXT, -- Example Values: `L`, `R`, `-` | Value Statics: Total count 2171 - Distinct count 3 - Null count 0 PlayerName TEXT, -- ); CREATE TABLE height_info ( height_in_cm INTEGER, -- Example Values: `165`, `170`, `172`, `174`, `177` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 height_id INTEGER primary key, height_in_inch TEXT, -- Example Values: `5'5"`, `5'7"`, `5'8"`, `5'9"`, `5'10"` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 ); CREATE TABLE weight_info ( weight_id INTEGER primary key, weight_in_kg INTEGER, -- weight_in_lbs INTEGER, -- ); CREATE TABLE SeasonStatus ( A INTEGER, -- SEASON TEXT, -- Example Values: `1997-1998`, `1999-2000`, `1998-1999`, `2000-2001`, `2001-2002` | Value Statics: Total count 5485 - Distinct count 10 - Null count 0 G INTEGER, -- ELITEID INTEGER, -- PIM INTEGER, -- LEAGUE TEXT, -- TEAM TEXT, -- GAMETYPE TEXT, -- Example Values: `Regular Season`, `Playoffs` | Value Statics: Total count 5485 - Distinct count 2 - Null count 0 P INTEGER, -- GP INTEGER, -- foreign key (ELITEID) references PlayerInfo(ELITEID), PLUSMINUS INTEGER, -- );
airline
What is the only flight destination for flights from Albany?
flight destination refers to DEST; from Albany refers to ORIGIN = 'ABY';
SELECT DEST FROM Airlines WHERE ORIGIN = 'ABY' GROUP BY DEST
CREATE TABLE Airlines ( CANCELLED INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 CRS_DEP_TIME INTEGER, -- CRS_ELAPSED_TIME INTEGER, -- CANCELLATION_CODE TEXT, -- Example Values: `A`, `B`, `C` | Value Statics: Total count 3795 - Distinct count 3 - Null count 96205 SECURITY_DELAY INTEGER, -- ORIGIN_CITY_MARKET_ID INTEGER, -- OP_CARRIER_FL_NUM INTEGER, -- ORIGIN_AIRPORT_ID INTEGER, -- LATE_AIRCRAFT_DELAY INTEGER, -- DEP_DELAY INTEGER, -- ORIGIN_AIRPORT_SEQ_ID INTEGER, -- DEP_TIME INTEGER, -- FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code), ARR_DELAY INTEGER, -- ACTUAL_ELAPSED_TIME INTEGER, -- NAS_DELAY INTEGER, -- FOREIGN KEY (DEST) REFERENCES Airports(Code), TAIL_NUM TEXT, -- DEST TEXT, -- DEST_CITY_MARKET_ID INTEGER, -- ARR_DELAY_NEW INTEGER, -- OP_CARRIER_AIRLINE_ID INTEGER, -- ARR_TIME INTEGER, -- FOREIGN KEY (ORIGIN) REFERENCES Airports(Code), DEST_AIRPORT_ID INTEGER, -- WEATHER_DELAY INTEGER, -- DEP_DELAY_NEW INTEGER, -- ORIGIN TEXT, -- FL_DATE TEXT, -- CARRIER_DELAY INTEGER, -- DEST_AIRPORT_SEQ_ID INTEGER, -- ); CREATE TABLE Airports ( Code TEXT primary key, Description TEXT, -- ); CREATE TABLE Air Carriers ( Code INTEGER primary key, Description TEXT, -- );
video_games
What is the number of sales in region ID 2 with game platform ID 9615?
number of sales refers to multiply(num_sales, 100000)
SELECT T.num_sales * 100000 FROM region_sales AS T WHERE T.region_id = 2 AND T.game_platform_id = 9615
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
soccer_2016
How many players are from Australia?
Australia refers to Country_Name = 'Australia'
SELECT COUNT(CASE WHEN T2.Country_Name = 'Australia' THEN T1.Player_Id ELSE NULL END) FROM Player AS T1 INNER JOIN Country AS T2 ON T1.Country_Name = T2.Country_Id
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
ice_hockey_draft
Who among the players in season 2000-2001 has committed the highest rule violations or penalty minutes?
committed the highest rule violations or penalty minutes refers to MAX(PIM); 2000-2001 season refers to SEASON = '2000-2001'
SELECT T2.PlayerName FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.SEASON = '2000-2001' ORDER BY T1.PIM DESC LIMIT 1
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null count 0 sum_7yr_TOI INTEGER, -- overall INTEGER, -- position_info TEXT, -- ELITEID INTEGER primary key, sum_7yr_GP INTEGER, -- weight INTEGER, -- birthdate TEXT, -- birthday INTEGER, -- foreign key (height) references height_info(height_id), birthmonth INTEGER, -- Example Values: `6`, `7`, `3`, `5`, `10` | Value Statics: Total count 2171 - Distinct count 12 - Null count 0 foreign key (weight) references weight_info(weight_id), draftround INTEGER, -- Example Values: `7`, `3`, `5`, `4`, `1` | Value Statics: Total count 2171 - Distinct count 9 - Null count 0 overallby TEXT, -- birthplace TEXT, -- height INTEGER, -- Example Values: `73`, `76`, `72`, `75`, `70` | Value Statics: Total count 2171 - Distinct count 16 - Null count 0 birthyear DATE, -- nation TEXT, -- shoots TEXT, -- Example Values: `L`, `R`, `-` | Value Statics: Total count 2171 - Distinct count 3 - Null count 0 PlayerName TEXT, -- ); CREATE TABLE height_info ( height_in_cm INTEGER, -- Example Values: `165`, `170`, `172`, `174`, `177` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 height_id INTEGER primary key, height_in_inch TEXT, -- Example Values: `5'5"`, `5'7"`, `5'8"`, `5'9"`, `5'10"` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 ); CREATE TABLE weight_info ( weight_id INTEGER primary key, weight_in_kg INTEGER, -- weight_in_lbs INTEGER, -- ); CREATE TABLE SeasonStatus ( A INTEGER, -- SEASON TEXT, -- Example Values: `1997-1998`, `1999-2000`, `1998-1999`, `2000-2001`, `2001-2002` | Value Statics: Total count 5485 - Distinct count 10 - Null count 0 G INTEGER, -- ELITEID INTEGER, -- PIM INTEGER, -- LEAGUE TEXT, -- TEAM TEXT, -- GAMETYPE TEXT, -- Example Values: `Regular Season`, `Playoffs` | Value Statics: Total count 5485 - Distinct count 2 - Null count 0 P INTEGER, -- GP INTEGER, -- foreign key (ELITEID) references PlayerInfo(ELITEID), PLUSMINUS INTEGER, -- );
airline
Which airline does the aircraft with the fastest flight belong to?
fastest flight refers to MIN(SUBTRACT(ACTUAL_ELAPSED_TIME, CRS_ELAPSED_TIME));
SELECT T1.OP_CARRIER_AIRLINE_ID FROM Airlines AS T1 INNER JOIN Airports AS T2 ON T1.ORIGIN = T2.Code WHERE T1.ACTUAL_ELAPSED_TIME IS NOT NULL AND T1.CRS_ELAPSED_TIME IS NOT NULL ORDER BY T1.ACTUAL_ELAPSED_TIME - T1.CRS_ELAPSED_TIME ASC LIMIT 1
CREATE TABLE Airlines ( CANCELLED INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 CRS_DEP_TIME INTEGER, -- CRS_ELAPSED_TIME INTEGER, -- CANCELLATION_CODE TEXT, -- Example Values: `A`, `B`, `C` | Value Statics: Total count 3795 - Distinct count 3 - Null count 96205 SECURITY_DELAY INTEGER, -- ORIGIN_CITY_MARKET_ID INTEGER, -- OP_CARRIER_FL_NUM INTEGER, -- ORIGIN_AIRPORT_ID INTEGER, -- LATE_AIRCRAFT_DELAY INTEGER, -- DEP_DELAY INTEGER, -- ORIGIN_AIRPORT_SEQ_ID INTEGER, -- DEP_TIME INTEGER, -- FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code), ARR_DELAY INTEGER, -- ACTUAL_ELAPSED_TIME INTEGER, -- NAS_DELAY INTEGER, -- FOREIGN KEY (DEST) REFERENCES Airports(Code), TAIL_NUM TEXT, -- DEST TEXT, -- DEST_CITY_MARKET_ID INTEGER, -- ARR_DELAY_NEW INTEGER, -- OP_CARRIER_AIRLINE_ID INTEGER, -- ARR_TIME INTEGER, -- FOREIGN KEY (ORIGIN) REFERENCES Airports(Code), DEST_AIRPORT_ID INTEGER, -- WEATHER_DELAY INTEGER, -- DEP_DELAY_NEW INTEGER, -- ORIGIN TEXT, -- FL_DATE TEXT, -- CARRIER_DELAY INTEGER, -- DEST_AIRPORT_SEQ_ID INTEGER, -- ); CREATE TABLE Airports ( Code TEXT primary key, Description TEXT, -- ); CREATE TABLE Air Carriers ( Code INTEGER primary key, Description TEXT, -- );
soccer_2016
How many players were born after the year 1985?
born after the year 1985 refers to SUBSTR(DOB, 1, 4) > 1985
SELECT COUNT(Player_Id) FROM Player WHERE SUBSTR(DOB, 1, 4) > 1985
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
ice_hockey_draft
Among the USA players, who has the lightest weight?
USA refers to nation = 'USA' ; players refers to PlayerName; lightest weight refers to MIN(weight_in_lbs);
SELECT T2.PlayerName FROM weight_info AS T1 INNER JOIN PlayerInfo AS T2 ON T1.weight_id = T2.weight WHERE T2.nation = 'USA' ORDER BY T1.weight_in_lbs ASC LIMIT 1
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null count 0 sum_7yr_TOI INTEGER, -- overall INTEGER, -- position_info TEXT, -- ELITEID INTEGER primary key, sum_7yr_GP INTEGER, -- weight INTEGER, -- birthdate TEXT, -- birthday INTEGER, -- foreign key (height) references height_info(height_id), birthmonth INTEGER, -- Example Values: `6`, `7`, `3`, `5`, `10` | Value Statics: Total count 2171 - Distinct count 12 - Null count 0 foreign key (weight) references weight_info(weight_id), draftround INTEGER, -- Example Values: `7`, `3`, `5`, `4`, `1` | Value Statics: Total count 2171 - Distinct count 9 - Null count 0 overallby TEXT, -- birthplace TEXT, -- height INTEGER, -- Example Values: `73`, `76`, `72`, `75`, `70` | Value Statics: Total count 2171 - Distinct count 16 - Null count 0 birthyear DATE, -- nation TEXT, -- shoots TEXT, -- Example Values: `L`, `R`, `-` | Value Statics: Total count 2171 - Distinct count 3 - Null count 0 PlayerName TEXT, -- ); CREATE TABLE height_info ( height_in_cm INTEGER, -- Example Values: `165`, `170`, `172`, `174`, `177` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 height_id INTEGER primary key, height_in_inch TEXT, -- Example Values: `5'5"`, `5'7"`, `5'8"`, `5'9"`, `5'10"` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 ); CREATE TABLE weight_info ( weight_id INTEGER primary key, weight_in_kg INTEGER, -- weight_in_lbs INTEGER, -- ); CREATE TABLE SeasonStatus ( A INTEGER, -- SEASON TEXT, -- Example Values: `1997-1998`, `1999-2000`, `1998-1999`, `2000-2001`, `2001-2002` | Value Statics: Total count 5485 - Distinct count 10 - Null count 0 G INTEGER, -- ELITEID INTEGER, -- PIM INTEGER, -- LEAGUE TEXT, -- TEAM TEXT, -- GAMETYPE TEXT, -- Example Values: `Regular Season`, `Playoffs` | Value Statics: Total count 5485 - Distinct count 2 - Null count 0 P INTEGER, -- GP INTEGER, -- foreign key (ELITEID) references PlayerInfo(ELITEID), PLUSMINUS INTEGER, -- );
video_games
What is the average number of sales in Japan?
in Japan refers to region_name = 'Japan'; average number of sales = multiply(avg(num_sales), 100000) where region_name = 'Japan'
SELECT AVG(T2.num_sales) * 100000 AS avg_japan FROM region AS T1 INNER JOIN region_sales AS T2 ON T1.id = T2.region_id WHERE T1.region_name = 'Japan'
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
soccer_2016
Please list the IDs of all the matches in the year 2008.
ID of matches refers to Match_Id; in the year 2008 refers to SUBSTR(Match_Date, 1, 4) = '2008'
SELECT Match_Id FROM `Match` WHERE SUBSTR(Match_Date, 1, 4) = '2008'
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
ice_hockey_draft
What is the percentage of Russian players who have a height of under 200 inch?
percentage = MULTIPLY(DIVIDE(SUM(nation = 'Russia' WHERE height_in_cm < 200), COUNT(ELITEID)), 100); Russian refers to nation = 'Russia'; players refers to PlayerName; height of under 200 inch refers to height_in_cm < 200;
SELECT CAST(COUNT(CASE WHEN T1.height_in_cm < 200 AND T2.nation = 'Russia' THEN T2.ELITEID ELSE NULL END) AS REAL) * 100 / COUNT(T2.ELITEID) FROM height_info AS T1 INNER JOIN PlayerInfo AS T2 ON T1.height_id = T2.height
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null count 0 sum_7yr_TOI INTEGER, -- overall INTEGER, -- position_info TEXT, -- ELITEID INTEGER primary key, sum_7yr_GP INTEGER, -- weight INTEGER, -- birthdate TEXT, -- birthday INTEGER, -- foreign key (height) references height_info(height_id), birthmonth INTEGER, -- Example Values: `6`, `7`, `3`, `5`, `10` | Value Statics: Total count 2171 - Distinct count 12 - Null count 0 foreign key (weight) references weight_info(weight_id), draftround INTEGER, -- Example Values: `7`, `3`, `5`, `4`, `1` | Value Statics: Total count 2171 - Distinct count 9 - Null count 0 overallby TEXT, -- birthplace TEXT, -- height INTEGER, -- Example Values: `73`, `76`, `72`, `75`, `70` | Value Statics: Total count 2171 - Distinct count 16 - Null count 0 birthyear DATE, -- nation TEXT, -- shoots TEXT, -- Example Values: `L`, `R`, `-` | Value Statics: Total count 2171 - Distinct count 3 - Null count 0 PlayerName TEXT, -- ); CREATE TABLE height_info ( height_in_cm INTEGER, -- Example Values: `165`, `170`, `172`, `174`, `177` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 height_id INTEGER primary key, height_in_inch TEXT, -- Example Values: `5'5"`, `5'7"`, `5'8"`, `5'9"`, `5'10"` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 ); CREATE TABLE weight_info ( weight_id INTEGER primary key, weight_in_kg INTEGER, -- weight_in_lbs INTEGER, -- ); CREATE TABLE SeasonStatus ( A INTEGER, -- SEASON TEXT, -- Example Values: `1997-1998`, `1999-2000`, `1998-1999`, `2000-2001`, `2001-2002` | Value Statics: Total count 5485 - Distinct count 10 - Null count 0 G INTEGER, -- ELITEID INTEGER, -- PIM INTEGER, -- LEAGUE TEXT, -- TEAM TEXT, -- GAMETYPE TEXT, -- Example Values: `Regular Season`, `Playoffs` | Value Statics: Total count 5485 - Distinct count 2 - Null count 0 P INTEGER, -- GP INTEGER, -- foreign key (ELITEID) references PlayerInfo(ELITEID), PLUSMINUS INTEGER, -- );
airline
What are the destinations of the flights with air carrier description "Southeast Alaska Airlines: WEB"?
destinations refers to DEST; Southeast Alaska Airlines: WEB refers to Description = 'Southeast Alaska Airlines: WEB';
SELECT T2.DEST FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T1.Description = 'Southeast Alaska Airlines: WEB'
CREATE TABLE Airlines ( CANCELLED INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 CRS_DEP_TIME INTEGER, -- CRS_ELAPSED_TIME INTEGER, -- CANCELLATION_CODE TEXT, -- Example Values: `A`, `B`, `C` | Value Statics: Total count 3795 - Distinct count 3 - Null count 96205 SECURITY_DELAY INTEGER, -- ORIGIN_CITY_MARKET_ID INTEGER, -- OP_CARRIER_FL_NUM INTEGER, -- ORIGIN_AIRPORT_ID INTEGER, -- LATE_AIRCRAFT_DELAY INTEGER, -- DEP_DELAY INTEGER, -- ORIGIN_AIRPORT_SEQ_ID INTEGER, -- DEP_TIME INTEGER, -- FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code), ARR_DELAY INTEGER, -- ACTUAL_ELAPSED_TIME INTEGER, -- NAS_DELAY INTEGER, -- FOREIGN KEY (DEST) REFERENCES Airports(Code), TAIL_NUM TEXT, -- DEST TEXT, -- DEST_CITY_MARKET_ID INTEGER, -- ARR_DELAY_NEW INTEGER, -- OP_CARRIER_AIRLINE_ID INTEGER, -- ARR_TIME INTEGER, -- FOREIGN KEY (ORIGIN) REFERENCES Airports(Code), DEST_AIRPORT_ID INTEGER, -- WEATHER_DELAY INTEGER, -- DEP_DELAY_NEW INTEGER, -- ORIGIN TEXT, -- FL_DATE TEXT, -- CARRIER_DELAY INTEGER, -- DEST_AIRPORT_SEQ_ID INTEGER, -- ); CREATE TABLE Airports ( Code TEXT primary key, Description TEXT, -- ); CREATE TABLE Air Carriers ( Code INTEGER primary key, Description TEXT, -- );
video_games
List down the record ID of records released between 2000 to 2003.
record ID refers to game.id; released between 2000 to 2003 refers to release_year BETWEEN 2000 AND 2003
SELECT T.id FROM game_platform AS T WHERE T.release_year BETWEEN 2000 AND 2003
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
ice_hockey_draft
How many players were born in 1982 and have a height above 182cm?
born in 1982 refers to birthyear = 1982; height above 182cm refers to height_in_cm > 182 ;
SELECT COUNT(T2.ELITEID) FROM height_info AS T1 INNER JOIN PlayerInfo AS T2 ON T1.height_id = T2.height WHERE T1.height_in_cm > 182 AND strftime('%Y', T2.birthdate) = '1982'
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null count 0 sum_7yr_TOI INTEGER, -- overall INTEGER, -- position_info TEXT, -- ELITEID INTEGER primary key, sum_7yr_GP INTEGER, -- weight INTEGER, -- birthdate TEXT, -- birthday INTEGER, -- foreign key (height) references height_info(height_id), birthmonth INTEGER, -- Example Values: `6`, `7`, `3`, `5`, `10` | Value Statics: Total count 2171 - Distinct count 12 - Null count 0 foreign key (weight) references weight_info(weight_id), draftround INTEGER, -- Example Values: `7`, `3`, `5`, `4`, `1` | Value Statics: Total count 2171 - Distinct count 9 - Null count 0 overallby TEXT, -- birthplace TEXT, -- height INTEGER, -- Example Values: `73`, `76`, `72`, `75`, `70` | Value Statics: Total count 2171 - Distinct count 16 - Null count 0 birthyear DATE, -- nation TEXT, -- shoots TEXT, -- Example Values: `L`, `R`, `-` | Value Statics: Total count 2171 - Distinct count 3 - Null count 0 PlayerName TEXT, -- ); CREATE TABLE height_info ( height_in_cm INTEGER, -- Example Values: `165`, `170`, `172`, `174`, `177` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 height_id INTEGER primary key, height_in_inch TEXT, -- Example Values: `5'5"`, `5'7"`, `5'8"`, `5'9"`, `5'10"` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 ); CREATE TABLE weight_info ( weight_id INTEGER primary key, weight_in_kg INTEGER, -- weight_in_lbs INTEGER, -- ); CREATE TABLE SeasonStatus ( A INTEGER, -- SEASON TEXT, -- Example Values: `1997-1998`, `1999-2000`, `1998-1999`, `2000-2001`, `2001-2002` | Value Statics: Total count 5485 - Distinct count 10 - Null count 0 G INTEGER, -- ELITEID INTEGER, -- PIM INTEGER, -- LEAGUE TEXT, -- TEAM TEXT, -- GAMETYPE TEXT, -- Example Values: `Regular Season`, `Playoffs` | Value Statics: Total count 5485 - Distinct count 2 - Null count 0 P INTEGER, -- GP INTEGER, -- foreign key (ELITEID) references PlayerInfo(ELITEID), PLUSMINUS INTEGER, -- );
airline
Provide the air carrier description of the flight with the highest actual elapsed time.
highest actual elapsed time refers to MAX(ACTUAL_ELAPSED_TIME);
SELECT T1.Description FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID ORDER BY T2.ACTUAL_ELAPSED_TIME DESC LIMIT 1
CREATE TABLE Airlines ( CANCELLED INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 CRS_DEP_TIME INTEGER, -- CRS_ELAPSED_TIME INTEGER, -- CANCELLATION_CODE TEXT, -- Example Values: `A`, `B`, `C` | Value Statics: Total count 3795 - Distinct count 3 - Null count 96205 SECURITY_DELAY INTEGER, -- ORIGIN_CITY_MARKET_ID INTEGER, -- OP_CARRIER_FL_NUM INTEGER, -- ORIGIN_AIRPORT_ID INTEGER, -- LATE_AIRCRAFT_DELAY INTEGER, -- DEP_DELAY INTEGER, -- ORIGIN_AIRPORT_SEQ_ID INTEGER, -- DEP_TIME INTEGER, -- FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code), ARR_DELAY INTEGER, -- ACTUAL_ELAPSED_TIME INTEGER, -- NAS_DELAY INTEGER, -- FOREIGN KEY (DEST) REFERENCES Airports(Code), TAIL_NUM TEXT, -- DEST TEXT, -- DEST_CITY_MARKET_ID INTEGER, -- ARR_DELAY_NEW INTEGER, -- OP_CARRIER_AIRLINE_ID INTEGER, -- ARR_TIME INTEGER, -- FOREIGN KEY (ORIGIN) REFERENCES Airports(Code), DEST_AIRPORT_ID INTEGER, -- WEATHER_DELAY INTEGER, -- DEP_DELAY_NEW INTEGER, -- ORIGIN TEXT, -- FL_DATE TEXT, -- CARRIER_DELAY INTEGER, -- DEST_AIRPORT_SEQ_ID INTEGER, -- ); CREATE TABLE Airports ( Code TEXT primary key, Description TEXT, -- ); CREATE TABLE Air Carriers ( Code INTEGER primary key, Description TEXT, -- );
ice_hockey_draft
List out the name of players who have a height of 5'8".
name of players refers to PlayerName; height of 5'8" refers to height_in_inch = '5''8"';
SELECT T2.PlayerName FROM height_info AS T1 INNER JOIN PlayerInfo AS T2 ON T1.height_id = T2.height WHERE T1.height_in_inch = '5''8"'
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null count 0 sum_7yr_TOI INTEGER, -- overall INTEGER, -- position_info TEXT, -- ELITEID INTEGER primary key, sum_7yr_GP INTEGER, -- weight INTEGER, -- birthdate TEXT, -- birthday INTEGER, -- foreign key (height) references height_info(height_id), birthmonth INTEGER, -- Example Values: `6`, `7`, `3`, `5`, `10` | Value Statics: Total count 2171 - Distinct count 12 - Null count 0 foreign key (weight) references weight_info(weight_id), draftround INTEGER, -- Example Values: `7`, `3`, `5`, `4`, `1` | Value Statics: Total count 2171 - Distinct count 9 - Null count 0 overallby TEXT, -- birthplace TEXT, -- height INTEGER, -- Example Values: `73`, `76`, `72`, `75`, `70` | Value Statics: Total count 2171 - Distinct count 16 - Null count 0 birthyear DATE, -- nation TEXT, -- shoots TEXT, -- Example Values: `L`, `R`, `-` | Value Statics: Total count 2171 - Distinct count 3 - Null count 0 PlayerName TEXT, -- ); CREATE TABLE height_info ( height_in_cm INTEGER, -- Example Values: `165`, `170`, `172`, `174`, `177` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 height_id INTEGER primary key, height_in_inch TEXT, -- Example Values: `5'5"`, `5'7"`, `5'8"`, `5'9"`, `5'10"` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 ); CREATE TABLE weight_info ( weight_id INTEGER primary key, weight_in_kg INTEGER, -- weight_in_lbs INTEGER, -- ); CREATE TABLE SeasonStatus ( A INTEGER, -- SEASON TEXT, -- Example Values: `1997-1998`, `1999-2000`, `1998-1999`, `2000-2001`, `2001-2002` | Value Statics: Total count 5485 - Distinct count 10 - Null count 0 G INTEGER, -- ELITEID INTEGER, -- PIM INTEGER, -- LEAGUE TEXT, -- TEAM TEXT, -- GAMETYPE TEXT, -- Example Values: `Regular Season`, `Playoffs` | Value Statics: Total count 5485 - Distinct count 2 - Null count 0 P INTEGER, -- GP INTEGER, -- foreign key (ELITEID) references PlayerInfo(ELITEID), PLUSMINUS INTEGER, -- );
airline
Among the flights with air carrier described as Asap Air Inc.: ASP, what is the tail number of the flight with the longest departure delay?
Asap Air Inc.: ASP refers to Description = 'Asap Air Inc.: ASP'; tail number refers to TAIL_NUM; longest departure delay refers to MAX(DEP_DELAY);
SELECT T2.TAIL_NUM FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T1.Description = 'Asap Air Inc.: ASP' ORDER BY T2.DEP_DELAY DESC LIMIT 1
CREATE TABLE Airlines ( CANCELLED INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 CRS_DEP_TIME INTEGER, -- CRS_ELAPSED_TIME INTEGER, -- CANCELLATION_CODE TEXT, -- Example Values: `A`, `B`, `C` | Value Statics: Total count 3795 - Distinct count 3 - Null count 96205 SECURITY_DELAY INTEGER, -- ORIGIN_CITY_MARKET_ID INTEGER, -- OP_CARRIER_FL_NUM INTEGER, -- ORIGIN_AIRPORT_ID INTEGER, -- LATE_AIRCRAFT_DELAY INTEGER, -- DEP_DELAY INTEGER, -- ORIGIN_AIRPORT_SEQ_ID INTEGER, -- DEP_TIME INTEGER, -- FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code), ARR_DELAY INTEGER, -- ACTUAL_ELAPSED_TIME INTEGER, -- NAS_DELAY INTEGER, -- FOREIGN KEY (DEST) REFERENCES Airports(Code), TAIL_NUM TEXT, -- DEST TEXT, -- DEST_CITY_MARKET_ID INTEGER, -- ARR_DELAY_NEW INTEGER, -- OP_CARRIER_AIRLINE_ID INTEGER, -- ARR_TIME INTEGER, -- FOREIGN KEY (ORIGIN) REFERENCES Airports(Code), DEST_AIRPORT_ID INTEGER, -- WEATHER_DELAY INTEGER, -- DEP_DELAY_NEW INTEGER, -- ORIGIN TEXT, -- FL_DATE TEXT, -- CARRIER_DELAY INTEGER, -- DEST_AIRPORT_SEQ_ID INTEGER, -- ); CREATE TABLE Airports ( Code TEXT primary key, Description TEXT, -- ); CREATE TABLE Air Carriers ( Code INTEGER primary key, Description TEXT, -- );
video_games
When was the game titled 3DS Classic Collection released?
when refers to release_year; the game titled 3DS Classic Collection refers to game_name = '3DS Classic Collection'
SELECT T1.release_year FROM game_platform AS T1 INNER JOIN game_publisher AS T2 ON T1.game_publisher_id = T2.id INNER JOIN game AS T3 ON T2.game_id = T3.id WHERE T3.game_name = '3DS Classic Collection'
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
ice_hockey_draft
Among the Italian players, who has the shortest height?
Italian refers to nation = 'Italy'; players refers to PlayerName; shortest height refers to MIN(height_in_cm);
SELECT T2.PlayerName FROM height_info AS T1 INNER JOIN PlayerInfo AS T2 ON T1.height_id = T2.height WHERE T2.nation = 'Italy' ORDER BY T1.height_in_cm ASC LIMIT 1
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null count 0 sum_7yr_TOI INTEGER, -- overall INTEGER, -- position_info TEXT, -- ELITEID INTEGER primary key, sum_7yr_GP INTEGER, -- weight INTEGER, -- birthdate TEXT, -- birthday INTEGER, -- foreign key (height) references height_info(height_id), birthmonth INTEGER, -- Example Values: `6`, `7`, `3`, `5`, `10` | Value Statics: Total count 2171 - Distinct count 12 - Null count 0 foreign key (weight) references weight_info(weight_id), draftround INTEGER, -- Example Values: `7`, `3`, `5`, `4`, `1` | Value Statics: Total count 2171 - Distinct count 9 - Null count 0 overallby TEXT, -- birthplace TEXT, -- height INTEGER, -- Example Values: `73`, `76`, `72`, `75`, `70` | Value Statics: Total count 2171 - Distinct count 16 - Null count 0 birthyear DATE, -- nation TEXT, -- shoots TEXT, -- Example Values: `L`, `R`, `-` | Value Statics: Total count 2171 - Distinct count 3 - Null count 0 PlayerName TEXT, -- ); CREATE TABLE height_info ( height_in_cm INTEGER, -- Example Values: `165`, `170`, `172`, `174`, `177` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 height_id INTEGER primary key, height_in_inch TEXT, -- Example Values: `5'5"`, `5'7"`, `5'8"`, `5'9"`, `5'10"` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 ); CREATE TABLE weight_info ( weight_id INTEGER primary key, weight_in_kg INTEGER, -- weight_in_lbs INTEGER, -- ); CREATE TABLE SeasonStatus ( A INTEGER, -- SEASON TEXT, -- Example Values: `1997-1998`, `1999-2000`, `1998-1999`, `2000-2001`, `2001-2002` | Value Statics: Total count 5485 - Distinct count 10 - Null count 0 G INTEGER, -- ELITEID INTEGER, -- PIM INTEGER, -- LEAGUE TEXT, -- TEAM TEXT, -- GAMETYPE TEXT, -- Example Values: `Regular Season`, `Playoffs` | Value Statics: Total count 5485 - Distinct count 2 - Null count 0 P INTEGER, -- GP INTEGER, -- foreign key (ELITEID) references PlayerInfo(ELITEID), PLUSMINUS INTEGER, -- );
airline
List the air carrier's description of the flights with 0 departure delay.
0 departure delay refers to DEP_DELAY = 0;
SELECT T1.Description FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T2.DEP_DELAY = 0 GROUP BY T1.Description
CREATE TABLE Airlines ( CANCELLED INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 CRS_DEP_TIME INTEGER, -- CRS_ELAPSED_TIME INTEGER, -- CANCELLATION_CODE TEXT, -- Example Values: `A`, `B`, `C` | Value Statics: Total count 3795 - Distinct count 3 - Null count 96205 SECURITY_DELAY INTEGER, -- ORIGIN_CITY_MARKET_ID INTEGER, -- OP_CARRIER_FL_NUM INTEGER, -- ORIGIN_AIRPORT_ID INTEGER, -- LATE_AIRCRAFT_DELAY INTEGER, -- DEP_DELAY INTEGER, -- ORIGIN_AIRPORT_SEQ_ID INTEGER, -- DEP_TIME INTEGER, -- FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code), ARR_DELAY INTEGER, -- ACTUAL_ELAPSED_TIME INTEGER, -- NAS_DELAY INTEGER, -- FOREIGN KEY (DEST) REFERENCES Airports(Code), TAIL_NUM TEXT, -- DEST TEXT, -- DEST_CITY_MARKET_ID INTEGER, -- ARR_DELAY_NEW INTEGER, -- OP_CARRIER_AIRLINE_ID INTEGER, -- ARR_TIME INTEGER, -- FOREIGN KEY (ORIGIN) REFERENCES Airports(Code), DEST_AIRPORT_ID INTEGER, -- WEATHER_DELAY INTEGER, -- DEP_DELAY_NEW INTEGER, -- ORIGIN TEXT, -- FL_DATE TEXT, -- CARRIER_DELAY INTEGER, -- DEST_AIRPORT_SEQ_ID INTEGER, -- ); CREATE TABLE Airports ( Code TEXT primary key, Description TEXT, -- ); CREATE TABLE Air Carriers ( Code INTEGER primary key, Description TEXT, -- );
video_games
List down the name of games published by 3DO.
name of game refers to game_name; published by 3DO refers to publisher_name = '3DO'
SELECT T1.game_name FROM game AS T1 INNER JOIN game_publisher AS T2 ON T1.id = T2.game_id INNER JOIN publisher AS T3 ON T2.publisher_id = T3.id WHERE T3.publisher_name = '3DO'
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
ice_hockey_draft
What is the highest point highest point of Per Mars in the draft year?
highest point in the draft year refers to MAX(P);
SELECT T1.P FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T2.PlayerName = 'Per Mars' ORDER BY T1.P DESC LIMIT 1
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null count 0 sum_7yr_TOI INTEGER, -- overall INTEGER, -- position_info TEXT, -- ELITEID INTEGER primary key, sum_7yr_GP INTEGER, -- weight INTEGER, -- birthdate TEXT, -- birthday INTEGER, -- foreign key (height) references height_info(height_id), birthmonth INTEGER, -- Example Values: `6`, `7`, `3`, `5`, `10` | Value Statics: Total count 2171 - Distinct count 12 - Null count 0 foreign key (weight) references weight_info(weight_id), draftround INTEGER, -- Example Values: `7`, `3`, `5`, `4`, `1` | Value Statics: Total count 2171 - Distinct count 9 - Null count 0 overallby TEXT, -- birthplace TEXT, -- height INTEGER, -- Example Values: `73`, `76`, `72`, `75`, `70` | Value Statics: Total count 2171 - Distinct count 16 - Null count 0 birthyear DATE, -- nation TEXT, -- shoots TEXT, -- Example Values: `L`, `R`, `-` | Value Statics: Total count 2171 - Distinct count 3 - Null count 0 PlayerName TEXT, -- ); CREATE TABLE height_info ( height_in_cm INTEGER, -- Example Values: `165`, `170`, `172`, `174`, `177` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 height_id INTEGER primary key, height_in_inch TEXT, -- Example Values: `5'5"`, `5'7"`, `5'8"`, `5'9"`, `5'10"` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 ); CREATE TABLE weight_info ( weight_id INTEGER primary key, weight_in_kg INTEGER, -- weight_in_lbs INTEGER, -- ); CREATE TABLE SeasonStatus ( A INTEGER, -- SEASON TEXT, -- Example Values: `1997-1998`, `1999-2000`, `1998-1999`, `2000-2001`, `2001-2002` | Value Statics: Total count 5485 - Distinct count 10 - Null count 0 G INTEGER, -- ELITEID INTEGER, -- PIM INTEGER, -- LEAGUE TEXT, -- TEAM TEXT, -- GAMETYPE TEXT, -- Example Values: `Regular Season`, `Playoffs` | Value Statics: Total count 5485 - Distinct count 2 - Null count 0 P INTEGER, -- GP INTEGER, -- foreign key (ELITEID) references PlayerInfo(ELITEID), PLUSMINUS INTEGER, -- );
video_games
What is the id of the game "Resident Evil Archives: Resident Evil"?
id of game refers to game.id; "Resident Evil Archives: Resident Evil" refers to game_name = 'Resident Evil Archives: Resident Evil'
SELECT T.genre_id FROM game AS T WHERE T.game_name = 'Resident Evil Archives: Resident Evil'
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
soccer_2016
What is the bowling skill of SC Ganguly?
SC Ganguly refers to Player_Name = 'SC Ganguly'
SELECT T1.Bowling_Skill FROM Bowling_Style AS T1 INNER JOIN Player AS T2 ON T2.Bowling_skill = T1.Bowling_Id WHERE T2.Player_Name = 'SC Ganguly'
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
ice_hockey_draft
List out the nation of players who played for the 1997-1998 season .
players refers to PlayerName; 1997-1998 season refers to SEASON = '1997-1998';
SELECT DISTINCT T2.nation FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.SEASON = '1997-1998'
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null count 0 sum_7yr_TOI INTEGER, -- overall INTEGER, -- position_info TEXT, -- ELITEID INTEGER primary key, sum_7yr_GP INTEGER, -- weight INTEGER, -- birthdate TEXT, -- birthday INTEGER, -- foreign key (height) references height_info(height_id), birthmonth INTEGER, -- Example Values: `6`, `7`, `3`, `5`, `10` | Value Statics: Total count 2171 - Distinct count 12 - Null count 0 foreign key (weight) references weight_info(weight_id), draftround INTEGER, -- Example Values: `7`, `3`, `5`, `4`, `1` | Value Statics: Total count 2171 - Distinct count 9 - Null count 0 overallby TEXT, -- birthplace TEXT, -- height INTEGER, -- Example Values: `73`, `76`, `72`, `75`, `70` | Value Statics: Total count 2171 - Distinct count 16 - Null count 0 birthyear DATE, -- nation TEXT, -- shoots TEXT, -- Example Values: `L`, `R`, `-` | Value Statics: Total count 2171 - Distinct count 3 - Null count 0 PlayerName TEXT, -- ); CREATE TABLE height_info ( height_in_cm INTEGER, -- Example Values: `165`, `170`, `172`, `174`, `177` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 height_id INTEGER primary key, height_in_inch TEXT, -- Example Values: `5'5"`, `5'7"`, `5'8"`, `5'9"`, `5'10"` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 ); CREATE TABLE weight_info ( weight_id INTEGER primary key, weight_in_kg INTEGER, -- weight_in_lbs INTEGER, -- ); CREATE TABLE SeasonStatus ( A INTEGER, -- SEASON TEXT, -- Example Values: `1997-1998`, `1999-2000`, `1998-1999`, `2000-2001`, `2001-2002` | Value Statics: Total count 5485 - Distinct count 10 - Null count 0 G INTEGER, -- ELITEID INTEGER, -- PIM INTEGER, -- LEAGUE TEXT, -- TEAM TEXT, -- GAMETYPE TEXT, -- Example Values: `Regular Season`, `Playoffs` | Value Statics: Total count 5485 - Distinct count 2 - Null count 0 P INTEGER, -- GP INTEGER, -- foreign key (ELITEID) references PlayerInfo(ELITEID), PLUSMINUS INTEGER, -- );
airline
From August 10 to August 20, 2018, how many cancelled flights of air carrier named Spirit Air Lines: NK are there?
From August 10 to August 20, 2018 refers to FL_DATE BETWEEN '2018/8/10' AND '2018/8/20'; cancelled flights refers to CANCELLED = 1; Trans Southern Airways: 'Spirit Air Lines: NK' refers to Description = 'Spirit Air Lines: NK';
SELECT COUNT(*) FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T1.Description = 'Spirit Air Lines: NK' AND T2.CANCELLED = 0 AND T2.FL_DATE BETWEEN '2018/8/10' AND '2018/8/20'
CREATE TABLE Airlines ( CANCELLED INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 CRS_DEP_TIME INTEGER, -- CRS_ELAPSED_TIME INTEGER, -- CANCELLATION_CODE TEXT, -- Example Values: `A`, `B`, `C` | Value Statics: Total count 3795 - Distinct count 3 - Null count 96205 SECURITY_DELAY INTEGER, -- ORIGIN_CITY_MARKET_ID INTEGER, -- OP_CARRIER_FL_NUM INTEGER, -- ORIGIN_AIRPORT_ID INTEGER, -- LATE_AIRCRAFT_DELAY INTEGER, -- DEP_DELAY INTEGER, -- ORIGIN_AIRPORT_SEQ_ID INTEGER, -- DEP_TIME INTEGER, -- FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code), ARR_DELAY INTEGER, -- ACTUAL_ELAPSED_TIME INTEGER, -- NAS_DELAY INTEGER, -- FOREIGN KEY (DEST) REFERENCES Airports(Code), TAIL_NUM TEXT, -- DEST TEXT, -- DEST_CITY_MARKET_ID INTEGER, -- ARR_DELAY_NEW INTEGER, -- OP_CARRIER_AIRLINE_ID INTEGER, -- ARR_TIME INTEGER, -- FOREIGN KEY (ORIGIN) REFERENCES Airports(Code), DEST_AIRPORT_ID INTEGER, -- WEATHER_DELAY INTEGER, -- DEP_DELAY_NEW INTEGER, -- ORIGIN TEXT, -- FL_DATE TEXT, -- CARRIER_DELAY INTEGER, -- DEST_AIRPORT_SEQ_ID INTEGER, -- ); CREATE TABLE Airports ( Code TEXT primary key, Description TEXT, -- ); CREATE TABLE Air Carriers ( Code INTEGER primary key, Description TEXT, -- );
soccer_2016
For how many times has player no.41 won the "man of the match" award?
player no.41 won the "man of the match" refers to Man_of_the_Match = 41
SELECT COUNT(Match_Id) FROM `Match` WHERE Man_of_the_Match = 41
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
ice_hockey_draft
Mention the type of game that Matthias Trattnig played.
type of game refers to GAMETYPE;
SELECT DISTINCT T1.GAMETYPE FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T2.PlayerName = 'Matthias Trattnig'
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null count 0 sum_7yr_TOI INTEGER, -- overall INTEGER, -- position_info TEXT, -- ELITEID INTEGER primary key, sum_7yr_GP INTEGER, -- weight INTEGER, -- birthdate TEXT, -- birthday INTEGER, -- foreign key (height) references height_info(height_id), birthmonth INTEGER, -- Example Values: `6`, `7`, `3`, `5`, `10` | Value Statics: Total count 2171 - Distinct count 12 - Null count 0 foreign key (weight) references weight_info(weight_id), draftround INTEGER, -- Example Values: `7`, `3`, `5`, `4`, `1` | Value Statics: Total count 2171 - Distinct count 9 - Null count 0 overallby TEXT, -- birthplace TEXT, -- height INTEGER, -- Example Values: `73`, `76`, `72`, `75`, `70` | Value Statics: Total count 2171 - Distinct count 16 - Null count 0 birthyear DATE, -- nation TEXT, -- shoots TEXT, -- Example Values: `L`, `R`, `-` | Value Statics: Total count 2171 - Distinct count 3 - Null count 0 PlayerName TEXT, -- ); CREATE TABLE height_info ( height_in_cm INTEGER, -- Example Values: `165`, `170`, `172`, `174`, `177` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 height_id INTEGER primary key, height_in_inch TEXT, -- Example Values: `5'5"`, `5'7"`, `5'8"`, `5'9"`, `5'10"` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 ); CREATE TABLE weight_info ( weight_id INTEGER primary key, weight_in_kg INTEGER, -- weight_in_lbs INTEGER, -- ); CREATE TABLE SeasonStatus ( A INTEGER, -- SEASON TEXT, -- Example Values: `1997-1998`, `1999-2000`, `1998-1999`, `2000-2001`, `2001-2002` | Value Statics: Total count 5485 - Distinct count 10 - Null count 0 G INTEGER, -- ELITEID INTEGER, -- PIM INTEGER, -- LEAGUE TEXT, -- TEAM TEXT, -- GAMETYPE TEXT, -- Example Values: `Regular Season`, `Playoffs` | Value Statics: Total count 5485 - Distinct count 2 - Null count 0 P INTEGER, -- GP INTEGER, -- foreign key (ELITEID) references PlayerInfo(ELITEID), PLUSMINUS INTEGER, -- );
airline
What is the air carrier's description of the cancelled flights?
cancelled flights refers to CANCELLED = 1;
SELECT T1.Description FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T2.CANCELLED = 1 GROUP BY T1.Description
CREATE TABLE Airlines ( CANCELLED INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 CRS_DEP_TIME INTEGER, -- CRS_ELAPSED_TIME INTEGER, -- CANCELLATION_CODE TEXT, -- Example Values: `A`, `B`, `C` | Value Statics: Total count 3795 - Distinct count 3 - Null count 96205 SECURITY_DELAY INTEGER, -- ORIGIN_CITY_MARKET_ID INTEGER, -- OP_CARRIER_FL_NUM INTEGER, -- ORIGIN_AIRPORT_ID INTEGER, -- LATE_AIRCRAFT_DELAY INTEGER, -- DEP_DELAY INTEGER, -- ORIGIN_AIRPORT_SEQ_ID INTEGER, -- DEP_TIME INTEGER, -- FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code), ARR_DELAY INTEGER, -- ACTUAL_ELAPSED_TIME INTEGER, -- NAS_DELAY INTEGER, -- FOREIGN KEY (DEST) REFERENCES Airports(Code), TAIL_NUM TEXT, -- DEST TEXT, -- DEST_CITY_MARKET_ID INTEGER, -- ARR_DELAY_NEW INTEGER, -- OP_CARRIER_AIRLINE_ID INTEGER, -- ARR_TIME INTEGER, -- FOREIGN KEY (ORIGIN) REFERENCES Airports(Code), DEST_AIRPORT_ID INTEGER, -- WEATHER_DELAY INTEGER, -- DEP_DELAY_NEW INTEGER, -- ORIGIN TEXT, -- FL_DATE TEXT, -- CARRIER_DELAY INTEGER, -- DEST_AIRPORT_SEQ_ID INTEGER, -- ); CREATE TABLE Airports ( Code TEXT primary key, Description TEXT, -- ); CREATE TABLE Air Carriers ( Code INTEGER primary key, Description TEXT, -- );
video_games
List the region name where games reached 300000 sales and above.
reached 300000 sales and above refers to num_sales > 3
SELECT DISTINCT T1.region_name FROM region AS T1 INNER JOIN region_sales AS T2 ON T1.id = T2.region_id WHERE T2.num_sales * 100000 > 300000
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
soccer_2016
Please list the bowling skills of all the players from Australia.
Australia refers to Country_Name = 'Australia'
SELECT T2.Bowling_Skill FROM Player AS T1 INNER JOIN Bowling_Style AS T2 ON T1.Bowling_skill = T2.Bowling_Id INNER JOIN Country AS T3 ON T1.Country_Name = T3.Country_Id WHERE T3.Country_Name = 'Australia' GROUP BY T2.Bowling_Skill
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
ice_hockey_draft
List out the seasons that Niklas Eckerblom played.
FALSE;
SELECT DISTINCT T1.SEASON FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T2.PlayerName = 'Niklas Eckerblom'
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null count 0 sum_7yr_TOI INTEGER, -- overall INTEGER, -- position_info TEXT, -- ELITEID INTEGER primary key, sum_7yr_GP INTEGER, -- weight INTEGER, -- birthdate TEXT, -- birthday INTEGER, -- foreign key (height) references height_info(height_id), birthmonth INTEGER, -- Example Values: `6`, `7`, `3`, `5`, `10` | Value Statics: Total count 2171 - Distinct count 12 - Null count 0 foreign key (weight) references weight_info(weight_id), draftround INTEGER, -- Example Values: `7`, `3`, `5`, `4`, `1` | Value Statics: Total count 2171 - Distinct count 9 - Null count 0 overallby TEXT, -- birthplace TEXT, -- height INTEGER, -- Example Values: `73`, `76`, `72`, `75`, `70` | Value Statics: Total count 2171 - Distinct count 16 - Null count 0 birthyear DATE, -- nation TEXT, -- shoots TEXT, -- Example Values: `L`, `R`, `-` | Value Statics: Total count 2171 - Distinct count 3 - Null count 0 PlayerName TEXT, -- ); CREATE TABLE height_info ( height_in_cm INTEGER, -- Example Values: `165`, `170`, `172`, `174`, `177` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 height_id INTEGER primary key, height_in_inch TEXT, -- Example Values: `5'5"`, `5'7"`, `5'8"`, `5'9"`, `5'10"` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 ); CREATE TABLE weight_info ( weight_id INTEGER primary key, weight_in_kg INTEGER, -- weight_in_lbs INTEGER, -- ); CREATE TABLE SeasonStatus ( A INTEGER, -- SEASON TEXT, -- Example Values: `1997-1998`, `1999-2000`, `1998-1999`, `2000-2001`, `2001-2002` | Value Statics: Total count 5485 - Distinct count 10 - Null count 0 G INTEGER, -- ELITEID INTEGER, -- PIM INTEGER, -- LEAGUE TEXT, -- TEAM TEXT, -- GAMETYPE TEXT, -- Example Values: `Regular Season`, `Playoffs` | Value Statics: Total count 5485 - Distinct count 2 - Null count 0 P INTEGER, -- GP INTEGER, -- foreign key (ELITEID) references PlayerInfo(ELITEID), PLUSMINUS INTEGER, -- );
ice_hockey_draft
Which team does Andreas Jamtin belong to?
FALSE;
SELECT DISTINCT T1.TEAM FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T2.PlayerName = 'Andreas Jamtin'
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null count 0 sum_7yr_TOI INTEGER, -- overall INTEGER, -- position_info TEXT, -- ELITEID INTEGER primary key, sum_7yr_GP INTEGER, -- weight INTEGER, -- birthdate TEXT, -- birthday INTEGER, -- foreign key (height) references height_info(height_id), birthmonth INTEGER, -- Example Values: `6`, `7`, `3`, `5`, `10` | Value Statics: Total count 2171 - Distinct count 12 - Null count 0 foreign key (weight) references weight_info(weight_id), draftround INTEGER, -- Example Values: `7`, `3`, `5`, `4`, `1` | Value Statics: Total count 2171 - Distinct count 9 - Null count 0 overallby TEXT, -- birthplace TEXT, -- height INTEGER, -- Example Values: `73`, `76`, `72`, `75`, `70` | Value Statics: Total count 2171 - Distinct count 16 - Null count 0 birthyear DATE, -- nation TEXT, -- shoots TEXT, -- Example Values: `L`, `R`, `-` | Value Statics: Total count 2171 - Distinct count 3 - Null count 0 PlayerName TEXT, -- ); CREATE TABLE height_info ( height_in_cm INTEGER, -- Example Values: `165`, `170`, `172`, `174`, `177` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 height_id INTEGER primary key, height_in_inch TEXT, -- Example Values: `5'5"`, `5'7"`, `5'8"`, `5'9"`, `5'10"` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 ); CREATE TABLE weight_info ( weight_id INTEGER primary key, weight_in_kg INTEGER, -- weight_in_lbs INTEGER, -- ); CREATE TABLE SeasonStatus ( A INTEGER, -- SEASON TEXT, -- Example Values: `1997-1998`, `1999-2000`, `1998-1999`, `2000-2001`, `2001-2002` | Value Statics: Total count 5485 - Distinct count 10 - Null count 0 G INTEGER, -- ELITEID INTEGER, -- PIM INTEGER, -- LEAGUE TEXT, -- TEAM TEXT, -- GAMETYPE TEXT, -- Example Values: `Regular Season`, `Playoffs` | Value Statics: Total count 5485 - Distinct count 2 - Null count 0 P INTEGER, -- GP INTEGER, -- foreign key (ELITEID) references PlayerInfo(ELITEID), PLUSMINUS INTEGER, -- );
airline
What is the tail number of the flight with air carrier named Iscargo Hf: ICQ and arrival time of 1000 and below?
tail number refers to TAIL_NUM; Iscargo Hf: ICQ refers to Description = 'Iscargo Hf: ICQ'; arrival time of 1000 and below refers to ARR_TIME < = 1000;
SELECT T2.TAIL_NUM FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T2.ARR_TIME <= 1000 AND T1.Description = 'Iscargo Hf: ICQ'
CREATE TABLE Airlines ( CANCELLED INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 CRS_DEP_TIME INTEGER, -- CRS_ELAPSED_TIME INTEGER, -- CANCELLATION_CODE TEXT, -- Example Values: `A`, `B`, `C` | Value Statics: Total count 3795 - Distinct count 3 - Null count 96205 SECURITY_DELAY INTEGER, -- ORIGIN_CITY_MARKET_ID INTEGER, -- OP_CARRIER_FL_NUM INTEGER, -- ORIGIN_AIRPORT_ID INTEGER, -- LATE_AIRCRAFT_DELAY INTEGER, -- DEP_DELAY INTEGER, -- ORIGIN_AIRPORT_SEQ_ID INTEGER, -- DEP_TIME INTEGER, -- FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code), ARR_DELAY INTEGER, -- ACTUAL_ELAPSED_TIME INTEGER, -- NAS_DELAY INTEGER, -- FOREIGN KEY (DEST) REFERENCES Airports(Code), TAIL_NUM TEXT, -- DEST TEXT, -- DEST_CITY_MARKET_ID INTEGER, -- ARR_DELAY_NEW INTEGER, -- OP_CARRIER_AIRLINE_ID INTEGER, -- ARR_TIME INTEGER, -- FOREIGN KEY (ORIGIN) REFERENCES Airports(Code), DEST_AIRPORT_ID INTEGER, -- WEATHER_DELAY INTEGER, -- DEP_DELAY_NEW INTEGER, -- ORIGIN TEXT, -- FL_DATE TEXT, -- CARRIER_DELAY INTEGER, -- DEST_AIRPORT_SEQ_ID INTEGER, -- ); CREATE TABLE Airports ( Code TEXT primary key, Description TEXT, -- ); CREATE TABLE Air Carriers ( Code INTEGER primary key, Description TEXT, -- );