-- DBMS: bigquery
CREATE TABLE `bigquery-public-data.iowa_liquor_sales.sales`
(
  invoice_and_item_number STRING OPTIONS(description="Concatenated invoice and line number associated with the liquor order. This provides a unique identifier for the individual liquor products included in the store order."),
  date DATE OPTIONS(description="Date of order"),
  store_number STRING OPTIONS(description="Unique number assigned to the store who ordered the liquor."),
  store_name STRING OPTIONS(description="Name of store who ordered the liquor."),
  address STRING OPTIONS(description="Address of store who ordered the liquor."),
  city STRING OPTIONS(description="City where the store who ordered the liquor is located"),
  zip_code STRING OPTIONS(description="Zip code where the store who ordered the liquor is located"),
  store_location GEOGRAPHY OPTIONS(description="Location of store who ordered the liquor. The Address, City, State and Zip Code are geocoded to provide geographic coordinates. Accuracy of geocoding is dependent on how well the address is interpreted and the completeness of the reference data used."),
  county_number STRING OPTIONS(description="Iowa county number for the county where store who ordered the liquor is located"),
  county STRING OPTIONS(description="County where the store who ordered the liquor is located"),
  category STRING OPTIONS(description="Category code associated with the liquor ordered"),
  category_name STRING OPTIONS(description="Category of the liquor ordered."),
  vendor_number STRING OPTIONS(description="The vendor number of the company for the brand of liquor ordered"),
  vendor_name STRING OPTIONS(description="The vendor name of the company for the brand of liquor ordered"),
  item_number STRING OPTIONS(description="Item number for the individual liquor product ordered."),
  item_description STRING OPTIONS(description="Description of the individual liquor product ordered."),
  pack INT64 OPTIONS(description="The number of bottles in a case for the liquor ordered"),
  bottle_volume_ml INT64 OPTIONS(description="Volume of each liquor bottle ordered in milliliters."),
  state_bottle_cost FLOAT64 OPTIONS(description="The amount that Alcoholic Beverages Division paid for each bottle of liquor ordered"),
  state_bottle_retail FLOAT64 OPTIONS(description="The amount the store paid for each bottle of liquor ordered"),
  bottles_sold INT64 OPTIONS(description="The number of bottles of liquor ordered by the store"),
  sale_dollars FLOAT64 OPTIONS(description="Total cost of liquor order (number of bottles multiplied by the state bottle retail)"),
  volume_sold_liters FLOAT64 OPTIONS(description="Total volume of liquor ordered in liters. (i.e. (Bottle Volume (ml) x Bottles Sold)/1,000)\""),
  volume_sold_gallons FLOAT64 OPTIONS(description="Total volume of liquor ordered in gallons. (i.e. (Bottle Volume (ml) x Bottles Sold)/3785.411784)\"")
)
OPTIONS(
  description="Sales Dataset"
);

INSERT INTO `bigquery-public-data.iowa_liquor_sales.sales` (invoice_and_item_number, date, store_number, store_name, address, city, zip_code, store_location, county_number, county, category, category_name, vendor_number, vendor_name, item_number, item_description, pack, bottle_volume_ml, state_bottle_cost, state_bottle_retail, bottles_sold, sale_dollars, volume_sold_liters, volume_sold_gallons) VALUES ('RINV-04809400053', '2023-08-18', '3525', 'WINES AND SPIRITS / WASHINGTON', '106 W 2ND ST', 'WASHINGTON', '52353.0', 'POINT(-91.692147959 41.300652)', NULL, 'WASHINGTON', '1081500.0', 'TRIPLE SEC', '421', 'SAZERAC COMPANY  INC', '86390', 'MONTEZUMA TRIPLE SEC', 12, 1000, 2.13, 3.2, -60, -192.0, -60.0, -15.85), ('RINV-04944900248', '2023-11-07', '2603', 'HY-VEE WINE AND SPIRITS / BETTENDORF', '2890 DEVILS GLEN ROAD', 'BETTENDORF', '52722.0', 'POINT(-90.483805647 41.55235808)', NULL, 'SCOTT', '1031100', 'AMERICAN VODKAS', '301', 'FIFTH GENERATION INC', '38176', 'TITOS HANDMADE VODKA', 12, 750, 10.0, 15.0, -36, -540.0, -27.0, -7.13), ('RINV-05252100041', '2024-05-09', '3494', 'SAM''S CLUB 6514 / WATERLOO', '210 EAST TOWER PARK DR', 'WATERLOO', '50702.0', 'POINT(-92.352287039 42.454405004)', NULL, 'BLACK HAWK', '1011200.0', 'STRAIGHT BOURBON WHISKIES', '259', 'HEAVEN HILL BRANDS', '17958', 'EVAN WILLIAMS BLACK', 6, 1750, 17.0, 25.5, -12, -306.0, -21.0, -5.54), ('RINV-04746700044', '2023-07-12', '3830', 'WAL-MART 1435 / CRESTON', '806 LAUREL ST', 'CRESTON', '50801.0', 'POINT(-94.372769023 41.045432981)', NULL, 'UNION', '1031100.0', 'AMERICAN VODKAS', '301', 'FIFTH GENERATION INC', '38178', 'TITOS HANDMADE VODKA', 6, 1750, 19.0, 28.5, -12, -342.0, -21.0, -5.54), ('RINV-04758800043', '2023-07-19', '3712', 'MONTE SPIRITS', '109 N 4TH ST', 'MONTEZUMA', '50171.0', 'POINT(-92.523602876 41.585489221)', NULL, 'POWESHIEK', '1901000.0', 'SPECIAL ORDER ITEMS', '421', 'SAZERAC COMPANY  INC', '903707', 'SOOH WISERS DELUXE', 6, 1750, 14.99, 22.49, -12, -269.88, -21.0, -5.54);