question
stringlengths 24
325
| sql
stringlengths 30
804
| db_id
stringclasses 63
values | question_id
int64 167
9.43k
| difficulty
stringclasses 1
value | table_names_with_rag
sequencelengths 2
12
| create_statements_all
sequencelengths 1
1
| create_statements_rag
sequencelengths 1
1
| len_create_all
int64 2
65
| len_create_rag
int64 2
65
| column_names_with_rag
stringlengths 8.82k
9.82k
|
---|---|---|---|---|---|---|---|---|---|---|
Which date has the most ordered quantity? What is the total order quantity on that day? | SELECT ord_date, SUM(qty) FROM sales GROUP BY ord_date ORDER BY SUM(qty) DESC LIMIT 1 | book_publishing_company | 167 | [
"employee",
"sales",
"stores",
"roysched",
"titles",
"publishers",
"discounts",
"jobs"
] | [
[
" CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ",
" CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL NOT NULL, FOREIGN KEY(stor_id) REFERENCES stores (stor_id) ) ",
" CREATE TABLE employee ( emp_id TEXT, fname TEXT NOT NULL, minit TEXT, lname TEXT NOT NULL, job_id INTEGER NOT NULL, job_lvl INTEGER, pub_id TEXT NOT NULL, hire_date DATETIME NOT NULL, PRIMARY KEY (emp_id), FOREIGN KEY(job_id) REFERENCES jobs (job_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE jobs ( job_id INTEGER, job_desc TEXT NOT NULL, min_lvl INTEGER NOT NULL, max_lvl INTEGER NOT NULL, PRIMARY KEY (job_id) ) ",
" CREATE TABLE pub_info ( pub_id TEXT, logo BLOB, pr_info TEXT, PRIMARY KEY (pub_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE publishers ( pub_id TEXT, pub_name TEXT, city TEXT, state TEXT, country TEXT, PRIMARY KEY (pub_id) ) ",
" CREATE TABLE roysched ( title_id TEXT NOT NULL, lorange INTEGER, hirange INTEGER, royalty INTEGER, FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE sales ( stor_id TEXT NOT NULL, ord_num TEXT NOT NULL, ord_date DATETIME NOT NULL, qty INTEGER NOT NULL, payterms TEXT NOT NULL, title_id TEXT NOT NULL, PRIMARY KEY (stor_id, ord_num, title_id), FOREIGN KEY(stor_id) REFERENCES stores (stor_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE stores ( stor_id TEXT, stor_name TEXT, stor_address TEXT, city TEXT, state TEXT, zip TEXT, PRIMARY KEY (stor_id) ) ",
" CREATE TABLE titleauthor ( au_id TEXT NOT NULL, title_id TEXT NOT NULL, au_ord INTEGER, royaltyper INTEGER, PRIMARY KEY (au_id, title_id), FOREIGN KEY(au_id) REFERENCES authors (au_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE titles ( title_id TEXT, title TEXT NOT NULL, type TEXT NOT NULL, pub_id TEXT, price REAL, advance REAL, royalty INTEGER, ytd_sales INTEGER, notes TEXT, pubdate DATETIME NOT NULL, PRIMARY KEY (title_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) "
]
] | [
[
" CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ",
" CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL NOT NULL, FOREIGN KEY(stor_id) REFERENCES stores (stor_id) ) ",
" CREATE TABLE employee ( emp_id TEXT, fname TEXT NOT NULL, minit TEXT, lname TEXT NOT NULL, job_id INTEGER NOT NULL, job_lvl INTEGER, pub_id TEXT NOT NULL, hire_date DATETIME NOT NULL, PRIMARY KEY (emp_id), FOREIGN KEY(job_id) REFERENCES jobs (job_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE jobs ( job_id INTEGER, job_desc TEXT NOT NULL, min_lvl INTEGER NOT NULL, max_lvl INTEGER NOT NULL, PRIMARY KEY (job_id) ) ",
" CREATE TABLE pub_info ( pub_id TEXT, logo BLOB, pr_info TEXT, PRIMARY KEY (pub_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE publishers ( pub_id TEXT, pub_name TEXT, city TEXT, state TEXT, country TEXT, PRIMARY KEY (pub_id) ) ",
" CREATE TABLE roysched ( title_id TEXT NOT NULL, lorange INTEGER, hirange INTEGER, royalty INTEGER, FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE sales ( stor_id TEXT NOT NULL, ord_num TEXT NOT NULL, ord_date DATETIME NOT NULL, qty INTEGER NOT NULL, payterms TEXT NOT NULL, title_id TEXT NOT NULL, PRIMARY KEY (stor_id, ord_num, title_id), FOREIGN KEY(stor_id) REFERENCES stores (stor_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE stores ( stor_id TEXT, stor_name TEXT, stor_address TEXT, city TEXT, state TEXT, zip TEXT, PRIMARY KEY (stor_id) ) ",
" CREATE TABLE titleauthor ( au_id TEXT NOT NULL, title_id TEXT NOT NULL, au_ord INTEGER, royaltyper INTEGER, PRIMARY KEY (au_id, title_id), FOREIGN KEY(au_id) REFERENCES authors (au_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE titles ( title_id TEXT, title TEXT NOT NULL, type TEXT NOT NULL, pub_id TEXT, price REAL, advance REAL, royalty INTEGER, ytd_sales INTEGER, notes TEXT, pubdate DATETIME NOT NULL, PRIMARY KEY (title_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) "
]
] | 11 | 11 | {"ATT_CLASSES": null, "Address": null, "AddressType": null, "Air Carriers": null, "Airlines": null, "Airports": null, "Answer": null, "Attributes": null, "Author": null, "Award": null, "AwardsCoaches": null, "AwardsMisc": null, "AwardsPlayers": null, "Ball_by_Ball": null, "Batsman_Scored": null, "Batting_Style": null, "BillOfMaterials": null, "Bowling_Style": null, "Business": null, "BusinessEntity": null, "BusinessEntityAddress": null, "BusinessEntityContact": null, "Business_Attributes": null, "Business_Categories": null, "Business_Hours": null, "CBSA": null, "Categories": null, "Character_Award": null, "Checkins": null, "City": null, "Classification": null, "Coaches": null, "CombinedShutouts": null, "Community_Area": null, "Compliments": null, "Conference": null, "ContactType": null, "Country": null, "CountryLanguage": null, "CountryRegion": null, "CountryRegionCurrency": null, "Credit": null, "CreditCard": null, "Crime": null, "Culture": null, "Currency": null, "CurrencyRate": null, "Customer": null, "Customers": null, "Days": null, "Demog": null, "Department": null, "Dish": null, "District": null, "Document": null, "Elite": null, "EmailAddress": null, "Employee": null, "EmployeeDepartmentHistory": null, "EmployeePayHistory": null, "Employees": null, "Episode": null, "Extra_Runs": null, "Extra_Type": null, "FBI_Code": null, "Genes": null, "Goalies": null, "GoaliesSC": null, "GoaliesShootout": null, "HOF": null, "IMG_OBJ": null, "IMG_OBJ_ATT": null, "IMG_REL": null, "IUCR": null, "Ingredient": null, "Interactions": null, "JobCandidate": null, "Journal": null, "Keyword": null, "Location": null, "Mailings1_2": null, "Master": null, "Match": null, "Menu": null, "MenuItem": null, "MenuPage": null, "Neighborhood": null, "Nutrition": null, "OBJ_CLASSES": null, "OrderDetails": null, "Orders": null, "Out_Type": null, "Outcome": null, "PRED_CLASSES": null, "Paper": null, "PaperAuthor": null, "Password": null, "Person": null, "PersonCreditCard": null, "PhoneNumberType": null, "Player": null, "PlayerInfo": null, "Player_Match": null, "Product": null, "ProductCategory": null, "ProductCostHistory": null, "ProductDescription": null, "ProductDocument": null, "ProductInventory": null, "ProductListPriceHistory": null, "ProductModel": null, "ProductModelProductDescriptionCulture": null, "ProductPhoto": null, "ProductProductPhoto": null, "ProductReview": null, "ProductSubcategory": null, "ProductVendor": null, "Products": null, "PurchaseOrderDetail": null, "PurchaseOrderHeader": null, "Quantity": null, "Question": null, "RA": null, "Recipe": null, "Regions": null, "Reviews": null, "Rolee": null, "Sales": null, "Sales Orders": null, "Sales Team": null, "SalesOrderDetail": null, "SalesOrderHeader": null, "SalesOrderHeaderSalesReason": null, "SalesPerson": null, "SalesPersonQuotaHistory": null, "SalesReason": null, "SalesTaxRate": null, "SalesTerritory": null, "SalesTerritoryHistory": null, "Scoring": null, "ScoringSC": null, "ScoringShootout": null, "ScoringSup": null, "ScrapReason": null, "Season": null, "SeasonStatus": null, "SeriesPost": null, "Shift": null, "ShipMethod": null, "Shippers": null, "ShoppingCartItem": null, "SpecialOffer": null, "SpecialOfferProduct": null, "StateProvince": null, "Store": null, "Store Locations": null, "Suppliers": null, "Survey": null, "Team": null, "TeamSplits": null, "TeamVsTeam": null, "Teams": null, "TeamsHalf": null, "TeamsPost": null, "TeamsSC": null, "Tips": null, "Toss_Decision": null, "TransactionHistory": null, "TransactionHistoryArchive": null, "Umpire": null, "UnitMeasure": null, "Users": null, "Users_Compliments": null, "Vendor": null, "Venue": null, "Vote": null, "Ward": null, "Wicket_Taken": null, "Win_By": null, "WorkOrder": null, "WorkOrderRouting": null, "Years": null, "abbrev": null, "actor": null, "actors": null, "address": null, "address_status": null, "advisedBy": null, "alias": null, "all_prevalences": null, "allergies": null, "app_all": null, "app_events": null, "app_events_relevant": null, "app_labels": null, "area_code": null, "author": null, "authors": null, "avoid": null, "awards_coaches": null, "awards_players": null, "beers": null, "book": null, "book_author": null, "book_language": null, "bool": null, "borders": null, "breweries": null, "businesses": null, "callcenterlogs": null, "careplans": null, "cars": null, "categories": null, "category": null, "central_superstore": null, "chapters": null, "characters": null, "cites": null, "city": null, "claims": null, "client": null, "coaches": null, "coins": null, "competitor_event": null, "conditions": null, "congress": null, "content": null, "continent": null, "country": null, "course": null, "current": null, "current-terms": null, "cust_order": null, "customer": null, "customer_address": null, "customers": null, "data": null, "department": null, "desert": null, "director": null, "directors": null, "disabled": null, "discounts": ["discount", "discounttype", "highqty", "stor_id", "lowqty"], "district": null, "divisions": null, "draft": null, "driver": null, "east_superstore": null, "economy": null, "employee": ["hire_date", "minit", "job_id", "emp_id", "job_lvl"], "employees": null, "encompasses": null, "encounters": null, "enlist": null, "enrolled": null, "establishment": null, "ethnicGroup": null, "event": null, "events": null, "events_relevant": null, "filed_for_bankrupcy": null, "film": null, "film_actor": null, "film_category": null, "film_text": null, "game": null, "game_platform": null, "game_publisher": null, "games": null, "games_city": null, "games_competitor": null, "gender": null, "gender_age": null, "gender_age_test": null, "gender_age_train": null, "generalinfo": null, "genre": null, "geo_desert": null, "geo_estuary": null, "geo_island": null, "geo_lake": null, "geo_mountain": null, "geo_river": null, "geo_sea": null, "geo_source": null, "geographic": null, "geolocation": null, "height_info": null, "historical": null, "historical-terms": null, "immunizations": null, "incidents": null, "inspection": null, "inspection_point": null, "inspections": null, "institution_details": null, "institution_grads": null, "inventory": null, "isMember": null, "island": null, "islandIn": null, "jobs": null, "keyword": null, "label_categories": null, "lake": null, "language": null, "language_role": null, "lineitem": null, "located": null, "locatedOn": null, "location": null, "longest_absense_from_school": null, "mailings3": null, "male": null, "matchs": null, "medal": null, "medications": null, "mergesWith": null, "mountain": null, "mountainOnIsland": null, "movie": null, "movie_cast": null, "movie_company": null, "movie_crew": null, "movie_genres": null, "movie_keywords": null, "movie_languages": null, "movies": null, "movies2actors": null, "movies2directors": null, "movies_total_gross": null, "nation": null, "no_payment_due": null, "noc_region": null, "observations": null, "officers": null, "offices": null, "order_history": null, "order_line": null, "order_status": null, "orderdetails": null, "orders": null, "organization": null, "paper": null, "paragraphs": null, "part": null, "partsupp": null, "patients": null, "payment": null, "payments": null, "people": null, "person": null, "person_region": null, "phone_brand_device_model2": null, "platform": null, "player_allstar": null, "players": null, "players_teams": null, "playstore": null, "podcasts": null, "politics": null, "population": null, "position": null, "price": null, "procedures": null, "product": null, "production": null, "production_company": null, "production_country": null, "productlines": null, "products": null, "prof": null, "province": null, "pub_info": null, "publisher": null, "publishers": null, "ranking_criteria": null, "ranking_system": null, "region": null, "region_sales": null, "registration": null, "relation": null, "religion": null, "rental": null, "revenue": null, "reviews": null, "river": null, "rootbeer": null, "rootbeerbrand": null, "rootbeerreview": null, "roysched": null, "runs": null, "sales": ["ord_date", "qty", "ord_num", "payterms", "stor_id", "title_id"], "sales_in_weather": null, "sample_submission": null, "sea": null, "series_post": null, "shipment": null, "shipping_method": null, "social-media": null, "south_superstore": null, "sport": null, "staff": null, "state": null, "state_sector_details": null, "state_sector_grads": null, "store": null, "stores": ["city", "state", "stor_id", "stor_name", "zip", "stor_address"], "student": null, "subjects": null, "supplier": null, "tags": null, "target": null, "taughtBy": null, "teams": null, "titleauthor": null, "titles": ["pubdate", "price", "ytd_sales", "advance", "title_id", "pub_id", "type", "title"], "torrents": null, "trains": null, "transaction": null, "truck": null, "twitter": null, "u2base": null, "unemployed": null, "university": null, "university_ranking_year": null, "university_year": null, "user": null, "user_reviews": null, "users": null, "violation": null, "violations": null, "voice-actors": null, "weather": null, "weight_info": null, "west_superstore": null, "works": null, "zip_congress": null, "zip_data": null} |
|
What is the title with the most ordered quantity in year 1992? | SELECT T2.title FROM sales AS T1 INNER JOIN titles AS T2 ON T1.title_id = T2.title_id WHERE STRFTIME('%Y', T1.ord_date) = '1992' ORDER BY T1.qty DESC LIMIT 1 | book_publishing_company | 168 | [
"sales",
"stores",
"roysched",
"titles",
"titleauthor",
"discounts"
] | [
[
" CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ",
" CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL NOT NULL, FOREIGN KEY(stor_id) REFERENCES stores (stor_id) ) ",
" CREATE TABLE employee ( emp_id TEXT, fname TEXT NOT NULL, minit TEXT, lname TEXT NOT NULL, job_id INTEGER NOT NULL, job_lvl INTEGER, pub_id TEXT NOT NULL, hire_date DATETIME NOT NULL, PRIMARY KEY (emp_id), FOREIGN KEY(job_id) REFERENCES jobs (job_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE jobs ( job_id INTEGER, job_desc TEXT NOT NULL, min_lvl INTEGER NOT NULL, max_lvl INTEGER NOT NULL, PRIMARY KEY (job_id) ) ",
" CREATE TABLE pub_info ( pub_id TEXT, logo BLOB, pr_info TEXT, PRIMARY KEY (pub_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE publishers ( pub_id TEXT, pub_name TEXT, city TEXT, state TEXT, country TEXT, PRIMARY KEY (pub_id) ) ",
" CREATE TABLE roysched ( title_id TEXT NOT NULL, lorange INTEGER, hirange INTEGER, royalty INTEGER, FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE sales ( stor_id TEXT NOT NULL, ord_num TEXT NOT NULL, ord_date DATETIME NOT NULL, qty INTEGER NOT NULL, payterms TEXT NOT NULL, title_id TEXT NOT NULL, PRIMARY KEY (stor_id, ord_num, title_id), FOREIGN KEY(stor_id) REFERENCES stores (stor_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE stores ( stor_id TEXT, stor_name TEXT, stor_address TEXT, city TEXT, state TEXT, zip TEXT, PRIMARY KEY (stor_id) ) ",
" CREATE TABLE titleauthor ( au_id TEXT NOT NULL, title_id TEXT NOT NULL, au_ord INTEGER, royaltyper INTEGER, PRIMARY KEY (au_id, title_id), FOREIGN KEY(au_id) REFERENCES authors (au_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE titles ( title_id TEXT, title TEXT NOT NULL, type TEXT NOT NULL, pub_id TEXT, price REAL, advance REAL, royalty INTEGER, ytd_sales INTEGER, notes TEXT, pubdate DATETIME NOT NULL, PRIMARY KEY (title_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) "
]
] | [
[
" CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ",
" CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL NOT NULL, FOREIGN KEY(stor_id) REFERENCES stores (stor_id) ) ",
" CREATE TABLE employee ( emp_id TEXT, fname TEXT NOT NULL, minit TEXT, lname TEXT NOT NULL, job_id INTEGER NOT NULL, job_lvl INTEGER, pub_id TEXT NOT NULL, hire_date DATETIME NOT NULL, PRIMARY KEY (emp_id), FOREIGN KEY(job_id) REFERENCES jobs (job_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE jobs ( job_id INTEGER, job_desc TEXT NOT NULL, min_lvl INTEGER NOT NULL, max_lvl INTEGER NOT NULL, PRIMARY KEY (job_id) ) ",
" CREATE TABLE pub_info ( pub_id TEXT, logo BLOB, pr_info TEXT, PRIMARY KEY (pub_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE publishers ( pub_id TEXT, pub_name TEXT, city TEXT, state TEXT, country TEXT, PRIMARY KEY (pub_id) ) ",
" CREATE TABLE roysched ( title_id TEXT NOT NULL, lorange INTEGER, hirange INTEGER, royalty INTEGER, FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE sales ( stor_id TEXT NOT NULL, ord_num TEXT NOT NULL, ord_date DATETIME NOT NULL, qty INTEGER NOT NULL, payterms TEXT NOT NULL, title_id TEXT NOT NULL, PRIMARY KEY (stor_id, ord_num, title_id), FOREIGN KEY(stor_id) REFERENCES stores (stor_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE stores ( stor_id TEXT, stor_name TEXT, stor_address TEXT, city TEXT, state TEXT, zip TEXT, PRIMARY KEY (stor_id) ) ",
" CREATE TABLE titleauthor ( au_id TEXT NOT NULL, title_id TEXT NOT NULL, au_ord INTEGER, royaltyper INTEGER, PRIMARY KEY (au_id, title_id), FOREIGN KEY(au_id) REFERENCES authors (au_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE titles ( title_id TEXT, title TEXT NOT NULL, type TEXT NOT NULL, pub_id TEXT, price REAL, advance REAL, royalty INTEGER, ytd_sales INTEGER, notes TEXT, pubdate DATETIME NOT NULL, PRIMARY KEY (title_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) "
]
] | 11 | 11 | {"ATT_CLASSES": null, "Address": null, "AddressType": null, "Air Carriers": null, "Airlines": null, "Airports": null, "Answer": null, "Attributes": null, "Author": null, "Award": null, "AwardsCoaches": null, "AwardsMisc": null, "AwardsPlayers": null, "Ball_by_Ball": null, "Batsman_Scored": null, "Batting_Style": null, "BillOfMaterials": null, "Bowling_Style": null, "Business": null, "BusinessEntity": null, "BusinessEntityAddress": null, "BusinessEntityContact": null, "Business_Attributes": null, "Business_Categories": null, "Business_Hours": null, "CBSA": null, "Categories": null, "Character_Award": null, "Checkins": null, "City": null, "Classification": null, "Coaches": null, "CombinedShutouts": null, "Community_Area": null, "Compliments": null, "Conference": null, "ContactType": null, "Country": null, "CountryLanguage": null, "CountryRegion": null, "CountryRegionCurrency": null, "Credit": null, "CreditCard": null, "Crime": null, "Culture": null, "Currency": null, "CurrencyRate": null, "Customer": null, "Customers": null, "Days": null, "Demog": null, "Department": null, "Dish": null, "District": null, "Document": null, "Elite": null, "EmailAddress": null, "Employee": null, "EmployeeDepartmentHistory": null, "EmployeePayHistory": null, "Employees": null, "Episode": null, "Extra_Runs": null, "Extra_Type": null, "FBI_Code": null, "Genes": null, "Goalies": null, "GoaliesSC": null, "GoaliesShootout": null, "HOF": null, "IMG_OBJ": null, "IMG_OBJ_ATT": null, "IMG_REL": null, "IUCR": null, "Ingredient": null, "Interactions": null, "JobCandidate": null, "Journal": null, "Keyword": null, "Location": null, "Mailings1_2": null, "Master": null, "Match": null, "Menu": null, "MenuItem": null, "MenuPage": null, "Neighborhood": null, "Nutrition": null, "OBJ_CLASSES": null, "OrderDetails": null, "Orders": null, "Out_Type": null, "Outcome": null, "PRED_CLASSES": null, "Paper": null, "PaperAuthor": null, "Password": null, "Person": null, "PersonCreditCard": null, "PhoneNumberType": null, "Player": null, "PlayerInfo": null, "Player_Match": null, "Product": null, "ProductCategory": null, "ProductCostHistory": null, "ProductDescription": null, "ProductDocument": null, "ProductInventory": null, "ProductListPriceHistory": null, "ProductModel": null, "ProductModelProductDescriptionCulture": null, "ProductPhoto": null, "ProductProductPhoto": null, "ProductReview": null, "ProductSubcategory": null, "ProductVendor": null, "Products": null, "PurchaseOrderDetail": null, "PurchaseOrderHeader": null, "Quantity": null, "Question": null, "RA": null, "Recipe": null, "Regions": null, "Reviews": null, "Rolee": null, "Sales": null, "Sales Orders": null, "Sales Team": null, "SalesOrderDetail": null, "SalesOrderHeader": null, "SalesOrderHeaderSalesReason": null, "SalesPerson": null, "SalesPersonQuotaHistory": null, "SalesReason": null, "SalesTaxRate": null, "SalesTerritory": null, "SalesTerritoryHistory": null, "Scoring": null, "ScoringSC": null, "ScoringShootout": null, "ScoringSup": null, "ScrapReason": null, "Season": null, "SeasonStatus": null, "SeriesPost": null, "Shift": null, "ShipMethod": null, "Shippers": null, "ShoppingCartItem": null, "SpecialOffer": null, "SpecialOfferProduct": null, "StateProvince": null, "Store": null, "Store Locations": null, "Suppliers": null, "Survey": null, "Team": null, "TeamSplits": null, "TeamVsTeam": null, "Teams": null, "TeamsHalf": null, "TeamsPost": null, "TeamsSC": null, "Tips": null, "Toss_Decision": null, "TransactionHistory": null, "TransactionHistoryArchive": null, "Umpire": null, "UnitMeasure": null, "Users": null, "Users_Compliments": null, "Vendor": null, "Venue": null, "Vote": null, "Ward": null, "Wicket_Taken": null, "Win_By": null, "WorkOrder": null, "WorkOrderRouting": null, "Years": null, "abbrev": null, "actor": null, "actors": null, "address": null, "address_status": null, "advisedBy": null, "alias": null, "all_prevalences": null, "allergies": null, "app_all": null, "app_events": null, "app_events_relevant": null, "app_labels": null, "area_code": null, "author": null, "authors": null, "avoid": null, "awards_coaches": null, "awards_players": null, "beers": null, "book": null, "book_author": null, "book_language": null, "bool": null, "borders": null, "breweries": null, "businesses": null, "callcenterlogs": null, "careplans": null, "cars": null, "categories": null, "category": null, "central_superstore": null, "chapters": null, "characters": null, "cites": null, "city": null, "claims": null, "client": null, "coaches": null, "coins": null, "competitor_event": null, "conditions": null, "congress": null, "content": null, "continent": null, "country": null, "course": null, "current": null, "current-terms": null, "cust_order": null, "customer": null, "customer_address": null, "customers": null, "data": null, "department": null, "desert": null, "director": null, "directors": null, "disabled": null, "discounts": ["discount", "discounttype", "stor_id", "highqty", "lowqty"], "district": null, "divisions": null, "draft": null, "driver": null, "east_superstore": null, "economy": null, "employee": null, "employees": null, "encompasses": null, "encounters": null, "enlist": null, "enrolled": null, "establishment": null, "ethnicGroup": null, "event": null, "events": null, "events_relevant": null, "filed_for_bankrupcy": null, "film": null, "film_actor": null, "film_category": null, "film_text": null, "game": null, "game_platform": null, "game_publisher": null, "games": null, "games_city": null, "games_competitor": null, "gender": null, "gender_age": null, "gender_age_test": null, "gender_age_train": null, "generalinfo": null, "genre": null, "geo_desert": null, "geo_estuary": null, "geo_island": null, "geo_lake": null, "geo_mountain": null, "geo_river": null, "geo_sea": null, "geo_source": null, "geographic": null, "geolocation": null, "height_info": null, "historical": null, "historical-terms": null, "immunizations": null, "incidents": null, "inspection": null, "inspection_point": null, "inspections": null, "institution_details": null, "institution_grads": null, "inventory": null, "isMember": null, "island": null, "islandIn": null, "jobs": null, "keyword": null, "label_categories": null, "lake": null, "language": null, "language_role": null, "lineitem": null, "located": null, "locatedOn": null, "location": null, "longest_absense_from_school": null, "mailings3": null, "male": null, "matchs": null, "medal": null, "medications": null, "mergesWith": null, "mountain": null, "mountainOnIsland": null, "movie": null, "movie_cast": null, "movie_company": null, "movie_crew": null, "movie_genres": null, "movie_keywords": null, "movie_languages": null, "movies": null, "movies2actors": null, "movies2directors": null, "movies_total_gross": null, "nation": null, "no_payment_due": null, "noc_region": null, "observations": null, "officers": null, "offices": null, "order_history": null, "order_line": null, "order_status": null, "orderdetails": null, "orders": null, "organization": null, "paper": null, "paragraphs": null, "part": null, "partsupp": null, "patients": null, "payment": null, "payments": null, "people": null, "person": null, "person_region": null, "phone_brand_device_model2": null, "platform": null, "player_allstar": null, "players": null, "players_teams": null, "playstore": null, "podcasts": null, "politics": null, "population": null, "position": null, "price": null, "procedures": null, "product": null, "production": null, "production_company": null, "production_country": null, "productlines": null, "products": null, "prof": null, "province": null, "pub_info": null, "publisher": null, "publishers": null, "ranking_criteria": null, "ranking_system": null, "region": null, "region_sales": null, "registration": null, "relation": null, "religion": null, "rental": null, "revenue": null, "reviews": null, "river": null, "rootbeer": null, "rootbeerbrand": null, "rootbeerreview": null, "roysched": ["title_id", "royalty", "lorange", "hirange"], "runs": null, "sales": ["title_id", "ord_date", "qty"], "sales_in_weather": null, "sample_submission": null, "sea": null, "series_post": null, "shipment": null, "shipping_method": null, "social-media": null, "south_superstore": null, "sport": null, "staff": null, "state": null, "state_sector_details": null, "state_sector_grads": null, "store": null, "stores": null, "student": null, "subjects": null, "supplier": null, "tags": null, "target": null, "taughtBy": null, "teams": null, "titleauthor": ["title_id", "au_id", "au_ord", "royaltyper"], "titles": ["price", "advance", "type", "title", "ytd_sales", "title_id", "royalty", "pub_id", "pubdate", "notes"], "torrents": null, "trains": null, "transaction": null, "truck": null, "twitter": null, "u2base": null, "unemployed": null, "university": null, "university_ranking_year": null, "university_year": null, "user": null, "user_reviews": null, "users": null, "violation": null, "violations": null, "voice-actors": null, "weather": null, "weight_info": null, "west_superstore": null, "works": null, "zip_congress": null, "zip_data": null} |
|
List the title, price and publication date for all sales with 'ON invoice' payment terms. | SELECT T2.title, T2.price, T2.pubdate FROM sales AS T1 INNER JOIN titles AS T2 ON T1.title_id = T2.title_id WHERE T1.payterms = 'ON invoice' | book_publishing_company | 169 | [
"employee",
"sales",
"stores",
"titles",
"publishers",
"titleauthor",
"discounts"
] | [
[
" CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ",
" CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL NOT NULL, FOREIGN KEY(stor_id) REFERENCES stores (stor_id) ) ",
" CREATE TABLE employee ( emp_id TEXT, fname TEXT NOT NULL, minit TEXT, lname TEXT NOT NULL, job_id INTEGER NOT NULL, job_lvl INTEGER, pub_id TEXT NOT NULL, hire_date DATETIME NOT NULL, PRIMARY KEY (emp_id), FOREIGN KEY(job_id) REFERENCES jobs (job_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE jobs ( job_id INTEGER, job_desc TEXT NOT NULL, min_lvl INTEGER NOT NULL, max_lvl INTEGER NOT NULL, PRIMARY KEY (job_id) ) ",
" CREATE TABLE pub_info ( pub_id TEXT, logo BLOB, pr_info TEXT, PRIMARY KEY (pub_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE publishers ( pub_id TEXT, pub_name TEXT, city TEXT, state TEXT, country TEXT, PRIMARY KEY (pub_id) ) ",
" CREATE TABLE roysched ( title_id TEXT NOT NULL, lorange INTEGER, hirange INTEGER, royalty INTEGER, FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE sales ( stor_id TEXT NOT NULL, ord_num TEXT NOT NULL, ord_date DATETIME NOT NULL, qty INTEGER NOT NULL, payterms TEXT NOT NULL, title_id TEXT NOT NULL, PRIMARY KEY (stor_id, ord_num, title_id), FOREIGN KEY(stor_id) REFERENCES stores (stor_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE stores ( stor_id TEXT, stor_name TEXT, stor_address TEXT, city TEXT, state TEXT, zip TEXT, PRIMARY KEY (stor_id) ) ",
" CREATE TABLE titleauthor ( au_id TEXT NOT NULL, title_id TEXT NOT NULL, au_ord INTEGER, royaltyper INTEGER, PRIMARY KEY (au_id, title_id), FOREIGN KEY(au_id) REFERENCES authors (au_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE titles ( title_id TEXT, title TEXT NOT NULL, type TEXT NOT NULL, pub_id TEXT, price REAL, advance REAL, royalty INTEGER, ytd_sales INTEGER, notes TEXT, pubdate DATETIME NOT NULL, PRIMARY KEY (title_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) "
]
] | [
[
" CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ",
" CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL NOT NULL, FOREIGN KEY(stor_id) REFERENCES stores (stor_id) ) ",
" CREATE TABLE employee ( emp_id TEXT, fname TEXT NOT NULL, minit TEXT, lname TEXT NOT NULL, job_id INTEGER NOT NULL, job_lvl INTEGER, pub_id TEXT NOT NULL, hire_date DATETIME NOT NULL, PRIMARY KEY (emp_id), FOREIGN KEY(job_id) REFERENCES jobs (job_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE jobs ( job_id INTEGER, job_desc TEXT NOT NULL, min_lvl INTEGER NOT NULL, max_lvl INTEGER NOT NULL, PRIMARY KEY (job_id) ) ",
" CREATE TABLE pub_info ( pub_id TEXT, logo BLOB, pr_info TEXT, PRIMARY KEY (pub_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE publishers ( pub_id TEXT, pub_name TEXT, city TEXT, state TEXT, country TEXT, PRIMARY KEY (pub_id) ) ",
" CREATE TABLE roysched ( title_id TEXT NOT NULL, lorange INTEGER, hirange INTEGER, royalty INTEGER, FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE sales ( stor_id TEXT NOT NULL, ord_num TEXT NOT NULL, ord_date DATETIME NOT NULL, qty INTEGER NOT NULL, payterms TEXT NOT NULL, title_id TEXT NOT NULL, PRIMARY KEY (stor_id, ord_num, title_id), FOREIGN KEY(stor_id) REFERENCES stores (stor_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE stores ( stor_id TEXT, stor_name TEXT, stor_address TEXT, city TEXT, state TEXT, zip TEXT, PRIMARY KEY (stor_id) ) ",
" CREATE TABLE titleauthor ( au_id TEXT NOT NULL, title_id TEXT NOT NULL, au_ord INTEGER, royaltyper INTEGER, PRIMARY KEY (au_id, title_id), FOREIGN KEY(au_id) REFERENCES authors (au_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE titles ( title_id TEXT, title TEXT NOT NULL, type TEXT NOT NULL, pub_id TEXT, price REAL, advance REAL, royalty INTEGER, ytd_sales INTEGER, notes TEXT, pubdate DATETIME NOT NULL, PRIMARY KEY (title_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) "
]
] | 11 | 11 | {"ATT_CLASSES": null, "Address": null, "AddressType": null, "Air Carriers": null, "Airlines": null, "Airports": null, "Answer": null, "Attributes": null, "Author": null, "Award": null, "AwardsCoaches": null, "AwardsMisc": null, "AwardsPlayers": null, "Ball_by_Ball": null, "Batsman_Scored": null, "Batting_Style": null, "BillOfMaterials": null, "Bowling_Style": null, "Business": null, "BusinessEntity": null, "BusinessEntityAddress": null, "BusinessEntityContact": null, "Business_Attributes": null, "Business_Categories": null, "Business_Hours": null, "CBSA": null, "Categories": null, "Character_Award": null, "Checkins": null, "City": null, "Classification": null, "Coaches": null, "CombinedShutouts": null, "Community_Area": null, "Compliments": null, "Conference": null, "ContactType": null, "Country": null, "CountryLanguage": null, "CountryRegion": null, "CountryRegionCurrency": null, "Credit": null, "CreditCard": null, "Crime": null, "Culture": null, "Currency": null, "CurrencyRate": null, "Customer": null, "Customers": null, "Days": null, "Demog": null, "Department": null, "Dish": null, "District": null, "Document": null, "Elite": null, "EmailAddress": null, "Employee": null, "EmployeeDepartmentHistory": null, "EmployeePayHistory": null, "Employees": null, "Episode": null, "Extra_Runs": null, "Extra_Type": null, "FBI_Code": null, "Genes": null, "Goalies": null, "GoaliesSC": null, "GoaliesShootout": null, "HOF": null, "IMG_OBJ": null, "IMG_OBJ_ATT": null, "IMG_REL": null, "IUCR": null, "Ingredient": null, "Interactions": null, "JobCandidate": null, "Journal": null, "Keyword": null, "Location": null, "Mailings1_2": null, "Master": null, "Match": null, "Menu": null, "MenuItem": null, "MenuPage": null, "Neighborhood": null, "Nutrition": null, "OBJ_CLASSES": null, "OrderDetails": null, "Orders": null, "Out_Type": null, "Outcome": null, "PRED_CLASSES": null, "Paper": null, "PaperAuthor": null, "Password": null, "Person": null, "PersonCreditCard": null, "PhoneNumberType": null, "Player": null, "PlayerInfo": null, "Player_Match": null, "Product": null, "ProductCategory": null, "ProductCostHistory": null, "ProductDescription": null, "ProductDocument": null, "ProductInventory": null, "ProductListPriceHistory": null, "ProductModel": null, "ProductModelProductDescriptionCulture": null, "ProductPhoto": null, "ProductProductPhoto": null, "ProductReview": null, "ProductSubcategory": null, "ProductVendor": null, "Products": null, "PurchaseOrderDetail": null, "PurchaseOrderHeader": null, "Quantity": null, "Question": null, "RA": null, "Recipe": null, "Regions": null, "Reviews": null, "Rolee": null, "Sales": null, "Sales Orders": null, "Sales Team": null, "SalesOrderDetail": null, "SalesOrderHeader": null, "SalesOrderHeaderSalesReason": null, "SalesPerson": null, "SalesPersonQuotaHistory": null, "SalesReason": null, "SalesTaxRate": null, "SalesTerritory": null, "SalesTerritoryHistory": null, "Scoring": null, "ScoringSC": null, "ScoringShootout": null, "ScoringSup": null, "ScrapReason": null, "Season": null, "SeasonStatus": null, "SeriesPost": null, "Shift": null, "ShipMethod": null, "Shippers": null, "ShoppingCartItem": null, "SpecialOffer": null, "SpecialOfferProduct": null, "StateProvince": null, "Store": null, "Store Locations": null, "Suppliers": null, "Survey": null, "Team": null, "TeamSplits": null, "TeamVsTeam": null, "Teams": null, "TeamsHalf": null, "TeamsPost": null, "TeamsSC": null, "Tips": null, "Toss_Decision": null, "TransactionHistory": null, "TransactionHistoryArchive": null, "Umpire": null, "UnitMeasure": null, "Users": null, "Users_Compliments": null, "Vendor": null, "Venue": null, "Vote": null, "Ward": null, "Wicket_Taken": null, "Win_By": null, "WorkOrder": null, "WorkOrderRouting": null, "Years": null, "abbrev": null, "actor": null, "actors": null, "address": null, "address_status": null, "advisedBy": null, "alias": null, "all_prevalences": null, "allergies": null, "app_all": null, "app_events": null, "app_events_relevant": null, "app_labels": null, "area_code": null, "author": null, "authors": null, "avoid": null, "awards_coaches": null, "awards_players": null, "beers": null, "book": null, "book_author": null, "book_language": null, "bool": null, "borders": null, "breweries": null, "businesses": null, "callcenterlogs": null, "careplans": null, "cars": null, "categories": null, "category": null, "central_superstore": null, "chapters": null, "characters": null, "cites": null, "city": null, "claims": null, "client": null, "coaches": null, "coins": null, "competitor_event": null, "conditions": null, "congress": null, "content": null, "continent": null, "country": null, "course": null, "current": null, "current-terms": null, "cust_order": null, "customer": null, "customer_address": null, "customers": null, "data": null, "department": null, "desert": null, "director": null, "directors": null, "disabled": null, "discounts": ["discount", "discounttype", "highqty", "stor_id", "lowqty"], "district": null, "divisions": null, "draft": null, "driver": null, "east_superstore": null, "economy": null, "employee": ["hire_date"], "employees": null, "encompasses": null, "encounters": null, "enlist": null, "enrolled": null, "establishment": null, "ethnicGroup": null, "event": null, "events": null, "events_relevant": null, "filed_for_bankrupcy": null, "film": null, "film_actor": null, "film_category": null, "film_text": null, "game": null, "game_platform": null, "game_publisher": null, "games": null, "games_city": null, "games_competitor": null, "gender": null, "gender_age": null, "gender_age_test": null, "gender_age_train": null, "generalinfo": null, "genre": null, "geo_desert": null, "geo_estuary": null, "geo_island": null, "geo_lake": null, "geo_mountain": null, "geo_river": null, "geo_sea": null, "geo_source": null, "geographic": null, "geolocation": null, "height_info": null, "historical": null, "historical-terms": null, "immunizations": null, "incidents": null, "inspection": null, "inspection_point": null, "inspections": null, "institution_details": null, "institution_grads": null, "inventory": null, "isMember": null, "island": null, "islandIn": null, "jobs": null, "keyword": null, "label_categories": null, "lake": null, "language": null, "language_role": null, "lineitem": null, "located": null, "locatedOn": null, "location": null, "longest_absense_from_school": null, "mailings3": null, "male": null, "matchs": null, "medal": null, "medications": null, "mergesWith": null, "mountain": null, "mountainOnIsland": null, "movie": null, "movie_cast": null, "movie_company": null, "movie_crew": null, "movie_genres": null, "movie_keywords": null, "movie_languages": null, "movies": null, "movies2actors": null, "movies2directors": null, "movies_total_gross": null, "nation": null, "no_payment_due": null, "noc_region": null, "observations": null, "officers": null, "offices": null, "order_history": null, "order_line": null, "order_status": null, "orderdetails": null, "orders": null, "organization": null, "paper": null, "paragraphs": null, "part": null, "partsupp": null, "patients": null, "payment": null, "payments": null, "people": null, "person": null, "person_region": null, "phone_brand_device_model2": null, "platform": null, "player_allstar": null, "players": null, "players_teams": null, "playstore": null, "podcasts": null, "politics": null, "population": null, "position": null, "price": null, "procedures": null, "product": null, "production": null, "production_company": null, "production_country": null, "productlines": null, "products": null, "prof": null, "province": null, "pub_info": null, "publisher": null, "publishers": null, "ranking_criteria": null, "ranking_system": null, "region": null, "region_sales": null, "registration": null, "relation": null, "religion": null, "rental": null, "revenue": null, "reviews": null, "river": null, "rootbeer": null, "rootbeerbrand": null, "rootbeerreview": null, "roysched": null, "runs": null, "sales": ["ord_date", "title_id", "payterms", "qty", "stor_id", "ord_num"], "sales_in_weather": null, "sample_submission": null, "sea": null, "series_post": null, "shipment": null, "shipping_method": null, "social-media": null, "south_superstore": null, "sport": null, "staff": null, "state": null, "state_sector_details": null, "state_sector_grads": null, "store": null, "stores": null, "student": null, "subjects": null, "supplier": null, "tags": null, "target": null, "taughtBy": null, "teams": null, "titleauthor": ["title_id", "royaltyper", "au_ord", "au_id"], "titles": ["price", "ytd_sales", "pubdate", "title_id", "type", "title", "advance", "notes", "royalty", "pub_id"], "torrents": null, "trains": null, "transaction": null, "truck": null, "twitter": null, "u2base": null, "unemployed": null, "university": null, "university_ranking_year": null, "university_year": null, "user": null, "user_reviews": null, "users": null, "violation": null, "violations": null, "voice-actors": null, "weather": null, "weight_info": null, "west_superstore": null, "works": null, "zip_congress": null, "zip_data": null} |
|
What is the title that have at least 10% royalty without minimum range amount. | SELECT T1.title FROM titles AS T1 INNER JOIN roysched AS T2 ON T1.title_id = T2.title_id WHERE T2.lorange = 0 AND T2.royalty >= 10 | book_publishing_company | 170 | [
"sales",
"stores",
"roysched",
"titles",
"publishers",
"titleauthor",
"discounts"
] | [
[
" CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ",
" CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL NOT NULL, FOREIGN KEY(stor_id) REFERENCES stores (stor_id) ) ",
" CREATE TABLE employee ( emp_id TEXT, fname TEXT NOT NULL, minit TEXT, lname TEXT NOT NULL, job_id INTEGER NOT NULL, job_lvl INTEGER, pub_id TEXT NOT NULL, hire_date DATETIME NOT NULL, PRIMARY KEY (emp_id), FOREIGN KEY(job_id) REFERENCES jobs (job_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE jobs ( job_id INTEGER, job_desc TEXT NOT NULL, min_lvl INTEGER NOT NULL, max_lvl INTEGER NOT NULL, PRIMARY KEY (job_id) ) ",
" CREATE TABLE pub_info ( pub_id TEXT, logo BLOB, pr_info TEXT, PRIMARY KEY (pub_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE publishers ( pub_id TEXT, pub_name TEXT, city TEXT, state TEXT, country TEXT, PRIMARY KEY (pub_id) ) ",
" CREATE TABLE roysched ( title_id TEXT NOT NULL, lorange INTEGER, hirange INTEGER, royalty INTEGER, FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE sales ( stor_id TEXT NOT NULL, ord_num TEXT NOT NULL, ord_date DATETIME NOT NULL, qty INTEGER NOT NULL, payterms TEXT NOT NULL, title_id TEXT NOT NULL, PRIMARY KEY (stor_id, ord_num, title_id), FOREIGN KEY(stor_id) REFERENCES stores (stor_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE stores ( stor_id TEXT, stor_name TEXT, stor_address TEXT, city TEXT, state TEXT, zip TEXT, PRIMARY KEY (stor_id) ) ",
" CREATE TABLE titleauthor ( au_id TEXT NOT NULL, title_id TEXT NOT NULL, au_ord INTEGER, royaltyper INTEGER, PRIMARY KEY (au_id, title_id), FOREIGN KEY(au_id) REFERENCES authors (au_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE titles ( title_id TEXT, title TEXT NOT NULL, type TEXT NOT NULL, pub_id TEXT, price REAL, advance REAL, royalty INTEGER, ytd_sales INTEGER, notes TEXT, pubdate DATETIME NOT NULL, PRIMARY KEY (title_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) "
]
] | [
[
" CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ",
" CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL NOT NULL, FOREIGN KEY(stor_id) REFERENCES stores (stor_id) ) ",
" CREATE TABLE employee ( emp_id TEXT, fname TEXT NOT NULL, minit TEXT, lname TEXT NOT NULL, job_id INTEGER NOT NULL, job_lvl INTEGER, pub_id TEXT NOT NULL, hire_date DATETIME NOT NULL, PRIMARY KEY (emp_id), FOREIGN KEY(job_id) REFERENCES jobs (job_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE jobs ( job_id INTEGER, job_desc TEXT NOT NULL, min_lvl INTEGER NOT NULL, max_lvl INTEGER NOT NULL, PRIMARY KEY (job_id) ) ",
" CREATE TABLE pub_info ( pub_id TEXT, logo BLOB, pr_info TEXT, PRIMARY KEY (pub_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE publishers ( pub_id TEXT, pub_name TEXT, city TEXT, state TEXT, country TEXT, PRIMARY KEY (pub_id) ) ",
" CREATE TABLE roysched ( title_id TEXT NOT NULL, lorange INTEGER, hirange INTEGER, royalty INTEGER, FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE sales ( stor_id TEXT NOT NULL, ord_num TEXT NOT NULL, ord_date DATETIME NOT NULL, qty INTEGER NOT NULL, payterms TEXT NOT NULL, title_id TEXT NOT NULL, PRIMARY KEY (stor_id, ord_num, title_id), FOREIGN KEY(stor_id) REFERENCES stores (stor_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE stores ( stor_id TEXT, stor_name TEXT, stor_address TEXT, city TEXT, state TEXT, zip TEXT, PRIMARY KEY (stor_id) ) ",
" CREATE TABLE titleauthor ( au_id TEXT NOT NULL, title_id TEXT NOT NULL, au_ord INTEGER, royaltyper INTEGER, PRIMARY KEY (au_id, title_id), FOREIGN KEY(au_id) REFERENCES authors (au_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE titles ( title_id TEXT, title TEXT NOT NULL, type TEXT NOT NULL, pub_id TEXT, price REAL, advance REAL, royalty INTEGER, ytd_sales INTEGER, notes TEXT, pubdate DATETIME NOT NULL, PRIMARY KEY (title_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) "
]
] | 11 | 11 | {"ATT_CLASSES": null, "Address": null, "AddressType": null, "Air Carriers": null, "Airlines": null, "Airports": null, "Answer": null, "Attributes": null, "Author": null, "Award": null, "AwardsCoaches": null, "AwardsMisc": null, "AwardsPlayers": null, "Ball_by_Ball": null, "Batsman_Scored": null, "Batting_Style": null, "BillOfMaterials": null, "Bowling_Style": null, "Business": null, "BusinessEntity": null, "BusinessEntityAddress": null, "BusinessEntityContact": null, "Business_Attributes": null, "Business_Categories": null, "Business_Hours": null, "CBSA": null, "Categories": null, "Character_Award": null, "Checkins": null, "City": null, "Classification": null, "Coaches": null, "CombinedShutouts": null, "Community_Area": null, "Compliments": null, "Conference": null, "ContactType": null, "Country": null, "CountryLanguage": null, "CountryRegion": null, "CountryRegionCurrency": null, "Credit": null, "CreditCard": null, "Crime": null, "Culture": null, "Currency": null, "CurrencyRate": null, "Customer": null, "Customers": null, "Days": null, "Demog": null, "Department": null, "Dish": null, "District": null, "Document": null, "Elite": null, "EmailAddress": null, "Employee": null, "EmployeeDepartmentHistory": null, "EmployeePayHistory": null, "Employees": null, "Episode": null, "Extra_Runs": null, "Extra_Type": null, "FBI_Code": null, "Genes": null, "Goalies": null, "GoaliesSC": null, "GoaliesShootout": null, "HOF": null, "IMG_OBJ": null, "IMG_OBJ_ATT": null, "IMG_REL": null, "IUCR": null, "Ingredient": null, "Interactions": null, "JobCandidate": null, "Journal": null, "Keyword": null, "Location": null, "Mailings1_2": null, "Master": null, "Match": null, "Menu": null, "MenuItem": null, "MenuPage": null, "Neighborhood": null, "Nutrition": null, "OBJ_CLASSES": null, "OrderDetails": null, "Orders": null, "Out_Type": null, "Outcome": null, "PRED_CLASSES": null, "Paper": null, "PaperAuthor": null, "Password": null, "Person": null, "PersonCreditCard": null, "PhoneNumberType": null, "Player": null, "PlayerInfo": null, "Player_Match": null, "Product": null, "ProductCategory": null, "ProductCostHistory": null, "ProductDescription": null, "ProductDocument": null, "ProductInventory": null, "ProductListPriceHistory": null, "ProductModel": null, "ProductModelProductDescriptionCulture": null, "ProductPhoto": null, "ProductProductPhoto": null, "ProductReview": null, "ProductSubcategory": null, "ProductVendor": null, "Products": null, "PurchaseOrderDetail": null, "PurchaseOrderHeader": null, "Quantity": null, "Question": null, "RA": null, "Recipe": null, "Regions": null, "Reviews": null, "Rolee": null, "Sales": null, "Sales Orders": null, "Sales Team": null, "SalesOrderDetail": null, "SalesOrderHeader": null, "SalesOrderHeaderSalesReason": null, "SalesPerson": null, "SalesPersonQuotaHistory": null, "SalesReason": null, "SalesTaxRate": null, "SalesTerritory": null, "SalesTerritoryHistory": null, "Scoring": null, "ScoringSC": null, "ScoringShootout": null, "ScoringSup": null, "ScrapReason": null, "Season": null, "SeasonStatus": null, "SeriesPost": null, "Shift": null, "ShipMethod": null, "Shippers": null, "ShoppingCartItem": null, "SpecialOffer": null, "SpecialOfferProduct": null, "StateProvince": null, "Store": null, "Store Locations": null, "Suppliers": null, "Survey": null, "Team": null, "TeamSplits": null, "TeamVsTeam": null, "Teams": null, "TeamsHalf": null, "TeamsPost": null, "TeamsSC": null, "Tips": null, "Toss_Decision": null, "TransactionHistory": null, "TransactionHistoryArchive": null, "Umpire": null, "UnitMeasure": null, "Users": null, "Users_Compliments": null, "Vendor": null, "Venue": null, "Vote": null, "Ward": null, "Wicket_Taken": null, "Win_By": null, "WorkOrder": null, "WorkOrderRouting": null, "Years": null, "abbrev": null, "actor": null, "actors": null, "address": null, "address_status": null, "advisedBy": null, "alias": null, "all_prevalences": null, "allergies": null, "app_all": null, "app_events": null, "app_events_relevant": null, "app_labels": null, "area_code": null, "author": null, "authors": null, "avoid": null, "awards_coaches": null, "awards_players": null, "beers": null, "book": null, "book_author": null, "book_language": null, "bool": null, "borders": null, "breweries": null, "businesses": null, "callcenterlogs": null, "careplans": null, "cars": null, "categories": null, "category": null, "central_superstore": null, "chapters": null, "characters": null, "cites": null, "city": null, "claims": null, "client": null, "coaches": null, "coins": null, "competitor_event": null, "conditions": null, "congress": null, "content": null, "continent": null, "country": null, "course": null, "current": null, "current-terms": null, "cust_order": null, "customer": null, "customer_address": null, "customers": null, "data": null, "department": null, "desert": null, "director": null, "directors": null, "disabled": null, "discounts": ["lowqty", "discount", "discounttype", "stor_id"], "district": null, "divisions": null, "draft": null, "driver": null, "east_superstore": null, "economy": null, "employee": null, "employees": null, "encompasses": null, "encounters": null, "enlist": null, "enrolled": null, "establishment": null, "ethnicGroup": null, "event": null, "events": null, "events_relevant": null, "filed_for_bankrupcy": null, "film": null, "film_actor": null, "film_category": null, "film_text": null, "game": null, "game_platform": null, "game_publisher": null, "games": null, "games_city": null, "games_competitor": null, "gender": null, "gender_age": null, "gender_age_test": null, "gender_age_train": null, "generalinfo": null, "genre": null, "geo_desert": null, "geo_estuary": null, "geo_island": null, "geo_lake": null, "geo_mountain": null, "geo_river": null, "geo_sea": null, "geo_source": null, "geographic": null, "geolocation": null, "height_info": null, "historical": null, "historical-terms": null, "immunizations": null, "incidents": null, "inspection": null, "inspection_point": null, "inspections": null, "institution_details": null, "institution_grads": null, "inventory": null, "isMember": null, "island": null, "islandIn": null, "jobs": null, "keyword": null, "label_categories": null, "lake": null, "language": null, "language_role": null, "lineitem": null, "located": null, "locatedOn": null, "location": null, "longest_absense_from_school": null, "mailings3": null, "male": null, "matchs": null, "medal": null, "medications": null, "mergesWith": null, "mountain": null, "mountainOnIsland": null, "movie": null, "movie_cast": null, "movie_company": null, "movie_crew": null, "movie_genres": null, "movie_keywords": null, "movie_languages": null, "movies": null, "movies2actors": null, "movies2directors": null, "movies_total_gross": null, "nation": null, "no_payment_due": null, "noc_region": null, "observations": null, "officers": null, "offices": null, "order_history": null, "order_line": null, "order_status": null, "orderdetails": null, "orders": null, "organization": null, "paper": null, "paragraphs": null, "part": null, "partsupp": null, "patients": null, "payment": null, "payments": null, "people": null, "person": null, "person_region": null, "phone_brand_device_model2": null, "platform": null, "player_allstar": null, "players": null, "players_teams": null, "playstore": null, "podcasts": null, "politics": null, "population": null, "position": null, "price": null, "procedures": null, "product": null, "production": null, "production_company": null, "production_country": null, "productlines": null, "products": null, "prof": null, "province": null, "pub_info": null, "publisher": null, "publishers": null, "ranking_criteria": null, "ranking_system": null, "region": null, "region_sales": null, "registration": null, "relation": null, "religion": null, "rental": null, "revenue": null, "reviews": null, "river": null, "rootbeer": null, "rootbeerbrand": null, "rootbeerreview": null, "roysched": ["royalty", "title_id", "lorange", "hirange"], "runs": null, "sales": ["title_id", "payterms", "ord_num", "qty", "stor_id", "ord_date"], "sales_in_weather": null, "sample_submission": null, "sea": null, "series_post": null, "shipment": null, "shipping_method": null, "social-media": null, "south_superstore": null, "sport": null, "staff": null, "state": null, "state_sector_details": null, "state_sector_grads": null, "store": null, "stores": null, "student": null, "subjects": null, "supplier": null, "tags": null, "target": null, "taughtBy": null, "teams": null, "titleauthor": ["royaltyper", "title_id", "au_id", "au_ord"], "titles": ["royalty", "title", "title_id", "price", "type", "advance", "ytd_sales", "pub_id", "pubdate", "notes"], "torrents": null, "trains": null, "transaction": null, "truck": null, "twitter": null, "u2base": null, "unemployed": null, "university": null, "university_ranking_year": null, "university_year": null, "user": null, "user_reviews": null, "users": null, "violation": null, "violations": null, "voice-actors": null, "weather": null, "weight_info": null, "west_superstore": null, "works": null, "zip_congress": null, "zip_data": null} |
|
State the title and royalty percentage for title ID BU2075 between 10000 to 50000 range. | SELECT T1.title, T2.royalty FROM titles AS T1 INNER JOIN roysched AS T2 ON T1.title_id = T2.title_id WHERE T2.lorange > 10000 AND T2.hirange < 50000 AND T1.title_ID = 'BU2075' | book_publishing_company | 171 | [
"employee",
"sales",
"roysched",
"titles",
"publishers",
"titleauthor"
] | [
[
" CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ",
" CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL NOT NULL, FOREIGN KEY(stor_id) REFERENCES stores (stor_id) ) ",
" CREATE TABLE employee ( emp_id TEXT, fname TEXT NOT NULL, minit TEXT, lname TEXT NOT NULL, job_id INTEGER NOT NULL, job_lvl INTEGER, pub_id TEXT NOT NULL, hire_date DATETIME NOT NULL, PRIMARY KEY (emp_id), FOREIGN KEY(job_id) REFERENCES jobs (job_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE jobs ( job_id INTEGER, job_desc TEXT NOT NULL, min_lvl INTEGER NOT NULL, max_lvl INTEGER NOT NULL, PRIMARY KEY (job_id) ) ",
" CREATE TABLE pub_info ( pub_id TEXT, logo BLOB, pr_info TEXT, PRIMARY KEY (pub_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE publishers ( pub_id TEXT, pub_name TEXT, city TEXT, state TEXT, country TEXT, PRIMARY KEY (pub_id) ) ",
" CREATE TABLE roysched ( title_id TEXT NOT NULL, lorange INTEGER, hirange INTEGER, royalty INTEGER, FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE sales ( stor_id TEXT NOT NULL, ord_num TEXT NOT NULL, ord_date DATETIME NOT NULL, qty INTEGER NOT NULL, payterms TEXT NOT NULL, title_id TEXT NOT NULL, PRIMARY KEY (stor_id, ord_num, title_id), FOREIGN KEY(stor_id) REFERENCES stores (stor_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE stores ( stor_id TEXT, stor_name TEXT, stor_address TEXT, city TEXT, state TEXT, zip TEXT, PRIMARY KEY (stor_id) ) ",
" CREATE TABLE titleauthor ( au_id TEXT NOT NULL, title_id TEXT NOT NULL, au_ord INTEGER, royaltyper INTEGER, PRIMARY KEY (au_id, title_id), FOREIGN KEY(au_id) REFERENCES authors (au_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE titles ( title_id TEXT, title TEXT NOT NULL, type TEXT NOT NULL, pub_id TEXT, price REAL, advance REAL, royalty INTEGER, ytd_sales INTEGER, notes TEXT, pubdate DATETIME NOT NULL, PRIMARY KEY (title_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) "
]
] | [
[
" CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ",
" CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL NOT NULL, FOREIGN KEY(stor_id) REFERENCES stores (stor_id) ) ",
" CREATE TABLE employee ( emp_id TEXT, fname TEXT NOT NULL, minit TEXT, lname TEXT NOT NULL, job_id INTEGER NOT NULL, job_lvl INTEGER, pub_id TEXT NOT NULL, hire_date DATETIME NOT NULL, PRIMARY KEY (emp_id), FOREIGN KEY(job_id) REFERENCES jobs (job_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE jobs ( job_id INTEGER, job_desc TEXT NOT NULL, min_lvl INTEGER NOT NULL, max_lvl INTEGER NOT NULL, PRIMARY KEY (job_id) ) ",
" CREATE TABLE pub_info ( pub_id TEXT, logo BLOB, pr_info TEXT, PRIMARY KEY (pub_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE publishers ( pub_id TEXT, pub_name TEXT, city TEXT, state TEXT, country TEXT, PRIMARY KEY (pub_id) ) ",
" CREATE TABLE roysched ( title_id TEXT NOT NULL, lorange INTEGER, hirange INTEGER, royalty INTEGER, FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE sales ( stor_id TEXT NOT NULL, ord_num TEXT NOT NULL, ord_date DATETIME NOT NULL, qty INTEGER NOT NULL, payterms TEXT NOT NULL, title_id TEXT NOT NULL, PRIMARY KEY (stor_id, ord_num, title_id), FOREIGN KEY(stor_id) REFERENCES stores (stor_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE stores ( stor_id TEXT, stor_name TEXT, stor_address TEXT, city TEXT, state TEXT, zip TEXT, PRIMARY KEY (stor_id) ) ",
" CREATE TABLE titleauthor ( au_id TEXT NOT NULL, title_id TEXT NOT NULL, au_ord INTEGER, royaltyper INTEGER, PRIMARY KEY (au_id, title_id), FOREIGN KEY(au_id) REFERENCES authors (au_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE titles ( title_id TEXT, title TEXT NOT NULL, type TEXT NOT NULL, pub_id TEXT, price REAL, advance REAL, royalty INTEGER, ytd_sales INTEGER, notes TEXT, pubdate DATETIME NOT NULL, PRIMARY KEY (title_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) "
]
] | 11 | 11 | {"ATT_CLASSES": null, "Address": null, "AddressType": null, "Air Carriers": null, "Airlines": null, "Airports": null, "Answer": null, "Attributes": null, "Author": null, "Award": null, "AwardsCoaches": null, "AwardsMisc": null, "AwardsPlayers": null, "Ball_by_Ball": null, "Batsman_Scored": null, "Batting_Style": null, "BillOfMaterials": null, "Bowling_Style": null, "Business": null, "BusinessEntity": null, "BusinessEntityAddress": null, "BusinessEntityContact": null, "Business_Attributes": null, "Business_Categories": null, "Business_Hours": null, "CBSA": null, "Categories": null, "Character_Award": null, "Checkins": null, "City": null, "Classification": null, "Coaches": null, "CombinedShutouts": null, "Community_Area": null, "Compliments": null, "Conference": null, "ContactType": null, "Country": null, "CountryLanguage": null, "CountryRegion": null, "CountryRegionCurrency": null, "Credit": null, "CreditCard": null, "Crime": null, "Culture": null, "Currency": null, "CurrencyRate": null, "Customer": null, "Customers": null, "Days": null, "Demog": null, "Department": null, "Dish": null, "District": null, "Document": null, "Elite": null, "EmailAddress": null, "Employee": null, "EmployeeDepartmentHistory": null, "EmployeePayHistory": null, "Employees": null, "Episode": null, "Extra_Runs": null, "Extra_Type": null, "FBI_Code": null, "Genes": null, "Goalies": null, "GoaliesSC": null, "GoaliesShootout": null, "HOF": null, "IMG_OBJ": null, "IMG_OBJ_ATT": null, "IMG_REL": null, "IUCR": null, "Ingredient": null, "Interactions": null, "JobCandidate": null, "Journal": null, "Keyword": null, "Location": null, "Mailings1_2": null, "Master": null, "Match": null, "Menu": null, "MenuItem": null, "MenuPage": null, "Neighborhood": null, "Nutrition": null, "OBJ_CLASSES": null, "OrderDetails": null, "Orders": null, "Out_Type": null, "Outcome": null, "PRED_CLASSES": null, "Paper": null, "PaperAuthor": null, "Password": null, "Person": null, "PersonCreditCard": null, "PhoneNumberType": null, "Player": null, "PlayerInfo": null, "Player_Match": null, "Product": null, "ProductCategory": null, "ProductCostHistory": null, "ProductDescription": null, "ProductDocument": null, "ProductInventory": null, "ProductListPriceHistory": null, "ProductModel": null, "ProductModelProductDescriptionCulture": null, "ProductPhoto": null, "ProductProductPhoto": null, "ProductReview": null, "ProductSubcategory": null, "ProductVendor": null, "Products": null, "PurchaseOrderDetail": null, "PurchaseOrderHeader": null, "Quantity": null, "Question": null, "RA": null, "Recipe": null, "Regions": null, "Reviews": null, "Rolee": null, "Sales": null, "Sales Orders": null, "Sales Team": null, "SalesOrderDetail": null, "SalesOrderHeader": null, "SalesOrderHeaderSalesReason": null, "SalesPerson": null, "SalesPersonQuotaHistory": null, "SalesReason": null, "SalesTaxRate": null, "SalesTerritory": null, "SalesTerritoryHistory": null, "Scoring": null, "ScoringSC": null, "ScoringShootout": null, "ScoringSup": null, "ScrapReason": null, "Season": null, "SeasonStatus": null, "SeriesPost": null, "Shift": null, "ShipMethod": null, "Shippers": null, "ShoppingCartItem": null, "SpecialOffer": null, "SpecialOfferProduct": null, "StateProvince": null, "Store": null, "Store Locations": null, "Suppliers": null, "Survey": null, "Team": null, "TeamSplits": null, "TeamVsTeam": null, "Teams": null, "TeamsHalf": null, "TeamsPost": null, "TeamsSC": null, "Tips": null, "Toss_Decision": null, "TransactionHistory": null, "TransactionHistoryArchive": null, "Umpire": null, "UnitMeasure": null, "Users": null, "Users_Compliments": null, "Vendor": null, "Venue": null, "Vote": null, "Ward": null, "Wicket_Taken": null, "Win_By": null, "WorkOrder": null, "WorkOrderRouting": null, "Years": null, "abbrev": null, "actor": null, "actors": null, "address": null, "address_status": null, "advisedBy": null, "alias": null, "all_prevalences": null, "allergies": null, "app_all": null, "app_events": null, "app_events_relevant": null, "app_labels": null, "area_code": null, "author": null, "authors": null, "avoid": null, "awards_coaches": null, "awards_players": null, "beers": null, "book": null, "book_author": null, "book_language": null, "bool": null, "borders": null, "breweries": null, "businesses": null, "callcenterlogs": null, "careplans": null, "cars": null, "categories": null, "category": null, "central_superstore": null, "chapters": null, "characters": null, "cites": null, "city": null, "claims": null, "client": null, "coaches": null, "coins": null, "competitor_event": null, "conditions": null, "congress": null, "content": null, "continent": null, "country": null, "course": null, "current": null, "current-terms": null, "cust_order": null, "customer": null, "customer_address": null, "customers": null, "data": null, "department": null, "desert": null, "director": null, "directors": null, "disabled": null, "discounts": null, "district": null, "divisions": null, "draft": null, "driver": null, "east_superstore": null, "economy": null, "employee": null, "employees": null, "encompasses": null, "encounters": null, "enlist": null, "enrolled": null, "establishment": null, "ethnicGroup": null, "event": null, "events": null, "events_relevant": null, "filed_for_bankrupcy": null, "film": null, "film_actor": null, "film_category": null, "film_text": null, "game": null, "game_platform": null, "game_publisher": null, "games": null, "games_city": null, "games_competitor": null, "gender": null, "gender_age": null, "gender_age_test": null, "gender_age_train": null, "generalinfo": null, "genre": null, "geo_desert": null, "geo_estuary": null, "geo_island": null, "geo_lake": null, "geo_mountain": null, "geo_river": null, "geo_sea": null, "geo_source": null, "geographic": null, "geolocation": null, "height_info": null, "historical": null, "historical-terms": null, "immunizations": null, "incidents": null, "inspection": null, "inspection_point": null, "inspections": null, "institution_details": null, "institution_grads": null, "inventory": null, "isMember": null, "island": null, "islandIn": null, "jobs": null, "keyword": null, "label_categories": null, "lake": null, "language": null, "language_role": null, "lineitem": null, "located": null, "locatedOn": null, "location": null, "longest_absense_from_school": null, "mailings3": null, "male": null, "matchs": null, "medal": null, "medications": null, "mergesWith": null, "mountain": null, "mountainOnIsland": null, "movie": null, "movie_cast": null, "movie_company": null, "movie_crew": null, "movie_genres": null, "movie_keywords": null, "movie_languages": null, "movies": null, "movies2actors": null, "movies2directors": null, "movies_total_gross": null, "nation": null, "no_payment_due": null, "noc_region": null, "observations": null, "officers": null, "offices": null, "order_history": null, "order_line": null, "order_status": null, "orderdetails": null, "orders": null, "organization": null, "paper": null, "paragraphs": null, "part": null, "partsupp": null, "patients": null, "payment": null, "payments": null, "people": null, "person": null, "person_region": null, "phone_brand_device_model2": null, "platform": null, "player_allstar": null, "players": null, "players_teams": null, "playstore": null, "podcasts": null, "politics": null, "population": null, "position": null, "price": null, "procedures": null, "product": null, "production": null, "production_company": null, "production_country": null, "productlines": null, "products": null, "prof": null, "province": null, "pub_info": null, "publisher": null, "publishers": ["state", "city", "country", "pub_name", "pub_id"], "ranking_criteria": null, "ranking_system": null, "region": null, "region_sales": null, "registration": null, "relation": null, "religion": null, "rental": null, "revenue": null, "reviews": null, "river": null, "rootbeer": null, "rootbeerbrand": null, "rootbeerreview": null, "roysched": ["royalty", "title_id"], "runs": null, "sales": ["title_id", "qty", "ord_num", "stor_id", "payterms", "ord_date"], "sales_in_weather": null, "sample_submission": null, "sea": null, "series_post": null, "shipment": null, "shipping_method": null, "social-media": null, "south_superstore": null, "sport": null, "staff": null, "state": null, "state_sector_details": null, "state_sector_grads": null, "store": null, "stores": null, "student": null, "subjects": null, "supplier": null, "tags": null, "target": null, "taughtBy": null, "teams": null, "titleauthor": ["royaltyper", "title_id", "au_ord", "au_id"], "titles": ["royalty", "price", "title_id", "title", "type", "ytd_sales", "advance", "pub_id", "pubdate", "notes"], "torrents": null, "trains": null, "transaction": null, "truck": null, "twitter": null, "u2base": null, "unemployed": null, "university": null, "university_ranking_year": null, "university_year": null, "user": null, "user_reviews": null, "users": null, "violation": null, "violations": null, "voice-actors": null, "weather": null, "weight_info": null, "west_superstore": null, "works": null, "zip_congress": null, "zip_data": null} |
|
Among the titles with royalty percentage, which title has the greatest royalty percentage. State it's minimum range to enjoy this royalty percentage. | SELECT T1.title, T2.lorange FROM titles AS T1 INNER JOIN roysched AS T2 ON T1.title_id = T2.title_id ORDER BY T2.royalty DESC LIMIT 1 | book_publishing_company | 172 | [
"employee",
"sales",
"stores",
"roysched",
"titles",
"publishers",
"titleauthor",
"discounts",
"jobs"
] | [
[
" CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ",
" CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL NOT NULL, FOREIGN KEY(stor_id) REFERENCES stores (stor_id) ) ",
" CREATE TABLE employee ( emp_id TEXT, fname TEXT NOT NULL, minit TEXT, lname TEXT NOT NULL, job_id INTEGER NOT NULL, job_lvl INTEGER, pub_id TEXT NOT NULL, hire_date DATETIME NOT NULL, PRIMARY KEY (emp_id), FOREIGN KEY(job_id) REFERENCES jobs (job_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE jobs ( job_id INTEGER, job_desc TEXT NOT NULL, min_lvl INTEGER NOT NULL, max_lvl INTEGER NOT NULL, PRIMARY KEY (job_id) ) ",
" CREATE TABLE pub_info ( pub_id TEXT, logo BLOB, pr_info TEXT, PRIMARY KEY (pub_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE publishers ( pub_id TEXT, pub_name TEXT, city TEXT, state TEXT, country TEXT, PRIMARY KEY (pub_id) ) ",
" CREATE TABLE roysched ( title_id TEXT NOT NULL, lorange INTEGER, hirange INTEGER, royalty INTEGER, FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE sales ( stor_id TEXT NOT NULL, ord_num TEXT NOT NULL, ord_date DATETIME NOT NULL, qty INTEGER NOT NULL, payterms TEXT NOT NULL, title_id TEXT NOT NULL, PRIMARY KEY (stor_id, ord_num, title_id), FOREIGN KEY(stor_id) REFERENCES stores (stor_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE stores ( stor_id TEXT, stor_name TEXT, stor_address TEXT, city TEXT, state TEXT, zip TEXT, PRIMARY KEY (stor_id) ) ",
" CREATE TABLE titleauthor ( au_id TEXT NOT NULL, title_id TEXT NOT NULL, au_ord INTEGER, royaltyper INTEGER, PRIMARY KEY (au_id, title_id), FOREIGN KEY(au_id) REFERENCES authors (au_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE titles ( title_id TEXT, title TEXT NOT NULL, type TEXT NOT NULL, pub_id TEXT, price REAL, advance REAL, royalty INTEGER, ytd_sales INTEGER, notes TEXT, pubdate DATETIME NOT NULL, PRIMARY KEY (title_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) "
]
] | [
[
" CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ",
" CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL NOT NULL, FOREIGN KEY(stor_id) REFERENCES stores (stor_id) ) ",
" CREATE TABLE employee ( emp_id TEXT, fname TEXT NOT NULL, minit TEXT, lname TEXT NOT NULL, job_id INTEGER NOT NULL, job_lvl INTEGER, pub_id TEXT NOT NULL, hire_date DATETIME NOT NULL, PRIMARY KEY (emp_id), FOREIGN KEY(job_id) REFERENCES jobs (job_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE jobs ( job_id INTEGER, job_desc TEXT NOT NULL, min_lvl INTEGER NOT NULL, max_lvl INTEGER NOT NULL, PRIMARY KEY (job_id) ) ",
" CREATE TABLE pub_info ( pub_id TEXT, logo BLOB, pr_info TEXT, PRIMARY KEY (pub_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE publishers ( pub_id TEXT, pub_name TEXT, city TEXT, state TEXT, country TEXT, PRIMARY KEY (pub_id) ) ",
" CREATE TABLE roysched ( title_id TEXT NOT NULL, lorange INTEGER, hirange INTEGER, royalty INTEGER, FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE sales ( stor_id TEXT NOT NULL, ord_num TEXT NOT NULL, ord_date DATETIME NOT NULL, qty INTEGER NOT NULL, payterms TEXT NOT NULL, title_id TEXT NOT NULL, PRIMARY KEY (stor_id, ord_num, title_id), FOREIGN KEY(stor_id) REFERENCES stores (stor_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE stores ( stor_id TEXT, stor_name TEXT, stor_address TEXT, city TEXT, state TEXT, zip TEXT, PRIMARY KEY (stor_id) ) ",
" CREATE TABLE titleauthor ( au_id TEXT NOT NULL, title_id TEXT NOT NULL, au_ord INTEGER, royaltyper INTEGER, PRIMARY KEY (au_id, title_id), FOREIGN KEY(au_id) REFERENCES authors (au_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE titles ( title_id TEXT, title TEXT NOT NULL, type TEXT NOT NULL, pub_id TEXT, price REAL, advance REAL, royalty INTEGER, ytd_sales INTEGER, notes TEXT, pubdate DATETIME NOT NULL, PRIMARY KEY (title_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) "
]
] | 11 | 11 | {"ATT_CLASSES": null, "Address": null, "AddressType": null, "Air Carriers": null, "Airlines": null, "Airports": null, "Answer": null, "Attributes": null, "Author": null, "Award": null, "AwardsCoaches": null, "AwardsMisc": null, "AwardsPlayers": null, "Ball_by_Ball": null, "Batsman_Scored": null, "Batting_Style": null, "BillOfMaterials": null, "Bowling_Style": null, "Business": null, "BusinessEntity": null, "BusinessEntityAddress": null, "BusinessEntityContact": null, "Business_Attributes": null, "Business_Categories": null, "Business_Hours": null, "CBSA": null, "Categories": null, "Character_Award": null, "Checkins": null, "City": null, "Classification": null, "Coaches": null, "CombinedShutouts": null, "Community_Area": null, "Compliments": null, "Conference": null, "ContactType": null, "Country": null, "CountryLanguage": null, "CountryRegion": null, "CountryRegionCurrency": null, "Credit": null, "CreditCard": null, "Crime": null, "Culture": null, "Currency": null, "CurrencyRate": null, "Customer": null, "Customers": null, "Days": null, "Demog": null, "Department": null, "Dish": null, "District": null, "Document": null, "Elite": null, "EmailAddress": null, "Employee": null, "EmployeeDepartmentHistory": null, "EmployeePayHistory": null, "Employees": null, "Episode": null, "Extra_Runs": null, "Extra_Type": null, "FBI_Code": null, "Genes": null, "Goalies": null, "GoaliesSC": null, "GoaliesShootout": null, "HOF": null, "IMG_OBJ": null, "IMG_OBJ_ATT": null, "IMG_REL": null, "IUCR": null, "Ingredient": null, "Interactions": null, "JobCandidate": null, "Journal": null, "Keyword": null, "Location": null, "Mailings1_2": null, "Master": null, "Match": null, "Menu": null, "MenuItem": null, "MenuPage": null, "Neighborhood": null, "Nutrition": null, "OBJ_CLASSES": null, "OrderDetails": null, "Orders": null, "Out_Type": null, "Outcome": null, "PRED_CLASSES": null, "Paper": null, "PaperAuthor": null, "Password": null, "Person": null, "PersonCreditCard": null, "PhoneNumberType": null, "Player": null, "PlayerInfo": null, "Player_Match": null, "Product": null, "ProductCategory": null, "ProductCostHistory": null, "ProductDescription": null, "ProductDocument": null, "ProductInventory": null, "ProductListPriceHistory": null, "ProductModel": null, "ProductModelProductDescriptionCulture": null, "ProductPhoto": null, "ProductProductPhoto": null, "ProductReview": null, "ProductSubcategory": null, "ProductVendor": null, "Products": null, "PurchaseOrderDetail": null, "PurchaseOrderHeader": null, "Quantity": null, "Question": null, "RA": null, "Recipe": null, "Regions": null, "Reviews": null, "Rolee": null, "Sales": null, "Sales Orders": null, "Sales Team": null, "SalesOrderDetail": null, "SalesOrderHeader": null, "SalesOrderHeaderSalesReason": null, "SalesPerson": null, "SalesPersonQuotaHistory": null, "SalesReason": null, "SalesTaxRate": null, "SalesTerritory": null, "SalesTerritoryHistory": null, "Scoring": null, "ScoringSC": null, "ScoringShootout": null, "ScoringSup": null, "ScrapReason": null, "Season": null, "SeasonStatus": null, "SeriesPost": null, "Shift": null, "ShipMethod": null, "Shippers": null, "ShoppingCartItem": null, "SpecialOffer": null, "SpecialOfferProduct": null, "StateProvince": null, "Store": null, "Store Locations": null, "Suppliers": null, "Survey": null, "Team": null, "TeamSplits": null, "TeamVsTeam": null, "Teams": null, "TeamsHalf": null, "TeamsPost": null, "TeamsSC": null, "Tips": null, "Toss_Decision": null, "TransactionHistory": null, "TransactionHistoryArchive": null, "Umpire": null, "UnitMeasure": null, "Users": null, "Users_Compliments": null, "Vendor": null, "Venue": null, "Vote": null, "Ward": null, "Wicket_Taken": null, "Win_By": null, "WorkOrder": null, "WorkOrderRouting": null, "Years": null, "abbrev": null, "actor": null, "actors": null, "address": null, "address_status": null, "advisedBy": null, "alias": null, "all_prevalences": null, "allergies": null, "app_all": null, "app_events": null, "app_events_relevant": null, "app_labels": null, "area_code": null, "author": null, "authors": null, "avoid": null, "awards_coaches": null, "awards_players": null, "beers": null, "book": null, "book_author": null, "book_language": null, "bool": null, "borders": null, "breweries": null, "businesses": null, "callcenterlogs": null, "careplans": null, "cars": null, "categories": null, "category": null, "central_superstore": null, "chapters": null, "characters": null, "cites": null, "city": null, "claims": null, "client": null, "coaches": null, "coins": null, "competitor_event": null, "conditions": null, "congress": null, "content": null, "continent": null, "country": null, "course": null, "current": null, "current-terms": null, "cust_order": null, "customer": null, "customer_address": null, "customers": null, "data": null, "department": null, "desert": null, "director": null, "directors": null, "disabled": null, "discounts": null, "district": null, "divisions": null, "draft": null, "driver": null, "east_superstore": null, "economy": null, "employee": null, "employees": null, "encompasses": null, "encounters": null, "enlist": null, "enrolled": null, "establishment": null, "ethnicGroup": null, "event": null, "events": null, "events_relevant": null, "filed_for_bankrupcy": null, "film": null, "film_actor": null, "film_category": null, "film_text": null, "game": null, "game_platform": null, "game_publisher": null, "games": null, "games_city": null, "games_competitor": null, "gender": null, "gender_age": null, "gender_age_test": null, "gender_age_train": null, "generalinfo": null, "genre": null, "geo_desert": null, "geo_estuary": null, "geo_island": null, "geo_lake": null, "geo_mountain": null, "geo_river": null, "geo_sea": null, "geo_source": null, "geographic": null, "geolocation": null, "height_info": null, "historical": null, "historical-terms": null, "immunizations": null, "incidents": null, "inspection": null, "inspection_point": null, "inspections": null, "institution_details": null, "institution_grads": null, "inventory": null, "isMember": null, "island": null, "islandIn": null, "jobs": ["min_lvl", "max_lvl", "job_id"], "keyword": null, "label_categories": null, "lake": null, "language": null, "language_role": null, "lineitem": null, "located": null, "locatedOn": null, "location": null, "longest_absense_from_school": null, "mailings3": null, "male": null, "matchs": null, "medal": null, "medications": null, "mergesWith": null, "mountain": null, "mountainOnIsland": null, "movie": null, "movie_cast": null, "movie_company": null, "movie_crew": null, "movie_genres": null, "movie_keywords": null, "movie_languages": null, "movies": null, "movies2actors": null, "movies2directors": null, "movies_total_gross": null, "nation": null, "no_payment_due": null, "noc_region": null, "observations": null, "officers": null, "offices": null, "order_history": null, "order_line": null, "order_status": null, "orderdetails": null, "orders": null, "organization": null, "paper": null, "paragraphs": null, "part": null, "partsupp": null, "patients": null, "payment": null, "payments": null, "people": null, "person": null, "person_region": null, "phone_brand_device_model2": null, "platform": null, "player_allstar": null, "players": null, "players_teams": null, "playstore": null, "podcasts": null, "politics": null, "population": null, "position": null, "price": null, "procedures": null, "product": null, "production": null, "production_company": null, "production_country": null, "productlines": null, "products": null, "prof": null, "province": null, "pub_info": null, "publisher": null, "publishers": null, "ranking_criteria": null, "ranking_system": null, "region": null, "region_sales": null, "registration": null, "relation": null, "religion": null, "rental": null, "revenue": null, "reviews": null, "river": null, "rootbeer": null, "rootbeerbrand": null, "rootbeerreview": null, "roysched": ["royalty", "title_id", "lorange", "hirange"], "runs": null, "sales": ["title_id", "qty", "stor_id", "ord_num"], "sales_in_weather": null, "sample_submission": null, "sea": null, "series_post": null, "shipment": null, "shipping_method": null, "social-media": null, "south_superstore": null, "sport": null, "staff": null, "state": null, "state_sector_details": null, "state_sector_grads": null, "store": null, "stores": null, "student": null, "subjects": null, "supplier": null, "tags": null, "target": null, "taughtBy": null, "teams": null, "titleauthor": ["royaltyper", "title_id", "au_id", "au_ord"], "titles": ["royalty", "type", "advance", "title", "title_id", "price", "ytd_sales", "pub_id", "pubdate", "notes"], "torrents": null, "trains": null, "transaction": null, "truck": null, "twitter": null, "u2base": null, "unemployed": null, "university": null, "university_ranking_year": null, "university_year": null, "user": null, "user_reviews": null, "users": null, "violation": null, "violations": null, "voice-actors": null, "weather": null, "weight_info": null, "west_superstore": null, "works": null, "zip_congress": null, "zip_data": null} |
|
Provide a list of titles together with its publisher name for all publishers located in the USA. | SELECT T1.title, T2.pub_name FROM titles AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id WHERE T2.country = 'USA' | book_publishing_company | 173 | [
"sales",
"stores",
"titles",
"publishers",
"titleauthor"
] | [
[
" CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ",
" CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL NOT NULL, FOREIGN KEY(stor_id) REFERENCES stores (stor_id) ) ",
" CREATE TABLE employee ( emp_id TEXT, fname TEXT NOT NULL, minit TEXT, lname TEXT NOT NULL, job_id INTEGER NOT NULL, job_lvl INTEGER, pub_id TEXT NOT NULL, hire_date DATETIME NOT NULL, PRIMARY KEY (emp_id), FOREIGN KEY(job_id) REFERENCES jobs (job_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE jobs ( job_id INTEGER, job_desc TEXT NOT NULL, min_lvl INTEGER NOT NULL, max_lvl INTEGER NOT NULL, PRIMARY KEY (job_id) ) ",
" CREATE TABLE pub_info ( pub_id TEXT, logo BLOB, pr_info TEXT, PRIMARY KEY (pub_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE publishers ( pub_id TEXT, pub_name TEXT, city TEXT, state TEXT, country TEXT, PRIMARY KEY (pub_id) ) ",
" CREATE TABLE roysched ( title_id TEXT NOT NULL, lorange INTEGER, hirange INTEGER, royalty INTEGER, FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE sales ( stor_id TEXT NOT NULL, ord_num TEXT NOT NULL, ord_date DATETIME NOT NULL, qty INTEGER NOT NULL, payterms TEXT NOT NULL, title_id TEXT NOT NULL, PRIMARY KEY (stor_id, ord_num, title_id), FOREIGN KEY(stor_id) REFERENCES stores (stor_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE stores ( stor_id TEXT, stor_name TEXT, stor_address TEXT, city TEXT, state TEXT, zip TEXT, PRIMARY KEY (stor_id) ) ",
" CREATE TABLE titleauthor ( au_id TEXT NOT NULL, title_id TEXT NOT NULL, au_ord INTEGER, royaltyper INTEGER, PRIMARY KEY (au_id, title_id), FOREIGN KEY(au_id) REFERENCES authors (au_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE titles ( title_id TEXT, title TEXT NOT NULL, type TEXT NOT NULL, pub_id TEXT, price REAL, advance REAL, royalty INTEGER, ytd_sales INTEGER, notes TEXT, pubdate DATETIME NOT NULL, PRIMARY KEY (title_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) "
]
] | [
[
" CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ",
" CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL NOT NULL, FOREIGN KEY(stor_id) REFERENCES stores (stor_id) ) ",
" CREATE TABLE employee ( emp_id TEXT, fname TEXT NOT NULL, minit TEXT, lname TEXT NOT NULL, job_id INTEGER NOT NULL, job_lvl INTEGER, pub_id TEXT NOT NULL, hire_date DATETIME NOT NULL, PRIMARY KEY (emp_id), FOREIGN KEY(job_id) REFERENCES jobs (job_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE jobs ( job_id INTEGER, job_desc TEXT NOT NULL, min_lvl INTEGER NOT NULL, max_lvl INTEGER NOT NULL, PRIMARY KEY (job_id) ) ",
" CREATE TABLE pub_info ( pub_id TEXT, logo BLOB, pr_info TEXT, PRIMARY KEY (pub_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE publishers ( pub_id TEXT, pub_name TEXT, city TEXT, state TEXT, country TEXT, PRIMARY KEY (pub_id) ) ",
" CREATE TABLE roysched ( title_id TEXT NOT NULL, lorange INTEGER, hirange INTEGER, royalty INTEGER, FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE sales ( stor_id TEXT NOT NULL, ord_num TEXT NOT NULL, ord_date DATETIME NOT NULL, qty INTEGER NOT NULL, payterms TEXT NOT NULL, title_id TEXT NOT NULL, PRIMARY KEY (stor_id, ord_num, title_id), FOREIGN KEY(stor_id) REFERENCES stores (stor_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE stores ( stor_id TEXT, stor_name TEXT, stor_address TEXT, city TEXT, state TEXT, zip TEXT, PRIMARY KEY (stor_id) ) ",
" CREATE TABLE titleauthor ( au_id TEXT NOT NULL, title_id TEXT NOT NULL, au_ord INTEGER, royaltyper INTEGER, PRIMARY KEY (au_id, title_id), FOREIGN KEY(au_id) REFERENCES authors (au_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE titles ( title_id TEXT, title TEXT NOT NULL, type TEXT NOT NULL, pub_id TEXT, price REAL, advance REAL, royalty INTEGER, ytd_sales INTEGER, notes TEXT, pubdate DATETIME NOT NULL, PRIMARY KEY (title_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) "
]
] | 11 | 11 | {"ATT_CLASSES": null, "Address": null, "AddressType": null, "Air Carriers": null, "Airlines": null, "Airports": null, "Answer": null, "Attributes": null, "Author": null, "Award": null, "AwardsCoaches": null, "AwardsMisc": null, "AwardsPlayers": null, "Ball_by_Ball": null, "Batsman_Scored": null, "Batting_Style": null, "BillOfMaterials": null, "Bowling_Style": null, "Business": null, "BusinessEntity": null, "BusinessEntityAddress": null, "BusinessEntityContact": null, "Business_Attributes": null, "Business_Categories": null, "Business_Hours": null, "CBSA": null, "Categories": null, "Character_Award": null, "Checkins": null, "City": null, "Classification": null, "Coaches": null, "CombinedShutouts": null, "Community_Area": null, "Compliments": null, "Conference": null, "ContactType": null, "Country": null, "CountryLanguage": null, "CountryRegion": null, "CountryRegionCurrency": null, "Credit": null, "CreditCard": null, "Crime": null, "Culture": null, "Currency": null, "CurrencyRate": null, "Customer": null, "Customers": null, "Days": null, "Demog": null, "Department": null, "Dish": null, "District": null, "Document": null, "Elite": null, "EmailAddress": null, "Employee": null, "EmployeeDepartmentHistory": null, "EmployeePayHistory": null, "Employees": null, "Episode": null, "Extra_Runs": null, "Extra_Type": null, "FBI_Code": null, "Genes": null, "Goalies": null, "GoaliesSC": null, "GoaliesShootout": null, "HOF": null, "IMG_OBJ": null, "IMG_OBJ_ATT": null, "IMG_REL": null, "IUCR": null, "Ingredient": null, "Interactions": null, "JobCandidate": null, "Journal": null, "Keyword": null, "Location": null, "Mailings1_2": null, "Master": null, "Match": null, "Menu": null, "MenuItem": null, "MenuPage": null, "Neighborhood": null, "Nutrition": null, "OBJ_CLASSES": null, "OrderDetails": null, "Orders": null, "Out_Type": null, "Outcome": null, "PRED_CLASSES": null, "Paper": null, "PaperAuthor": null, "Password": null, "Person": null, "PersonCreditCard": null, "PhoneNumberType": null, "Player": null, "PlayerInfo": null, "Player_Match": null, "Product": null, "ProductCategory": null, "ProductCostHistory": null, "ProductDescription": null, "ProductDocument": null, "ProductInventory": null, "ProductListPriceHistory": null, "ProductModel": null, "ProductModelProductDescriptionCulture": null, "ProductPhoto": null, "ProductProductPhoto": null, "ProductReview": null, "ProductSubcategory": null, "ProductVendor": null, "Products": null, "PurchaseOrderDetail": null, "PurchaseOrderHeader": null, "Quantity": null, "Question": null, "RA": null, "Recipe": null, "Regions": null, "Reviews": null, "Rolee": null, "Sales": null, "Sales Orders": null, "Sales Team": null, "SalesOrderDetail": null, "SalesOrderHeader": null, "SalesOrderHeaderSalesReason": null, "SalesPerson": null, "SalesPersonQuotaHistory": null, "SalesReason": null, "SalesTaxRate": null, "SalesTerritory": null, "SalesTerritoryHistory": null, "Scoring": null, "ScoringSC": null, "ScoringShootout": null, "ScoringSup": null, "ScrapReason": null, "Season": null, "SeasonStatus": null, "SeriesPost": null, "Shift": null, "ShipMethod": null, "Shippers": null, "ShoppingCartItem": null, "SpecialOffer": null, "SpecialOfferProduct": null, "StateProvince": null, "Store": null, "Store Locations": null, "Suppliers": null, "Survey": null, "Team": null, "TeamSplits": null, "TeamVsTeam": null, "Teams": null, "TeamsHalf": null, "TeamsPost": null, "TeamsSC": null, "Tips": null, "Toss_Decision": null, "TransactionHistory": null, "TransactionHistoryArchive": null, "Umpire": null, "UnitMeasure": null, "Users": null, "Users_Compliments": null, "Vendor": null, "Venue": null, "Vote": null, "Ward": null, "Wicket_Taken": null, "Win_By": null, "WorkOrder": null, "WorkOrderRouting": null, "Years": null, "abbrev": null, "actor": null, "actors": null, "address": null, "address_status": null, "advisedBy": null, "alias": null, "all_prevalences": null, "allergies": null, "app_all": null, "app_events": null, "app_events_relevant": null, "app_labels": null, "area_code": null, "author": null, "authors": null, "avoid": null, "awards_coaches": null, "awards_players": null, "beers": null, "book": null, "book_author": null, "book_language": null, "bool": null, "borders": null, "breweries": null, "businesses": null, "callcenterlogs": null, "careplans": null, "cars": null, "categories": null, "category": null, "central_superstore": null, "chapters": null, "characters": null, "cites": null, "city": null, "claims": null, "client": null, "coaches": null, "coins": null, "competitor_event": null, "conditions": null, "congress": null, "content": null, "continent": null, "country": null, "course": null, "current": null, "current-terms": null, "cust_order": null, "customer": null, "customer_address": null, "customers": null, "data": null, "department": null, "desert": null, "director": null, "directors": null, "disabled": null, "discounts": null, "district": null, "divisions": null, "draft": null, "driver": null, "east_superstore": null, "economy": null, "employee": null, "employees": null, "encompasses": null, "encounters": null, "enlist": null, "enrolled": null, "establishment": null, "ethnicGroup": null, "event": null, "events": null, "events_relevant": null, "filed_for_bankrupcy": null, "film": null, "film_actor": null, "film_category": null, "film_text": null, "game": null, "game_platform": null, "game_publisher": null, "games": null, "games_city": null, "games_competitor": null, "gender": null, "gender_age": null, "gender_age_test": null, "gender_age_train": null, "generalinfo": null, "genre": null, "geo_desert": null, "geo_estuary": null, "geo_island": null, "geo_lake": null, "geo_mountain": null, "geo_river": null, "geo_sea": null, "geo_source": null, "geographic": null, "geolocation": null, "height_info": null, "historical": null, "historical-terms": null, "immunizations": null, "incidents": null, "inspection": null, "inspection_point": null, "inspections": null, "institution_details": null, "institution_grads": null, "inventory": null, "isMember": null, "island": null, "islandIn": null, "jobs": null, "keyword": null, "label_categories": null, "lake": null, "language": null, "language_role": null, "lineitem": null, "located": null, "locatedOn": null, "location": null, "longest_absense_from_school": null, "mailings3": null, "male": null, "matchs": null, "medal": null, "medications": null, "mergesWith": null, "mountain": null, "mountainOnIsland": null, "movie": null, "movie_cast": null, "movie_company": null, "movie_crew": null, "movie_genres": null, "movie_keywords": null, "movie_languages": null, "movies": null, "movies2actors": null, "movies2directors": null, "movies_total_gross": null, "nation": null, "no_payment_due": null, "noc_region": null, "observations": null, "officers": null, "offices": null, "order_history": null, "order_line": null, "order_status": null, "orderdetails": null, "orders": null, "organization": null, "paper": null, "paragraphs": null, "part": null, "partsupp": null, "patients": null, "payment": null, "payments": null, "people": null, "person": null, "person_region": null, "phone_brand_device_model2": null, "platform": null, "player_allstar": null, "players": null, "players_teams": null, "playstore": null, "podcasts": null, "politics": null, "population": null, "position": null, "price": null, "procedures": null, "product": null, "production": null, "production_company": null, "production_country": null, "productlines": null, "products": null, "prof": null, "province": null, "pub_info": null, "publisher": null, "publishers": ["city", "state", "country", "pub_name", "pub_id"], "ranking_criteria": null, "ranking_system": null, "region": null, "region_sales": null, "registration": null, "relation": null, "religion": null, "rental": null, "revenue": null, "reviews": null, "river": null, "rootbeer": null, "rootbeerbrand": null, "rootbeerreview": null, "roysched": null, "runs": null, "sales": ["title_id", "payterms", "stor_id", "qty", "ord_num"], "sales_in_weather": null, "sample_submission": null, "sea": null, "series_post": null, "shipment": null, "shipping_method": null, "social-media": null, "south_superstore": null, "sport": null, "staff": null, "state": null, "state_sector_details": null, "state_sector_grads": null, "store": null, "stores": ["city", "stor_name", "state", "stor_address", "stor_id", "zip"], "student": null, "subjects": null, "supplier": null, "tags": null, "target": null, "taughtBy": null, "teams": null, "titleauthor": ["au_ord", "au_id", "royaltyper", "title_id"], "titles": ["type", "ytd_sales", "advance", "title", "pub_id", "title_id", "royalty", "pubdate", "price", "notes"], "torrents": null, "trains": null, "transaction": null, "truck": null, "twitter": null, "u2base": null, "unemployed": null, "university": null, "university_ranking_year": null, "university_year": null, "user": null, "user_reviews": null, "users": null, "violation": null, "violations": null, "voice-actors": null, "weather": null, "weight_info": null, "west_superstore": null, "works": null, "zip_congress": null, "zip_data": null} |
|
State the royalty percentage for the most year to date sale title within the 20000 range. | SELECT MAX(T1.ytd_sales) FROM titles AS T1 INNER JOIN roysched AS T2 ON T1.title_id = T2.title_id WHERE T2.lorange > 20000 AND T2.hirange < 20000 | book_publishing_company | 174 | [
"employee",
"sales",
"stores",
"roysched",
"titles",
"publishers",
"titleauthor",
"discounts"
] | [
[
" CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ",
" CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL NOT NULL, FOREIGN KEY(stor_id) REFERENCES stores (stor_id) ) ",
" CREATE TABLE employee ( emp_id TEXT, fname TEXT NOT NULL, minit TEXT, lname TEXT NOT NULL, job_id INTEGER NOT NULL, job_lvl INTEGER, pub_id TEXT NOT NULL, hire_date DATETIME NOT NULL, PRIMARY KEY (emp_id), FOREIGN KEY(job_id) REFERENCES jobs (job_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE jobs ( job_id INTEGER, job_desc TEXT NOT NULL, min_lvl INTEGER NOT NULL, max_lvl INTEGER NOT NULL, PRIMARY KEY (job_id) ) ",
" CREATE TABLE pub_info ( pub_id TEXT, logo BLOB, pr_info TEXT, PRIMARY KEY (pub_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE publishers ( pub_id TEXT, pub_name TEXT, city TEXT, state TEXT, country TEXT, PRIMARY KEY (pub_id) ) ",
" CREATE TABLE roysched ( title_id TEXT NOT NULL, lorange INTEGER, hirange INTEGER, royalty INTEGER, FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE sales ( stor_id TEXT NOT NULL, ord_num TEXT NOT NULL, ord_date DATETIME NOT NULL, qty INTEGER NOT NULL, payterms TEXT NOT NULL, title_id TEXT NOT NULL, PRIMARY KEY (stor_id, ord_num, title_id), FOREIGN KEY(stor_id) REFERENCES stores (stor_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE stores ( stor_id TEXT, stor_name TEXT, stor_address TEXT, city TEXT, state TEXT, zip TEXT, PRIMARY KEY (stor_id) ) ",
" CREATE TABLE titleauthor ( au_id TEXT NOT NULL, title_id TEXT NOT NULL, au_ord INTEGER, royaltyper INTEGER, PRIMARY KEY (au_id, title_id), FOREIGN KEY(au_id) REFERENCES authors (au_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE titles ( title_id TEXT, title TEXT NOT NULL, type TEXT NOT NULL, pub_id TEXT, price REAL, advance REAL, royalty INTEGER, ytd_sales INTEGER, notes TEXT, pubdate DATETIME NOT NULL, PRIMARY KEY (title_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) "
]
] | [
[
" CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ",
" CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL NOT NULL, FOREIGN KEY(stor_id) REFERENCES stores (stor_id) ) ",
" CREATE TABLE employee ( emp_id TEXT, fname TEXT NOT NULL, minit TEXT, lname TEXT NOT NULL, job_id INTEGER NOT NULL, job_lvl INTEGER, pub_id TEXT NOT NULL, hire_date DATETIME NOT NULL, PRIMARY KEY (emp_id), FOREIGN KEY(job_id) REFERENCES jobs (job_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE jobs ( job_id INTEGER, job_desc TEXT NOT NULL, min_lvl INTEGER NOT NULL, max_lvl INTEGER NOT NULL, PRIMARY KEY (job_id) ) ",
" CREATE TABLE pub_info ( pub_id TEXT, logo BLOB, pr_info TEXT, PRIMARY KEY (pub_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE publishers ( pub_id TEXT, pub_name TEXT, city TEXT, state TEXT, country TEXT, PRIMARY KEY (pub_id) ) ",
" CREATE TABLE roysched ( title_id TEXT NOT NULL, lorange INTEGER, hirange INTEGER, royalty INTEGER, FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE sales ( stor_id TEXT NOT NULL, ord_num TEXT NOT NULL, ord_date DATETIME NOT NULL, qty INTEGER NOT NULL, payterms TEXT NOT NULL, title_id TEXT NOT NULL, PRIMARY KEY (stor_id, ord_num, title_id), FOREIGN KEY(stor_id) REFERENCES stores (stor_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE stores ( stor_id TEXT, stor_name TEXT, stor_address TEXT, city TEXT, state TEXT, zip TEXT, PRIMARY KEY (stor_id) ) ",
" CREATE TABLE titleauthor ( au_id TEXT NOT NULL, title_id TEXT NOT NULL, au_ord INTEGER, royaltyper INTEGER, PRIMARY KEY (au_id, title_id), FOREIGN KEY(au_id) REFERENCES authors (au_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE titles ( title_id TEXT, title TEXT NOT NULL, type TEXT NOT NULL, pub_id TEXT, price REAL, advance REAL, royalty INTEGER, ytd_sales INTEGER, notes TEXT, pubdate DATETIME NOT NULL, PRIMARY KEY (title_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) "
]
] | 11 | 11 | {"ATT_CLASSES": null, "Address": null, "AddressType": null, "Air Carriers": null, "Airlines": null, "Airports": null, "Answer": null, "Attributes": null, "Author": null, "Award": null, "AwardsCoaches": null, "AwardsMisc": null, "AwardsPlayers": null, "Ball_by_Ball": null, "Batsman_Scored": null, "Batting_Style": null, "BillOfMaterials": null, "Bowling_Style": null, "Business": null, "BusinessEntity": null, "BusinessEntityAddress": null, "BusinessEntityContact": null, "Business_Attributes": null, "Business_Categories": null, "Business_Hours": null, "CBSA": null, "Categories": null, "Character_Award": null, "Checkins": null, "City": null, "Classification": null, "Coaches": null, "CombinedShutouts": null, "Community_Area": null, "Compliments": null, "Conference": null, "ContactType": null, "Country": null, "CountryLanguage": null, "CountryRegion": null, "CountryRegionCurrency": null, "Credit": null, "CreditCard": null, "Crime": null, "Culture": null, "Currency": null, "CurrencyRate": null, "Customer": null, "Customers": null, "Days": null, "Demog": null, "Department": null, "Dish": null, "District": null, "Document": null, "Elite": null, "EmailAddress": null, "Employee": null, "EmployeeDepartmentHistory": null, "EmployeePayHistory": null, "Employees": null, "Episode": null, "Extra_Runs": null, "Extra_Type": null, "FBI_Code": null, "Genes": null, "Goalies": null, "GoaliesSC": null, "GoaliesShootout": null, "HOF": null, "IMG_OBJ": null, "IMG_OBJ_ATT": null, "IMG_REL": null, "IUCR": null, "Ingredient": null, "Interactions": null, "JobCandidate": null, "Journal": null, "Keyword": null, "Location": null, "Mailings1_2": null, "Master": null, "Match": null, "Menu": null, "MenuItem": null, "MenuPage": null, "Neighborhood": null, "Nutrition": null, "OBJ_CLASSES": null, "OrderDetails": null, "Orders": null, "Out_Type": null, "Outcome": null, "PRED_CLASSES": null, "Paper": null, "PaperAuthor": null, "Password": null, "Person": null, "PersonCreditCard": null, "PhoneNumberType": null, "Player": null, "PlayerInfo": null, "Player_Match": null, "Product": null, "ProductCategory": null, "ProductCostHistory": null, "ProductDescription": null, "ProductDocument": null, "ProductInventory": null, "ProductListPriceHistory": null, "ProductModel": null, "ProductModelProductDescriptionCulture": null, "ProductPhoto": null, "ProductProductPhoto": null, "ProductReview": null, "ProductSubcategory": null, "ProductVendor": null, "Products": null, "PurchaseOrderDetail": null, "PurchaseOrderHeader": null, "Quantity": null, "Question": null, "RA": null, "Recipe": null, "Regions": null, "Reviews": null, "Rolee": null, "Sales": null, "Sales Orders": null, "Sales Team": null, "SalesOrderDetail": null, "SalesOrderHeader": null, "SalesOrderHeaderSalesReason": null, "SalesPerson": null, "SalesPersonQuotaHistory": null, "SalesReason": null, "SalesTaxRate": null, "SalesTerritory": null, "SalesTerritoryHistory": null, "Scoring": null, "ScoringSC": null, "ScoringShootout": null, "ScoringSup": null, "ScrapReason": null, "Season": null, "SeasonStatus": null, "SeriesPost": null, "Shift": null, "ShipMethod": null, "Shippers": null, "ShoppingCartItem": null, "SpecialOffer": null, "SpecialOfferProduct": null, "StateProvince": null, "Store": null, "Store Locations": null, "Suppliers": null, "Survey": null, "Team": null, "TeamSplits": null, "TeamVsTeam": null, "Teams": null, "TeamsHalf": null, "TeamsPost": null, "TeamsSC": null, "Tips": null, "Toss_Decision": null, "TransactionHistory": null, "TransactionHistoryArchive": null, "Umpire": null, "UnitMeasure": null, "Users": null, "Users_Compliments": null, "Vendor": null, "Venue": null, "Vote": null, "Ward": null, "Wicket_Taken": null, "Win_By": null, "WorkOrder": null, "WorkOrderRouting": null, "Years": null, "abbrev": null, "actor": null, "actors": null, "address": null, "address_status": null, "advisedBy": null, "alias": null, "all_prevalences": null, "allergies": null, "app_all": null, "app_events": null, "app_events_relevant": null, "app_labels": null, "area_code": null, "author": null, "authors": null, "avoid": null, "awards_coaches": null, "awards_players": null, "beers": null, "book": null, "book_author": null, "book_language": null, "bool": null, "borders": null, "breweries": null, "businesses": null, "callcenterlogs": null, "careplans": null, "cars": null, "categories": null, "category": null, "central_superstore": null, "chapters": null, "characters": null, "cites": null, "city": null, "claims": null, "client": null, "coaches": null, "coins": null, "competitor_event": null, "conditions": null, "congress": null, "content": null, "continent": null, "country": null, "course": null, "current": null, "current-terms": null, "cust_order": null, "customer": null, "customer_address": null, "customers": null, "data": null, "department": null, "desert": null, "director": null, "directors": null, "disabled": null, "discounts": null, "district": null, "divisions": null, "draft": null, "driver": null, "east_superstore": null, "economy": null, "employee": ["hire_date"], "employees": null, "encompasses": null, "encounters": null, "enlist": null, "enrolled": null, "establishment": null, "ethnicGroup": null, "event": null, "events": null, "events_relevant": null, "filed_for_bankrupcy": null, "film": null, "film_actor": null, "film_category": null, "film_text": null, "game": null, "game_platform": null, "game_publisher": null, "games": null, "games_city": null, "games_competitor": null, "gender": null, "gender_age": null, "gender_age_test": null, "gender_age_train": null, "generalinfo": null, "genre": null, "geo_desert": null, "geo_estuary": null, "geo_island": null, "geo_lake": null, "geo_mountain": null, "geo_river": null, "geo_sea": null, "geo_source": null, "geographic": null, "geolocation": null, "height_info": null, "historical": null, "historical-terms": null, "immunizations": null, "incidents": null, "inspection": null, "inspection_point": null, "inspections": null, "institution_details": null, "institution_grads": null, "inventory": null, "isMember": null, "island": null, "islandIn": null, "jobs": null, "keyword": null, "label_categories": null, "lake": null, "language": null, "language_role": null, "lineitem": null, "located": null, "locatedOn": null, "location": null, "longest_absense_from_school": null, "mailings3": null, "male": null, "matchs": null, "medal": null, "medications": null, "mergesWith": null, "mountain": null, "mountainOnIsland": null, "movie": null, "movie_cast": null, "movie_company": null, "movie_crew": null, "movie_genres": null, "movie_keywords": null, "movie_languages": null, "movies": null, "movies2actors": null, "movies2directors": null, "movies_total_gross": null, "nation": null, "no_payment_due": null, "noc_region": null, "observations": null, "officers": null, "offices": null, "order_history": null, "order_line": null, "order_status": null, "orderdetails": null, "orders": null, "organization": null, "paper": null, "paragraphs": null, "part": null, "partsupp": null, "patients": null, "payment": null, "payments": null, "people": null, "person": null, "person_region": null, "phone_brand_device_model2": null, "platform": null, "player_allstar": null, "players": null, "players_teams": null, "playstore": null, "podcasts": null, "politics": null, "population": null, "position": null, "price": null, "procedures": null, "product": null, "production": null, "production_company": null, "production_country": null, "productlines": null, "products": null, "prof": null, "province": null, "pub_info": null, "publisher": null, "publishers": null, "ranking_criteria": null, "ranking_system": null, "region": null, "region_sales": null, "registration": null, "relation": null, "religion": null, "rental": null, "revenue": null, "reviews": null, "river": null, "rootbeer": null, "rootbeerbrand": null, "rootbeerreview": null, "roysched": ["royalty", "title_id", "lorange", "hirange"], "runs": null, "sales": ["ord_date", "title_id", "qty", "stor_id", "ord_num", "payterms"], "sales_in_weather": null, "sample_submission": null, "sea": null, "series_post": null, "shipment": null, "shipping_method": null, "social-media": null, "south_superstore": null, "sport": null, "staff": null, "state": null, "state_sector_details": null, "state_sector_grads": null, "store": null, "stores": null, "student": null, "subjects": null, "supplier": null, "tags": null, "target": null, "taughtBy": null, "teams": null, "titleauthor": ["royaltyper", "title_id", "au_id", "au_ord"], "titles": ["royalty", "ytd_sales", "pubdate", "price", "title", "title_id", "type", "advance", "pub_id", "notes"], "torrents": null, "trains": null, "transaction": null, "truck": null, "twitter": null, "u2base": null, "unemployed": null, "university": null, "university_ranking_year": null, "university_year": null, "user": null, "user_reviews": null, "users": null, "violation": null, "violations": null, "voice-actors": null, "weather": null, "weight_info": null, "west_superstore": null, "works": null, "zip_congress": null, "zip_data": null} |
|
List all titles published in year 1991. Also provide notes details of the title and the publisher's name. | SELECT T1.title, T1.notes, T2.pub_name FROM titles AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id WHERE STRFTIME('%Y', T1.pubdate) = '1991' | book_publishing_company | 175 | [
"sales",
"roysched",
"titles",
"publishers",
"titleauthor",
"authors"
] | [
[
" CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ",
" CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL NOT NULL, FOREIGN KEY(stor_id) REFERENCES stores (stor_id) ) ",
" CREATE TABLE employee ( emp_id TEXT, fname TEXT NOT NULL, minit TEXT, lname TEXT NOT NULL, job_id INTEGER NOT NULL, job_lvl INTEGER, pub_id TEXT NOT NULL, hire_date DATETIME NOT NULL, PRIMARY KEY (emp_id), FOREIGN KEY(job_id) REFERENCES jobs (job_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE jobs ( job_id INTEGER, job_desc TEXT NOT NULL, min_lvl INTEGER NOT NULL, max_lvl INTEGER NOT NULL, PRIMARY KEY (job_id) ) ",
" CREATE TABLE pub_info ( pub_id TEXT, logo BLOB, pr_info TEXT, PRIMARY KEY (pub_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE publishers ( pub_id TEXT, pub_name TEXT, city TEXT, state TEXT, country TEXT, PRIMARY KEY (pub_id) ) ",
" CREATE TABLE roysched ( title_id TEXT NOT NULL, lorange INTEGER, hirange INTEGER, royalty INTEGER, FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE sales ( stor_id TEXT NOT NULL, ord_num TEXT NOT NULL, ord_date DATETIME NOT NULL, qty INTEGER NOT NULL, payterms TEXT NOT NULL, title_id TEXT NOT NULL, PRIMARY KEY (stor_id, ord_num, title_id), FOREIGN KEY(stor_id) REFERENCES stores (stor_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE stores ( stor_id TEXT, stor_name TEXT, stor_address TEXT, city TEXT, state TEXT, zip TEXT, PRIMARY KEY (stor_id) ) ",
" CREATE TABLE titleauthor ( au_id TEXT NOT NULL, title_id TEXT NOT NULL, au_ord INTEGER, royaltyper INTEGER, PRIMARY KEY (au_id, title_id), FOREIGN KEY(au_id) REFERENCES authors (au_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE titles ( title_id TEXT, title TEXT NOT NULL, type TEXT NOT NULL, pub_id TEXT, price REAL, advance REAL, royalty INTEGER, ytd_sales INTEGER, notes TEXT, pubdate DATETIME NOT NULL, PRIMARY KEY (title_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) "
]
] | [
[
" CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ",
" CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL NOT NULL, FOREIGN KEY(stor_id) REFERENCES stores (stor_id) ) ",
" CREATE TABLE employee ( emp_id TEXT, fname TEXT NOT NULL, minit TEXT, lname TEXT NOT NULL, job_id INTEGER NOT NULL, job_lvl INTEGER, pub_id TEXT NOT NULL, hire_date DATETIME NOT NULL, PRIMARY KEY (emp_id), FOREIGN KEY(job_id) REFERENCES jobs (job_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE jobs ( job_id INTEGER, job_desc TEXT NOT NULL, min_lvl INTEGER NOT NULL, max_lvl INTEGER NOT NULL, PRIMARY KEY (job_id) ) ",
" CREATE TABLE pub_info ( pub_id TEXT, logo BLOB, pr_info TEXT, PRIMARY KEY (pub_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE publishers ( pub_id TEXT, pub_name TEXT, city TEXT, state TEXT, country TEXT, PRIMARY KEY (pub_id) ) ",
" CREATE TABLE roysched ( title_id TEXT NOT NULL, lorange INTEGER, hirange INTEGER, royalty INTEGER, FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE sales ( stor_id TEXT NOT NULL, ord_num TEXT NOT NULL, ord_date DATETIME NOT NULL, qty INTEGER NOT NULL, payterms TEXT NOT NULL, title_id TEXT NOT NULL, PRIMARY KEY (stor_id, ord_num, title_id), FOREIGN KEY(stor_id) REFERENCES stores (stor_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE stores ( stor_id TEXT, stor_name TEXT, stor_address TEXT, city TEXT, state TEXT, zip TEXT, PRIMARY KEY (stor_id) ) ",
" CREATE TABLE titleauthor ( au_id TEXT NOT NULL, title_id TEXT NOT NULL, au_ord INTEGER, royaltyper INTEGER, PRIMARY KEY (au_id, title_id), FOREIGN KEY(au_id) REFERENCES authors (au_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE titles ( title_id TEXT, title TEXT NOT NULL, type TEXT NOT NULL, pub_id TEXT, price REAL, advance REAL, royalty INTEGER, ytd_sales INTEGER, notes TEXT, pubdate DATETIME NOT NULL, PRIMARY KEY (title_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) "
]
] | 11 | 11 | {"ATT_CLASSES": null, "Address": null, "AddressType": null, "Air Carriers": null, "Airlines": null, "Airports": null, "Answer": null, "Attributes": null, "Author": null, "Award": null, "AwardsCoaches": null, "AwardsMisc": null, "AwardsPlayers": null, "Ball_by_Ball": null, "Batsman_Scored": null, "Batting_Style": null, "BillOfMaterials": null, "Bowling_Style": null, "Business": null, "BusinessEntity": null, "BusinessEntityAddress": null, "BusinessEntityContact": null, "Business_Attributes": null, "Business_Categories": null, "Business_Hours": null, "CBSA": null, "Categories": null, "Character_Award": null, "Checkins": null, "City": null, "Classification": null, "Coaches": null, "CombinedShutouts": null, "Community_Area": null, "Compliments": null, "Conference": null, "ContactType": null, "Country": null, "CountryLanguage": null, "CountryRegion": null, "CountryRegionCurrency": null, "Credit": null, "CreditCard": null, "Crime": null, "Culture": null, "Currency": null, "CurrencyRate": null, "Customer": null, "Customers": null, "Days": null, "Demog": null, "Department": null, "Dish": null, "District": null, "Document": null, "Elite": null, "EmailAddress": null, "Employee": null, "EmployeeDepartmentHistory": null, "EmployeePayHistory": null, "Employees": null, "Episode": null, "Extra_Runs": null, "Extra_Type": null, "FBI_Code": null, "Genes": null, "Goalies": null, "GoaliesSC": null, "GoaliesShootout": null, "HOF": null, "IMG_OBJ": null, "IMG_OBJ_ATT": null, "IMG_REL": null, "IUCR": null, "Ingredient": null, "Interactions": null, "JobCandidate": null, "Journal": null, "Keyword": null, "Location": null, "Mailings1_2": null, "Master": null, "Match": null, "Menu": null, "MenuItem": null, "MenuPage": null, "Neighborhood": null, "Nutrition": null, "OBJ_CLASSES": null, "OrderDetails": null, "Orders": null, "Out_Type": null, "Outcome": null, "PRED_CLASSES": null, "Paper": null, "PaperAuthor": null, "Password": null, "Person": null, "PersonCreditCard": null, "PhoneNumberType": null, "Player": null, "PlayerInfo": null, "Player_Match": null, "Product": null, "ProductCategory": null, "ProductCostHistory": null, "ProductDescription": null, "ProductDocument": null, "ProductInventory": null, "ProductListPriceHistory": null, "ProductModel": null, "ProductModelProductDescriptionCulture": null, "ProductPhoto": null, "ProductProductPhoto": null, "ProductReview": null, "ProductSubcategory": null, "ProductVendor": null, "Products": null, "PurchaseOrderDetail": null, "PurchaseOrderHeader": null, "Quantity": null, "Question": null, "RA": null, "Recipe": null, "Regions": null, "Reviews": null, "Rolee": null, "Sales": null, "Sales Orders": null, "Sales Team": null, "SalesOrderDetail": null, "SalesOrderHeader": null, "SalesOrderHeaderSalesReason": null, "SalesPerson": null, "SalesPersonQuotaHistory": null, "SalesReason": null, "SalesTaxRate": null, "SalesTerritory": null, "SalesTerritoryHistory": null, "Scoring": null, "ScoringSC": null, "ScoringShootout": null, "ScoringSup": null, "ScrapReason": null, "Season": null, "SeasonStatus": null, "SeriesPost": null, "Shift": null, "ShipMethod": null, "Shippers": null, "ShoppingCartItem": null, "SpecialOffer": null, "SpecialOfferProduct": null, "StateProvince": null, "Store": null, "Store Locations": null, "Suppliers": null, "Survey": null, "Team": null, "TeamSplits": null, "TeamVsTeam": null, "Teams": null, "TeamsHalf": null, "TeamsPost": null, "TeamsSC": null, "Tips": null, "Toss_Decision": null, "TransactionHistory": null, "TransactionHistoryArchive": null, "Umpire": null, "UnitMeasure": null, "Users": null, "Users_Compliments": null, "Vendor": null, "Venue": null, "Vote": null, "Ward": null, "Wicket_Taken": null, "Win_By": null, "WorkOrder": null, "WorkOrderRouting": null, "Years": null, "abbrev": null, "actor": null, "actors": null, "address": null, "address_status": null, "advisedBy": null, "alias": null, "all_prevalences": null, "allergies": null, "app_all": null, "app_events": null, "app_events_relevant": null, "app_labels": null, "area_code": null, "author": null, "authors": null, "avoid": null, "awards_coaches": null, "awards_players": null, "beers": null, "book": null, "book_author": null, "book_language": null, "bool": null, "borders": null, "breweries": null, "businesses": null, "callcenterlogs": null, "careplans": null, "cars": null, "categories": null, "category": null, "central_superstore": null, "chapters": null, "characters": null, "cites": null, "city": null, "claims": null, "client": null, "coaches": null, "coins": null, "competitor_event": null, "conditions": null, "congress": null, "content": null, "continent": null, "country": null, "course": null, "current": null, "current-terms": null, "cust_order": null, "customer": null, "customer_address": null, "customers": null, "data": null, "department": null, "desert": null, "director": null, "directors": null, "disabled": null, "discounts": null, "district": null, "divisions": null, "draft": null, "driver": null, "east_superstore": null, "economy": null, "employee": null, "employees": null, "encompasses": null, "encounters": null, "enlist": null, "enrolled": null, "establishment": null, "ethnicGroup": null, "event": null, "events": null, "events_relevant": null, "filed_for_bankrupcy": null, "film": null, "film_actor": null, "film_category": null, "film_text": null, "game": null, "game_platform": null, "game_publisher": null, "games": null, "games_city": null, "games_competitor": null, "gender": null, "gender_age": null, "gender_age_test": null, "gender_age_train": null, "generalinfo": null, "genre": null, "geo_desert": null, "geo_estuary": null, "geo_island": null, "geo_lake": null, "geo_mountain": null, "geo_river": null, "geo_sea": null, "geo_source": null, "geographic": null, "geolocation": null, "height_info": null, "historical": null, "historical-terms": null, "immunizations": null, "incidents": null, "inspection": null, "inspection_point": null, "inspections": null, "institution_details": null, "institution_grads": null, "inventory": null, "isMember": null, "island": null, "islandIn": null, "jobs": null, "keyword": null, "label_categories": null, "lake": null, "language": null, "language_role": null, "lineitem": null, "located": null, "locatedOn": null, "location": null, "longest_absense_from_school": null, "mailings3": null, "male": null, "matchs": null, "medal": null, "medications": null, "mergesWith": null, "mountain": null, "mountainOnIsland": null, "movie": null, "movie_cast": null, "movie_company": null, "movie_crew": null, "movie_genres": null, "movie_keywords": null, "movie_languages": null, "movies": null, "movies2actors": null, "movies2directors": null, "movies_total_gross": null, "nation": null, "no_payment_due": null, "noc_region": null, "observations": null, "officers": null, "offices": null, "order_history": null, "order_line": null, "order_status": null, "orderdetails": null, "orders": null, "organization": null, "paper": null, "paragraphs": null, "part": null, "partsupp": null, "patients": null, "payment": null, "payments": null, "people": null, "person": null, "person_region": null, "phone_brand_device_model2": null, "platform": null, "player_allstar": null, "players": null, "players_teams": null, "playstore": null, "podcasts": null, "politics": null, "population": null, "position": null, "price": null, "procedures": null, "product": null, "production": null, "production_company": null, "production_country": null, "productlines": null, "products": null, "prof": null, "province": null, "pub_info": null, "publisher": null, "publishers": ["city", "state", "pub_name", "pub_id", "country"], "ranking_criteria": null, "ranking_system": null, "region": null, "region_sales": null, "registration": null, "relation": null, "religion": null, "rental": null, "revenue": null, "reviews": null, "river": null, "rootbeer": null, "rootbeerbrand": null, "rootbeerreview": null, "roysched": ["title_id", "royalty", "hirange"], "runs": null, "sales": ["title_id", "stor_id", "ord_date", "payterms", "qty"], "sales_in_weather": null, "sample_submission": null, "sea": null, "series_post": null, "shipment": null, "shipping_method": null, "social-media": null, "south_superstore": null, "sport": null, "staff": null, "state": null, "state_sector_details": null, "state_sector_grads": null, "store": null, "stores": null, "student": null, "subjects": null, "supplier": null, "tags": null, "target": null, "taughtBy": null, "teams": null, "titleauthor": ["title_id", "royaltyper", "au_id", "au_ord"], "titles": ["notes", "ytd_sales", "type", "title", "pubdate", "title_id", "pub_id", "royalty", "price", "advance"], "torrents": null, "trains": null, "transaction": null, "truck": null, "twitter": null, "u2base": null, "unemployed": null, "university": null, "university_ranking_year": null, "university_year": null, "user": null, "user_reviews": null, "users": null, "violation": null, "violations": null, "voice-actors": null, "weather": null, "weight_info": null, "west_superstore": null, "works": null, "zip_congress": null, "zip_data": null} |
|
List all titles with sales of quantity more than 20 and store located in the CA state. | SELECT T1.title, T2.qty FROM titles AS T1 INNER JOIN sales AS T2 ON T1.title_id = T2.title_id INNER JOIN stores AS T3 ON T2.stor_id = T3.stor_id WHERE T2.qty > 20 AND T3.state = 'CA' | book_publishing_company | 176 | [
"sales",
"stores",
"titles",
"publishers",
"titleauthor",
"discounts"
] | [
[
" CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ",
" CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL NOT NULL, FOREIGN KEY(stor_id) REFERENCES stores (stor_id) ) ",
" CREATE TABLE employee ( emp_id TEXT, fname TEXT NOT NULL, minit TEXT, lname TEXT NOT NULL, job_id INTEGER NOT NULL, job_lvl INTEGER, pub_id TEXT NOT NULL, hire_date DATETIME NOT NULL, PRIMARY KEY (emp_id), FOREIGN KEY(job_id) REFERENCES jobs (job_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE jobs ( job_id INTEGER, job_desc TEXT NOT NULL, min_lvl INTEGER NOT NULL, max_lvl INTEGER NOT NULL, PRIMARY KEY (job_id) ) ",
" CREATE TABLE pub_info ( pub_id TEXT, logo BLOB, pr_info TEXT, PRIMARY KEY (pub_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE publishers ( pub_id TEXT, pub_name TEXT, city TEXT, state TEXT, country TEXT, PRIMARY KEY (pub_id) ) ",
" CREATE TABLE roysched ( title_id TEXT NOT NULL, lorange INTEGER, hirange INTEGER, royalty INTEGER, FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE sales ( stor_id TEXT NOT NULL, ord_num TEXT NOT NULL, ord_date DATETIME NOT NULL, qty INTEGER NOT NULL, payterms TEXT NOT NULL, title_id TEXT NOT NULL, PRIMARY KEY (stor_id, ord_num, title_id), FOREIGN KEY(stor_id) REFERENCES stores (stor_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE stores ( stor_id TEXT, stor_name TEXT, stor_address TEXT, city TEXT, state TEXT, zip TEXT, PRIMARY KEY (stor_id) ) ",
" CREATE TABLE titleauthor ( au_id TEXT NOT NULL, title_id TEXT NOT NULL, au_ord INTEGER, royaltyper INTEGER, PRIMARY KEY (au_id, title_id), FOREIGN KEY(au_id) REFERENCES authors (au_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE titles ( title_id TEXT, title TEXT NOT NULL, type TEXT NOT NULL, pub_id TEXT, price REAL, advance REAL, royalty INTEGER, ytd_sales INTEGER, notes TEXT, pubdate DATETIME NOT NULL, PRIMARY KEY (title_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) "
]
] | [
[
" CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ",
" CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL NOT NULL, FOREIGN KEY(stor_id) REFERENCES stores (stor_id) ) ",
" CREATE TABLE employee ( emp_id TEXT, fname TEXT NOT NULL, minit TEXT, lname TEXT NOT NULL, job_id INTEGER NOT NULL, job_lvl INTEGER, pub_id TEXT NOT NULL, hire_date DATETIME NOT NULL, PRIMARY KEY (emp_id), FOREIGN KEY(job_id) REFERENCES jobs (job_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE jobs ( job_id INTEGER, job_desc TEXT NOT NULL, min_lvl INTEGER NOT NULL, max_lvl INTEGER NOT NULL, PRIMARY KEY (job_id) ) ",
" CREATE TABLE pub_info ( pub_id TEXT, logo BLOB, pr_info TEXT, PRIMARY KEY (pub_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE publishers ( pub_id TEXT, pub_name TEXT, city TEXT, state TEXT, country TEXT, PRIMARY KEY (pub_id) ) ",
" CREATE TABLE roysched ( title_id TEXT NOT NULL, lorange INTEGER, hirange INTEGER, royalty INTEGER, FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE sales ( stor_id TEXT NOT NULL, ord_num TEXT NOT NULL, ord_date DATETIME NOT NULL, qty INTEGER NOT NULL, payterms TEXT NOT NULL, title_id TEXT NOT NULL, PRIMARY KEY (stor_id, ord_num, title_id), FOREIGN KEY(stor_id) REFERENCES stores (stor_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE stores ( stor_id TEXT, stor_name TEXT, stor_address TEXT, city TEXT, state TEXT, zip TEXT, PRIMARY KEY (stor_id) ) ",
" CREATE TABLE titleauthor ( au_id TEXT NOT NULL, title_id TEXT NOT NULL, au_ord INTEGER, royaltyper INTEGER, PRIMARY KEY (au_id, title_id), FOREIGN KEY(au_id) REFERENCES authors (au_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE titles ( title_id TEXT, title TEXT NOT NULL, type TEXT NOT NULL, pub_id TEXT, price REAL, advance REAL, royalty INTEGER, ytd_sales INTEGER, notes TEXT, pubdate DATETIME NOT NULL, PRIMARY KEY (title_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) "
]
] | 11 | 11 | {"ATT_CLASSES": null, "Address": null, "AddressType": null, "Air Carriers": null, "Airlines": null, "Airports": null, "Answer": null, "Attributes": null, "Author": null, "Award": null, "AwardsCoaches": null, "AwardsMisc": null, "AwardsPlayers": null, "Ball_by_Ball": null, "Batsman_Scored": null, "Batting_Style": null, "BillOfMaterials": null, "Bowling_Style": null, "Business": null, "BusinessEntity": null, "BusinessEntityAddress": null, "BusinessEntityContact": null, "Business_Attributes": null, "Business_Categories": null, "Business_Hours": null, "CBSA": null, "Categories": null, "Character_Award": null, "Checkins": null, "City": null, "Classification": null, "Coaches": null, "CombinedShutouts": null, "Community_Area": null, "Compliments": null, "Conference": null, "ContactType": null, "Country": null, "CountryLanguage": null, "CountryRegion": null, "CountryRegionCurrency": null, "Credit": null, "CreditCard": null, "Crime": null, "Culture": null, "Currency": null, "CurrencyRate": null, "Customer": null, "Customers": null, "Days": null, "Demog": null, "Department": null, "Dish": null, "District": null, "Document": null, "Elite": null, "EmailAddress": null, "Employee": null, "EmployeeDepartmentHistory": null, "EmployeePayHistory": null, "Employees": null, "Episode": null, "Extra_Runs": null, "Extra_Type": null, "FBI_Code": null, "Genes": null, "Goalies": null, "GoaliesSC": null, "GoaliesShootout": null, "HOF": null, "IMG_OBJ": null, "IMG_OBJ_ATT": null, "IMG_REL": null, "IUCR": null, "Ingredient": null, "Interactions": null, "JobCandidate": null, "Journal": null, "Keyword": null, "Location": null, "Mailings1_2": null, "Master": null, "Match": null, "Menu": null, "MenuItem": null, "MenuPage": null, "Neighborhood": null, "Nutrition": null, "OBJ_CLASSES": null, "OrderDetails": null, "Orders": null, "Out_Type": null, "Outcome": null, "PRED_CLASSES": null, "Paper": null, "PaperAuthor": null, "Password": null, "Person": null, "PersonCreditCard": null, "PhoneNumberType": null, "Player": null, "PlayerInfo": null, "Player_Match": null, "Product": null, "ProductCategory": null, "ProductCostHistory": null, "ProductDescription": null, "ProductDocument": null, "ProductInventory": null, "ProductListPriceHistory": null, "ProductModel": null, "ProductModelProductDescriptionCulture": null, "ProductPhoto": null, "ProductProductPhoto": null, "ProductReview": null, "ProductSubcategory": null, "ProductVendor": null, "Products": null, "PurchaseOrderDetail": null, "PurchaseOrderHeader": null, "Quantity": null, "Question": null, "RA": null, "Recipe": null, "Regions": null, "Reviews": null, "Rolee": null, "Sales": null, "Sales Orders": null, "Sales Team": null, "SalesOrderDetail": null, "SalesOrderHeader": null, "SalesOrderHeaderSalesReason": null, "SalesPerson": null, "SalesPersonQuotaHistory": null, "SalesReason": null, "SalesTaxRate": null, "SalesTerritory": null, "SalesTerritoryHistory": null, "Scoring": null, "ScoringSC": null, "ScoringShootout": null, "ScoringSup": null, "ScrapReason": null, "Season": null, "SeasonStatus": null, "SeriesPost": null, "Shift": null, "ShipMethod": null, "Shippers": null, "ShoppingCartItem": null, "SpecialOffer": null, "SpecialOfferProduct": null, "StateProvince": null, "Store": null, "Store Locations": null, "Suppliers": null, "Survey": null, "Team": null, "TeamSplits": null, "TeamVsTeam": null, "Teams": null, "TeamsHalf": null, "TeamsPost": null, "TeamsSC": null, "Tips": null, "Toss_Decision": null, "TransactionHistory": null, "TransactionHistoryArchive": null, "Umpire": null, "UnitMeasure": null, "Users": null, "Users_Compliments": null, "Vendor": null, "Venue": null, "Vote": null, "Ward": null, "Wicket_Taken": null, "Win_By": null, "WorkOrder": null, "WorkOrderRouting": null, "Years": null, "abbrev": null, "actor": null, "actors": null, "address": null, "address_status": null, "advisedBy": null, "alias": null, "all_prevalences": null, "allergies": null, "app_all": null, "app_events": null, "app_events_relevant": null, "app_labels": null, "area_code": null, "author": null, "authors": null, "avoid": null, "awards_coaches": null, "awards_players": null, "beers": null, "book": null, "book_author": null, "book_language": null, "bool": null, "borders": null, "breweries": null, "businesses": null, "callcenterlogs": null, "careplans": null, "cars": null, "categories": null, "category": null, "central_superstore": null, "chapters": null, "characters": null, "cites": null, "city": null, "claims": null, "client": null, "coaches": null, "coins": null, "competitor_event": null, "conditions": null, "congress": null, "content": null, "continent": null, "country": null, "course": null, "current": null, "current-terms": null, "cust_order": null, "customer": null, "customer_address": null, "customers": null, "data": null, "department": null, "desert": null, "director": null, "directors": null, "disabled": null, "discounts": null, "district": null, "divisions": null, "draft": null, "driver": null, "east_superstore": null, "economy": null, "employee": null, "employees": null, "encompasses": null, "encounters": null, "enlist": null, "enrolled": null, "establishment": null, "ethnicGroup": null, "event": null, "events": null, "events_relevant": null, "filed_for_bankrupcy": null, "film": null, "film_actor": null, "film_category": null, "film_text": null, "game": null, "game_platform": null, "game_publisher": null, "games": null, "games_city": null, "games_competitor": null, "gender": null, "gender_age": null, "gender_age_test": null, "gender_age_train": null, "generalinfo": null, "genre": null, "geo_desert": null, "geo_estuary": null, "geo_island": null, "geo_lake": null, "geo_mountain": null, "geo_river": null, "geo_sea": null, "geo_source": null, "geographic": null, "geolocation": null, "height_info": null, "historical": null, "historical-terms": null, "immunizations": null, "incidents": null, "inspection": null, "inspection_point": null, "inspections": null, "institution_details": null, "institution_grads": null, "inventory": null, "isMember": null, "island": null, "islandIn": null, "jobs": null, "keyword": null, "label_categories": null, "lake": null, "language": null, "language_role": null, "lineitem": null, "located": null, "locatedOn": null, "location": null, "longest_absense_from_school": null, "mailings3": null, "male": null, "matchs": null, "medal": null, "medications": null, "mergesWith": null, "mountain": null, "mountainOnIsland": null, "movie": null, "movie_cast": null, "movie_company": null, "movie_crew": null, "movie_genres": null, "movie_keywords": null, "movie_languages": null, "movies": null, "movies2actors": null, "movies2directors": null, "movies_total_gross": null, "nation": null, "no_payment_due": null, "noc_region": null, "observations": null, "officers": null, "offices": null, "order_history": null, "order_line": null, "order_status": null, "orderdetails": null, "orders": null, "organization": null, "paper": null, "paragraphs": null, "part": null, "partsupp": null, "patients": null, "payment": null, "payments": null, "people": null, "person": null, "person_region": null, "phone_brand_device_model2": null, "platform": null, "player_allstar": null, "players": null, "players_teams": null, "playstore": null, "podcasts": null, "politics": null, "population": null, "position": null, "price": null, "procedures": null, "product": null, "production": null, "production_company": null, "production_country": null, "productlines": null, "products": null, "prof": null, "province": null, "pub_info": null, "publisher": null, "publishers": ["state", "city", "country", "pub_id", "pub_name"], "ranking_criteria": null, "ranking_system": null, "region": null, "region_sales": null, "registration": null, "relation": null, "religion": null, "rental": null, "revenue": null, "reviews": null, "river": null, "rootbeer": null, "rootbeerbrand": null, "rootbeerreview": null, "roysched": null, "runs": null, "sales": ["title_id", "stor_id", "ord_num", "qty", "payterms", "ord_date"], "sales_in_weather": null, "sample_submission": null, "sea": null, "series_post": null, "shipment": null, "shipping_method": null, "social-media": null, "south_superstore": null, "sport": null, "staff": null, "state": null, "state_sector_details": null, "state_sector_grads": null, "store": null, "stores": ["state", "city", "stor_name", "stor_id", "stor_address", "zip"], "student": null, "subjects": null, "supplier": null, "tags": null, "target": null, "taughtBy": null, "teams": null, "titleauthor": ["royaltyper", "au_ord", "title_id", "au_id"], "titles": ["ytd_sales", "price", "type", "title", "title_id", "pub_id", "royalty", "advance", "pubdate", "notes"], "torrents": null, "trains": null, "transaction": null, "truck": null, "twitter": null, "u2base": null, "unemployed": null, "university": null, "university_ranking_year": null, "university_year": null, "user": null, "user_reviews": null, "users": null, "violation": null, "violations": null, "voice-actors": null, "weather": null, "weight_info": null, "west_superstore": null, "works": null, "zip_congress": null, "zip_data": null} |
|
Name the store with the highest quantity in sales? What is the least quantity title from the store's sale? | SELECT T3.stor_id, T2.title FROM sales AS T1 INNER JOIN titles AS T2 ON T1.title_id = T2.title_id INNER JOIN stores AS T3 ON T3.stor_id = T1.stor_id WHERE T3.stor_id = ( SELECT stor_id FROM sales GROUP BY stor_id ORDER BY SUM(qty) DESC LIMIT 1 ) GROUP BY T3.stor_id, T2.title ORDER BY SUM(T1.qty) ASC LIMIT 1 | book_publishing_company | 177 | [
"sales",
"stores",
"roysched",
"titles",
"titleauthor",
"discounts"
] | [
[
" CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ",
" CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL NOT NULL, FOREIGN KEY(stor_id) REFERENCES stores (stor_id) ) ",
" CREATE TABLE employee ( emp_id TEXT, fname TEXT NOT NULL, minit TEXT, lname TEXT NOT NULL, job_id INTEGER NOT NULL, job_lvl INTEGER, pub_id TEXT NOT NULL, hire_date DATETIME NOT NULL, PRIMARY KEY (emp_id), FOREIGN KEY(job_id) REFERENCES jobs (job_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE jobs ( job_id INTEGER, job_desc TEXT NOT NULL, min_lvl INTEGER NOT NULL, max_lvl INTEGER NOT NULL, PRIMARY KEY (job_id) ) ",
" CREATE TABLE pub_info ( pub_id TEXT, logo BLOB, pr_info TEXT, PRIMARY KEY (pub_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE publishers ( pub_id TEXT, pub_name TEXT, city TEXT, state TEXT, country TEXT, PRIMARY KEY (pub_id) ) ",
" CREATE TABLE roysched ( title_id TEXT NOT NULL, lorange INTEGER, hirange INTEGER, royalty INTEGER, FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE sales ( stor_id TEXT NOT NULL, ord_num TEXT NOT NULL, ord_date DATETIME NOT NULL, qty INTEGER NOT NULL, payterms TEXT NOT NULL, title_id TEXT NOT NULL, PRIMARY KEY (stor_id, ord_num, title_id), FOREIGN KEY(stor_id) REFERENCES stores (stor_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE stores ( stor_id TEXT, stor_name TEXT, stor_address TEXT, city TEXT, state TEXT, zip TEXT, PRIMARY KEY (stor_id) ) ",
" CREATE TABLE titleauthor ( au_id TEXT NOT NULL, title_id TEXT NOT NULL, au_ord INTEGER, royaltyper INTEGER, PRIMARY KEY (au_id, title_id), FOREIGN KEY(au_id) REFERENCES authors (au_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE titles ( title_id TEXT, title TEXT NOT NULL, type TEXT NOT NULL, pub_id TEXT, price REAL, advance REAL, royalty INTEGER, ytd_sales INTEGER, notes TEXT, pubdate DATETIME NOT NULL, PRIMARY KEY (title_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) "
]
] | [
[
" CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ",
" CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL NOT NULL, FOREIGN KEY(stor_id) REFERENCES stores (stor_id) ) ",
" CREATE TABLE employee ( emp_id TEXT, fname TEXT NOT NULL, minit TEXT, lname TEXT NOT NULL, job_id INTEGER NOT NULL, job_lvl INTEGER, pub_id TEXT NOT NULL, hire_date DATETIME NOT NULL, PRIMARY KEY (emp_id), FOREIGN KEY(job_id) REFERENCES jobs (job_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE jobs ( job_id INTEGER, job_desc TEXT NOT NULL, min_lvl INTEGER NOT NULL, max_lvl INTEGER NOT NULL, PRIMARY KEY (job_id) ) ",
" CREATE TABLE pub_info ( pub_id TEXT, logo BLOB, pr_info TEXT, PRIMARY KEY (pub_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE publishers ( pub_id TEXT, pub_name TEXT, city TEXT, state TEXT, country TEXT, PRIMARY KEY (pub_id) ) ",
" CREATE TABLE roysched ( title_id TEXT NOT NULL, lorange INTEGER, hirange INTEGER, royalty INTEGER, FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE sales ( stor_id TEXT NOT NULL, ord_num TEXT NOT NULL, ord_date DATETIME NOT NULL, qty INTEGER NOT NULL, payterms TEXT NOT NULL, title_id TEXT NOT NULL, PRIMARY KEY (stor_id, ord_num, title_id), FOREIGN KEY(stor_id) REFERENCES stores (stor_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE stores ( stor_id TEXT, stor_name TEXT, stor_address TEXT, city TEXT, state TEXT, zip TEXT, PRIMARY KEY (stor_id) ) ",
" CREATE TABLE titleauthor ( au_id TEXT NOT NULL, title_id TEXT NOT NULL, au_ord INTEGER, royaltyper INTEGER, PRIMARY KEY (au_id, title_id), FOREIGN KEY(au_id) REFERENCES authors (au_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE titles ( title_id TEXT, title TEXT NOT NULL, type TEXT NOT NULL, pub_id TEXT, price REAL, advance REAL, royalty INTEGER, ytd_sales INTEGER, notes TEXT, pubdate DATETIME NOT NULL, PRIMARY KEY (title_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) "
]
] | 11 | 11 | {"ATT_CLASSES": null, "Address": null, "AddressType": null, "Air Carriers": null, "Airlines": null, "Airports": null, "Answer": null, "Attributes": null, "Author": null, "Award": null, "AwardsCoaches": null, "AwardsMisc": null, "AwardsPlayers": null, "Ball_by_Ball": null, "Batsman_Scored": null, "Batting_Style": null, "BillOfMaterials": null, "Bowling_Style": null, "Business": null, "BusinessEntity": null, "BusinessEntityAddress": null, "BusinessEntityContact": null, "Business_Attributes": null, "Business_Categories": null, "Business_Hours": null, "CBSA": null, "Categories": null, "Character_Award": null, "Checkins": null, "City": null, "Classification": null, "Coaches": null, "CombinedShutouts": null, "Community_Area": null, "Compliments": null, "Conference": null, "ContactType": null, "Country": null, "CountryLanguage": null, "CountryRegion": null, "CountryRegionCurrency": null, "Credit": null, "CreditCard": null, "Crime": null, "Culture": null, "Currency": null, "CurrencyRate": null, "Customer": null, "Customers": null, "Days": null, "Demog": null, "Department": null, "Dish": null, "District": null, "Document": null, "Elite": null, "EmailAddress": null, "Employee": null, "EmployeeDepartmentHistory": null, "EmployeePayHistory": null, "Employees": null, "Episode": null, "Extra_Runs": null, "Extra_Type": null, "FBI_Code": null, "Genes": null, "Goalies": null, "GoaliesSC": null, "GoaliesShootout": null, "HOF": null, "IMG_OBJ": null, "IMG_OBJ_ATT": null, "IMG_REL": null, "IUCR": null, "Ingredient": null, "Interactions": null, "JobCandidate": null, "Journal": null, "Keyword": null, "Location": null, "Mailings1_2": null, "Master": null, "Match": null, "Menu": null, "MenuItem": null, "MenuPage": null, "Neighborhood": null, "Nutrition": null, "OBJ_CLASSES": null, "OrderDetails": null, "Orders": null, "Out_Type": null, "Outcome": null, "PRED_CLASSES": null, "Paper": null, "PaperAuthor": null, "Password": null, "Person": null, "PersonCreditCard": null, "PhoneNumberType": null, "Player": null, "PlayerInfo": null, "Player_Match": null, "Product": null, "ProductCategory": null, "ProductCostHistory": null, "ProductDescription": null, "ProductDocument": null, "ProductInventory": null, "ProductListPriceHistory": null, "ProductModel": null, "ProductModelProductDescriptionCulture": null, "ProductPhoto": null, "ProductProductPhoto": null, "ProductReview": null, "ProductSubcategory": null, "ProductVendor": null, "Products": null, "PurchaseOrderDetail": null, "PurchaseOrderHeader": null, "Quantity": null, "Question": null, "RA": null, "Recipe": null, "Regions": null, "Reviews": null, "Rolee": null, "Sales": null, "Sales Orders": null, "Sales Team": null, "SalesOrderDetail": null, "SalesOrderHeader": null, "SalesOrderHeaderSalesReason": null, "SalesPerson": null, "SalesPersonQuotaHistory": null, "SalesReason": null, "SalesTaxRate": null, "SalesTerritory": null, "SalesTerritoryHistory": null, "Scoring": null, "ScoringSC": null, "ScoringShootout": null, "ScoringSup": null, "ScrapReason": null, "Season": null, "SeasonStatus": null, "SeriesPost": null, "Shift": null, "ShipMethod": null, "Shippers": null, "ShoppingCartItem": null, "SpecialOffer": null, "SpecialOfferProduct": null, "StateProvince": null, "Store": null, "Store Locations": null, "Suppliers": null, "Survey": null, "Team": null, "TeamSplits": null, "TeamVsTeam": null, "Teams": null, "TeamsHalf": null, "TeamsPost": null, "TeamsSC": null, "Tips": null, "Toss_Decision": null, "TransactionHistory": null, "TransactionHistoryArchive": null, "Umpire": null, "UnitMeasure": null, "Users": null, "Users_Compliments": null, "Vendor": null, "Venue": null, "Vote": null, "Ward": null, "Wicket_Taken": null, "Win_By": null, "WorkOrder": null, "WorkOrderRouting": null, "Years": null, "abbrev": null, "actor": null, "actors": null, "address": null, "address_status": null, "advisedBy": null, "alias": null, "all_prevalences": null, "allergies": null, "app_all": null, "app_events": null, "app_events_relevant": null, "app_labels": null, "area_code": null, "author": null, "authors": null, "avoid": null, "awards_coaches": null, "awards_players": null, "beers": null, "book": null, "book_author": null, "book_language": null, "bool": null, "borders": null, "breweries": null, "businesses": null, "callcenterlogs": null, "careplans": null, "cars": null, "categories": null, "category": null, "central_superstore": null, "chapters": null, "characters": null, "cites": null, "city": null, "claims": null, "client": null, "coaches": null, "coins": null, "competitor_event": null, "conditions": null, "congress": null, "content": null, "continent": null, "country": null, "course": null, "current": null, "current-terms": null, "cust_order": null, "customer": null, "customer_address": null, "customers": null, "data": null, "department": null, "desert": null, "director": null, "directors": null, "disabled": null, "discounts": ["highqty", "lowqty", "discount", "discounttype", "stor_id"], "district": null, "divisions": null, "draft": null, "driver": null, "east_superstore": null, "economy": null, "employee": null, "employees": null, "encompasses": null, "encounters": null, "enlist": null, "enrolled": null, "establishment": null, "ethnicGroup": null, "event": null, "events": null, "events_relevant": null, "filed_for_bankrupcy": null, "film": null, "film_actor": null, "film_category": null, "film_text": null, "game": null, "game_platform": null, "game_publisher": null, "games": null, "games_city": null, "games_competitor": null, "gender": null, "gender_age": null, "gender_age_test": null, "gender_age_train": null, "generalinfo": null, "genre": null, "geo_desert": null, "geo_estuary": null, "geo_island": null, "geo_lake": null, "geo_mountain": null, "geo_river": null, "geo_sea": null, "geo_source": null, "geographic": null, "geolocation": null, "height_info": null, "historical": null, "historical-terms": null, "immunizations": null, "incidents": null, "inspection": null, "inspection_point": null, "inspections": null, "institution_details": null, "institution_grads": null, "inventory": null, "isMember": null, "island": null, "islandIn": null, "jobs": null, "keyword": null, "label_categories": null, "lake": null, "language": null, "language_role": null, "lineitem": null, "located": null, "locatedOn": null, "location": null, "longest_absense_from_school": null, "mailings3": null, "male": null, "matchs": null, "medal": null, "medications": null, "mergesWith": null, "mountain": null, "mountainOnIsland": null, "movie": null, "movie_cast": null, "movie_company": null, "movie_crew": null, "movie_genres": null, "movie_keywords": null, "movie_languages": null, "movies": null, "movies2actors": null, "movies2directors": null, "movies_total_gross": null, "nation": null, "no_payment_due": null, "noc_region": null, "observations": null, "officers": null, "offices": null, "order_history": null, "order_line": null, "order_status": null, "orderdetails": null, "orders": null, "organization": null, "paper": null, "paragraphs": null, "part": null, "partsupp": null, "patients": null, "payment": null, "payments": null, "people": null, "person": null, "person_region": null, "phone_brand_device_model2": null, "platform": null, "player_allstar": null, "players": null, "players_teams": null, "playstore": null, "podcasts": null, "politics": null, "population": null, "position": null, "price": null, "procedures": null, "product": null, "production": null, "production_company": null, "production_country": null, "productlines": null, "products": null, "prof": null, "province": null, "pub_info": null, "publisher": null, "publishers": null, "ranking_criteria": null, "ranking_system": null, "region": null, "region_sales": null, "registration": null, "relation": null, "religion": null, "rental": null, "revenue": null, "reviews": null, "river": null, "rootbeer": null, "rootbeerbrand": null, "rootbeerreview": null, "roysched": ["title_id", "royalty", "hirange", "lorange"], "runs": null, "sales": ["title_id", "ord_num", "qty", "stor_id", "ord_date", "payterms"], "sales_in_weather": null, "sample_submission": null, "sea": null, "series_post": null, "shipment": null, "shipping_method": null, "social-media": null, "south_superstore": null, "sport": null, "staff": null, "state": null, "state_sector_details": null, "state_sector_grads": null, "store": null, "stores": ["stor_name", "city", "stor_id", "state", "zip", "stor_address"], "student": null, "subjects": null, "supplier": null, "tags": null, "target": null, "taughtBy": null, "teams": null, "titleauthor": null, "titles": ["ytd_sales", "price", "type", "title", "title_id", "advance", "royalty", "pub_id", "pubdate", "notes"], "torrents": null, "trains": null, "transaction": null, "truck": null, "twitter": null, "u2base": null, "unemployed": null, "university": null, "university_ranking_year": null, "university_year": null, "user": null, "user_reviews": null, "users": null, "violation": null, "violations": null, "voice-actors": null, "weather": null, "weight_info": null, "west_superstore": null, "works": null, "zip_congress": null, "zip_data": null} |
|
Name the title and publisher for title ID BU 2075. Provide all the royalty percentage for all ranges. | SELECT T1.title, T3.pub_name, T2.lorange, T2.hirange, T2.royalty FROM titles AS T1 INNER JOIN roysched AS T2 ON T1.title_id = T2.title_id INNER JOIN publishers AS T3 ON T1.pub_id = T3.pub_id WHERE T1.title_id = 'BU2075' | book_publishing_company | 178 | [
"sales",
"roysched",
"titles",
"publishers",
"titleauthor",
"authors"
] | [
[
" CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ",
" CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL NOT NULL, FOREIGN KEY(stor_id) REFERENCES stores (stor_id) ) ",
" CREATE TABLE employee ( emp_id TEXT, fname TEXT NOT NULL, minit TEXT, lname TEXT NOT NULL, job_id INTEGER NOT NULL, job_lvl INTEGER, pub_id TEXT NOT NULL, hire_date DATETIME NOT NULL, PRIMARY KEY (emp_id), FOREIGN KEY(job_id) REFERENCES jobs (job_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE jobs ( job_id INTEGER, job_desc TEXT NOT NULL, min_lvl INTEGER NOT NULL, max_lvl INTEGER NOT NULL, PRIMARY KEY (job_id) ) ",
" CREATE TABLE pub_info ( pub_id TEXT, logo BLOB, pr_info TEXT, PRIMARY KEY (pub_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE publishers ( pub_id TEXT, pub_name TEXT, city TEXT, state TEXT, country TEXT, PRIMARY KEY (pub_id) ) ",
" CREATE TABLE roysched ( title_id TEXT NOT NULL, lorange INTEGER, hirange INTEGER, royalty INTEGER, FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE sales ( stor_id TEXT NOT NULL, ord_num TEXT NOT NULL, ord_date DATETIME NOT NULL, qty INTEGER NOT NULL, payterms TEXT NOT NULL, title_id TEXT NOT NULL, PRIMARY KEY (stor_id, ord_num, title_id), FOREIGN KEY(stor_id) REFERENCES stores (stor_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE stores ( stor_id TEXT, stor_name TEXT, stor_address TEXT, city TEXT, state TEXT, zip TEXT, PRIMARY KEY (stor_id) ) ",
" CREATE TABLE titleauthor ( au_id TEXT NOT NULL, title_id TEXT NOT NULL, au_ord INTEGER, royaltyper INTEGER, PRIMARY KEY (au_id, title_id), FOREIGN KEY(au_id) REFERENCES authors (au_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE titles ( title_id TEXT, title TEXT NOT NULL, type TEXT NOT NULL, pub_id TEXT, price REAL, advance REAL, royalty INTEGER, ytd_sales INTEGER, notes TEXT, pubdate DATETIME NOT NULL, PRIMARY KEY (title_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) "
]
] | [
[
" CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ",
" CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL NOT NULL, FOREIGN KEY(stor_id) REFERENCES stores (stor_id) ) ",
" CREATE TABLE employee ( emp_id TEXT, fname TEXT NOT NULL, minit TEXT, lname TEXT NOT NULL, job_id INTEGER NOT NULL, job_lvl INTEGER, pub_id TEXT NOT NULL, hire_date DATETIME NOT NULL, PRIMARY KEY (emp_id), FOREIGN KEY(job_id) REFERENCES jobs (job_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE jobs ( job_id INTEGER, job_desc TEXT NOT NULL, min_lvl INTEGER NOT NULL, max_lvl INTEGER NOT NULL, PRIMARY KEY (job_id) ) ",
" CREATE TABLE pub_info ( pub_id TEXT, logo BLOB, pr_info TEXT, PRIMARY KEY (pub_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) ",
" CREATE TABLE publishers ( pub_id TEXT, pub_name TEXT, city TEXT, state TEXT, country TEXT, PRIMARY KEY (pub_id) ) ",
" CREATE TABLE roysched ( title_id TEXT NOT NULL, lorange INTEGER, hirange INTEGER, royalty INTEGER, FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE sales ( stor_id TEXT NOT NULL, ord_num TEXT NOT NULL, ord_date DATETIME NOT NULL, qty INTEGER NOT NULL, payterms TEXT NOT NULL, title_id TEXT NOT NULL, PRIMARY KEY (stor_id, ord_num, title_id), FOREIGN KEY(stor_id) REFERENCES stores (stor_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE stores ( stor_id TEXT, stor_name TEXT, stor_address TEXT, city TEXT, state TEXT, zip TEXT, PRIMARY KEY (stor_id) ) ",
" CREATE TABLE titleauthor ( au_id TEXT NOT NULL, title_id TEXT NOT NULL, au_ord INTEGER, royaltyper INTEGER, PRIMARY KEY (au_id, title_id), FOREIGN KEY(au_id) REFERENCES authors (au_id), FOREIGN KEY(title_id) REFERENCES titles (title_id) ) ",
" CREATE TABLE titles ( title_id TEXT, title TEXT NOT NULL, type TEXT NOT NULL, pub_id TEXT, price REAL, advance REAL, royalty INTEGER, ytd_sales INTEGER, notes TEXT, pubdate DATETIME NOT NULL, PRIMARY KEY (title_id), FOREIGN KEY(pub_id) REFERENCES publishers (pub_id) ) "
]
] | 11 | 11 | {"ATT_CLASSES": null, "Address": null, "AddressType": null, "Air Carriers": null, "Airlines": null, "Airports": null, "Answer": null, "Attributes": null, "Author": null, "Award": null, "AwardsCoaches": null, "AwardsMisc": null, "AwardsPlayers": null, "Ball_by_Ball": null, "Batsman_Scored": null, "Batting_Style": null, "BillOfMaterials": null, "Bowling_Style": null, "Business": null, "BusinessEntity": null, "BusinessEntityAddress": null, "BusinessEntityContact": null, "Business_Attributes": null, "Business_Categories": null, "Business_Hours": null, "CBSA": null, "Categories": null, "Character_Award": null, "Checkins": null, "City": null, "Classification": null, "Coaches": null, "CombinedShutouts": null, "Community_Area": null, "Compliments": null, "Conference": null, "ContactType": null, "Country": null, "CountryLanguage": null, "CountryRegion": null, "CountryRegionCurrency": null, "Credit": null, "CreditCard": null, "Crime": null, "Culture": null, "Currency": null, "CurrencyRate": null, "Customer": null, "Customers": null, "Days": null, "Demog": null, "Department": null, "Dish": null, "District": null, "Document": null, "Elite": null, "EmailAddress": null, "Employee": null, "EmployeeDepartmentHistory": null, "EmployeePayHistory": null, "Employees": null, "Episode": null, "Extra_Runs": null, "Extra_Type": null, "FBI_Code": null, "Genes": null, "Goalies": null, "GoaliesSC": null, "GoaliesShootout": null, "HOF": null, "IMG_OBJ": null, "IMG_OBJ_ATT": null, "IMG_REL": null, "IUCR": null, "Ingredient": null, "Interactions": null, "JobCandidate": null, "Journal": null, "Keyword": null, "Location": null, "Mailings1_2": null, "Master": null, "Match": null, "Menu": null, "MenuItem": null, "MenuPage": null, "Neighborhood": null, "Nutrition": null, "OBJ_CLASSES": null, "OrderDetails": null, "Orders": null, "Out_Type": null, "Outcome": null, "PRED_CLASSES": null, "Paper": null, "PaperAuthor": null, "Password": null, "Person": null, "PersonCreditCard": null, "PhoneNumberType": null, "Player": null, "PlayerInfo": null, "Player_Match": null, "Product": null, "ProductCategory": null, "ProductCostHistory": null, "ProductDescription": null, "ProductDocument": null, "ProductInventory": null, "ProductListPriceHistory": null, "ProductModel": null, "ProductModelProductDescriptionCulture": null, "ProductPhoto": null, "ProductProductPhoto": null, "ProductReview": null, "ProductSubcategory": null, "ProductVendor": null, "Products": null, "PurchaseOrderDetail": null, "PurchaseOrderHeader": null, "Quantity": null, "Question": null, "RA": null, "Recipe": null, "Regions": null, "Reviews": null, "Rolee": null, "Sales": null, "Sales Orders": null, "Sales Team": null, "SalesOrderDetail": null, "SalesOrderHeader": null, "SalesOrderHeaderSalesReason": null, "SalesPerson": null, "SalesPersonQuotaHistory": null, "SalesReason": null, "SalesTaxRate": null, "SalesTerritory": null, "SalesTerritoryHistory": null, "Scoring": null, "ScoringSC": null, "ScoringShootout": null, "ScoringSup": null, "ScrapReason": null, "Season": null, "SeasonStatus": null, "SeriesPost": null, "Shift": null, "ShipMethod": null, "Shippers": null, "ShoppingCartItem": null, "SpecialOffer": null, "SpecialOfferProduct": null, "StateProvince": null, "Store": null, "Store Locations": null, "Suppliers": null, "Survey": null, "Team": null, "TeamSplits": null, "TeamVsTeam": null, "Teams": null, "TeamsHalf": null, "TeamsPost": null, "TeamsSC": null, "Tips": null, "Toss_Decision": null, "TransactionHistory": null, "TransactionHistoryArchive": null, "Umpire": null, "UnitMeasure": null, "Users": null, "Users_Compliments": null, "Vendor": null, "Venue": null, "Vote": null, "Ward": null, "Wicket_Taken": null, "Win_By": null, "WorkOrder": null, "WorkOrderRouting": null, "Years": null, "abbrev": null, "actor": null, "actors": null, "address": null, "address_status": null, "advisedBy": null, "alias": null, "all_prevalences": null, "allergies": null, "app_all": null, "app_events": null, "app_events_relevant": null, "app_labels": null, "area_code": null, "author": null, "authors": null, "avoid": null, "awards_coaches": null, "awards_players": null, "beers": null, "book": null, "book_author": null, "book_language": null, "bool": null, "borders": null, "breweries": null, "businesses": null, "callcenterlogs": null, "careplans": null, "cars": null, "categories": null, "category": null, "central_superstore": null, "chapters": null, "characters": null, "cites": null, "city": null, "claims": null, "client": null, "coaches": null, "coins": null, "competitor_event": null, "conditions": null, "congress": null, "content": null, "continent": null, "country": null, "course": null, "current": null, "current-terms": null, "cust_order": null, "customer": null, "customer_address": null, "customers": null, "data": null, "department": null, "desert": null, "director": null, "directors": null, "disabled": null, "discounts": null, "district": null, "divisions": null, "draft": null, "driver": null, "east_superstore": null, "economy": null, "employee": null, "employees": null, "encompasses": null, "encounters": null, "enlist": null, "enrolled": null, "establishment": null, "ethnicGroup": null, "event": null, "events": null, "events_relevant": null, "filed_for_bankrupcy": null, "film": null, "film_actor": null, "film_category": null, "film_text": null, "game": null, "game_platform": null, "game_publisher": null, "games": null, "games_city": null, "games_competitor": null, "gender": null, "gender_age": null, "gender_age_test": null, "gender_age_train": null, "generalinfo": null, "genre": null, "geo_desert": null, "geo_estuary": null, "geo_island": null, "geo_lake": null, "geo_mountain": null, "geo_river": null, "geo_sea": null, "geo_source": null, "geographic": null, "geolocation": null, "height_info": null, "historical": null, "historical-terms": null, "immunizations": null, "incidents": null, "inspection": null, "inspection_point": null, "inspections": null, "institution_details": null, "institution_grads": null, "inventory": null, "isMember": null, "island": null, "islandIn": null, "jobs": null, "keyword": null, "label_categories": null, "lake": null, "language": null, "language_role": null, "lineitem": null, "located": null, "locatedOn": null, "location": null, "longest_absense_from_school": null, "mailings3": null, "male": null, "matchs": null, "medal": null, "medications": null, "mergesWith": null, "mountain": null, "mountainOnIsland": null, "movie": null, "movie_cast": null, "movie_company": null, "movie_crew": null, "movie_genres": null, "movie_keywords": null, "movie_languages": null, "movies": null, "movies2actors": null, "movies2directors": null, "movies_total_gross": null, "nation": null, "no_payment_due": null, "noc_region": null, "observations": null, "officers": null, "offices": null, "order_history": null, "order_line": null, "order_status": null, "orderdetails": null, "orders": null, "organization": null, "paper": null, "paragraphs": null, "part": null, "partsupp": null, "patients": null, "payment": null, "payments": null, "people": null, "person": null, "person_region": null, "phone_brand_device_model2": null, "platform": null, "player_allstar": null, "players": null, "players_teams": null, "playstore": null, "podcasts": null, "politics": null, "population": null, "position": null, "price": null, "procedures": null, "product": null, "production": null, "production_company": null, "production_country": null, "productlines": null, "products": null, "prof": null, "province": null, "pub_info": null, "publisher": null, "publishers": ["city", "state", "pub_name", "pub_id", "country"], "ranking_criteria": null, "ranking_system": null, "region": null, "region_sales": null, "registration": null, "relation": null, "religion": null, "rental": null, "revenue": null, "reviews": null, "river": null, "rootbeer": null, "rootbeerbrand": null, "rootbeerreview": null, "roysched": ["royalty", "title_id", "hirange", "lorange"], "runs": null, "sales": ["title_id", "qty", "ord_num", "payterms", "stor_id", "ord_date"], "sales_in_weather": null, "sample_submission": null, "sea": null, "series_post": null, "shipment": null, "shipping_method": null, "social-media": null, "south_superstore": null, "sport": null, "staff": null, "state": null, "state_sector_details": null, "state_sector_grads": null, "store": null, "stores": null, "student": null, "subjects": null, "supplier": null, "tags": null, "target": null, "taughtBy": null, "teams": null, "titleauthor": ["royaltyper", "title_id", "au_ord", "au_id"], "titles": ["royalty", "title", "type", "advance", "ytd_sales", "title_id", "price", "pub_id", "pubdate", "notes"], "torrents": null, "trains": null, "transaction": null, "truck": null, "twitter": null, "u2base": null, "unemployed": null, "university": null, "university_ranking_year": null, "university_year": null, "user": null, "user_reviews": null, "users": null, "violation": null, "violations": null, "voice-actors": null, "weather": null, "weight_info": null, "west_superstore": null, "works": null, "zip_congress": null, "zip_data": null} |
End of preview. Expand
in Dataset Viewer.
- Downloads last month
- 0