db_id
stringclasses
66 values
question
stringlengths
24
325
evidence
stringlengths
1
673
gold_query
stringlengths
23
804
db_schema
stringclasses
66 values
chicago_crime
Give the neighborhood name of West Englewood community.
West Englewood community refers to community_area_name = 'West Englewood'
SELECT T1.neighborhood_name FROM Neighborhood AS T1 INNER JOIN Community_Area AS T2 ON T1.community_area_no = T2.community_area_no WHERE T2.community_area_name = 'West Englewood'
CREATE TABLE District ( district_no INTEGER primary key, email TEXT, -- phone TEXT, -- address TEXT, -- fax TEXT, -- district_name TEXT, -- tty TEXT, -- commander TEXT, -- zip_code INTEGER, -- twitter TEXT, -- ); CREATE TABLE Community_Area ( population TEXT, -- side TEXT, -- Example Values: `Far North `, `North `, `Central`, `Northwest `, `West ` | Value Statics: Total count 77 - Distinct count 9 - Null count 0 community_area_no INTEGER primary key, community_area_name TEXT, -- ); CREATE TABLE Ward ( ward_office_address TEXT, -- ward_office_zip TEXT, -- city_hall_office_phone TEXT, -- alderman_first_name TEXT, -- ward_no INTEGER primary key, ward_email TEXT, -- ward_office_fax TEXT, -- alderman_last_name TEXT, -- Population INTEGER, -- alderman_name_suffix TEXT, -- Example Values: `Jr.` | Value Statics: Total count 5 - Distinct count 1 - Null count 45 ward_office_phone TEXT, -- city_hall_office_room INTEGER, -- Example Values: `200`, `305`, `300`, `302` | Value Statics: Total count 50 - Distinct count 4 - Null count 0 city_hall_office_fax TEXT, -- ); CREATE TABLE IUCR ( iucr_no TEXT primary key, index_code TEXT, -- Example Values: `I`, `N` | Value Statics: Total count 401 - Distinct count 2 - Null count 0 primary_description TEXT, -- secondary_description TEXT, -- ); CREATE TABLE FBI_Code ( description TEXT, -- fbi_code_no TEXT primary key, crime_against TEXT, -- Example Values: `Persons`, `Property`, `Society`, `Persons and Society` | Value Statics: Total count 26 - Distinct count 4 - Null count 0 title TEXT, -- ); CREATE TABLE Neighborhood ( foreign key (community_area_no) references Community_Area(community_area_no), community_area_no INTEGER, -- neighborhood_name TEXT primary key, ); CREATE TABLE Crime ( case_number TEXT, -- longitude TEXT, -- foreign key (fbi_code_no) references FBI_Code(fbi_code_no), fbi_code_no TEXT, -- date TEXT, -- arrest TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 foreign key (community_area_no) references Community_Area(community_area_no), location_description TEXT, -- latitude TEXT, -- block TEXT, -- ward_no INTEGER, -- domestic TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 district_no INTEGER, -- report_no INTEGER primary key, iucr_no TEXT, -- foreign key (ward_no) references Ward(ward_no), community_area_no INTEGER, -- foreign key (district_no) references District(district_no), foreign key (iucr_no) references IUCR(iucr_no), beat INTEGER, -- );
retail_world
How many times is the number of territories in "Eastern Region" than "Southern Region"?
"Eastern Region" refers to RegionDescription = 'Eastern'; "Southern Region" refers to RegionDescription = 'Southern'; times = divide(count(TerritoryDescription where RegionDescription = 'Eastern') , count(TerritoryDescription where RegionDescription = 'Southern'))
SELECT CAST(( SELECT COUNT(T1.TerritoryID) FROM Territories AS T1 INNER JOIN Region AS T2 ON T1.RegionID = T2.RegionID WHERE T2.RegionDescription = 'Eastern' ) AS REAL) / ( SELECT COUNT(T1.TerritoryID) FROM Territories AS T1 INNER JOIN Region AS T2 ON T1.RegionID = T2.RegionID WHERE T2.RegionDescription = 'Southern' ) AS Calu
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
books
What percentage of the orders placed by Kaleena were shipped by the international method?
shipped by international method refers to method_name = 'International'; percentage = Divide (Sum(method_name = 'International'), Count(method_name)) * 100
SELECT CAST(SUM(CASE WHEN T3.method_name = 'International' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM customer AS T1 INNER JOIN cust_order AS T2 ON T1.customer_id = T2.customer_id INNER JOIN shipping_method AS T3 ON T3.method_id = T2.shipping_method_id WHERE T1.first_name = 'Kaleena'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
app_store
List down app that does not have negative sentiment and give their average rating?
doest not have negative sentiment refers to Sentiment! = 'Negative'; average = AVG(Sentiment_Polarity);
SELECT T1.App, AVG(T2.Sentiment_Polarity) FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T2.Sentiment != 'Negative' GROUP BY T1.App
CREATE TABLE playstore ( Rating REAL, -- Size TEXT, -- App TEXT, -- Category TEXT, -- Price TEXT, -- "Content Rating" TEXT, -- Example Values: `Everyone`, `Teen`, `Everyone 10+`, `Mature 17+`, `Adults only 18+` | Value Statics: Total count 10840 - Distinct count 6 - Null count 0 Installs TEXT, -- Type TEXT, -- Example Values: `Free`, `Paid`, `NaN` | Value Statics: Total count 10840 - Distinct count 3 - Null count 0 Reviews INTEGER, -- Genres TEXT, -- ); CREATE TABLE user_reviews ( Sentiment TEXT, -- Example Values: `Positive`, `nan`, `Neutral`, `Negative` | Value Statics: Total count 64286 - Distinct count 4 - Null count 0 App TEXT references "playstore" (App), -- Translated_Review TEXT, -- Sentiment_Subjectivity TEXT, -- Sentiment_Polarity TEXT, -- );
chicago_crime
Who was the alderman of the legislative district where case No. JB103470 took place? Give the full name.
case No. JB103470 refers to case_number = 'JB103470'; full name refers to alderman_first_name, alderman_last_name
SELECT T1.alderman_first_name, T1.alderman_last_name FROM Ward AS T1 INNER JOIN Crime AS T2 ON T1.ward_no = T2.ward_no WHERE T2.case_number = 'JB103470'
CREATE TABLE District ( district_no INTEGER primary key, email TEXT, -- phone TEXT, -- address TEXT, -- fax TEXT, -- district_name TEXT, -- tty TEXT, -- commander TEXT, -- zip_code INTEGER, -- twitter TEXT, -- ); CREATE TABLE Community_Area ( population TEXT, -- side TEXT, -- Example Values: `Far North `, `North `, `Central`, `Northwest `, `West ` | Value Statics: Total count 77 - Distinct count 9 - Null count 0 community_area_no INTEGER primary key, community_area_name TEXT, -- ); CREATE TABLE Ward ( ward_office_address TEXT, -- ward_office_zip TEXT, -- city_hall_office_phone TEXT, -- alderman_first_name TEXT, -- ward_no INTEGER primary key, ward_email TEXT, -- ward_office_fax TEXT, -- alderman_last_name TEXT, -- Population INTEGER, -- alderman_name_suffix TEXT, -- Example Values: `Jr.` | Value Statics: Total count 5 - Distinct count 1 - Null count 45 ward_office_phone TEXT, -- city_hall_office_room INTEGER, -- Example Values: `200`, `305`, `300`, `302` | Value Statics: Total count 50 - Distinct count 4 - Null count 0 city_hall_office_fax TEXT, -- ); CREATE TABLE IUCR ( iucr_no TEXT primary key, index_code TEXT, -- Example Values: `I`, `N` | Value Statics: Total count 401 - Distinct count 2 - Null count 0 primary_description TEXT, -- secondary_description TEXT, -- ); CREATE TABLE FBI_Code ( description TEXT, -- fbi_code_no TEXT primary key, crime_against TEXT, -- Example Values: `Persons`, `Property`, `Society`, `Persons and Society` | Value Statics: Total count 26 - Distinct count 4 - Null count 0 title TEXT, -- ); CREATE TABLE Neighborhood ( foreign key (community_area_no) references Community_Area(community_area_no), community_area_no INTEGER, -- neighborhood_name TEXT primary key, ); CREATE TABLE Crime ( case_number TEXT, -- longitude TEXT, -- foreign key (fbi_code_no) references FBI_Code(fbi_code_no), fbi_code_no TEXT, -- date TEXT, -- arrest TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 foreign key (community_area_no) references Community_Area(community_area_no), location_description TEXT, -- latitude TEXT, -- block TEXT, -- ward_no INTEGER, -- domestic TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 district_no INTEGER, -- report_no INTEGER primary key, iucr_no TEXT, -- foreign key (ward_no) references Ward(ward_no), community_area_no INTEGER, -- foreign key (district_no) references District(district_no), foreign key (iucr_no) references IUCR(iucr_no), beat INTEGER, -- );
retail_world
How many percent more orders were fulfilled with shipper company "United Package" than with "Speedy Express"?
percent = divide(subtract(count(OrderID where CompanyName = 'United Package') , count(OrderID where CompanyName = 'Speedy Express')) , count(OrderID where CompanyName = 'Speedy Express')) * 100%
SELECT CAST((COUNT(CASE WHEN T2.CompanyName = 'United Package' THEN 1 ELSE NULL END) - COUNT(CASE WHEN T2.CompanyName = 'Speedy Express' THEN 1 ELSE NULL END)) AS REAL) * 100 / COUNT(CASE WHEN T2.CompanyName = 'Speedy Express' THEN 1 ELSE NULL END) FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID
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, );
chicago_crime
Give the name of the community area which had the most pocket-picking thefts.
name of the community area refers to community_area_name; the most refers to max(case_number); pocket-picking theft refers to primary_description = 'THEFT' AND secondary_description = 'POCKET-PICKING'
SELECT T3.community_area_name FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T1.iucr_no = T2.iucr_no INNER JOIN Community_Area AS T3 ON T2.community_area_no = T3.community_area_no WHERE T1.primary_description = 'THEFT' AND T1.secondary_description = 'POCKET-PICKING' GROUP BY T2.community_area_no ORDER BY T2.case_number DESC LIMIT 1
CREATE TABLE District ( district_no INTEGER primary key, email TEXT, -- phone TEXT, -- address TEXT, -- fax TEXT, -- district_name TEXT, -- tty TEXT, -- commander TEXT, -- zip_code INTEGER, -- twitter TEXT, -- ); CREATE TABLE Community_Area ( population TEXT, -- side TEXT, -- Example Values: `Far North `, `North `, `Central`, `Northwest `, `West ` | Value Statics: Total count 77 - Distinct count 9 - Null count 0 community_area_no INTEGER primary key, community_area_name TEXT, -- ); CREATE TABLE Ward ( ward_office_address TEXT, -- ward_office_zip TEXT, -- city_hall_office_phone TEXT, -- alderman_first_name TEXT, -- ward_no INTEGER primary key, ward_email TEXT, -- ward_office_fax TEXT, -- alderman_last_name TEXT, -- Population INTEGER, -- alderman_name_suffix TEXT, -- Example Values: `Jr.` | Value Statics: Total count 5 - Distinct count 1 - Null count 45 ward_office_phone TEXT, -- city_hall_office_room INTEGER, -- Example Values: `200`, `305`, `300`, `302` | Value Statics: Total count 50 - Distinct count 4 - Null count 0 city_hall_office_fax TEXT, -- ); CREATE TABLE IUCR ( iucr_no TEXT primary key, index_code TEXT, -- Example Values: `I`, `N` | Value Statics: Total count 401 - Distinct count 2 - Null count 0 primary_description TEXT, -- secondary_description TEXT, -- ); CREATE TABLE FBI_Code ( description TEXT, -- fbi_code_no TEXT primary key, crime_against TEXT, -- Example Values: `Persons`, `Property`, `Society`, `Persons and Society` | Value Statics: Total count 26 - Distinct count 4 - Null count 0 title TEXT, -- ); CREATE TABLE Neighborhood ( foreign key (community_area_no) references Community_Area(community_area_no), community_area_no INTEGER, -- neighborhood_name TEXT primary key, ); CREATE TABLE Crime ( case_number TEXT, -- longitude TEXT, -- foreign key (fbi_code_no) references FBI_Code(fbi_code_no), fbi_code_no TEXT, -- date TEXT, -- arrest TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 foreign key (community_area_no) references Community_Area(community_area_no), location_description TEXT, -- latitude TEXT, -- block TEXT, -- ward_no INTEGER, -- domestic TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 district_no INTEGER, -- report_no INTEGER primary key, iucr_no TEXT, -- foreign key (ward_no) references Ward(ward_no), community_area_no INTEGER, -- foreign key (district_no) references District(district_no), foreign key (iucr_no) references IUCR(iucr_no), beat INTEGER, -- );
retail_world
For the orders of Customer "WHITC", what is the percentage of the orders were fulfilled with shipper company "United Package"?
Customer "WHITC" refers to CustomerID = 'WHITC'; shipper company "United Package" refers to CompanyName = 'United Package'; percentage = divide(count(ShipperID where CompanyName = 'United Package') , count(ShipperID)) * 100%
SELECT CAST(COUNT(CASE WHEN T2.CompanyName = 'United Package' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.OrderID) FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T1.CustomerID = 'WHITC'
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, );
app_store
What is the percentage for free application with a rating 4.5 and above have not been updated since 2018?
paid refers to Type = 'Paid'; application refers to App; Rating>4.5; Last Updated>'2018; percentage = DIVIDE(SUM(Genres = 'Mature 17+' and Rating>4.5 and substr("Last Updated",-4,4)>'2018' )), (COUNT(App)) as percent;
SELECT CAST(SUM(CASE WHEN SUBSTR('Last Updated', -4) > '2018' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(App) PER FROM playstore WHERE Type = 'Free' AND Rating >= 4.5
CREATE TABLE playstore ( Rating REAL, -- Size TEXT, -- App TEXT, -- Category TEXT, -- Price TEXT, -- "Content Rating" TEXT, -- Example Values: `Everyone`, `Teen`, `Everyone 10+`, `Mature 17+`, `Adults only 18+` | Value Statics: Total count 10840 - Distinct count 6 - Null count 0 Installs TEXT, -- Type TEXT, -- Example Values: `Free`, `Paid`, `NaN` | Value Statics: Total count 10840 - Distinct count 3 - Null count 0 Reviews INTEGER, -- Genres TEXT, -- ); CREATE TABLE user_reviews ( Sentiment TEXT, -- Example Values: `Positive`, `nan`, `Neutral`, `Negative` | Value Statics: Total count 64286 - Distinct count 4 - Null count 0 App TEXT references "playstore" (App), -- Translated_Review TEXT, -- Sentiment_Subjectivity TEXT, -- Sentiment_Polarity TEXT, -- );
chicago_crime
How severe was case JB296775? Give the index code for severity.
index code refers to iucr_no; case JB296775 refers to case_number = 'JB296775'
SELECT T2.iucr_no FROM Crime AS T1 INNER JOIN IUCR AS T2 ON T1.iucr_no = T2.iucr_no WHERE T1.case_number = 'JB296775'
CREATE TABLE District ( district_no INTEGER primary key, email TEXT, -- phone TEXT, -- address TEXT, -- fax TEXT, -- district_name TEXT, -- tty TEXT, -- commander TEXT, -- zip_code INTEGER, -- twitter TEXT, -- ); CREATE TABLE Community_Area ( population TEXT, -- side TEXT, -- Example Values: `Far North `, `North `, `Central`, `Northwest `, `West ` | Value Statics: Total count 77 - Distinct count 9 - Null count 0 community_area_no INTEGER primary key, community_area_name TEXT, -- ); CREATE TABLE Ward ( ward_office_address TEXT, -- ward_office_zip TEXT, -- city_hall_office_phone TEXT, -- alderman_first_name TEXT, -- ward_no INTEGER primary key, ward_email TEXT, -- ward_office_fax TEXT, -- alderman_last_name TEXT, -- Population INTEGER, -- alderman_name_suffix TEXT, -- Example Values: `Jr.` | Value Statics: Total count 5 - Distinct count 1 - Null count 45 ward_office_phone TEXT, -- city_hall_office_room INTEGER, -- Example Values: `200`, `305`, `300`, `302` | Value Statics: Total count 50 - Distinct count 4 - Null count 0 city_hall_office_fax TEXT, -- ); CREATE TABLE IUCR ( iucr_no TEXT primary key, index_code TEXT, -- Example Values: `I`, `N` | Value Statics: Total count 401 - Distinct count 2 - Null count 0 primary_description TEXT, -- secondary_description TEXT, -- ); CREATE TABLE FBI_Code ( description TEXT, -- fbi_code_no TEXT primary key, crime_against TEXT, -- Example Values: `Persons`, `Property`, `Society`, `Persons and Society` | Value Statics: Total count 26 - Distinct count 4 - Null count 0 title TEXT, -- ); CREATE TABLE Neighborhood ( foreign key (community_area_no) references Community_Area(community_area_no), community_area_no INTEGER, -- neighborhood_name TEXT primary key, ); CREATE TABLE Crime ( case_number TEXT, -- longitude TEXT, -- foreign key (fbi_code_no) references FBI_Code(fbi_code_no), fbi_code_no TEXT, -- date TEXT, -- arrest TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 foreign key (community_area_no) references Community_Area(community_area_no), location_description TEXT, -- latitude TEXT, -- block TEXT, -- ward_no INTEGER, -- domestic TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 district_no INTEGER, -- report_no INTEGER primary key, iucr_no TEXT, -- foreign key (ward_no) references Ward(ward_no), community_area_no INTEGER, -- foreign key (district_no) references District(district_no), foreign key (iucr_no) references IUCR(iucr_no), beat INTEGER, -- );
retail_world
Which region is "Columbia" in?
region refers to RegionID; "Columbia" refers to TerritoryDescription = 'Columbia'
SELECT T2.RegionDescription FROM Territories AS T1 INNER JOIN Region AS T2 ON T1.RegionID = T2.RegionID WHERE T1.TerritoryDescription = 'Columbia'
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, );
books
List every book that Ursola Purdy has ordered.
book refers to title
SELECT T1.title FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id INNER JOIN customer AS T4 ON T4.customer_id = T3.customer_id WHERE T4.first_name = 'Ursola' AND T4.last_name = 'Purdy'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
app_store
What is the average price of games belonging in the arcade genre which has a content rating of Everyone 10+?
average price = AVG(Price);
SELECT AVG(Price) FROM playstore WHERE 'Content Rating' = 'Everyone 10+' AND Genres = 'Arcade'
CREATE TABLE playstore ( Rating REAL, -- Size TEXT, -- App TEXT, -- Category TEXT, -- Price TEXT, -- "Content Rating" TEXT, -- Example Values: `Everyone`, `Teen`, `Everyone 10+`, `Mature 17+`, `Adults only 18+` | Value Statics: Total count 10840 - Distinct count 6 - Null count 0 Installs TEXT, -- Type TEXT, -- Example Values: `Free`, `Paid`, `NaN` | Value Statics: Total count 10840 - Distinct count 3 - Null count 0 Reviews INTEGER, -- Genres TEXT, -- ); CREATE TABLE user_reviews ( Sentiment TEXT, -- Example Values: `Positive`, `nan`, `Neutral`, `Negative` | Value Statics: Total count 64286 - Distinct count 4 - Null count 0 App TEXT references "playstore" (App), -- Translated_Review TEXT, -- Sentiment_Subjectivity TEXT, -- Sentiment_Polarity TEXT, -- );
chicago_crime
Which district had the most number of first degree murders? Give the district number.
the most number refers to max(count(case_number)); first degree murder refers to secondary_description = 'FIRST DEGREE MURDER'; district number refers to district_no
SELECT T2.district_no FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T1.iucr_no = T2.iucr_no WHERE T1.secondary_description = 'FIRST DEGREE MURDER' GROUP BY T2.district_no ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE District ( district_no INTEGER primary key, email TEXT, -- phone TEXT, -- address TEXT, -- fax TEXT, -- district_name TEXT, -- tty TEXT, -- commander TEXT, -- zip_code INTEGER, -- twitter TEXT, -- ); CREATE TABLE Community_Area ( population TEXT, -- side TEXT, -- Example Values: `Far North `, `North `, `Central`, `Northwest `, `West ` | Value Statics: Total count 77 - Distinct count 9 - Null count 0 community_area_no INTEGER primary key, community_area_name TEXT, -- ); CREATE TABLE Ward ( ward_office_address TEXT, -- ward_office_zip TEXT, -- city_hall_office_phone TEXT, -- alderman_first_name TEXT, -- ward_no INTEGER primary key, ward_email TEXT, -- ward_office_fax TEXT, -- alderman_last_name TEXT, -- Population INTEGER, -- alderman_name_suffix TEXT, -- Example Values: `Jr.` | Value Statics: Total count 5 - Distinct count 1 - Null count 45 ward_office_phone TEXT, -- city_hall_office_room INTEGER, -- Example Values: `200`, `305`, `300`, `302` | Value Statics: Total count 50 - Distinct count 4 - Null count 0 city_hall_office_fax TEXT, -- ); CREATE TABLE IUCR ( iucr_no TEXT primary key, index_code TEXT, -- Example Values: `I`, `N` | Value Statics: Total count 401 - Distinct count 2 - Null count 0 primary_description TEXT, -- secondary_description TEXT, -- ); CREATE TABLE FBI_Code ( description TEXT, -- fbi_code_no TEXT primary key, crime_against TEXT, -- Example Values: `Persons`, `Property`, `Society`, `Persons and Society` | Value Statics: Total count 26 - Distinct count 4 - Null count 0 title TEXT, -- ); CREATE TABLE Neighborhood ( foreign key (community_area_no) references Community_Area(community_area_no), community_area_no INTEGER, -- neighborhood_name TEXT primary key, ); CREATE TABLE Crime ( case_number TEXT, -- longitude TEXT, -- foreign key (fbi_code_no) references FBI_Code(fbi_code_no), fbi_code_no TEXT, -- date TEXT, -- arrest TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 foreign key (community_area_no) references Community_Area(community_area_no), location_description TEXT, -- latitude TEXT, -- block TEXT, -- ward_no INTEGER, -- domestic TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 district_no INTEGER, -- report_no INTEGER primary key, iucr_no TEXT, -- foreign key (ward_no) references Ward(ward_no), community_area_no INTEGER, -- foreign key (district_no) references District(district_no), foreign key (iucr_no) references IUCR(iucr_no), beat INTEGER, -- );
retail_world
Give the number of territories in the "Northern" region.
"Northern" region refers to RegionDescription = 'Northern'
SELECT COUNT(T1.TerritoryID) FROM Territories AS T1 INNER JOIN Region AS T2 ON T1.RegionID = T2.RegionID WHERE T2.RegionDescription = 'Northern'
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, );
books
What is the average number of pages in the books written by Jennifer Crusie?
"Jennifer Crusie" is the author_name; average number of pages refers to AVG(num_pages)
SELECT AVG(T1.num_pages) FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T3.author_name = 'Jennifer Crusie'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
genes
Among the genes with nucleic acid metabolism defects, how many of them can be found in the vacuole?
null
SELECT COUNT(T1.GeneID) FROM Genes AS T1 INNER JOIN Classification AS T2 ON T1.GeneID = T2.GeneID WHERE T2.Localization = 'vacuole' AND T1.Phenotype = 'Nucleic acid metabolism defects'
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression_Corr REAL not null, -- Type TEXT not null, -- Example Values: `Genetic-Physical`, `Genetic`, `Physical` | Value Statics: Total count 910 - Distinct count 3 - Null count 0 ); CREATE TABLE Genes ( Motif TEXT not null, -- Class TEXT not null, -- Complex TEXT null, -- Phenotype TEXT not null, -- Example Values: `?`, `Mating and sporulation defects`, `Cell cycle defects`, `Cell morphology and organelle mutants`, `Conditional phenotypes` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 foreign key (GeneID) references Classification (GeneID) on update cascade on delete cascade, Chromosome INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 4346 - Distinct count 17 - Null count 0 GeneID TEXT not null, -- Function TEXT not null, -- Example Values: `CELLULAR ORGANIZATION (proteins are localized to the corresponding organelle)`, `PROTEIN SYNTHESIS`, `CELL RESCUE, DEFENSE, CELL DEATH AND AGEING`, `CELLULAR TRANSPORT AND TRANSPORTMECHANISMS`, `PROTEIN DESTINATION` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 4346 - Distinct count 15 - Null count 0 Essential TEXT not null, -- Example Values: `Essential`, `Non-Essential`, `?`, `Ambiguous-Essential` | Value Statics: Total count 4346 - Distinct count 4 - Null count 0 ); CREATE TABLE Classification ( GeneID TEXT not null primary key, Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 862 - Distinct count 15 - Null count 0 );
chicago_crime
How many simple assaults happened on 2018/9/8?
simple assault refers to primary_description = 'ASSAULT'AND secondary_description = 'SIMPLE'; on 2018/9/8 refers to date like '%9/8/2018%'
SELECT SUM(CASE WHEN T2.secondary_description = 'SIMPLE' THEN 1 ELSE 0 END) FROM Crime AS T1 INNER JOIN IUCR AS T2 ON T1.iucr_no = T2.iucr_no WHERE T1.date LIKE '%9/8/2018%' AND T2.primary_description = 'ASSAULT'
CREATE TABLE District ( district_no INTEGER primary key, email TEXT, -- phone TEXT, -- address TEXT, -- fax TEXT, -- district_name TEXT, -- tty TEXT, -- commander TEXT, -- zip_code INTEGER, -- twitter TEXT, -- ); CREATE TABLE Community_Area ( population TEXT, -- side TEXT, -- Example Values: `Far North `, `North `, `Central`, `Northwest `, `West ` | Value Statics: Total count 77 - Distinct count 9 - Null count 0 community_area_no INTEGER primary key, community_area_name TEXT, -- ); CREATE TABLE Ward ( ward_office_address TEXT, -- ward_office_zip TEXT, -- city_hall_office_phone TEXT, -- alderman_first_name TEXT, -- ward_no INTEGER primary key, ward_email TEXT, -- ward_office_fax TEXT, -- alderman_last_name TEXT, -- Population INTEGER, -- alderman_name_suffix TEXT, -- Example Values: `Jr.` | Value Statics: Total count 5 - Distinct count 1 - Null count 45 ward_office_phone TEXT, -- city_hall_office_room INTEGER, -- Example Values: `200`, `305`, `300`, `302` | Value Statics: Total count 50 - Distinct count 4 - Null count 0 city_hall_office_fax TEXT, -- ); CREATE TABLE IUCR ( iucr_no TEXT primary key, index_code TEXT, -- Example Values: `I`, `N` | Value Statics: Total count 401 - Distinct count 2 - Null count 0 primary_description TEXT, -- secondary_description TEXT, -- ); CREATE TABLE FBI_Code ( description TEXT, -- fbi_code_no TEXT primary key, crime_against TEXT, -- Example Values: `Persons`, `Property`, `Society`, `Persons and Society` | Value Statics: Total count 26 - Distinct count 4 - Null count 0 title TEXT, -- ); CREATE TABLE Neighborhood ( foreign key (community_area_no) references Community_Area(community_area_no), community_area_no INTEGER, -- neighborhood_name TEXT primary key, ); CREATE TABLE Crime ( case_number TEXT, -- longitude TEXT, -- foreign key (fbi_code_no) references FBI_Code(fbi_code_no), fbi_code_no TEXT, -- date TEXT, -- arrest TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 foreign key (community_area_no) references Community_Area(community_area_no), location_description TEXT, -- latitude TEXT, -- block TEXT, -- ward_no INTEGER, -- domestic TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 district_no INTEGER, -- report_no INTEGER primary key, iucr_no TEXT, -- foreign key (ward_no) references Ward(ward_no), community_area_no INTEGER, -- foreign key (district_no) references District(district_no), foreign key (iucr_no) references IUCR(iucr_no), beat INTEGER, -- );
retail_world
Tell the country name of the supplier for "Scottish Longbreads".
"Scottish Longbreads" refers to ProductName = 'Scottish Longbreads'
SELECT T2.Country FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.ProductName = 'Scottish Longbreads'
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, );
chicago_crime
Give the name of the person who was responsible for case No.JB524952.
name of the person refers to commander; case No.JB524952 refers to case_number = 'JB524952'
SELECT T1.commander FROM District AS T1 INNER JOIN Crime AS T2 ON T1.district_no = T2.district_no WHERE T2.case_number = 'JB524952'
CREATE TABLE District ( district_no INTEGER primary key, email TEXT, -- phone TEXT, -- address TEXT, -- fax TEXT, -- district_name TEXT, -- tty TEXT, -- commander TEXT, -- zip_code INTEGER, -- twitter TEXT, -- ); CREATE TABLE Community_Area ( population TEXT, -- side TEXT, -- Example Values: `Far North `, `North `, `Central`, `Northwest `, `West ` | Value Statics: Total count 77 - Distinct count 9 - Null count 0 community_area_no INTEGER primary key, community_area_name TEXT, -- ); CREATE TABLE Ward ( ward_office_address TEXT, -- ward_office_zip TEXT, -- city_hall_office_phone TEXT, -- alderman_first_name TEXT, -- ward_no INTEGER primary key, ward_email TEXT, -- ward_office_fax TEXT, -- alderman_last_name TEXT, -- Population INTEGER, -- alderman_name_suffix TEXT, -- Example Values: `Jr.` | Value Statics: Total count 5 - Distinct count 1 - Null count 45 ward_office_phone TEXT, -- city_hall_office_room INTEGER, -- Example Values: `200`, `305`, `300`, `302` | Value Statics: Total count 50 - Distinct count 4 - Null count 0 city_hall_office_fax TEXT, -- ); CREATE TABLE IUCR ( iucr_no TEXT primary key, index_code TEXT, -- Example Values: `I`, `N` | Value Statics: Total count 401 - Distinct count 2 - Null count 0 primary_description TEXT, -- secondary_description TEXT, -- ); CREATE TABLE FBI_Code ( description TEXT, -- fbi_code_no TEXT primary key, crime_against TEXT, -- Example Values: `Persons`, `Property`, `Society`, `Persons and Society` | Value Statics: Total count 26 - Distinct count 4 - Null count 0 title TEXT, -- ); CREATE TABLE Neighborhood ( foreign key (community_area_no) references Community_Area(community_area_no), community_area_no INTEGER, -- neighborhood_name TEXT primary key, ); CREATE TABLE Crime ( case_number TEXT, -- longitude TEXT, -- foreign key (fbi_code_no) references FBI_Code(fbi_code_no), fbi_code_no TEXT, -- date TEXT, -- arrest TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 foreign key (community_area_no) references Community_Area(community_area_no), location_description TEXT, -- latitude TEXT, -- block TEXT, -- ward_no INTEGER, -- domestic TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 district_no INTEGER, -- report_no INTEGER primary key, iucr_no TEXT, -- foreign key (ward_no) references Ward(ward_no), community_area_no INTEGER, -- foreign key (district_no) references District(district_no), foreign key (iucr_no) references IUCR(iucr_no), beat INTEGER, -- );
retail_world
Give the contact name of the supplier for the product "Gudbrandsdalsost".
product refers to ProductName
SELECT T2.ContactName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.ProductName = 'Gudbrandsdalsost'
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, );
app_store
Name the Apps with a sentiment objectivity of 0.3 and include their number of installs.
FALSE;
SELECT DISTINCT T1.App, T1.Installs FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T2.Sentiment_Polarity = 0.3
CREATE TABLE playstore ( Rating REAL, -- Size TEXT, -- App TEXT, -- Category TEXT, -- Price TEXT, -- "Content Rating" TEXT, -- Example Values: `Everyone`, `Teen`, `Everyone 10+`, `Mature 17+`, `Adults only 18+` | Value Statics: Total count 10840 - Distinct count 6 - Null count 0 Installs TEXT, -- Type TEXT, -- Example Values: `Free`, `Paid`, `NaN` | Value Statics: Total count 10840 - Distinct count 3 - Null count 0 Reviews INTEGER, -- Genres TEXT, -- ); CREATE TABLE user_reviews ( Sentiment TEXT, -- Example Values: `Positive`, `nan`, `Neutral`, `Negative` | Value Statics: Total count 64286 - Distinct count 4 - Null count 0 App TEXT references "playstore" (App), -- Translated_Review TEXT, -- Sentiment_Subjectivity TEXT, -- Sentiment_Polarity TEXT, -- );
chicago_crime
Where is the coordinate (41.66236555, -87.63470194) located? Give the name of the district.
coordinate (41.66236555, -87.63470194) refers to latitude = '41.66236555' AND longitude = '-87.63470194'; name of the district refers to district_name
SELECT T2.district_name FROM Crime AS T1 INNER JOIN District AS T2 ON T1.district_no = T2.district_no WHERE T1.longitude = '-87.63470194' AND T1.latitude = '41.66236555'
CREATE TABLE District ( district_no INTEGER primary key, email TEXT, -- phone TEXT, -- address TEXT, -- fax TEXT, -- district_name TEXT, -- tty TEXT, -- commander TEXT, -- zip_code INTEGER, -- twitter TEXT, -- ); CREATE TABLE Community_Area ( population TEXT, -- side TEXT, -- Example Values: `Far North `, `North `, `Central`, `Northwest `, `West ` | Value Statics: Total count 77 - Distinct count 9 - Null count 0 community_area_no INTEGER primary key, community_area_name TEXT, -- ); CREATE TABLE Ward ( ward_office_address TEXT, -- ward_office_zip TEXT, -- city_hall_office_phone TEXT, -- alderman_first_name TEXT, -- ward_no INTEGER primary key, ward_email TEXT, -- ward_office_fax TEXT, -- alderman_last_name TEXT, -- Population INTEGER, -- alderman_name_suffix TEXT, -- Example Values: `Jr.` | Value Statics: Total count 5 - Distinct count 1 - Null count 45 ward_office_phone TEXT, -- city_hall_office_room INTEGER, -- Example Values: `200`, `305`, `300`, `302` | Value Statics: Total count 50 - Distinct count 4 - Null count 0 city_hall_office_fax TEXT, -- ); CREATE TABLE IUCR ( iucr_no TEXT primary key, index_code TEXT, -- Example Values: `I`, `N` | Value Statics: Total count 401 - Distinct count 2 - Null count 0 primary_description TEXT, -- secondary_description TEXT, -- ); CREATE TABLE FBI_Code ( description TEXT, -- fbi_code_no TEXT primary key, crime_against TEXT, -- Example Values: `Persons`, `Property`, `Society`, `Persons and Society` | Value Statics: Total count 26 - Distinct count 4 - Null count 0 title TEXT, -- ); CREATE TABLE Neighborhood ( foreign key (community_area_no) references Community_Area(community_area_no), community_area_no INTEGER, -- neighborhood_name TEXT primary key, ); CREATE TABLE Crime ( case_number TEXT, -- longitude TEXT, -- foreign key (fbi_code_no) references FBI_Code(fbi_code_no), fbi_code_no TEXT, -- date TEXT, -- arrest TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 foreign key (community_area_no) references Community_Area(community_area_no), location_description TEXT, -- latitude TEXT, -- block TEXT, -- ward_no INTEGER, -- domestic TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 district_no INTEGER, -- report_no INTEGER primary key, iucr_no TEXT, -- foreign key (ward_no) references Ward(ward_no), community_area_no INTEGER, -- foreign key (district_no) references District(district_no), foreign key (iucr_no) references IUCR(iucr_no), beat INTEGER, -- );
retail_world
How many kinds of products are supplied by "Karkki Oy" company?
supplied by refers to CompanyName
SELECT COUNT(T1.ProductID) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Karkki Oy'
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, );
books
Provide the full name of the customers who have ordered the book The Sorrows of Young Werther.
full name refers to first_name, last_name; 'The Sorrows of Young Werther' is the title of the book
SELECT T4.first_name, T4.last_name FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id INNER JOIN customer AS T4 ON T4.customer_id = T3.customer_id WHERE T1.title = 'The Sorrows of Young Werther'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
app_store
List down the rating for the App Learn C++.
FALSE;
SELECT DISTINCT Rating FROM playstore WHERE App = 'Learn C++'
CREATE TABLE playstore ( Rating REAL, -- Size TEXT, -- App TEXT, -- Category TEXT, -- Price TEXT, -- "Content Rating" TEXT, -- Example Values: `Everyone`, `Teen`, `Everyone 10+`, `Mature 17+`, `Adults only 18+` | Value Statics: Total count 10840 - Distinct count 6 - Null count 0 Installs TEXT, -- Type TEXT, -- Example Values: `Free`, `Paid`, `NaN` | Value Statics: Total count 10840 - Distinct count 3 - Null count 0 Reviews INTEGER, -- Genres TEXT, -- ); CREATE TABLE user_reviews ( Sentiment TEXT, -- Example Values: `Positive`, `nan`, `Neutral`, `Negative` | Value Statics: Total count 64286 - Distinct count 4 - Null count 0 App TEXT references "playstore" (App), -- Translated_Review TEXT, -- Sentiment_Subjectivity TEXT, -- Sentiment_Polarity TEXT, -- );
chicago_crime
Where did case No. JB100065 happen? Give the name of the district.
case No. JB100065 refers to case_number = 'JB100065'; name of the district refers to district_name
SELECT T1.district_name FROM District AS T1 INNER JOIN Crime AS T2 ON T1.district_no = T2.district_no WHERE T2.case_number = 'JB100065'
CREATE TABLE District ( district_no INTEGER primary key, email TEXT, -- phone TEXT, -- address TEXT, -- fax TEXT, -- district_name TEXT, -- tty TEXT, -- commander TEXT, -- zip_code INTEGER, -- twitter TEXT, -- ); CREATE TABLE Community_Area ( population TEXT, -- side TEXT, -- Example Values: `Far North `, `North `, `Central`, `Northwest `, `West ` | Value Statics: Total count 77 - Distinct count 9 - Null count 0 community_area_no INTEGER primary key, community_area_name TEXT, -- ); CREATE TABLE Ward ( ward_office_address TEXT, -- ward_office_zip TEXT, -- city_hall_office_phone TEXT, -- alderman_first_name TEXT, -- ward_no INTEGER primary key, ward_email TEXT, -- ward_office_fax TEXT, -- alderman_last_name TEXT, -- Population INTEGER, -- alderman_name_suffix TEXT, -- Example Values: `Jr.` | Value Statics: Total count 5 - Distinct count 1 - Null count 45 ward_office_phone TEXT, -- city_hall_office_room INTEGER, -- Example Values: `200`, `305`, `300`, `302` | Value Statics: Total count 50 - Distinct count 4 - Null count 0 city_hall_office_fax TEXT, -- ); CREATE TABLE IUCR ( iucr_no TEXT primary key, index_code TEXT, -- Example Values: `I`, `N` | Value Statics: Total count 401 - Distinct count 2 - Null count 0 primary_description TEXT, -- secondary_description TEXT, -- ); CREATE TABLE FBI_Code ( description TEXT, -- fbi_code_no TEXT primary key, crime_against TEXT, -- Example Values: `Persons`, `Property`, `Society`, `Persons and Society` | Value Statics: Total count 26 - Distinct count 4 - Null count 0 title TEXT, -- ); CREATE TABLE Neighborhood ( foreign key (community_area_no) references Community_Area(community_area_no), community_area_no INTEGER, -- neighborhood_name TEXT primary key, ); CREATE TABLE Crime ( case_number TEXT, -- longitude TEXT, -- foreign key (fbi_code_no) references FBI_Code(fbi_code_no), fbi_code_no TEXT, -- date TEXT, -- arrest TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 foreign key (community_area_no) references Community_Area(community_area_no), location_description TEXT, -- latitude TEXT, -- block TEXT, -- ward_no INTEGER, -- domestic TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 district_no INTEGER, -- report_no INTEGER primary key, iucr_no TEXT, -- foreign key (ward_no) references Ward(ward_no), community_area_no INTEGER, -- foreign key (district_no) references District(district_no), foreign key (iucr_no) references IUCR(iucr_no), beat INTEGER, -- );
retail_world
Give the reorder level for the products from the supplier "Nord-Ost-Fisch Handelsgesellschaft mbH".
supplier "Nord-Ost-Fisch Handelsgesellschaft mbH" refers to CompanyName = 'Nord-Ost-Fisch Handelsgesellschaft mbH'
SELECT T1.ReorderLevel FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Nord-Ost-Fisch Handelsgesellschaft mbH'
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, );
chicago_crime
Who is the commander of Morgan Park district?
Morgan Park district refers to district_name = 'Morgan Park'
SELECT commander FROM District WHERE district_name = 'Morgan Park'
CREATE TABLE District ( district_no INTEGER primary key, email TEXT, -- phone TEXT, -- address TEXT, -- fax TEXT, -- district_name TEXT, -- tty TEXT, -- commander TEXT, -- zip_code INTEGER, -- twitter TEXT, -- ); CREATE TABLE Community_Area ( population TEXT, -- side TEXT, -- Example Values: `Far North `, `North `, `Central`, `Northwest `, `West ` | Value Statics: Total count 77 - Distinct count 9 - Null count 0 community_area_no INTEGER primary key, community_area_name TEXT, -- ); CREATE TABLE Ward ( ward_office_address TEXT, -- ward_office_zip TEXT, -- city_hall_office_phone TEXT, -- alderman_first_name TEXT, -- ward_no INTEGER primary key, ward_email TEXT, -- ward_office_fax TEXT, -- alderman_last_name TEXT, -- Population INTEGER, -- alderman_name_suffix TEXT, -- Example Values: `Jr.` | Value Statics: Total count 5 - Distinct count 1 - Null count 45 ward_office_phone TEXT, -- city_hall_office_room INTEGER, -- Example Values: `200`, `305`, `300`, `302` | Value Statics: Total count 50 - Distinct count 4 - Null count 0 city_hall_office_fax TEXT, -- ); CREATE TABLE IUCR ( iucr_no TEXT primary key, index_code TEXT, -- Example Values: `I`, `N` | Value Statics: Total count 401 - Distinct count 2 - Null count 0 primary_description TEXT, -- secondary_description TEXT, -- ); CREATE TABLE FBI_Code ( description TEXT, -- fbi_code_no TEXT primary key, crime_against TEXT, -- Example Values: `Persons`, `Property`, `Society`, `Persons and Society` | Value Statics: Total count 26 - Distinct count 4 - Null count 0 title TEXT, -- ); CREATE TABLE Neighborhood ( foreign key (community_area_no) references Community_Area(community_area_no), community_area_no INTEGER, -- neighborhood_name TEXT primary key, ); CREATE TABLE Crime ( case_number TEXT, -- longitude TEXT, -- foreign key (fbi_code_no) references FBI_Code(fbi_code_no), fbi_code_no TEXT, -- date TEXT, -- arrest TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 foreign key (community_area_no) references Community_Area(community_area_no), location_description TEXT, -- latitude TEXT, -- block TEXT, -- ward_no INTEGER, -- domestic TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 district_no INTEGER, -- report_no INTEGER primary key, iucr_no TEXT, -- foreign key (ward_no) references Ward(ward_no), community_area_no INTEGER, -- foreign key (district_no) references District(district_no), foreign key (iucr_no) references IUCR(iucr_no), beat INTEGER, -- );
retail_world
What is the total production of the products from the supplier “Escargots Nouveaux”?
total production of the products = add(units in stock , units on order); supplier “Escargots Nouveaux” refers to CompanyName = 'Escargots Nouveaux'
SELECT SUM(T1.UnitsInStock + T1.UnitsOnOrder) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Escargots Nouveaux'
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, );
books
How many books written by Akira Watanabe are available on Gravity?
"Akira Watanabe" is the author_name
SELECT COUNT(*) FROM author AS T1 INNER JOIN book_author AS T2 ON T1.author_id = T2.author_id WHERE T1.author_name = 'Akira Watanabe'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
app_store
How much is the size of Browser 4G and how many users have a pretty positive favorability on it?
Browser 4G is the App; pretty positive favorability refers to Sentiment_Polarity score = 0.5
SELECT T1.Size, COUNT(T1.App) FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = 'Browser 4G' AND T2.Sentiment_Polarity >= 0.5
CREATE TABLE playstore ( Rating REAL, -- Size TEXT, -- App TEXT, -- Category TEXT, -- Price TEXT, -- "Content Rating" TEXT, -- Example Values: `Everyone`, `Teen`, `Everyone 10+`, `Mature 17+`, `Adults only 18+` | Value Statics: Total count 10840 - Distinct count 6 - Null count 0 Installs TEXT, -- Type TEXT, -- Example Values: `Free`, `Paid`, `NaN` | Value Statics: Total count 10840 - Distinct count 3 - Null count 0 Reviews INTEGER, -- Genres TEXT, -- ); CREATE TABLE user_reviews ( Sentiment TEXT, -- Example Values: `Positive`, `nan`, `Neutral`, `Negative` | Value Statics: Total count 64286 - Distinct count 4 - Null count 0 App TEXT references "playstore" (App), -- Translated_Review TEXT, -- Sentiment_Subjectivity TEXT, -- Sentiment_Polarity TEXT, -- );
chicago_crime
How many community areas are in the Far North side?
the Far North side refers to side = 'Far North'
SELECT COUNT(*) FROM Community_Area WHERE side = 'Far North '
CREATE TABLE District ( district_no INTEGER primary key, email TEXT, -- phone TEXT, -- address TEXT, -- fax TEXT, -- district_name TEXT, -- tty TEXT, -- commander TEXT, -- zip_code INTEGER, -- twitter TEXT, -- ); CREATE TABLE Community_Area ( population TEXT, -- side TEXT, -- Example Values: `Far North `, `North `, `Central`, `Northwest `, `West ` | Value Statics: Total count 77 - Distinct count 9 - Null count 0 community_area_no INTEGER primary key, community_area_name TEXT, -- ); CREATE TABLE Ward ( ward_office_address TEXT, -- ward_office_zip TEXT, -- city_hall_office_phone TEXT, -- alderman_first_name TEXT, -- ward_no INTEGER primary key, ward_email TEXT, -- ward_office_fax TEXT, -- alderman_last_name TEXT, -- Population INTEGER, -- alderman_name_suffix TEXT, -- Example Values: `Jr.` | Value Statics: Total count 5 - Distinct count 1 - Null count 45 ward_office_phone TEXT, -- city_hall_office_room INTEGER, -- Example Values: `200`, `305`, `300`, `302` | Value Statics: Total count 50 - Distinct count 4 - Null count 0 city_hall_office_fax TEXT, -- ); CREATE TABLE IUCR ( iucr_no TEXT primary key, index_code TEXT, -- Example Values: `I`, `N` | Value Statics: Total count 401 - Distinct count 2 - Null count 0 primary_description TEXT, -- secondary_description TEXT, -- ); CREATE TABLE FBI_Code ( description TEXT, -- fbi_code_no TEXT primary key, crime_against TEXT, -- Example Values: `Persons`, `Property`, `Society`, `Persons and Society` | Value Statics: Total count 26 - Distinct count 4 - Null count 0 title TEXT, -- ); CREATE TABLE Neighborhood ( foreign key (community_area_no) references Community_Area(community_area_no), community_area_no INTEGER, -- neighborhood_name TEXT primary key, ); CREATE TABLE Crime ( case_number TEXT, -- longitude TEXT, -- foreign key (fbi_code_no) references FBI_Code(fbi_code_no), fbi_code_no TEXT, -- date TEXT, -- arrest TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 foreign key (community_area_no) references Community_Area(community_area_no), location_description TEXT, -- latitude TEXT, -- block TEXT, -- ward_no INTEGER, -- domestic TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 district_no INTEGER, -- report_no INTEGER primary key, iucr_no TEXT, -- foreign key (ward_no) references Ward(ward_no), community_area_no INTEGER, -- foreign key (district_no) references District(district_no), foreign key (iucr_no) references IUCR(iucr_no), beat INTEGER, -- );
retail_world
Which category does "tofu" belong to?
category refers to CategoryName; tofu refers to ProductName = 'Tofu';
SELECT T2.CategoryName FROM Products AS T1 INNER JOIN Categories AS T2 ON T1.CategoryID = T2.CategoryID WHERE T1.ProductName = 'Tofu'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
app_store
List the top 5 lowest rated puzzle games and count the number of negative sentiments the games received.
lowest rating refers to MIN(Rating); puzzle is the genre;
SELECT T1.App, COUNT(T1.App) COUNTNUMBER FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T2.Sentiment = 'Negative' GROUP BY T1.App ORDER BY T1.Rating LIMIT 5
CREATE TABLE playstore ( Rating REAL, -- Size TEXT, -- App TEXT, -- Category TEXT, -- Price TEXT, -- "Content Rating" TEXT, -- Example Values: `Everyone`, `Teen`, `Everyone 10+`, `Mature 17+`, `Adults only 18+` | Value Statics: Total count 10840 - Distinct count 6 - Null count 0 Installs TEXT, -- Type TEXT, -- Example Values: `Free`, `Paid`, `NaN` | Value Statics: Total count 10840 - Distinct count 3 - Null count 0 Reviews INTEGER, -- Genres TEXT, -- ); CREATE TABLE user_reviews ( Sentiment TEXT, -- Example Values: `Positive`, `nan`, `Neutral`, `Negative` | Value Statics: Total count 64286 - Distinct count 4 - Null count 0 App TEXT references "playstore" (App), -- Translated_Review TEXT, -- Sentiment_Subjectivity TEXT, -- Sentiment_Polarity TEXT, -- );
chicago_crime
Among the crimes in all the districts in Chicago, what is the percentage of them happening in the Central district?
the Central district refers to district_name = 'Central'; percentage = divide(count(case_number where district_name = 'Central'), count(case_number)) * 100%
SELECT CAST(SUM(CASE WHEN T2.district_name = 'Central' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.case_number) FROM Crime AS T1 INNER JOIN District AS T2 ON T1.district_no = T2.district_no
CREATE TABLE District ( district_no INTEGER primary key, email TEXT, -- phone TEXT, -- address TEXT, -- fax TEXT, -- district_name TEXT, -- tty TEXT, -- commander TEXT, -- zip_code INTEGER, -- twitter TEXT, -- ); CREATE TABLE Community_Area ( population TEXT, -- side TEXT, -- Example Values: `Far North `, `North `, `Central`, `Northwest `, `West ` | Value Statics: Total count 77 - Distinct count 9 - Null count 0 community_area_no INTEGER primary key, community_area_name TEXT, -- ); CREATE TABLE Ward ( ward_office_address TEXT, -- ward_office_zip TEXT, -- city_hall_office_phone TEXT, -- alderman_first_name TEXT, -- ward_no INTEGER primary key, ward_email TEXT, -- ward_office_fax TEXT, -- alderman_last_name TEXT, -- Population INTEGER, -- alderman_name_suffix TEXT, -- Example Values: `Jr.` | Value Statics: Total count 5 - Distinct count 1 - Null count 45 ward_office_phone TEXT, -- city_hall_office_room INTEGER, -- Example Values: `200`, `305`, `300`, `302` | Value Statics: Total count 50 - Distinct count 4 - Null count 0 city_hall_office_fax TEXT, -- ); CREATE TABLE IUCR ( iucr_no TEXT primary key, index_code TEXT, -- Example Values: `I`, `N` | Value Statics: Total count 401 - Distinct count 2 - Null count 0 primary_description TEXT, -- secondary_description TEXT, -- ); CREATE TABLE FBI_Code ( description TEXT, -- fbi_code_no TEXT primary key, crime_against TEXT, -- Example Values: `Persons`, `Property`, `Society`, `Persons and Society` | Value Statics: Total count 26 - Distinct count 4 - Null count 0 title TEXT, -- ); CREATE TABLE Neighborhood ( foreign key (community_area_no) references Community_Area(community_area_no), community_area_no INTEGER, -- neighborhood_name TEXT primary key, ); CREATE TABLE Crime ( case_number TEXT, -- longitude TEXT, -- foreign key (fbi_code_no) references FBI_Code(fbi_code_no), fbi_code_no TEXT, -- date TEXT, -- arrest TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 foreign key (community_area_no) references Community_Area(community_area_no), location_description TEXT, -- latitude TEXT, -- block TEXT, -- ward_no INTEGER, -- domestic TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 district_no INTEGER, -- report_no INTEGER primary key, iucr_no TEXT, -- foreign key (ward_no) references Ward(ward_no), community_area_no INTEGER, -- foreign key (district_no) references District(district_no), foreign key (iucr_no) references IUCR(iucr_no), beat INTEGER, -- );
retail_world
How many kinds of products are there in the the category of "dairy products"?
kinds of products refers to ProductID; category refers to CategoryName;
SELECT COUNT(T1.ProductID) FROM Products AS T1 INNER JOIN Categories AS T2 ON T1.CategoryID = T2.CategoryID WHERE T2.CategoryName = 'Dairy Products'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
chicago_crime
What is the average number of crimes in a neighborhood in Central Chicago?
Central Chicago refers to side = 'Central'; average number = divide(count(report_no), count(community_area_no))
SELECT CAST(COUNT(T1.report_no) AS REAL) / COUNT(T2.community_area_no) FROM Crime AS T1 INNER JOIN Community_Area AS T2 ON T1.community_area_no = T2.community_area_no WHERE T2.side = 'Central'
CREATE TABLE District ( district_no INTEGER primary key, email TEXT, -- phone TEXT, -- address TEXT, -- fax TEXT, -- district_name TEXT, -- tty TEXT, -- commander TEXT, -- zip_code INTEGER, -- twitter TEXT, -- ); CREATE TABLE Community_Area ( population TEXT, -- side TEXT, -- Example Values: `Far North `, `North `, `Central`, `Northwest `, `West ` | Value Statics: Total count 77 - Distinct count 9 - Null count 0 community_area_no INTEGER primary key, community_area_name TEXT, -- ); CREATE TABLE Ward ( ward_office_address TEXT, -- ward_office_zip TEXT, -- city_hall_office_phone TEXT, -- alderman_first_name TEXT, -- ward_no INTEGER primary key, ward_email TEXT, -- ward_office_fax TEXT, -- alderman_last_name TEXT, -- Population INTEGER, -- alderman_name_suffix TEXT, -- Example Values: `Jr.` | Value Statics: Total count 5 - Distinct count 1 - Null count 45 ward_office_phone TEXT, -- city_hall_office_room INTEGER, -- Example Values: `200`, `305`, `300`, `302` | Value Statics: Total count 50 - Distinct count 4 - Null count 0 city_hall_office_fax TEXT, -- ); CREATE TABLE IUCR ( iucr_no TEXT primary key, index_code TEXT, -- Example Values: `I`, `N` | Value Statics: Total count 401 - Distinct count 2 - Null count 0 primary_description TEXT, -- secondary_description TEXT, -- ); CREATE TABLE FBI_Code ( description TEXT, -- fbi_code_no TEXT primary key, crime_against TEXT, -- Example Values: `Persons`, `Property`, `Society`, `Persons and Society` | Value Statics: Total count 26 - Distinct count 4 - Null count 0 title TEXT, -- ); CREATE TABLE Neighborhood ( foreign key (community_area_no) references Community_Area(community_area_no), community_area_no INTEGER, -- neighborhood_name TEXT primary key, ); CREATE TABLE Crime ( case_number TEXT, -- longitude TEXT, -- foreign key (fbi_code_no) references FBI_Code(fbi_code_no), fbi_code_no TEXT, -- date TEXT, -- arrest TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 foreign key (community_area_no) references Community_Area(community_area_no), location_description TEXT, -- latitude TEXT, -- block TEXT, -- ward_no INTEGER, -- domestic TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 district_no INTEGER, -- report_no INTEGER primary key, iucr_no TEXT, -- foreign key (ward_no) references Ward(ward_no), community_area_no INTEGER, -- foreign key (district_no) references District(district_no), foreign key (iucr_no) references IUCR(iucr_no), beat INTEGER, -- );
retail_world
Give the number of orders that were shipped by "Federal Shipping".
Federal Shipping refers to CompanyName = 'Federal Shipping';
SELECT COUNT(T1.OrderID) FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T2.CompanyName = 'Federal Shipping'
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, );
genes
Please list the location of the genes that have the most chromosomes.
null
SELECT T2.Localization FROM Genes AS T1 INNER JOIN Classification AS T2 ON T1.GeneID = T2.GeneID ORDER BY T1.Chromosome DESC LIMIT 1
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression_Corr REAL not null, -- Type TEXT not null, -- Example Values: `Genetic-Physical`, `Genetic`, `Physical` | Value Statics: Total count 910 - Distinct count 3 - Null count 0 ); CREATE TABLE Genes ( Motif TEXT not null, -- Class TEXT not null, -- Complex TEXT null, -- Phenotype TEXT not null, -- Example Values: `?`, `Mating and sporulation defects`, `Cell cycle defects`, `Cell morphology and organelle mutants`, `Conditional phenotypes` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 foreign key (GeneID) references Classification (GeneID) on update cascade on delete cascade, Chromosome INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 4346 - Distinct count 17 - Null count 0 GeneID TEXT not null, -- Function TEXT not null, -- Example Values: `CELLULAR ORGANIZATION (proteins are localized to the corresponding organelle)`, `PROTEIN SYNTHESIS`, `CELL RESCUE, DEFENSE, CELL DEATH AND AGEING`, `CELLULAR TRANSPORT AND TRANSPORTMECHANISMS`, `PROTEIN DESTINATION` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 4346 - Distinct count 15 - Null count 0 Essential TEXT not null, -- Example Values: `Essential`, `Non-Essential`, `?`, `Ambiguous-Essential` | Value Statics: Total count 4346 - Distinct count 4 - Null count 0 ); CREATE TABLE Classification ( GeneID TEXT not null primary key, Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 862 - Distinct count 15 - Null count 0 );
chicago_crime
What is the fax number for the district with the most number of crimes in January, 2018?
fax number refers to fax; the most number of crimes refers to max(count(case_number)); in January 2018 refers to date like '%1/2018%'
SELECT T1.fax FROM District AS T1 INNER JOIN Crime AS T2 ON T1.district_no = T2.district_no WHERE T2.date LIKE '%1/2018%' GROUP BY T2.district_no ORDER BY COUNT(case_number) DESC LIMIT 1
CREATE TABLE District ( district_no INTEGER primary key, email TEXT, -- phone TEXT, -- address TEXT, -- fax TEXT, -- district_name TEXT, -- tty TEXT, -- commander TEXT, -- zip_code INTEGER, -- twitter TEXT, -- ); CREATE TABLE Community_Area ( population TEXT, -- side TEXT, -- Example Values: `Far North `, `North `, `Central`, `Northwest `, `West ` | Value Statics: Total count 77 - Distinct count 9 - Null count 0 community_area_no INTEGER primary key, community_area_name TEXT, -- ); CREATE TABLE Ward ( ward_office_address TEXT, -- ward_office_zip TEXT, -- city_hall_office_phone TEXT, -- alderman_first_name TEXT, -- ward_no INTEGER primary key, ward_email TEXT, -- ward_office_fax TEXT, -- alderman_last_name TEXT, -- Population INTEGER, -- alderman_name_suffix TEXT, -- Example Values: `Jr.` | Value Statics: Total count 5 - Distinct count 1 - Null count 45 ward_office_phone TEXT, -- city_hall_office_room INTEGER, -- Example Values: `200`, `305`, `300`, `302` | Value Statics: Total count 50 - Distinct count 4 - Null count 0 city_hall_office_fax TEXT, -- ); CREATE TABLE IUCR ( iucr_no TEXT primary key, index_code TEXT, -- Example Values: `I`, `N` | Value Statics: Total count 401 - Distinct count 2 - Null count 0 primary_description TEXT, -- secondary_description TEXT, -- ); CREATE TABLE FBI_Code ( description TEXT, -- fbi_code_no TEXT primary key, crime_against TEXT, -- Example Values: `Persons`, `Property`, `Society`, `Persons and Society` | Value Statics: Total count 26 - Distinct count 4 - Null count 0 title TEXT, -- ); CREATE TABLE Neighborhood ( foreign key (community_area_no) references Community_Area(community_area_no), community_area_no INTEGER, -- neighborhood_name TEXT primary key, ); CREATE TABLE Crime ( case_number TEXT, -- longitude TEXT, -- foreign key (fbi_code_no) references FBI_Code(fbi_code_no), fbi_code_no TEXT, -- date TEXT, -- arrest TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 foreign key (community_area_no) references Community_Area(community_area_no), location_description TEXT, -- latitude TEXT, -- block TEXT, -- ward_no INTEGER, -- domestic TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 district_no INTEGER, -- report_no INTEGER primary key, iucr_no TEXT, -- foreign key (ward_no) references Ward(ward_no), community_area_no INTEGER, -- foreign key (district_no) references District(district_no), foreign key (iucr_no) references IUCR(iucr_no), beat INTEGER, -- );
retail_world
Tell the name of the shipper company for the order No.10585.
name of the shipper company refers to ShipName; order No. refers to OrderID;
SELECT T2.CompanyName FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T1.OrderID = 10585
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, );
chicago_crime
More crimes happened in which community area in January, 2018, Woodlawn or Lincoln Square?
in January 2018 refers to date like '%1/2018%'; Woodlawn or Lincoln Square refers to community_area_name in ('Woodlawn', 'Lincoln Square'); number of crime refers to COUNT(report_no); the higher the report_no, the more crimes happened in the community;
SELECT T1.community_area_name FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T1.community_area_no = T2.community_area_no WHERE T1.community_area_name IN ('Woodlawn', 'Lincoln Square') AND T2.date LIKE '%1/2018%' GROUP BY T1.community_area_name ORDER BY COUNT(T1.community_area_name) DESC LIMIT 1
CREATE TABLE District ( district_no INTEGER primary key, email TEXT, -- phone TEXT, -- address TEXT, -- fax TEXT, -- district_name TEXT, -- tty TEXT, -- commander TEXT, -- zip_code INTEGER, -- twitter TEXT, -- ); CREATE TABLE Community_Area ( population TEXT, -- side TEXT, -- Example Values: `Far North `, `North `, `Central`, `Northwest `, `West ` | Value Statics: Total count 77 - Distinct count 9 - Null count 0 community_area_no INTEGER primary key, community_area_name TEXT, -- ); CREATE TABLE Ward ( ward_office_address TEXT, -- ward_office_zip TEXT, -- city_hall_office_phone TEXT, -- alderman_first_name TEXT, -- ward_no INTEGER primary key, ward_email TEXT, -- ward_office_fax TEXT, -- alderman_last_name TEXT, -- Population INTEGER, -- alderman_name_suffix TEXT, -- Example Values: `Jr.` | Value Statics: Total count 5 - Distinct count 1 - Null count 45 ward_office_phone TEXT, -- city_hall_office_room INTEGER, -- Example Values: `200`, `305`, `300`, `302` | Value Statics: Total count 50 - Distinct count 4 - Null count 0 city_hall_office_fax TEXT, -- ); CREATE TABLE IUCR ( iucr_no TEXT primary key, index_code TEXT, -- Example Values: `I`, `N` | Value Statics: Total count 401 - Distinct count 2 - Null count 0 primary_description TEXT, -- secondary_description TEXT, -- ); CREATE TABLE FBI_Code ( description TEXT, -- fbi_code_no TEXT primary key, crime_against TEXT, -- Example Values: `Persons`, `Property`, `Society`, `Persons and Society` | Value Statics: Total count 26 - Distinct count 4 - Null count 0 title TEXT, -- ); CREATE TABLE Neighborhood ( foreign key (community_area_no) references Community_Area(community_area_no), community_area_no INTEGER, -- neighborhood_name TEXT primary key, ); CREATE TABLE Crime ( case_number TEXT, -- longitude TEXT, -- foreign key (fbi_code_no) references FBI_Code(fbi_code_no), fbi_code_no TEXT, -- date TEXT, -- arrest TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 foreign key (community_area_no) references Community_Area(community_area_no), location_description TEXT, -- latitude TEXT, -- block TEXT, -- ward_no INTEGER, -- domestic TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 district_no INTEGER, -- report_no INTEGER primary key, iucr_no TEXT, -- foreign key (ward_no) references Ward(ward_no), community_area_no INTEGER, -- foreign key (district_no) references District(district_no), foreign key (iucr_no) references IUCR(iucr_no), beat INTEGER, -- );
retail_world
For the order paying the highest freight, how many kinds of products does it contain?
highest freight refers to MAX(Freight); kinds of products refers to ProductID;
SELECT COUNT(T2.ProductID) FROM Orders AS T1 INNER JOIN `Order Details` AS T2 ON T1.OrderID = T2.OrderID WHERE T1.Freight = ( SELECT MAX(Freight) FROM Orders ) GROUP BY T1.OrderID
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, );
books
Who is the author of the book The Mystery in the Rocky Mountains?
author refers to author_name; 'The Mystery in the Rocky Mountains' is the title of the book
SELECT T3.author_name FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T1.title = 'The Mystery in the Rocky Mountains'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
app_store
Indicate the number of installs and include the percentage of positive sentiments of FREEDOME VPN Unlimited anonymous Wifi Security.
FREEDOME VPN Unlimited anonymous Wifi Security is the App; percentage = MULTIPLY(DIVIDE((SUM(Sentiment = 'Positive')), (COUNT(*))), 100)
SELECT T1.Installs , CAST(SUM(CASE WHEN T2.Sentiment = 'Positive' THEN 1 ELSE 0 END) * 100 / SUM(CASE WHEN T2.Sentiment IS NOT NULL THEN 1.0 ELSE 0 END) AS REAL) FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = 'FREEDOME VPN Unlimited anonymous Wifi Security'
CREATE TABLE playstore ( Rating REAL, -- Size TEXT, -- App TEXT, -- Category TEXT, -- Price TEXT, -- "Content Rating" TEXT, -- Example Values: `Everyone`, `Teen`, `Everyone 10+`, `Mature 17+`, `Adults only 18+` | Value Statics: Total count 10840 - Distinct count 6 - Null count 0 Installs TEXT, -- Type TEXT, -- Example Values: `Free`, `Paid`, `NaN` | Value Statics: Total count 10840 - Distinct count 3 - Null count 0 Reviews INTEGER, -- Genres TEXT, -- ); CREATE TABLE user_reviews ( Sentiment TEXT, -- Example Values: `Positive`, `nan`, `Neutral`, `Negative` | Value Statics: Total count 64286 - Distinct count 4 - Null count 0 App TEXT references "playstore" (App), -- Translated_Review TEXT, -- Sentiment_Subjectivity TEXT, -- Sentiment_Polarity TEXT, -- );
chicago_crime
Among the crimes in Woodlawn, how many of them happened in January, 2018?
Woodlawn refers to community_area_name = 'Woodlawn'; in January 2018 refers to date like '%1/2018%'
SELECT SUM(CASE WHEN T1.community_area_name = 'Woodlawn' THEN 1 ELSE 0 END) FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T1.community_area_no = T2.community_area_no WHERE T2.date LIKE '%1/2018%'
CREATE TABLE District ( district_no INTEGER primary key, email TEXT, -- phone TEXT, -- address TEXT, -- fax TEXT, -- district_name TEXT, -- tty TEXT, -- commander TEXT, -- zip_code INTEGER, -- twitter TEXT, -- ); CREATE TABLE Community_Area ( population TEXT, -- side TEXT, -- Example Values: `Far North `, `North `, `Central`, `Northwest `, `West ` | Value Statics: Total count 77 - Distinct count 9 - Null count 0 community_area_no INTEGER primary key, community_area_name TEXT, -- ); CREATE TABLE Ward ( ward_office_address TEXT, -- ward_office_zip TEXT, -- city_hall_office_phone TEXT, -- alderman_first_name TEXT, -- ward_no INTEGER primary key, ward_email TEXT, -- ward_office_fax TEXT, -- alderman_last_name TEXT, -- Population INTEGER, -- alderman_name_suffix TEXT, -- Example Values: `Jr.` | Value Statics: Total count 5 - Distinct count 1 - Null count 45 ward_office_phone TEXT, -- city_hall_office_room INTEGER, -- Example Values: `200`, `305`, `300`, `302` | Value Statics: Total count 50 - Distinct count 4 - Null count 0 city_hall_office_fax TEXT, -- ); CREATE TABLE IUCR ( iucr_no TEXT primary key, index_code TEXT, -- Example Values: `I`, `N` | Value Statics: Total count 401 - Distinct count 2 - Null count 0 primary_description TEXT, -- secondary_description TEXT, -- ); CREATE TABLE FBI_Code ( description TEXT, -- fbi_code_no TEXT primary key, crime_against TEXT, -- Example Values: `Persons`, `Property`, `Society`, `Persons and Society` | Value Statics: Total count 26 - Distinct count 4 - Null count 0 title TEXT, -- ); CREATE TABLE Neighborhood ( foreign key (community_area_no) references Community_Area(community_area_no), community_area_no INTEGER, -- neighborhood_name TEXT primary key, ); CREATE TABLE Crime ( case_number TEXT, -- longitude TEXT, -- foreign key (fbi_code_no) references FBI_Code(fbi_code_no), fbi_code_no TEXT, -- date TEXT, -- arrest TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 foreign key (community_area_no) references Community_Area(community_area_no), location_description TEXT, -- latitude TEXT, -- block TEXT, -- ward_no INTEGER, -- domestic TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 district_no INTEGER, -- report_no INTEGER primary key, iucr_no TEXT, -- foreign key (ward_no) references Ward(ward_no), community_area_no INTEGER, -- foreign key (district_no) references District(district_no), foreign key (iucr_no) references IUCR(iucr_no), beat INTEGER, -- );
retail_world
For the order from "HILAA" on 1997/12/25, what was the total quantity of the products in that order?
HILLA refers to CustomerID = 'HILAA'; on 1997/12/25 refers to OrderDate = '1997/12/25';
SELECT SUM(T2.Quantity) FROM Orders AS T1 INNER JOIN `Order Details` AS T2 ON T1.OrderID = T2.OrderID WHERE T1.CustomerID = 'HILAA' AND T1.OrderDate LIKE '1997-12-25%'
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, );
books
Who is the author of the book with the biggest page count?
author refers to author_name, biggest page count refers to Max(num_pages)
SELECT T3.author_name FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id ORDER BY T1.num_pages DESC LIMIT 1
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
chicago_crime
How many crimes had happened in the community area with the most population?
the most population refers to max(population)
SELECT COUNT(T2.report_no) FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T1.community_area_no = T2.community_area_no GROUP BY T1.community_area_name ORDER BY T1.population DESC LIMIT 1
CREATE TABLE District ( district_no INTEGER primary key, email TEXT, -- phone TEXT, -- address TEXT, -- fax TEXT, -- district_name TEXT, -- tty TEXT, -- commander TEXT, -- zip_code INTEGER, -- twitter TEXT, -- ); CREATE TABLE Community_Area ( population TEXT, -- side TEXT, -- Example Values: `Far North `, `North `, `Central`, `Northwest `, `West ` | Value Statics: Total count 77 - Distinct count 9 - Null count 0 community_area_no INTEGER primary key, community_area_name TEXT, -- ); CREATE TABLE Ward ( ward_office_address TEXT, -- ward_office_zip TEXT, -- city_hall_office_phone TEXT, -- alderman_first_name TEXT, -- ward_no INTEGER primary key, ward_email TEXT, -- ward_office_fax TEXT, -- alderman_last_name TEXT, -- Population INTEGER, -- alderman_name_suffix TEXT, -- Example Values: `Jr.` | Value Statics: Total count 5 - Distinct count 1 - Null count 45 ward_office_phone TEXT, -- city_hall_office_room INTEGER, -- Example Values: `200`, `305`, `300`, `302` | Value Statics: Total count 50 - Distinct count 4 - Null count 0 city_hall_office_fax TEXT, -- ); CREATE TABLE IUCR ( iucr_no TEXT primary key, index_code TEXT, -- Example Values: `I`, `N` | Value Statics: Total count 401 - Distinct count 2 - Null count 0 primary_description TEXT, -- secondary_description TEXT, -- ); CREATE TABLE FBI_Code ( description TEXT, -- fbi_code_no TEXT primary key, crime_against TEXT, -- Example Values: `Persons`, `Property`, `Society`, `Persons and Society` | Value Statics: Total count 26 - Distinct count 4 - Null count 0 title TEXT, -- ); CREATE TABLE Neighborhood ( foreign key (community_area_no) references Community_Area(community_area_no), community_area_no INTEGER, -- neighborhood_name TEXT primary key, ); CREATE TABLE Crime ( case_number TEXT, -- longitude TEXT, -- foreign key (fbi_code_no) references FBI_Code(fbi_code_no), fbi_code_no TEXT, -- date TEXT, -- arrest TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 foreign key (community_area_no) references Community_Area(community_area_no), location_description TEXT, -- latitude TEXT, -- block TEXT, -- ward_no INTEGER, -- domestic TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 district_no INTEGER, -- report_no INTEGER primary key, iucr_no TEXT, -- foreign key (ward_no) references Ward(ward_no), community_area_no INTEGER, -- foreign key (district_no) references District(district_no), foreign key (iucr_no) references IUCR(iucr_no), beat INTEGER, -- );
retail_world
Give the home phone number of the employee who is in charge of "Savannah" territory.
home phone number refers to HomePhone; Savannah refers to TerritoryDescription = 'Savannah';
SELECT T1.HomePhone FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID INNER JOIN Territories AS T3 ON T2.TerritoryID = T3.TerritoryID WHERE T3.TerritoryDescription = 'Savannah'
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, );
books
Provide the full address of Ursola Purdy.
full address refers to street_number, street_name, city, country_name
SELECT T3.street_number, T3.street_name, T3.city FROM customer AS T1 INNER JOIN customer_address AS T2 ON T1.customer_id = T2.customer_id INNER JOIN address AS T3 ON T3.address_id = T2.address_id INNER JOIN country AS T4 ON T4.country_id = T3.country_id WHERE T1.first_name = 'Ursola' AND T1.last_name = 'Purdy'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
app_store
How much is the average sentiment polarity score of Golf GPS Rangefinder: Golf Pad and what is it's rating in the Google Play Store?
average sentiment polarity score = AVG(Sentiment_Polarity); Golf GPS Rangefinder: Golf Pad  is the App;
SELECT AVG(T2.Sentiment_Polarity), T1.Rating FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = 'Golf GPS Rangefinder: Golf Pad'
CREATE TABLE playstore ( Rating REAL, -- Size TEXT, -- App TEXT, -- Category TEXT, -- Price TEXT, -- "Content Rating" TEXT, -- Example Values: `Everyone`, `Teen`, `Everyone 10+`, `Mature 17+`, `Adults only 18+` | Value Statics: Total count 10840 - Distinct count 6 - Null count 0 Installs TEXT, -- Type TEXT, -- Example Values: `Free`, `Paid`, `NaN` | Value Statics: Total count 10840 - Distinct count 3 - Null count 0 Reviews INTEGER, -- Genres TEXT, -- ); CREATE TABLE user_reviews ( Sentiment TEXT, -- Example Values: `Positive`, `nan`, `Neutral`, `Negative` | Value Statics: Total count 64286 - Distinct count 4 - Null count 0 App TEXT references "playstore" (App), -- Translated_Review TEXT, -- Sentiment_Subjectivity TEXT, -- Sentiment_Polarity TEXT, -- );
chicago_crime
Please list the case numbers of all the crimes with no arrest made in Central Chicago.
no arrest made refers to arrest = 'FALSE'; Central Chicago refers to district_name = 'Central'
SELECT COUNT(*) FROM Crime AS T1 INNER JOIN District AS T2 ON T1.district_no = T2.district_no WHERE T2.district_name = 'Central' AND T1.arrest = 'FALSE'
CREATE TABLE District ( district_no INTEGER primary key, email TEXT, -- phone TEXT, -- address TEXT, -- fax TEXT, -- district_name TEXT, -- tty TEXT, -- commander TEXT, -- zip_code INTEGER, -- twitter TEXT, -- ); CREATE TABLE Community_Area ( population TEXT, -- side TEXT, -- Example Values: `Far North `, `North `, `Central`, `Northwest `, `West ` | Value Statics: Total count 77 - Distinct count 9 - Null count 0 community_area_no INTEGER primary key, community_area_name TEXT, -- ); CREATE TABLE Ward ( ward_office_address TEXT, -- ward_office_zip TEXT, -- city_hall_office_phone TEXT, -- alderman_first_name TEXT, -- ward_no INTEGER primary key, ward_email TEXT, -- ward_office_fax TEXT, -- alderman_last_name TEXT, -- Population INTEGER, -- alderman_name_suffix TEXT, -- Example Values: `Jr.` | Value Statics: Total count 5 - Distinct count 1 - Null count 45 ward_office_phone TEXT, -- city_hall_office_room INTEGER, -- Example Values: `200`, `305`, `300`, `302` | Value Statics: Total count 50 - Distinct count 4 - Null count 0 city_hall_office_fax TEXT, -- ); CREATE TABLE IUCR ( iucr_no TEXT primary key, index_code TEXT, -- Example Values: `I`, `N` | Value Statics: Total count 401 - Distinct count 2 - Null count 0 primary_description TEXT, -- secondary_description TEXT, -- ); CREATE TABLE FBI_Code ( description TEXT, -- fbi_code_no TEXT primary key, crime_against TEXT, -- Example Values: `Persons`, `Property`, `Society`, `Persons and Society` | Value Statics: Total count 26 - Distinct count 4 - Null count 0 title TEXT, -- ); CREATE TABLE Neighborhood ( foreign key (community_area_no) references Community_Area(community_area_no), community_area_no INTEGER, -- neighborhood_name TEXT primary key, ); CREATE TABLE Crime ( case_number TEXT, -- longitude TEXT, -- foreign key (fbi_code_no) references FBI_Code(fbi_code_no), fbi_code_no TEXT, -- date TEXT, -- arrest TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 foreign key (community_area_no) references Community_Area(community_area_no), location_description TEXT, -- latitude TEXT, -- block TEXT, -- ward_no INTEGER, -- domestic TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 district_no INTEGER, -- report_no INTEGER primary key, iucr_no TEXT, -- foreign key (ward_no) references Ward(ward_no), community_area_no INTEGER, -- foreign key (district_no) references District(district_no), foreign key (iucr_no) references IUCR(iucr_no), beat INTEGER, -- );
retail_world
Who is in charge of the "Santa Monica" territory? Give the full name.
Santa Monica refers to TerritoryDescription = 'Santa Monica'; full name = FirstName, MiddleName, LastName;
SELECT T1.FirstName, T1.LastName FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID INNER JOIN Territories AS T3 ON T2.TerritoryID = T3.TerritoryID WHERE T3.TerritoryDescription = 'Santa Monica'
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, );
books
Name the publisher of the oldest book.
publisher refers to publisher_name;  oldest book refers to Min(publication_date)
SELECT T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id ORDER BY T1.publication_date ASC LIMIT 1
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
chicago_crime
Among all the crimes that had happened in Central Chicago, how many of them were cases of domestic violence?
Central Chicago refers to district_name = 'Central'; case of domestic violence refers to domestic = 'TRUE'
SELECT COUNT(*) FROM Crime AS T1 INNER JOIN District AS T2 ON T1.district_no = T2.district_no WHERE T2.district_name = 'Central' AND T1.domestic = 'TRUE'
CREATE TABLE District ( district_no INTEGER primary key, email TEXT, -- phone TEXT, -- address TEXT, -- fax TEXT, -- district_name TEXT, -- tty TEXT, -- commander TEXT, -- zip_code INTEGER, -- twitter TEXT, -- ); CREATE TABLE Community_Area ( population TEXT, -- side TEXT, -- Example Values: `Far North `, `North `, `Central`, `Northwest `, `West ` | Value Statics: Total count 77 - Distinct count 9 - Null count 0 community_area_no INTEGER primary key, community_area_name TEXT, -- ); CREATE TABLE Ward ( ward_office_address TEXT, -- ward_office_zip TEXT, -- city_hall_office_phone TEXT, -- alderman_first_name TEXT, -- ward_no INTEGER primary key, ward_email TEXT, -- ward_office_fax TEXT, -- alderman_last_name TEXT, -- Population INTEGER, -- alderman_name_suffix TEXT, -- Example Values: `Jr.` | Value Statics: Total count 5 - Distinct count 1 - Null count 45 ward_office_phone TEXT, -- city_hall_office_room INTEGER, -- Example Values: `200`, `305`, `300`, `302` | Value Statics: Total count 50 - Distinct count 4 - Null count 0 city_hall_office_fax TEXT, -- ); CREATE TABLE IUCR ( iucr_no TEXT primary key, index_code TEXT, -- Example Values: `I`, `N` | Value Statics: Total count 401 - Distinct count 2 - Null count 0 primary_description TEXT, -- secondary_description TEXT, -- ); CREATE TABLE FBI_Code ( description TEXT, -- fbi_code_no TEXT primary key, crime_against TEXT, -- Example Values: `Persons`, `Property`, `Society`, `Persons and Society` | Value Statics: Total count 26 - Distinct count 4 - Null count 0 title TEXT, -- ); CREATE TABLE Neighborhood ( foreign key (community_area_no) references Community_Area(community_area_no), community_area_no INTEGER, -- neighborhood_name TEXT primary key, ); CREATE TABLE Crime ( case_number TEXT, -- longitude TEXT, -- foreign key (fbi_code_no) references FBI_Code(fbi_code_no), fbi_code_no TEXT, -- date TEXT, -- arrest TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 foreign key (community_area_no) references Community_Area(community_area_no), location_description TEXT, -- latitude TEXT, -- block TEXT, -- ward_no INTEGER, -- domestic TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 district_no INTEGER, -- report_no INTEGER primary key, iucr_no TEXT, -- foreign key (ward_no) references Ward(ward_no), community_area_no INTEGER, -- foreign key (district_no) references District(district_no), foreign key (iucr_no) references IUCR(iucr_no), beat INTEGER, -- );
retail_world
Which territory does Ms. Laura Callahan's direct supervisor work in? Give the name of the territory.
Ms. refers to TitleOfCourtesy = 'Ms'; ReportsTo’ represents a hierarchical relationship where the person being reported to is usually the direct supervisor of the reporter; name of the territory refers to TerritoryDescription;
SELECT T3.TerritoryDescription FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID INNER JOIN Territories AS T3 ON T2.TerritoryID = T3.TerritoryID WHERE T1.EmployeeID = ( SELECT ReportsTo FROM Employees WHERE TitleOfCourtesy = 'Ms.' AND 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, );
app_store
What is the percentage ratio between positive sentiments and negative sentiments that are in Fate/Grand Order? Also indicate the current version.
Fate/Grand Order is the App; percentage ratio = MULTIPLY(DIVIDE((SUM(Sentiment = 'Positive')), (SUM(Sentiment = 'Negative'))), 100);
SELECT CAST(SUM(CASE WHEN T2.Sentiment = 'Positive' THEN 1 ELSE 0 END) AS REAL) * 100 / SUM(CASE WHEN T2.Sentiment = 'Negative' THEN 1 ELSE 0 END), T1.`Current Ver` FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = 'Fate/Grand Order (English)' AND T1.`Current Ver` = '1.18.0'
CREATE TABLE playstore ( Rating REAL, -- Size TEXT, -- App TEXT, -- Category TEXT, -- Price TEXT, -- "Content Rating" TEXT, -- Example Values: `Everyone`, `Teen`, `Everyone 10+`, `Mature 17+`, `Adults only 18+` | Value Statics: Total count 10840 - Distinct count 6 - Null count 0 Installs TEXT, -- Type TEXT, -- Example Values: `Free`, `Paid`, `NaN` | Value Statics: Total count 10840 - Distinct count 3 - Null count 0 Reviews INTEGER, -- Genres TEXT, -- ); CREATE TABLE user_reviews ( Sentiment TEXT, -- Example Values: `Positive`, `nan`, `Neutral`, `Negative` | Value Statics: Total count 64286 - Distinct count 4 - Null count 0 App TEXT references "playstore" (App), -- Translated_Review TEXT, -- Sentiment_Subjectivity TEXT, -- Sentiment_Polarity TEXT, -- );
chicago_crime
How many crimes had happened in Central Chicago?
Central Chicago refers to district_name = 'Central'
SELECT COUNT(*) FROM Crime AS T1 INNER JOIN District AS T2 ON T1.district_no = T2.district_no WHERE T2.district_name = 'Central'
CREATE TABLE District ( district_no INTEGER primary key, email TEXT, -- phone TEXT, -- address TEXT, -- fax TEXT, -- district_name TEXT, -- tty TEXT, -- commander TEXT, -- zip_code INTEGER, -- twitter TEXT, -- ); CREATE TABLE Community_Area ( population TEXT, -- side TEXT, -- Example Values: `Far North `, `North `, `Central`, `Northwest `, `West ` | Value Statics: Total count 77 - Distinct count 9 - Null count 0 community_area_no INTEGER primary key, community_area_name TEXT, -- ); CREATE TABLE Ward ( ward_office_address TEXT, -- ward_office_zip TEXT, -- city_hall_office_phone TEXT, -- alderman_first_name TEXT, -- ward_no INTEGER primary key, ward_email TEXT, -- ward_office_fax TEXT, -- alderman_last_name TEXT, -- Population INTEGER, -- alderman_name_suffix TEXT, -- Example Values: `Jr.` | Value Statics: Total count 5 - Distinct count 1 - Null count 45 ward_office_phone TEXT, -- city_hall_office_room INTEGER, -- Example Values: `200`, `305`, `300`, `302` | Value Statics: Total count 50 - Distinct count 4 - Null count 0 city_hall_office_fax TEXT, -- ); CREATE TABLE IUCR ( iucr_no TEXT primary key, index_code TEXT, -- Example Values: `I`, `N` | Value Statics: Total count 401 - Distinct count 2 - Null count 0 primary_description TEXT, -- secondary_description TEXT, -- ); CREATE TABLE FBI_Code ( description TEXT, -- fbi_code_no TEXT primary key, crime_against TEXT, -- Example Values: `Persons`, `Property`, `Society`, `Persons and Society` | Value Statics: Total count 26 - Distinct count 4 - Null count 0 title TEXT, -- ); CREATE TABLE Neighborhood ( foreign key (community_area_no) references Community_Area(community_area_no), community_area_no INTEGER, -- neighborhood_name TEXT primary key, ); CREATE TABLE Crime ( case_number TEXT, -- longitude TEXT, -- foreign key (fbi_code_no) references FBI_Code(fbi_code_no), fbi_code_no TEXT, -- date TEXT, -- arrest TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 foreign key (community_area_no) references Community_Area(community_area_no), location_description TEXT, -- latitude TEXT, -- block TEXT, -- ward_no INTEGER, -- domestic TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 district_no INTEGER, -- report_no INTEGER primary key, iucr_no TEXT, -- foreign key (ward_no) references Ward(ward_no), community_area_no INTEGER, -- foreign key (district_no) references District(district_no), foreign key (iucr_no) references IUCR(iucr_no), beat INTEGER, -- );
retail_world
Give the name of the territory where Mr. Robert King works.
name of territory refers to TerritoryDescription; Mr. refers to TitleOfCourtesy = 'Mr';
SELECT T3.TerritoryDescription FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID INNER JOIN Territories AS T3 ON T2.TerritoryID = T3.TerritoryID WHERE T1.TitleOfCourtesy = 'Mr.' AND T1.FirstName = 'Robert' AND T1.LastName = 'King'
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, );
books
How many orders have been cancelled in 2022?
cancelled refers to status_value = 'Cancelled'; in 2022 refers to SUBSTR(status_date, 1, 4) = '2022'
SELECT COUNT(*) FROM order_status AS T1 INNER JOIN order_history AS T2 ON T1.status_id = T2.status_id WHERE T1.status_value = 'Cancelled' AND STRFTIME('%Y', T2.status_date) = '2022'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
chicago_crime
Please list the precise location coordinates of all the crimes in Central Chicago.
location coordinates refers to latitude, longitude; Central Chicago refers to district_name = 'Central'
SELECT T2.latitude, T2.longitude FROM District AS T1 INNER JOIN Crime AS T2 ON T1.district_no = T2.district_no WHERE T1.district_name = 'Central'
CREATE TABLE District ( district_no INTEGER primary key, email TEXT, -- phone TEXT, -- address TEXT, -- fax TEXT, -- district_name TEXT, -- tty TEXT, -- commander TEXT, -- zip_code INTEGER, -- twitter TEXT, -- ); CREATE TABLE Community_Area ( population TEXT, -- side TEXT, -- Example Values: `Far North `, `North `, `Central`, `Northwest `, `West ` | Value Statics: Total count 77 - Distinct count 9 - Null count 0 community_area_no INTEGER primary key, community_area_name TEXT, -- ); CREATE TABLE Ward ( ward_office_address TEXT, -- ward_office_zip TEXT, -- city_hall_office_phone TEXT, -- alderman_first_name TEXT, -- ward_no INTEGER primary key, ward_email TEXT, -- ward_office_fax TEXT, -- alderman_last_name TEXT, -- Population INTEGER, -- alderman_name_suffix TEXT, -- Example Values: `Jr.` | Value Statics: Total count 5 - Distinct count 1 - Null count 45 ward_office_phone TEXT, -- city_hall_office_room INTEGER, -- Example Values: `200`, `305`, `300`, `302` | Value Statics: Total count 50 - Distinct count 4 - Null count 0 city_hall_office_fax TEXT, -- ); CREATE TABLE IUCR ( iucr_no TEXT primary key, index_code TEXT, -- Example Values: `I`, `N` | Value Statics: Total count 401 - Distinct count 2 - Null count 0 primary_description TEXT, -- secondary_description TEXT, -- ); CREATE TABLE FBI_Code ( description TEXT, -- fbi_code_no TEXT primary key, crime_against TEXT, -- Example Values: `Persons`, `Property`, `Society`, `Persons and Society` | Value Statics: Total count 26 - Distinct count 4 - Null count 0 title TEXT, -- ); CREATE TABLE Neighborhood ( foreign key (community_area_no) references Community_Area(community_area_no), community_area_no INTEGER, -- neighborhood_name TEXT primary key, ); CREATE TABLE Crime ( case_number TEXT, -- longitude TEXT, -- foreign key (fbi_code_no) references FBI_Code(fbi_code_no), fbi_code_no TEXT, -- date TEXT, -- arrest TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 foreign key (community_area_no) references Community_Area(community_area_no), location_description TEXT, -- latitude TEXT, -- block TEXT, -- ward_no INTEGER, -- domestic TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 district_no INTEGER, -- report_no INTEGER primary key, iucr_no TEXT, -- foreign key (ward_no) references Ward(ward_no), community_area_no INTEGER, -- foreign key (district_no) references District(district_no), foreign key (iucr_no) references IUCR(iucr_no), beat INTEGER, -- );
retail_world
Provide the number of orders that were handled by Michael Suyama.
null
SELECT COUNT(T2.OrderID) 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, );
books
Identify the publisher of the book Girls' Night In.
"Girls' Night In" is the title of the book; publisher is the publisher_name
SELECT T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T1.title = 'Girls'' Night In'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
app_store
For the Honkai Impact 3rd App, what is the highest sentiment polarity score and what genre does it belong to?
highest sentiment polarity score refers to MAX(Sentiment_Polarity);
SELECT MAX(T2.Sentiment_Polarity), T1.Genres FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = 'Honkai Impact 3rd' AND T2.Sentiment_Polarity > 0.5 GROUP BY T1.Genres
CREATE TABLE playstore ( Rating REAL, -- Size TEXT, -- App TEXT, -- Category TEXT, -- Price TEXT, -- "Content Rating" TEXT, -- Example Values: `Everyone`, `Teen`, `Everyone 10+`, `Mature 17+`, `Adults only 18+` | Value Statics: Total count 10840 - Distinct count 6 - Null count 0 Installs TEXT, -- Type TEXT, -- Example Values: `Free`, `Paid`, `NaN` | Value Statics: Total count 10840 - Distinct count 3 - Null count 0 Reviews INTEGER, -- Genres TEXT, -- ); CREATE TABLE user_reviews ( Sentiment TEXT, -- Example Values: `Positive`, `nan`, `Neutral`, `Negative` | Value Statics: Total count 64286 - Distinct count 4 - Null count 0 App TEXT references "playstore" (App), -- Translated_Review TEXT, -- Sentiment_Subjectivity TEXT, -- Sentiment_Polarity TEXT, -- );
chicago_crime
Please list the names of all the neighborhoods in Central Chicago.
name of neighborhood refers to neighborhood_name; Central Chicago refers to side = 'Central'
SELECT T2.neighborhood_name FROM Community_Area AS T1 INNER JOIN Neighborhood AS T2 ON T1.community_area_no = T2.community_area_no WHERE T1.side = 'Central'
CREATE TABLE District ( district_no INTEGER primary key, email TEXT, -- phone TEXT, -- address TEXT, -- fax TEXT, -- district_name TEXT, -- tty TEXT, -- commander TEXT, -- zip_code INTEGER, -- twitter TEXT, -- ); CREATE TABLE Community_Area ( population TEXT, -- side TEXT, -- Example Values: `Far North `, `North `, `Central`, `Northwest `, `West ` | Value Statics: Total count 77 - Distinct count 9 - Null count 0 community_area_no INTEGER primary key, community_area_name TEXT, -- ); CREATE TABLE Ward ( ward_office_address TEXT, -- ward_office_zip TEXT, -- city_hall_office_phone TEXT, -- alderman_first_name TEXT, -- ward_no INTEGER primary key, ward_email TEXT, -- ward_office_fax TEXT, -- alderman_last_name TEXT, -- Population INTEGER, -- alderman_name_suffix TEXT, -- Example Values: `Jr.` | Value Statics: Total count 5 - Distinct count 1 - Null count 45 ward_office_phone TEXT, -- city_hall_office_room INTEGER, -- Example Values: `200`, `305`, `300`, `302` | Value Statics: Total count 50 - Distinct count 4 - Null count 0 city_hall_office_fax TEXT, -- ); CREATE TABLE IUCR ( iucr_no TEXT primary key, index_code TEXT, -- Example Values: `I`, `N` | Value Statics: Total count 401 - Distinct count 2 - Null count 0 primary_description TEXT, -- secondary_description TEXT, -- ); CREATE TABLE FBI_Code ( description TEXT, -- fbi_code_no TEXT primary key, crime_against TEXT, -- Example Values: `Persons`, `Property`, `Society`, `Persons and Society` | Value Statics: Total count 26 - Distinct count 4 - Null count 0 title TEXT, -- ); CREATE TABLE Neighborhood ( foreign key (community_area_no) references Community_Area(community_area_no), community_area_no INTEGER, -- neighborhood_name TEXT primary key, ); CREATE TABLE Crime ( case_number TEXT, -- longitude TEXT, -- foreign key (fbi_code_no) references FBI_Code(fbi_code_no), fbi_code_no TEXT, -- date TEXT, -- arrest TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 foreign key (community_area_no) references Community_Area(community_area_no), location_description TEXT, -- latitude TEXT, -- block TEXT, -- ward_no INTEGER, -- domestic TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 district_no INTEGER, -- report_no INTEGER primary key, iucr_no TEXT, -- foreign key (ward_no) references Ward(ward_no), community_area_no INTEGER, -- foreign key (district_no) references District(district_no), foreign key (iucr_no) references IUCR(iucr_no), beat INTEGER, -- );
retail_world
Who is the newest hired employee? Give the full name.
newest hired refers to latest HireDate; full name = FirstName, LastName;
SELECT FirstName, LastName FROM Employees WHERE HireDate = ( SELECT MAX(HireDate) FROM Employees )
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
books
Identify the cost difference between Priority and Express shipping methods.
"Priority" and "Express" are both method_name; cost difference = Subtract (Sum(cost where method_name = 'Express'), Sum(cost where method_name 'Priority'))
SELECT SUM(CASE WHEN method_name = 'Priority' THEN cost ELSE 0 END) - SUM(CASE WHEN method_name = 'Express' THEN cost ELSE 0 END) FROM shipping_method
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
genes
How many non-essential genes are located in the nucleus?
null
SELECT COUNT(T1.GeneID) FROM Genes AS T1 INNER JOIN Classification AS T2 ON T1.GeneID = T2.GeneID WHERE T2.Localization = 'nucleus' AND T1.Essential = 'Non-Essential'
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression_Corr REAL not null, -- Type TEXT not null, -- Example Values: `Genetic-Physical`, `Genetic`, `Physical` | Value Statics: Total count 910 - Distinct count 3 - Null count 0 ); CREATE TABLE Genes ( Motif TEXT not null, -- Class TEXT not null, -- Complex TEXT null, -- Phenotype TEXT not null, -- Example Values: `?`, `Mating and sporulation defects`, `Cell cycle defects`, `Cell morphology and organelle mutants`, `Conditional phenotypes` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 foreign key (GeneID) references Classification (GeneID) on update cascade on delete cascade, Chromosome INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 4346 - Distinct count 17 - Null count 0 GeneID TEXT not null, -- Function TEXT not null, -- Example Values: `CELLULAR ORGANIZATION (proteins are localized to the corresponding organelle)`, `PROTEIN SYNTHESIS`, `CELL RESCUE, DEFENSE, CELL DEATH AND AGEING`, `CELLULAR TRANSPORT AND TRANSPORTMECHANISMS`, `PROTEIN DESTINATION` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 4346 - Distinct count 15 - Null count 0 Essential TEXT not null, -- Example Values: `Essential`, `Non-Essential`, `?`, `Ambiguous-Essential` | Value Statics: Total count 4346 - Distinct count 4 - Null count 0 ); CREATE TABLE Classification ( GeneID TEXT not null primary key, Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 862 - Distinct count 15 - Null count 0 );
chicago_crime
Please list the names of all the neighborhoods in the community area with the most population.
name of neighborhood refers to neighborhood_name; the most population refers to max(population)
SELECT T1.neighborhood_name FROM Neighborhood AS T1 INNER JOIN Community_Area AS T2 ON T2.community_area_no = T2.community_area_no ORDER BY T2.population DESC LIMIT 1
CREATE TABLE District ( district_no INTEGER primary key, email TEXT, -- phone TEXT, -- address TEXT, -- fax TEXT, -- district_name TEXT, -- tty TEXT, -- commander TEXT, -- zip_code INTEGER, -- twitter TEXT, -- ); CREATE TABLE Community_Area ( population TEXT, -- side TEXT, -- Example Values: `Far North `, `North `, `Central`, `Northwest `, `West ` | Value Statics: Total count 77 - Distinct count 9 - Null count 0 community_area_no INTEGER primary key, community_area_name TEXT, -- ); CREATE TABLE Ward ( ward_office_address TEXT, -- ward_office_zip TEXT, -- city_hall_office_phone TEXT, -- alderman_first_name TEXT, -- ward_no INTEGER primary key, ward_email TEXT, -- ward_office_fax TEXT, -- alderman_last_name TEXT, -- Population INTEGER, -- alderman_name_suffix TEXT, -- Example Values: `Jr.` | Value Statics: Total count 5 - Distinct count 1 - Null count 45 ward_office_phone TEXT, -- city_hall_office_room INTEGER, -- Example Values: `200`, `305`, `300`, `302` | Value Statics: Total count 50 - Distinct count 4 - Null count 0 city_hall_office_fax TEXT, -- ); CREATE TABLE IUCR ( iucr_no TEXT primary key, index_code TEXT, -- Example Values: `I`, `N` | Value Statics: Total count 401 - Distinct count 2 - Null count 0 primary_description TEXT, -- secondary_description TEXT, -- ); CREATE TABLE FBI_Code ( description TEXT, -- fbi_code_no TEXT primary key, crime_against TEXT, -- Example Values: `Persons`, `Property`, `Society`, `Persons and Society` | Value Statics: Total count 26 - Distinct count 4 - Null count 0 title TEXT, -- ); CREATE TABLE Neighborhood ( foreign key (community_area_no) references Community_Area(community_area_no), community_area_no INTEGER, -- neighborhood_name TEXT primary key, ); CREATE TABLE Crime ( case_number TEXT, -- longitude TEXT, -- foreign key (fbi_code_no) references FBI_Code(fbi_code_no), fbi_code_no TEXT, -- date TEXT, -- arrest TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 foreign key (community_area_no) references Community_Area(community_area_no), location_description TEXT, -- latitude TEXT, -- block TEXT, -- ward_no INTEGER, -- domestic TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 district_no INTEGER, -- report_no INTEGER primary key, iucr_no TEXT, -- foreign key (ward_no) references Ward(ward_no), community_area_no INTEGER, -- foreign key (district_no) references District(district_no), foreign key (iucr_no) references IUCR(iucr_no), beat INTEGER, -- );
retail_world
Give the full name of the youngest employee.
full name = FirstName, LastName; youngest refers to latest BirthDate;
SELECT FirstName, LastName FROM Employees WHERE BirthDate = ( SELECT MAX(BirthDate) 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, );
chicago_crime
How many neighborhoods are there in the community area of Lincoln Square?
the community area of Lincoln Square refers to community_area_name = 'Lincoln Square'
SELECT COUNT(T3.community_area_no) FROM ( SELECT T1.community_area_no FROM Community_Area AS T1 INNER JOIN Neighborhood AS T2 ON T1.community_area_no = T2.community_area_no WHERE community_area_name = 'Lincoln Square' GROUP BY T1.community_area_no ) T3
CREATE TABLE District ( district_no INTEGER primary key, email TEXT, -- phone TEXT, -- address TEXT, -- fax TEXT, -- district_name TEXT, -- tty TEXT, -- commander TEXT, -- zip_code INTEGER, -- twitter TEXT, -- ); CREATE TABLE Community_Area ( population TEXT, -- side TEXT, -- Example Values: `Far North `, `North `, `Central`, `Northwest `, `West ` | Value Statics: Total count 77 - Distinct count 9 - Null count 0 community_area_no INTEGER primary key, community_area_name TEXT, -- ); CREATE TABLE Ward ( ward_office_address TEXT, -- ward_office_zip TEXT, -- city_hall_office_phone TEXT, -- alderman_first_name TEXT, -- ward_no INTEGER primary key, ward_email TEXT, -- ward_office_fax TEXT, -- alderman_last_name TEXT, -- Population INTEGER, -- alderman_name_suffix TEXT, -- Example Values: `Jr.` | Value Statics: Total count 5 - Distinct count 1 - Null count 45 ward_office_phone TEXT, -- city_hall_office_room INTEGER, -- Example Values: `200`, `305`, `300`, `302` | Value Statics: Total count 50 - Distinct count 4 - Null count 0 city_hall_office_fax TEXT, -- ); CREATE TABLE IUCR ( iucr_no TEXT primary key, index_code TEXT, -- Example Values: `I`, `N` | Value Statics: Total count 401 - Distinct count 2 - Null count 0 primary_description TEXT, -- secondary_description TEXT, -- ); CREATE TABLE FBI_Code ( description TEXT, -- fbi_code_no TEXT primary key, crime_against TEXT, -- Example Values: `Persons`, `Property`, `Society`, `Persons and Society` | Value Statics: Total count 26 - Distinct count 4 - Null count 0 title TEXT, -- ); CREATE TABLE Neighborhood ( foreign key (community_area_no) references Community_Area(community_area_no), community_area_no INTEGER, -- neighborhood_name TEXT primary key, ); CREATE TABLE Crime ( case_number TEXT, -- longitude TEXT, -- foreign key (fbi_code_no) references FBI_Code(fbi_code_no), fbi_code_no TEXT, -- date TEXT, -- arrest TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 foreign key (community_area_no) references Community_Area(community_area_no), location_description TEXT, -- latitude TEXT, -- block TEXT, -- ward_no INTEGER, -- domestic TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 district_no INTEGER, -- report_no INTEGER primary key, iucr_no TEXT, -- foreign key (ward_no) references Ward(ward_no), community_area_no INTEGER, -- foreign key (district_no) references District(district_no), foreign key (iucr_no) references IUCR(iucr_no), beat INTEGER, -- );
retail_world
Among the products ordered in order no. 10248, which product has the biggest ratio of units on order to units in stock?
order no. refers to OrderID; biggest ratio = MAX(DIVIDE(UnitsOnOrder, UnitsInStock));
SELECT T1.ProductName FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T2.OrderID = 10248 ORDER BY T1.UnitsOnOrder / T1.UnitsInStock DESC LIMIT 1
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
books
List all the books published by BBC Audiobooks.
"BBC Audiobooks" refers to publisher_name; books refers to title
SELECT T1.title FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'BBC Audiobooks'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
menu
Name the dishes that cost 180,000.
cost 180,000 refers to price = 180000;
SELECT T1.name FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id WHERE T2.price = 180000
CREATE TABLE Dish ( menus_appeared INTEGER, -- highest_price REAL, -- description TEXT, -- Example Values: `` | Value Statics: Total count 7 - Distinct count 1 - Null count 99993 last_appeared INTEGER, -- name TEXT, -- id INTEGER primary key, first_appeared INTEGER, -- lowest_price REAL, -- times_appeared INTEGER, -- ); CREATE TABLE MenuPage ( menu_id INTEGER, -- uuid TEXT, -- foreign key (menu_id) references Menu(id), id INTEGER primary key, full_width INTEGER, -- image_id REAL, -- page_number INTEGER, -- full_height INTEGER, -- ); CREATE TABLE Menu ( language TEXT, -- currency TEXT, -- venue TEXT, -- keywords TEXT, -- currency_symbol TEXT, -- physical_description TEXT, -- page_count INTEGER, -- location TEXT, -- dish_count INTEGER, -- name TEXT, -- occasion TEXT, -- id INTEGER primary key, notes TEXT, -- sponsor TEXT, -- place TEXT, -- call_number TEXT, -- location_type TEXT, -- status TEXT, -- Example Values: `complete` | Value Statics: Total count 17527 - Distinct count 1 - Null count 0 date DATE, -- event TEXT, -- ); CREATE TABLE MenuItem ( foreign key (dish_id) references Dish(id), updated_at TEXT, -- id INTEGER primary key, ypos REAL, -- xpos REAL, -- price REAL, -- high_price REAL, -- dish_id INTEGER, -- menu_page_id INTEGER, -- created_at TEXT, -- foreign key (menu_page_id) references MenuPage(id), foreign key (menu_page_id) references MenuPage(id), );
public_review_platform
State the state of businesses which have closing time at 12AM.
state refers to city
SELECT DISTINCT T1.state FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id WHERE T2.closing_time = '12AM'
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
soccer_2016
What are the names of the venues in Abu Dhabi?
names of the venues refers to Venue_Name; Abu Dhabi refers to City_Name = 'Abu Dhabi'
SELECT T1.Venue_Name FROM Venue AS T1 INNER JOIN City AS T2 ON T1.City_Id = T2.City_Id WHERE T2.City_Name = 'Abu Dhabi'
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, );
menu
How many dishes appeared more than once on a menu?
appeared more than once on a menu refers to times_appeared > menus_appeared;
SELECT COUNT(*) FROM Dish WHERE times_appeared > Dish.menus_appeared
CREATE TABLE Dish ( menus_appeared INTEGER, -- highest_price REAL, -- description TEXT, -- Example Values: `` | Value Statics: Total count 7 - Distinct count 1 - Null count 99993 last_appeared INTEGER, -- name TEXT, -- id INTEGER primary key, first_appeared INTEGER, -- lowest_price REAL, -- times_appeared INTEGER, -- ); CREATE TABLE MenuPage ( menu_id INTEGER, -- uuid TEXT, -- foreign key (menu_id) references Menu(id), id INTEGER primary key, full_width INTEGER, -- image_id REAL, -- page_number INTEGER, -- full_height INTEGER, -- ); CREATE TABLE Menu ( language TEXT, -- currency TEXT, -- venue TEXT, -- keywords TEXT, -- currency_symbol TEXT, -- physical_description TEXT, -- page_count INTEGER, -- location TEXT, -- dish_count INTEGER, -- name TEXT, -- occasion TEXT, -- id INTEGER primary key, notes TEXT, -- sponsor TEXT, -- place TEXT, -- call_number TEXT, -- location_type TEXT, -- status TEXT, -- Example Values: `complete` | Value Statics: Total count 17527 - Distinct count 1 - Null count 0 date DATE, -- event TEXT, -- ); CREATE TABLE MenuItem ( foreign key (dish_id) references Dish(id), updated_at TEXT, -- id INTEGER primary key, ypos REAL, -- xpos REAL, -- price REAL, -- high_price REAL, -- dish_id INTEGER, -- menu_page_id INTEGER, -- created_at TEXT, -- foreign key (menu_page_id) references MenuPage(id), foreign key (menu_page_id) references MenuPage(id), );
public_review_platform
Calculate the percentage of medium tip length in the list. List out the time when users of medium tip length join Yelp.
medium tip length refers to tip_length = 'Medium'; percentage = divide(count(tips where tip_length = 'Medium'), count(tips))*100%; the time when users join Yelp refers to user_yelping_since_year
SELECT CAST(SUM(CASE WHEN T1.tip_length = 'Medium' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.tip_length), T2.user_yelping_since_year FROM Tips AS T1 INNER JOIN Users AS T2 ON T1.user_id = T2.user_id
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
menu
List down name of dishes from menu with menu page ID 1389.
FALSE;
SELECT T2.name FROM MenuItem AS T1 INNER JOIN Dish AS T2 ON T2.id = T1.dish_id WHERE T1.menu_page_id = 1389
CREATE TABLE Dish ( menus_appeared INTEGER, -- highest_price REAL, -- description TEXT, -- Example Values: `` | Value Statics: Total count 7 - Distinct count 1 - Null count 99993 last_appeared INTEGER, -- name TEXT, -- id INTEGER primary key, first_appeared INTEGER, -- lowest_price REAL, -- times_appeared INTEGER, -- ); CREATE TABLE MenuPage ( menu_id INTEGER, -- uuid TEXT, -- foreign key (menu_id) references Menu(id), id INTEGER primary key, full_width INTEGER, -- image_id REAL, -- page_number INTEGER, -- full_height INTEGER, -- ); CREATE TABLE Menu ( language TEXT, -- currency TEXT, -- venue TEXT, -- keywords TEXT, -- currency_symbol TEXT, -- physical_description TEXT, -- page_count INTEGER, -- location TEXT, -- dish_count INTEGER, -- name TEXT, -- occasion TEXT, -- id INTEGER primary key, notes TEXT, -- sponsor TEXT, -- place TEXT, -- call_number TEXT, -- location_type TEXT, -- status TEXT, -- Example Values: `complete` | Value Statics: Total count 17527 - Distinct count 1 - Null count 0 date DATE, -- event TEXT, -- ); CREATE TABLE MenuItem ( foreign key (dish_id) references Dish(id), updated_at TEXT, -- id INTEGER primary key, ypos REAL, -- xpos REAL, -- price REAL, -- high_price REAL, -- dish_id INTEGER, -- menu_page_id INTEGER, -- created_at TEXT, -- foreign key (menu_page_id) references MenuPage(id), foreign key (menu_page_id) references MenuPage(id), );
public_review_platform
Which business ID has the most reviews?
the most reviews refer to MAX(user_id);
SELECT business_id FROM Reviews GROUP BY business_id ORDER BY COUNT(user_id) DESC LIMIT 1
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
soccer_2016
How many matches did Rajasthan Royals play in Season 8?
Season 8 refers to Season_Id = 8
SELECT SUM(CASE WHEN T1.Season_Id = 8 THEN 1 ELSE 0 END) FROM `Match` AS T1 INNER JOIN Team AS T2 ON T1.Team_1 = T2.Team_Id OR T1.Team_2 = T2.Team_Id WHERE T2.Team_Name = 'Rajasthan Royals'
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, );
public_review_platform
Calculate the percentage of businesses who located in Mesa. What is attribute value of these businesses.
percentage = divide(count(business where city = 'Mesa'), count(business)) * 100%
SELECT CAST(COUNT(T1.city) AS REAL) * 100 / ( SELECT COUNT(business_id) FROM Business ), T2.attribute_value FROM Business AS T1 INNER JOIN Business_Attributes AS T2 ON T1.business_id = T2.business_id WHERE T1.city = 'Mesa'
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
soccer_2016
Which country is umpire TH Wijewardene from?
country refers to Country_Name
SELECT T2.Country_Name FROM Umpire AS T1 INNER JOIN country AS T2 ON T2.Country_Id = T1.Umpire_Country WHERE T1.Umpire_Name = 'TH Wijewardene'
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, );
menu
Which dish has the longest history?
longest history refers to MAX(SUBTRACT(last_appeared, first_appeared));
SELECT name FROM Dish ORDER BY last_appeared - Dish.first_appeared DESC LIMIT 1
CREATE TABLE Dish ( menus_appeared INTEGER, -- highest_price REAL, -- description TEXT, -- Example Values: `` | Value Statics: Total count 7 - Distinct count 1 - Null count 99993 last_appeared INTEGER, -- name TEXT, -- id INTEGER primary key, first_appeared INTEGER, -- lowest_price REAL, -- times_appeared INTEGER, -- ); CREATE TABLE MenuPage ( menu_id INTEGER, -- uuid TEXT, -- foreign key (menu_id) references Menu(id), id INTEGER primary key, full_width INTEGER, -- image_id REAL, -- page_number INTEGER, -- full_height INTEGER, -- ); CREATE TABLE Menu ( language TEXT, -- currency TEXT, -- venue TEXT, -- keywords TEXT, -- currency_symbol TEXT, -- physical_description TEXT, -- page_count INTEGER, -- location TEXT, -- dish_count INTEGER, -- name TEXT, -- occasion TEXT, -- id INTEGER primary key, notes TEXT, -- sponsor TEXT, -- place TEXT, -- call_number TEXT, -- location_type TEXT, -- status TEXT, -- Example Values: `complete` | Value Statics: Total count 17527 - Distinct count 1 - Null count 0 date DATE, -- event TEXT, -- ); CREATE TABLE MenuItem ( foreign key (dish_id) references Dish(id), updated_at TEXT, -- id INTEGER primary key, ypos REAL, -- xpos REAL, -- price REAL, -- high_price REAL, -- dish_id INTEGER, -- menu_page_id INTEGER, -- created_at TEXT, -- foreign key (menu_page_id) references MenuPage(id), foreign key (menu_page_id) references MenuPage(id), );
menu
How many dishes have appeared on the menu in less than 5 years?
appeared on the menu in less than 5 years = SUBTRACT(last_appeared, first_appeared) < 5;
SELECT COUNT(*) FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id WHERE T1.last_appeared - T1.first_appeared < 5
CREATE TABLE Dish ( menus_appeared INTEGER, -- highest_price REAL, -- description TEXT, -- Example Values: `` | Value Statics: Total count 7 - Distinct count 1 - Null count 99993 last_appeared INTEGER, -- name TEXT, -- id INTEGER primary key, first_appeared INTEGER, -- lowest_price REAL, -- times_appeared INTEGER, -- ); CREATE TABLE MenuPage ( menu_id INTEGER, -- uuid TEXT, -- foreign key (menu_id) references Menu(id), id INTEGER primary key, full_width INTEGER, -- image_id REAL, -- page_number INTEGER, -- full_height INTEGER, -- ); CREATE TABLE Menu ( language TEXT, -- currency TEXT, -- venue TEXT, -- keywords TEXT, -- currency_symbol TEXT, -- physical_description TEXT, -- page_count INTEGER, -- location TEXT, -- dish_count INTEGER, -- name TEXT, -- occasion TEXT, -- id INTEGER primary key, notes TEXT, -- sponsor TEXT, -- place TEXT, -- call_number TEXT, -- location_type TEXT, -- status TEXT, -- Example Values: `complete` | Value Statics: Total count 17527 - Distinct count 1 - Null count 0 date DATE, -- event TEXT, -- ); CREATE TABLE MenuItem ( foreign key (dish_id) references Dish(id), updated_at TEXT, -- id INTEGER primary key, ypos REAL, -- xpos REAL, -- price REAL, -- high_price REAL, -- dish_id INTEGER, -- menu_page_id INTEGER, -- created_at TEXT, -- foreign key (menu_page_id) references MenuPage(id), foreign key (menu_page_id) references MenuPage(id), );
public_review_platform
Among the users who received high compliments from other users, which users joined Yelp earliest?
high compliments refers to number_of_compliments = ' High'; joined Yelp earliest refers to min(user_yelping_since_year)
SELECT T2.user_id FROM Users AS T1 INNER JOIN Users_Compliments AS T2 ON T1.user_id = T2.user_id WHERE T2.number_of_compliments = 'High' AND T1.user_yelping_since_year = ( SELECT MIN(user_yelping_since_year) FROM Users )
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
soccer_2016
List all the names of the winning team's players in the first match of season 1.
names refers to Player_Name; winning team's refers to Match_Winner; first match of season 1 refers to Season_Id = 1 and min(Match_Date)
SELECT T3.Player_Name FROM `Match` AS T1 INNER JOIN Player_Match AS T2 ON T1.Match_Winner = T2.Team_Id INNER JOIN Player AS T3 ON T2.Player_Id = T3.Player_Id WHERE T1.Season_Id = 1 ORDER BY T1.Match_Date LIMIT 1
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
menu
How many menus sponsored by Krogs Fiske Restaurant were created in April 2015?
sponsored by Krogs Fiske Restaurant refers to sponsor = 'Krogs Fiskerestaurant'; created in April 2015 refers to date like '2015-04%';
SELECT COUNT(*) FROM Menu WHERE date LIKE '2015-04%' AND sponsor = 'Krogs Fiskerestaurant'
CREATE TABLE Dish ( menus_appeared INTEGER, -- highest_price REAL, -- description TEXT, -- Example Values: `` | Value Statics: Total count 7 - Distinct count 1 - Null count 99993 last_appeared INTEGER, -- name TEXT, -- id INTEGER primary key, first_appeared INTEGER, -- lowest_price REAL, -- times_appeared INTEGER, -- ); CREATE TABLE MenuPage ( menu_id INTEGER, -- uuid TEXT, -- foreign key (menu_id) references Menu(id), id INTEGER primary key, full_width INTEGER, -- image_id REAL, -- page_number INTEGER, -- full_height INTEGER, -- ); CREATE TABLE Menu ( language TEXT, -- currency TEXT, -- venue TEXT, -- keywords TEXT, -- currency_symbol TEXT, -- physical_description TEXT, -- page_count INTEGER, -- location TEXT, -- dish_count INTEGER, -- name TEXT, -- occasion TEXT, -- id INTEGER primary key, notes TEXT, -- sponsor TEXT, -- place TEXT, -- call_number TEXT, -- location_type TEXT, -- status TEXT, -- Example Values: `complete` | Value Statics: Total count 17527 - Distinct count 1 - Null count 0 date DATE, -- event TEXT, -- ); CREATE TABLE MenuItem ( foreign key (dish_id) references Dish(id), updated_at TEXT, -- id INTEGER primary key, ypos REAL, -- xpos REAL, -- price REAL, -- high_price REAL, -- dish_id INTEGER, -- menu_page_id INTEGER, -- created_at TEXT, -- foreign key (menu_page_id) references MenuPage(id), foreign key (menu_page_id) references MenuPage(id), );
public_review_platform
How many 5 star businesses have uber review votes for funny?
businesses refer to business_id; review_stars = 5.0; review_votes_funny = 'uber';
SELECT COUNT(business_id) FROM Reviews WHERE review_stars = 5 AND review_votes_funny = 'Uber'
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
menu
How long has the "Clear Green Turtle" dish appeared on the menu, and tell me when its latest update was?
Clear Green Turtle is a name of dish; how long a dish appeared on the menu = SUBTRACT(last_appeared, first_appeared); latest update refers to latest updated_at;
SELECT T1.last_appeared - T1.first_appeared, T2.updated_at FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id WHERE T1.name = 'Clear green turtle'
CREATE TABLE Dish ( menus_appeared INTEGER, -- highest_price REAL, -- description TEXT, -- Example Values: `` | Value Statics: Total count 7 - Distinct count 1 - Null count 99993 last_appeared INTEGER, -- name TEXT, -- id INTEGER primary key, first_appeared INTEGER, -- lowest_price REAL, -- times_appeared INTEGER, -- ); CREATE TABLE MenuPage ( menu_id INTEGER, -- uuid TEXT, -- foreign key (menu_id) references Menu(id), id INTEGER primary key, full_width INTEGER, -- image_id REAL, -- page_number INTEGER, -- full_height INTEGER, -- ); CREATE TABLE Menu ( language TEXT, -- currency TEXT, -- venue TEXT, -- keywords TEXT, -- currency_symbol TEXT, -- physical_description TEXT, -- page_count INTEGER, -- location TEXT, -- dish_count INTEGER, -- name TEXT, -- occasion TEXT, -- id INTEGER primary key, notes TEXT, -- sponsor TEXT, -- place TEXT, -- call_number TEXT, -- location_type TEXT, -- status TEXT, -- Example Values: `complete` | Value Statics: Total count 17527 - Distinct count 1 - Null count 0 date DATE, -- event TEXT, -- ); CREATE TABLE MenuItem ( foreign key (dish_id) references Dish(id), updated_at TEXT, -- id INTEGER primary key, ypos REAL, -- xpos REAL, -- price REAL, -- high_price REAL, -- dish_id INTEGER, -- menu_page_id INTEGER, -- created_at TEXT, -- foreign key (menu_page_id) references MenuPage(id), foreign key (menu_page_id) references MenuPage(id), );
public_review_platform
Among the businesses which have attribute of beer_and_wine, how many business located in Peoria?
attribute of beer_and_wine refers to attribute_value = 'beer_and_wine'; in Peoria refers to city = 'Peoria'
SELECT COUNT(T1.business_id) FROM Business_Attributes AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id WHERE T2.city = 'Peoria' AND T1.attribute_value = 'beer_and_wine'
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
soccer_2016
How many players bowl in the legbreak style?
legbreak style refers to Bowling_skill = 'Legbreak'
SELECT T1.Player_Name FROM Player AS T1 INNER JOIN Bowling_Style AS T2 ON T1.Bowling_skill = T2.Bowling_Id WHERE T2.Bowling_skill = 'Legbreak'
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, );
public_review_platform
Which year has the most elite users?
year has the most elite users refers to year_id with MAX(user_id);
SELECT year_id FROM Elite GROUP BY year_id ORDER BY COUNT(user_id) DESC LIMIT 1
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
menu
How many pages are there in the "Emil Kuehn" menu?
Emil Kuehn is a name of menu;
SELECT SUM(CASE WHEN T1.name = 'Emil Kuehn' THEN 1 ELSE 0 END) FROM Menu AS T1 INNER JOIN MenuPage AS T2 ON T1.id = T2.menu_id
CREATE TABLE Dish ( menus_appeared INTEGER, -- highest_price REAL, -- description TEXT, -- Example Values: `` | Value Statics: Total count 7 - Distinct count 1 - Null count 99993 last_appeared INTEGER, -- name TEXT, -- id INTEGER primary key, first_appeared INTEGER, -- lowest_price REAL, -- times_appeared INTEGER, -- ); CREATE TABLE MenuPage ( menu_id INTEGER, -- uuid TEXT, -- foreign key (menu_id) references Menu(id), id INTEGER primary key, full_width INTEGER, -- image_id REAL, -- page_number INTEGER, -- full_height INTEGER, -- ); CREATE TABLE Menu ( language TEXT, -- currency TEXT, -- venue TEXT, -- keywords TEXT, -- currency_symbol TEXT, -- physical_description TEXT, -- page_count INTEGER, -- location TEXT, -- dish_count INTEGER, -- name TEXT, -- occasion TEXT, -- id INTEGER primary key, notes TEXT, -- sponsor TEXT, -- place TEXT, -- call_number TEXT, -- location_type TEXT, -- status TEXT, -- Example Values: `complete` | Value Statics: Total count 17527 - Distinct count 1 - Null count 0 date DATE, -- event TEXT, -- ); CREATE TABLE MenuItem ( foreign key (dish_id) references Dish(id), updated_at TEXT, -- id INTEGER primary key, ypos REAL, -- xpos REAL, -- price REAL, -- high_price REAL, -- dish_id INTEGER, -- menu_page_id INTEGER, -- created_at TEXT, -- foreign key (menu_page_id) references MenuPage(id), foreign key (menu_page_id) references MenuPage(id), );
soccer_2016
Provide the complete name of the venue, city and country where the last match was held.
name of the venue, city and country refers to Venue_Name and City_Name and Country_Name; last match refers to max(Match_Date)
SELECT T1.Venue_Name, T2.City_Name, T3.Country_Name FROM Venue AS T1 INNER JOIN City AS T2 ON T1.City_Id = T2.City_Id INNER JOIN Country AS T3 ON T2.Country_Id = T3.Country_Id INNER JOIN Match AS T4 ON T1.Venue_Id = T4.Venue_Id ORDER BY T4.Match_Date DESC LIMIT 1
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
menu
How many dishes appear in the right upper corner of the menu page?
appear in the right upper corner of the menu page refers to xpos > 0.75 and ypos < 0.25;
SELECT COUNT(*) FROM MenuItem AS T1 INNER JOIN Dish AS T2 ON T1.dish_id = T2.id WHERE T1.xpos > 0.75 AND T1.ypos < 0.25
CREATE TABLE Dish ( menus_appeared INTEGER, -- highest_price REAL, -- description TEXT, -- Example Values: `` | Value Statics: Total count 7 - Distinct count 1 - Null count 99993 last_appeared INTEGER, -- name TEXT, -- id INTEGER primary key, first_appeared INTEGER, -- lowest_price REAL, -- times_appeared INTEGER, -- ); CREATE TABLE MenuPage ( menu_id INTEGER, -- uuid TEXT, -- foreign key (menu_id) references Menu(id), id INTEGER primary key, full_width INTEGER, -- image_id REAL, -- page_number INTEGER, -- full_height INTEGER, -- ); CREATE TABLE Menu ( language TEXT, -- currency TEXT, -- venue TEXT, -- keywords TEXT, -- currency_symbol TEXT, -- physical_description TEXT, -- page_count INTEGER, -- location TEXT, -- dish_count INTEGER, -- name TEXT, -- occasion TEXT, -- id INTEGER primary key, notes TEXT, -- sponsor TEXT, -- place TEXT, -- call_number TEXT, -- location_type TEXT, -- status TEXT, -- Example Values: `complete` | Value Statics: Total count 17527 - Distinct count 1 - Null count 0 date DATE, -- event TEXT, -- ); CREATE TABLE MenuItem ( foreign key (dish_id) references Dish(id), updated_at TEXT, -- id INTEGER primary key, ypos REAL, -- xpos REAL, -- price REAL, -- high_price REAL, -- dish_id INTEGER, -- menu_page_id INTEGER, -- created_at TEXT, -- foreign key (menu_page_id) references MenuPage(id), foreign key (menu_page_id) references MenuPage(id), );
public_review_platform
Which business ID have the shortest business operating hours?
the shortest business operating hours refer to MIN(SUBTRACT(closing_time, opening_time));
SELECT business_id FROM Business_Hours ORDER BY closing_time - opening_time LIMIT 1
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
soccer_2016
Which country is the youngest player from?
country refers to Country_Name; youngest player refers to max(DOB)
SELECT T1.Country_Name FROM Country AS T1 INNER JOIN Player AS T2 ON T1.Country_Id = T2.Country_Name ORDER BY T2.DOB DESC LIMIT 1
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );