diff --git "a/test_dataset.json" "b/test_dataset.json" --- "a/test_dataset.json" +++ "b/test_dataset.json" @@ -1,10 +1,10 @@ -{"question":"What is the MoM (month-over-month) growth rate of sales for the last 12 months?","answer":"WITH monthly_sales AS (SELECT CONCAT(order_year, '-', LPAD(order_month, 2, '0')) AS order_month, SUM(COALESCE(net_sales_before_tax, 0)) AS net_sales FROM order_values WHERE TO_DATE(CONCAT(order_year, '-', LPAD(order_month, 2, '0')), 'yyyy-MM') >= DATE_TRUNC('month', ADD_MONTHS(CURRENT_DATE, -12)) AND TO_DATE(CONCAT(order_year, '-', LPAD(order_month, 2, '0')), 'yyyy-MM') < DATE_TRUNC('month', CURRENT_DATE) GROUP BY order_year, order_month ORDER BY order_year, order_month), sales_growth AS (SELECT order_month, net_sales, LAG(net_sales) OVER (ORDER BY order_month) AS previous_month_sales FROM monthly_sales) SELECT order_month, ROUND((net_sales - previous_month_sales) \/ NULLIF(previous_month_sales, 0) * 100, 2) AS mom_growth_rate FROM sales_growth;","llama-3-sqlcoder-8b":"SELECT EXTRACT(MONTH FROM o.order_date) AS order_month, SUM(o.total_sales_after_tax) AS total_sales, LAG(SUM(o.total_sales_after_tax), 1) OVER (ORDER BY EXTRACT(MONTH FROM o.order_date)) AS previous_month_sales FROM order_values o WHERE o.order_date >= (CURRENT_DATE - INTERVAL '12 months') GROUP BY EXTRACT(MONTH FROM o.order_date) ORDER BY EXTRACT(MONTH FROM o.order_date) NULLS LAST; WITH monthly_sales AS (SELECT order_month, total_sales, previous_month_sales FROM (SELECT order_month, total_sales, LAG(total_sales, 1) OVER (ORDER BY order_month) AS previous_month_sales FROM (SELECT order_month, SUM(total_sales_after_tax) AS total_sales FROM order_values WHERE order_date >= (CURRENT_DATE - INTERVAL '12 months') GROUP BY order_month) AS subquery1) AS subquery2) SELECT order_month, total_sales, ((total_sales - previous_month_sales) \/ NULLIF(previous_month_sales, 0)) * 100 AS growth_rate FROM monthly_sales ORDER BY order_month NULLS LAST;assistant I'd be happy to help you with your question. However, I","llama-3.1-8b":"SELECT EXTRACT(YEAR FROM order_date) AS year, EXTRACT(MONTH FROM order_date) AS month, SUM(total_sales_after_tax) AS sales, LAG(SUM(total_sales_after_tax), 1) OVER (ORDER BY EXTRACT(YEAR FROM order_date), EXTRACT(MONTH FROM order_date)) AS prev_month_sales FROM order_values WHERE EXTRACT(YEAR FROM order_date) = EXTRACT(YEAR FROM CURRENT_DATE) - 1 GROUP BY EXTRACT(YEAR FROM order_date), EXTRACT(MONTH FROM order_date)","context":"TABLE_DESCRIPTIONS = {\n \"order_values\": \"This table contains order information aggregated across multiple sources for an e-commerce brand. The table is unique at an Order ID - SKU ID level. The table includes, but is not limited to, all pricing information (like gross sales, tax, net sales, shipping charge, duties, etc.), information related to the product (like SKU, product id\/title, price, etc.), order related information (timestamp of order), payment information and shipping information.\",\n \"marketing_performance\": \"This table contains detailed marketing performance data for an e-commerce brand, capturing data from various marketing activities and platforms. It provides a comprehensive overview of campaign performance, including spend, clicks, views, impressions, and attributed revenue.\",\n}\n\nCOLUMNS = {\n \"order_values\": {\n \"order_line_item_id\": {\n \"description\": \"Unique identifier for each line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"source\": {\"description\": \"Source of the order\", \"values_sample\": [\"shopify\"]},\n \"order_id\": {\n \"description\": \"Unique identifier for each order\",\n \"values_sample\": [\"shopify_5667598663969\"],\n },\n \"ordered_quantity\": {\n \"description\": \"Quantity of each item of a line item\",\n \"values_sample\": [1],\n },\n \"tax_percent\": {\n \"description\": \"Tax percentage applied to the order\",\n \"values_sample\": [0.17999949556658],\n },\n \"total_price_tax\": {\n \"description\": \"Total price including tax\",\n \"values_sample\": [152.389468594368],\n },\n \"gross_sales_price_before_tax\": {\n \"description\": \"Gross sales price before applying tax\",\n \"values_sample\": [846.610531405632],\n },\n \"total_discount_after_tax\": {\n \"description\": \"Total discount after applying tax\",\n \"values_sample\": [0],\n },\n \"total_discount_tax\": {\n \"description\": \"Total discount amount subject to tax\",\n \"values_sample\": [0],\n },\n \"total_discount_before_tax\": {\n \"description\": \"Total discount before applying tax\",\n \"values_sample\": [0],\n },\n \"total_returns_before_tax\": {\n \"description\": \"Total return\/refund amount before tax\",\n \"values_sample\": [846.610531405632],\n },\n \"net_sales_before_tax\": {\n \"description\": \"Net sales amount before applying tax\",\n \"values_sample\": [0],\n },\n \"item_shipping_charge\": {\n \"description\": \"Shipping charge for an item\",\n \"values_sample\": [0],\n },\n \"item_duties\": {\n \"description\": \"Duties charged for an item\",\n \"values_sample\": [0],\n },\n \"item_additional_feels\": {\n \"description\": \"Additional fees charged for an item\",\n \"values_sample\": [0],\n },\n \"total_tax\": {\"description\": \"Total tax amount\", \"values_sample\": [0]},\n \"total_sales_after_tax\": {\n \"description\": \"Total sales amount after applying tax\",\n \"values_sample\": [0],\n },\n \"sku_id\": {\n \"description\": \"Unique identifier for each stock keeping unit (SKU)\",\n \"values_sample\": [\"shopify_8848983261473_47478863036705\"],\n },\n \"sku_code\": {\n \"description\": \"Code assigned to each stock keeping unit (SKU)\",\n \"values_sample\": [\"BSL-D-SIP-0001\"],\n },\n \"product_category\": {\n \"description\": \"Category of the product\",\n \"values_sample\": [\"Insulated Sipper\"],\n },\n \"product_id\": {\n \"description\": \"Unique identifier for each product\",\n \"values_sample\": [\"shopify_8848983261473\"],\n },\n \"product_title\": {\n \"description\": \"Title of the product\",\n \"values_sample\": [\"Kids Sipper (430 ml)\"],\n },\n \"product_price\": {\n \"description\": \"Price of the product\",\n \"values_sample\": [999],\n },\n \"customer_id\": {\n \"description\": \"Unique identifier for each customer\",\n \"values_sample\": [\"shopify_7694075199777\"],\n },\n \"first_ordered_at\": {\n \"description\": \"Timestamp of the first order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_refund_line_item_id\": {\n \"description\": \"Unique identifier for each refunded line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"order_date_time\": {\n \"description\": \"Date and time of the order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_date\": {\n \"description\": \"Date of the order\",\n \"values_sample\": [\"2024-02-14\"],\n },\n \"order_year\": {\"description\": \"Year of the order\", \"values_sample\": [2024]},\n \"order_quarter\": {\n \"description\": \"Quarter of the year of the order\",\n \"values_sample\": [1],\n },\n \"order_month\": {\"description\": \"Month of the order\", \"values_sample\": [2]},\n \"order_day_of_month\": {\n \"description\": \"Day of the month of the order\",\n \"values_sample\": [14],\n },\n \"order_week\": {\n \"description\": \"Week of the year of the order\",\n \"values_sample\": [7],\n },\n \"order_day_of_week\": {\n \"description\": \"Day of the week of the order\",\n \"values_sample\": [4],\n },\n \"order_hour\": {\n \"description\": \"Hour of the day of the order\",\n \"values_sample\": [16],\n },\n \"order_minute\": {\n \"description\": \"Minute of the hour of the order\",\n \"values_sample\": [0],\n },\n \"order_time\": {\"description\": \"Time of the order\", \"values_sample\": [\"16:00\"]},\n \"cancellation_status\": {\n \"description\": \"Status of order cancellation\",\n \"values_sample\": [\"false\"],\n },\n \"refund_status\": {\n \"description\": \"Status of order refund\",\n \"values_sample\": [\"false\"],\n },\n \"order_status\": {\n \"description\": \"Status of the order\",\n \"values_sample\": [\"unknown\"],\n },\n \"payment_status\": {\n \"description\": \"Status of payment for the order\",\n \"values_sample\": [\"pending\"],\n },\n \"shipping_address_city\": {\n \"description\": \"City of the shipping address\",\n \"values_sample\": [\"Surat\"],\n },\n \"shipping_address_state\": {\n \"description\": \"State of the shipping address\",\n \"values_sample\": [\"Gujarat\"],\n },\n \"shipping_address_country\": {\n \"description\": \"Country of the shipping address\",\n \"values_sample\": [\"India\"],\n },\n }\n}\n \"marketing_performance\": {\n \"marketing_id\": {\n \"description\": \"Unique identifier for each marketing activity.\",\n \"values_sample\": [\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_304143034868101_310419640566194_productAdsamazon_ads_sponsored_products_548576666024459\",\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_405826215303183_448674135385556_productAdsamazon_ads_sponsored_products_511545631860472\",\n ],\n },\n \"activity_date_time\": {\n \"description\": \"Timestamp of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_date\": {\n \"description\": \"Date of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_year\": {\n \"description\": \"Year of the marketing activity.\",\n \"values_sample\": [\"2024\"],\n },\n \"activity_quarter\": {\n \"description\": \"Quarter of the year in which the marketing activity took place.\",\n \"values_sample\": [\"2\"],\n },\n \"activity_month\": {\n \"description\": \"Month of the year in which the marketing activity took place.\",\n \"values_sample\": [\"4\"],\n },\n \"activity_day_of_month\": {\n \"description\": \"Day of the month on which the marketing activity took place.\",\n \"values_sample\": [\"1\"],\n },\n \"activity_week\": {\n \"description\": \"Week of the year in which the marketing activity took place.\",\n \"values_sample\": [\"14\"],\n },\n \"activity_day_of_week\": {\n \"description\": \"Day of the week on which the marketing activity took place (1 for Monday, 7 for Sunday).\",\n \"values_sample\": [\"2\"],\n },\n \"activity_hour\": {\n \"description\": \"Hour of the day in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_minute\": {\n \"description\": \"Minute of the hour in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_time\": {\n \"description\": \"Formatted string representation of the marketing activity time.\",\n \"values_sample\": [\"00:00\"],\n },\n \"channel\": {\n \"description\": \"Marketing channel used for the activity (e.g., Google Ads, Facebook Ads, Email Marketing).\",\n \"values_sample\": [\"sponsored product\"],\n },\n \"vendor\": {\n \"description\": \"Vendor or platform responsible for the marketing activity (e.g., Google, Facebook, Mailchimp).\",\n \"values_sample\": [\"amazon\"],\n },\n \"ad_account_id\": {\n \"description\": \"Unique identifier for the ad account associated with the activity.\",\n \"values_sample\": [\"A5IVEQE4ZPVNJ\"],\n },\n \"ad_account_name\": {\n \"description\": \"Name of the ad account associated with the activity.\",\n \"values_sample\": [\"Famyo\"],\n },\n \"property_name\": {\n \"description\": \"Name of the property or website where the marketing activity was run.\",\n \"values_sample\": [\"amazon sponsored product\"],\n },\n \"network_type\": {\n \"description\": \"Type of advertising network used (e.g., Search, Display, Video).\",\n \"values_sample\": [\"amazon\"],\n },\n \"campaign_id\": {\n \"description\": \"Unique identifier for the marketing campaign.\",\n \"values_sample\": [\n \"304143034868101\",\n \"405826215303183\",\n ],\n },\n \"campaign_name\": {\n \"description\": \"Name of the marketing campaign.\",\n \"values_sample\": [\n \"Football Campaign with presets - B0CT662KJL - 15\/2\/2024 23:09:44\",\n \"Hvs_Tar_SP_Blankets_Genric_Mix\",\n ],\n },\n \"campaign_status\": {\n \"description\": \"Current status of the marketing campaign (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"PAUSED\", \"ENABLED\"],\n },\n \"adset_id\": {\n \"description\": \"Unique identifier for the ad set within the campaign.\",\n \"values_sample\": [\n \"310419640566194\",\n \"448674135385556\",\n ],\n },\n \"adset_name\": {\n \"description\": \"Name of the ad set within the campaign.\",\n \"values_sample\": [\n \"Ad group - 15\/2\/2024 23:09:44\",\n \"Glow Blankets C1\",\n ],\n },\n \"adset_status\": {\n \"description\": \"Current status of the ad set (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"ad_id\": {\n \"description\": \"Unique identifier for the individual ad within the ad set.\",\n \"values_sample\": [\n \"548576666024459\",\n \"511545631860472\",\n ],\n },\n \"ad_name\": {\n \"description\": \"Name of the individual ad.\",\n \"values_sample\": [\"B0CT662KJL\", \"B0CT6428LV\"],\n },\n \"ad_description\": {\n \"description\": \"Description of the individual ad.\",\n \"values_sample\": [\n \"FM_GIDB_Football\",\n \"FM_GIDB_Astronaut\",\n ],\n },\n \"ad_status\": {\n \"description\": \"Current status of the individual ad (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"total_spend\": {\n \"description\": \"Total amount spent on the marketing activity.\",\n \"values_sample\": [\"29.15\", \"110.15\"],\n },\n \"total_clicks\": {\n \"description\": \"Total number of clicks generated by the marketing activity.\",\n \"values_sample\": [\"3\", \"7\"],\n },\n \"total_views\": {\n \"description\": \"Total number of times the marketing activity was viewed.\",\n \"values_sample\": [\"306\", \"1404\"],\n },\n \"total_impressions\": {\n \"description\": \"Total number of times the marketing activity was displayed.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_orders\": {\n \"description\": \"Number of orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_revenue\": {\n \"description\": \"Revenue generated from orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"keyword\": {\n \"description\": \"Keyword used in the marketing activity (if applicable).\",\n \"values_sample\": [None],\n },\n \"_synced_at\": {\n \"description\": \"Timestamp indicating when the data was last synced.\",\n \"values_sample\": [\"2024-07-16T21:32:08.452+00:00\"],\n },\n },\n}","messages":[{"content":"You are an advanced AI trained to generate SQL queries based\n on a given context. Your task is to write an SQL query that accurately \n retrieves the requested data from the provided table schema. Do not answer with any explanations -- just the SQL query.\n Output only plain text. Do not output markdown. \n Please ensure that the SQL query matches the exact table name and column names\n specified in the TABLE_DESCRIPTIONS = {\n \"order_values\": \"This table contains order information aggregated across multiple sources for an e-commerce brand. The table is unique at an Order ID - SKU ID level. The table includes, but is not limited to, all pricing information (like gross sales, tax, net sales, shipping charge, duties, etc.), information related to the product (like SKU, product id\/title, price, etc.), order related information (timestamp of order), payment information and shipping information.\",\n \"marketing_performance\": \"This table contains detailed marketing performance data for an e-commerce brand, capturing data from various marketing activities and platforms. It provides a comprehensive overview of campaign performance, including spend, clicks, views, impressions, and attributed revenue.\",\n}\n\nCOLUMNS = {\n \"order_values\": {\n \"order_line_item_id\": {\n \"description\": \"Unique identifier for each line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"source\": {\"description\": \"Source of the order\", \"values_sample\": [\"shopify\"]},\n \"order_id\": {\n \"description\": \"Unique identifier for each order\",\n \"values_sample\": [\"shopify_5667598663969\"],\n },\n \"ordered_quantity\": {\n \"description\": \"Quantity of each item of a line item\",\n \"values_sample\": [1],\n },\n \"tax_percent\": {\n \"description\": \"Tax percentage applied to the order\",\n \"values_sample\": [0.17999949556658],\n },\n \"total_price_tax\": {\n \"description\": \"Total price including tax\",\n \"values_sample\": [152.389468594368],\n },\n \"gross_sales_price_before_tax\": {\n \"description\": \"Gross sales price before applying tax\",\n \"values_sample\": [846.610531405632],\n },\n \"total_discount_after_tax\": {\n \"description\": \"Total discount after applying tax\",\n \"values_sample\": [0],\n },\n \"total_discount_tax\": {\n \"description\": \"Total discount amount subject to tax\",\n \"values_sample\": [0],\n },\n \"total_discount_before_tax\": {\n \"description\": \"Total discount before applying tax\",\n \"values_sample\": [0],\n },\n \"total_returns_before_tax\": {\n \"description\": \"Total return\/refund amount before tax\",\n \"values_sample\": [846.610531405632],\n },\n \"net_sales_before_tax\": {\n \"description\": \"Net sales amount before applying tax\",\n \"values_sample\": [0],\n },\n \"item_shipping_charge\": {\n \"description\": \"Shipping charge for an item\",\n \"values_sample\": [0],\n },\n \"item_duties\": {\n \"description\": \"Duties charged for an item\",\n \"values_sample\": [0],\n },\n \"item_additional_feels\": {\n \"description\": \"Additional fees charged for an item\",\n \"values_sample\": [0],\n },\n \"total_tax\": {\"description\": \"Total tax amount\", \"values_sample\": [0]},\n \"total_sales_after_tax\": {\n \"description\": \"Total sales amount after applying tax\",\n \"values_sample\": [0],\n },\n \"sku_id\": {\n \"description\": \"Unique identifier for each stock keeping unit (SKU)\",\n \"values_sample\": [\"shopify_8848983261473_47478863036705\"],\n },\n \"sku_code\": {\n \"description\": \"Code assigned to each stock keeping unit (SKU)\",\n \"values_sample\": [\"BSL-D-SIP-0001\"],\n },\n \"product_category\": {\n \"description\": \"Category of the product\",\n \"values_sample\": [\"Insulated Sipper\"],\n },\n \"product_id\": {\n \"description\": \"Unique identifier for each product\",\n \"values_sample\": [\"shopify_8848983261473\"],\n },\n \"product_title\": {\n \"description\": \"Title of the product\",\n \"values_sample\": [\"Kids Sipper (430 ml)\"],\n },\n \"product_price\": {\n \"description\": \"Price of the product\",\n \"values_sample\": [999],\n },\n \"customer_id\": {\n \"description\": \"Unique identifier for each customer\",\n \"values_sample\": [\"shopify_7694075199777\"],\n },\n \"first_ordered_at\": {\n \"description\": \"Timestamp of the first order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_refund_line_item_id\": {\n \"description\": \"Unique identifier for each refunded line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"order_date_time\": {\n \"description\": \"Date and time of the order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_date\": {\n \"description\": \"Date of the order\",\n \"values_sample\": [\"2024-02-14\"],\n },\n \"order_year\": {\"description\": \"Year of the order\", \"values_sample\": [2024]},\n \"order_quarter\": {\n \"description\": \"Quarter of the year of the order\",\n \"values_sample\": [1],\n },\n \"order_month\": {\"description\": \"Month of the order\", \"values_sample\": [2]},\n \"order_day_of_month\": {\n \"description\": \"Day of the month of the order\",\n \"values_sample\": [14],\n },\n \"order_week\": {\n \"description\": \"Week of the year of the order\",\n \"values_sample\": [7],\n },\n \"order_day_of_week\": {\n \"description\": \"Day of the week of the order\",\n \"values_sample\": [4],\n },\n \"order_hour\": {\n \"description\": \"Hour of the day of the order\",\n \"values_sample\": [16],\n },\n \"order_minute\": {\n \"description\": \"Minute of the hour of the order\",\n \"values_sample\": [0],\n },\n \"order_time\": {\"description\": \"Time of the order\", \"values_sample\": [\"16:00\"]},\n \"cancellation_status\": {\n \"description\": \"Status of order cancellation\",\n \"values_sample\": [\"false\"],\n },\n \"refund_status\": {\n \"description\": \"Status of order refund\",\n \"values_sample\": [\"false\"],\n },\n \"order_status\": {\n \"description\": \"Status of the order\",\n \"values_sample\": [\"unknown\"],\n },\n \"payment_status\": {\n \"description\": \"Status of payment for the order\",\n \"values_sample\": [\"pending\"],\n },\n \"shipping_address_city\": {\n \"description\": \"City of the shipping address\",\n \"values_sample\": [\"Surat\"],\n },\n \"shipping_address_state\": {\n \"description\": \"State of the shipping address\",\n \"values_sample\": [\"Gujarat\"],\n },\n \"shipping_address_country\": {\n \"description\": \"Country of the shipping address\",\n \"values_sample\": [\"India\"],\n },\n }\n}\n \"marketing_performance\": {\n \"marketing_id\": {\n \"description\": \"Unique identifier for each marketing activity.\",\n \"values_sample\": [\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_304143034868101_310419640566194_productAdsamazon_ads_sponsored_products_548576666024459\",\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_405826215303183_448674135385556_productAdsamazon_ads_sponsored_products_511545631860472\",\n ],\n },\n \"activity_date_time\": {\n \"description\": \"Timestamp of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_date\": {\n \"description\": \"Date of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_year\": {\n \"description\": \"Year of the marketing activity.\",\n \"values_sample\": [\"2024\"],\n },\n \"activity_quarter\": {\n \"description\": \"Quarter of the year in which the marketing activity took place.\",\n \"values_sample\": [\"2\"],\n },\n \"activity_month\": {\n \"description\": \"Month of the year in which the marketing activity took place.\",\n \"values_sample\": [\"4\"],\n },\n \"activity_day_of_month\": {\n \"description\": \"Day of the month on which the marketing activity took place.\",\n \"values_sample\": [\"1\"],\n },\n \"activity_week\": {\n \"description\": \"Week of the year in which the marketing activity took place.\",\n \"values_sample\": [\"14\"],\n },\n \"activity_day_of_week\": {\n \"description\": \"Day of the week on which the marketing activity took place (1 for Monday, 7 for Sunday).\",\n \"values_sample\": [\"2\"],\n },\n \"activity_hour\": {\n \"description\": \"Hour of the day in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_minute\": {\n \"description\": \"Minute of the hour in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_time\": {\n \"description\": \"Formatted string representation of the marketing activity time.\",\n \"values_sample\": [\"00:00\"],\n },\n \"channel\": {\n \"description\": \"Marketing channel used for the activity (e.g., Google Ads, Facebook Ads, Email Marketing).\",\n \"values_sample\": [\"sponsored product\"],\n },\n \"vendor\": {\n \"description\": \"Vendor or platform responsible for the marketing activity (e.g., Google, Facebook, Mailchimp).\",\n \"values_sample\": [\"amazon\"],\n },\n \"ad_account_id\": {\n \"description\": \"Unique identifier for the ad account associated with the activity.\",\n \"values_sample\": [\"A5IVEQE4ZPVNJ\"],\n },\n \"ad_account_name\": {\n \"description\": \"Name of the ad account associated with the activity.\",\n \"values_sample\": [\"Famyo\"],\n },\n \"property_name\": {\n \"description\": \"Name of the property or website where the marketing activity was run.\",\n \"values_sample\": [\"amazon sponsored product\"],\n },\n \"network_type\": {\n \"description\": \"Type of advertising network used (e.g., Search, Display, Video).\",\n \"values_sample\": [\"amazon\"],\n },\n \"campaign_id\": {\n \"description\": \"Unique identifier for the marketing campaign.\",\n \"values_sample\": [\n \"304143034868101\",\n \"405826215303183\",\n ],\n },\n \"campaign_name\": {\n \"description\": \"Name of the marketing campaign.\",\n \"values_sample\": [\n \"Football Campaign with presets - B0CT662KJL - 15\/2\/2024 23:09:44\",\n \"Hvs_Tar_SP_Blankets_Genric_Mix\",\n ],\n },\n \"campaign_status\": {\n \"description\": \"Current status of the marketing campaign (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"PAUSED\", \"ENABLED\"],\n },\n \"adset_id\": {\n \"description\": \"Unique identifier for the ad set within the campaign.\",\n \"values_sample\": [\n \"310419640566194\",\n \"448674135385556\",\n ],\n },\n \"adset_name\": {\n \"description\": \"Name of the ad set within the campaign.\",\n \"values_sample\": [\n \"Ad group - 15\/2\/2024 23:09:44\",\n \"Glow Blankets C1\",\n ],\n },\n \"adset_status\": {\n \"description\": \"Current status of the ad set (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"ad_id\": {\n \"description\": \"Unique identifier for the individual ad within the ad set.\",\n \"values_sample\": [\n \"548576666024459\",\n \"511545631860472\",\n ],\n },\n \"ad_name\": {\n \"description\": \"Name of the individual ad.\",\n \"values_sample\": [\"B0CT662KJL\", \"B0CT6428LV\"],\n },\n \"ad_description\": {\n \"description\": \"Description of the individual ad.\",\n \"values_sample\": [\n \"FM_GIDB_Football\",\n \"FM_GIDB_Astronaut\",\n ],\n },\n \"ad_status\": {\n \"description\": \"Current status of the individual ad (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"total_spend\": {\n \"description\": \"Total amount spent on the marketing activity.\",\n \"values_sample\": [\"29.15\", \"110.15\"],\n },\n \"total_clicks\": {\n \"description\": \"Total number of clicks generated by the marketing activity.\",\n \"values_sample\": [\"3\", \"7\"],\n },\n \"total_views\": {\n \"description\": \"Total number of times the marketing activity was viewed.\",\n \"values_sample\": [\"306\", \"1404\"],\n },\n \"total_impressions\": {\n \"description\": \"Total number of times the marketing activity was displayed.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_orders\": {\n \"description\": \"Number of orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_revenue\": {\n \"description\": \"Revenue generated from orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"keyword\": {\n \"description\": \"Keyword used in the marketing activity (if applicable).\",\n \"values_sample\": [None],\n },\n \"_synced_at\": {\n \"description\": \"Timestamp indicating when the data was last synced.\",\n \"values_sample\": [\"2024-07-16T21:32:08.452+00:00\"],\n },\n },\n} in context I am giving you complete DB and table info in details, user context is bit lengthy so go line by line then answer properly","role":"system"},{"content":"What is the MoM (month-over-month) growth rate of sales for the last 12 months?","role":"user"},{"content":"WITH monthly_sales AS (SELECT CONCAT(order_year, '-', LPAD(order_month, 2, '0')) AS order_month, SUM(COALESCE(net_sales_before_tax, 0)) AS net_sales FROM order_values WHERE TO_DATE(CONCAT(order_year, '-', LPAD(order_month, 2, '0')), 'yyyy-MM') >= DATE_TRUNC('month', ADD_MONTHS(CURRENT_DATE, -12)) AND TO_DATE(CONCAT(order_year, '-', LPAD(order_month, 2, '0')), 'yyyy-MM') < DATE_TRUNC('month', CURRENT_DATE) GROUP BY order_year, order_month ORDER BY order_year, order_month), sales_growth AS (SELECT order_month, net_sales, LAG(net_sales) OVER (ORDER BY order_month) AS previous_month_sales FROM monthly_sales) SELECT order_month, ROUND((net_sales - previous_month_sales) \/ NULLIF(previous_month_sales, 0) * 100, 2) AS mom_growth_rate FROM sales_growth;","role":"assistant"}]} -{"question":"Compare the return rates for each product category in the last year.","answer":"SELECT product_category, ROUND(SUM(CASE WHEN total_returns_before_tax > 0 THEN 1 ELSE 0 END) \/ COUNT(*) * 100.0) AS return_rate FROM order_values WHERE order_year = YEAR(DATE_SUB(CURRENT_DATE, 365)) GROUP BY product_category;","llama-3-sqlcoder-8b":"SELECT tv.product_category, SUM(tv.total_returns_before_tax) \/ NULLIF(SUM(tv.total_sales_after_tax), 0) AS return_rate FROM order_values tv WHERE tv.order_date > CURRENT_DATE - INTERVAL '1 year' GROUP BY tv.product_category ORDER BY return_rate DESC NULLS LAST;","llama-3.1-8b":"SELECT product_category, SUM(CASE WHEN total_returns_before_tax > 0 THEN 1 ELSE 0 END) AS return_count, SUM(CASE WHEN total_returns_before_tax = 0 THEN 1 ELSE 0 END) AS no_return_count FROM order_values WHERE order_year = 2024 GROUP BY product_category","context":"TABLE_DESCRIPTIONS = {\n \"order_values\": \"This table contains order information aggregated across multiple sources for an e-commerce brand. The table is unique at an Order ID - SKU ID level. The table includes, but is not limited to, all pricing information (like gross sales, tax, net sales, shipping charge, duties, etc.), information related to the product (like SKU, product id\/title, price, etc.), order related information (timestamp of order), payment information and shipping information.\",\n \"marketing_performance\": \"This table contains detailed marketing performance data for an e-commerce brand, capturing data from various marketing activities and platforms. It provides a comprehensive overview of campaign performance, including spend, clicks, views, impressions, and attributed revenue.\",\n}\n\nCOLUMNS = {\n \"order_values\": {\n \"order_line_item_id\": {\n \"description\": \"Unique identifier for each line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"source\": {\"description\": \"Source of the order\", \"values_sample\": [\"shopify\"]},\n \"order_id\": {\n \"description\": \"Unique identifier for each order\",\n \"values_sample\": [\"shopify_5667598663969\"],\n },\n \"ordered_quantity\": {\n \"description\": \"Quantity of each item of a line item\",\n \"values_sample\": [1],\n },\n \"tax_percent\": {\n \"description\": \"Tax percentage applied to the order\",\n \"values_sample\": [0.17999949556658],\n },\n \"total_price_tax\": {\n \"description\": \"Total price including tax\",\n \"values_sample\": [152.389468594368],\n },\n \"gross_sales_price_before_tax\": {\n \"description\": \"Gross sales price before applying tax\",\n \"values_sample\": [846.610531405632],\n },\n \"total_discount_after_tax\": {\n \"description\": \"Total discount after applying tax\",\n \"values_sample\": [0],\n },\n \"total_discount_tax\": {\n \"description\": \"Total discount amount subject to tax\",\n \"values_sample\": [0],\n },\n \"total_discount_before_tax\": {\n \"description\": \"Total discount before applying tax\",\n \"values_sample\": [0],\n },\n \"total_returns_before_tax\": {\n \"description\": \"Total return\/refund amount before tax\",\n \"values_sample\": [846.610531405632],\n },\n \"net_sales_before_tax\": {\n \"description\": \"Net sales amount before applying tax\",\n \"values_sample\": [0],\n },\n \"item_shipping_charge\": {\n \"description\": \"Shipping charge for an item\",\n \"values_sample\": [0],\n },\n \"item_duties\": {\n \"description\": \"Duties charged for an item\",\n \"values_sample\": [0],\n },\n \"item_additional_feels\": {\n \"description\": \"Additional fees charged for an item\",\n \"values_sample\": [0],\n },\n \"total_tax\": {\"description\": \"Total tax amount\", \"values_sample\": [0]},\n \"total_sales_after_tax\": {\n \"description\": \"Total sales amount after applying tax\",\n \"values_sample\": [0],\n },\n \"sku_id\": {\n \"description\": \"Unique identifier for each stock keeping unit (SKU)\",\n \"values_sample\": [\"shopify_8848983261473_47478863036705\"],\n },\n \"sku_code\": {\n \"description\": \"Code assigned to each stock keeping unit (SKU)\",\n \"values_sample\": [\"BSL-D-SIP-0001\"],\n },\n \"product_category\": {\n \"description\": \"Category of the product\",\n \"values_sample\": [\"Insulated Sipper\"],\n },\n \"product_id\": {\n \"description\": \"Unique identifier for each product\",\n \"values_sample\": [\"shopify_8848983261473\"],\n },\n \"product_title\": {\n \"description\": \"Title of the product\",\n \"values_sample\": [\"Kids Sipper (430 ml)\"],\n },\n \"product_price\": {\n \"description\": \"Price of the product\",\n \"values_sample\": [999],\n },\n \"customer_id\": {\n \"description\": \"Unique identifier for each customer\",\n \"values_sample\": [\"shopify_7694075199777\"],\n },\n \"first_ordered_at\": {\n \"description\": \"Timestamp of the first order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_refund_line_item_id\": {\n \"description\": \"Unique identifier for each refunded line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"order_date_time\": {\n \"description\": \"Date and time of the order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_date\": {\n \"description\": \"Date of the order\",\n \"values_sample\": [\"2024-02-14\"],\n },\n \"order_year\": {\"description\": \"Year of the order\", \"values_sample\": [2024]},\n \"order_quarter\": {\n \"description\": \"Quarter of the year of the order\",\n \"values_sample\": [1],\n },\n \"order_month\": {\"description\": \"Month of the order\", \"values_sample\": [2]},\n \"order_day_of_month\": {\n \"description\": \"Day of the month of the order\",\n \"values_sample\": [14],\n },\n \"order_week\": {\n \"description\": \"Week of the year of the order\",\n \"values_sample\": [7],\n },\n \"order_day_of_week\": {\n \"description\": \"Day of the week of the order\",\n \"values_sample\": [4],\n },\n \"order_hour\": {\n \"description\": \"Hour of the day of the order\",\n \"values_sample\": [16],\n },\n \"order_minute\": {\n \"description\": \"Minute of the hour of the order\",\n \"values_sample\": [0],\n },\n \"order_time\": {\"description\": \"Time of the order\", \"values_sample\": [\"16:00\"]},\n \"cancellation_status\": {\n \"description\": \"Status of order cancellation\",\n \"values_sample\": [\"false\"],\n },\n \"refund_status\": {\n \"description\": \"Status of order refund\",\n \"values_sample\": [\"false\"],\n },\n \"order_status\": {\n \"description\": \"Status of the order\",\n \"values_sample\": [\"unknown\"],\n },\n \"payment_status\": {\n \"description\": \"Status of payment for the order\",\n \"values_sample\": [\"pending\"],\n },\n \"shipping_address_city\": {\n \"description\": \"City of the shipping address\",\n \"values_sample\": [\"Surat\"],\n },\n \"shipping_address_state\": {\n \"description\": \"State of the shipping address\",\n \"values_sample\": [\"Gujarat\"],\n },\n \"shipping_address_country\": {\n \"description\": \"Country of the shipping address\",\n \"values_sample\": [\"India\"],\n },\n }\n}\n \"marketing_performance\": {\n \"marketing_id\": {\n \"description\": \"Unique identifier for each marketing activity.\",\n \"values_sample\": [\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_304143034868101_310419640566194_productAdsamazon_ads_sponsored_products_548576666024459\",\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_405826215303183_448674135385556_productAdsamazon_ads_sponsored_products_511545631860472\",\n ],\n },\n \"activity_date_time\": {\n \"description\": \"Timestamp of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_date\": {\n \"description\": \"Date of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_year\": {\n \"description\": \"Year of the marketing activity.\",\n \"values_sample\": [\"2024\"],\n },\n \"activity_quarter\": {\n \"description\": \"Quarter of the year in which the marketing activity took place.\",\n \"values_sample\": [\"2\"],\n },\n \"activity_month\": {\n \"description\": \"Month of the year in which the marketing activity took place.\",\n \"values_sample\": [\"4\"],\n },\n \"activity_day_of_month\": {\n \"description\": \"Day of the month on which the marketing activity took place.\",\n \"values_sample\": [\"1\"],\n },\n \"activity_week\": {\n \"description\": \"Week of the year in which the marketing activity took place.\",\n \"values_sample\": [\"14\"],\n },\n \"activity_day_of_week\": {\n \"description\": \"Day of the week on which the marketing activity took place (1 for Monday, 7 for Sunday).\",\n \"values_sample\": [\"2\"],\n },\n \"activity_hour\": {\n \"description\": \"Hour of the day in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_minute\": {\n \"description\": \"Minute of the hour in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_time\": {\n \"description\": \"Formatted string representation of the marketing activity time.\",\n \"values_sample\": [\"00:00\"],\n },\n \"channel\": {\n \"description\": \"Marketing channel used for the activity (e.g., Google Ads, Facebook Ads, Email Marketing).\",\n \"values_sample\": [\"sponsored product\"],\n },\n \"vendor\": {\n \"description\": \"Vendor or platform responsible for the marketing activity (e.g., Google, Facebook, Mailchimp).\",\n \"values_sample\": [\"amazon\"],\n },\n \"ad_account_id\": {\n \"description\": \"Unique identifier for the ad account associated with the activity.\",\n \"values_sample\": [\"A5IVEQE4ZPVNJ\"],\n },\n \"ad_account_name\": {\n \"description\": \"Name of the ad account associated with the activity.\",\n \"values_sample\": [\"Famyo\"],\n },\n \"property_name\": {\n \"description\": \"Name of the property or website where the marketing activity was run.\",\n \"values_sample\": [\"amazon sponsored product\"],\n },\n \"network_type\": {\n \"description\": \"Type of advertising network used (e.g., Search, Display, Video).\",\n \"values_sample\": [\"amazon\"],\n },\n \"campaign_id\": {\n \"description\": \"Unique identifier for the marketing campaign.\",\n \"values_sample\": [\n \"304143034868101\",\n \"405826215303183\",\n ],\n },\n \"campaign_name\": {\n \"description\": \"Name of the marketing campaign.\",\n \"values_sample\": [\n \"Football Campaign with presets - B0CT662KJL - 15\/2\/2024 23:09:44\",\n \"Hvs_Tar_SP_Blankets_Genric_Mix\",\n ],\n },\n \"campaign_status\": {\n \"description\": \"Current status of the marketing campaign (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"PAUSED\", \"ENABLED\"],\n },\n \"adset_id\": {\n \"description\": \"Unique identifier for the ad set within the campaign.\",\n \"values_sample\": [\n \"310419640566194\",\n \"448674135385556\",\n ],\n },\n \"adset_name\": {\n \"description\": \"Name of the ad set within the campaign.\",\n \"values_sample\": [\n \"Ad group - 15\/2\/2024 23:09:44\",\n \"Glow Blankets C1\",\n ],\n },\n \"adset_status\": {\n \"description\": \"Current status of the ad set (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"ad_id\": {\n \"description\": \"Unique identifier for the individual ad within the ad set.\",\n \"values_sample\": [\n \"548576666024459\",\n \"511545631860472\",\n ],\n },\n \"ad_name\": {\n \"description\": \"Name of the individual ad.\",\n \"values_sample\": [\"B0CT662KJL\", \"B0CT6428LV\"],\n },\n \"ad_description\": {\n \"description\": \"Description of the individual ad.\",\n \"values_sample\": [\n \"FM_GIDB_Football\",\n \"FM_GIDB_Astronaut\",\n ],\n },\n \"ad_status\": {\n \"description\": \"Current status of the individual ad (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"total_spend\": {\n \"description\": \"Total amount spent on the marketing activity.\",\n \"values_sample\": [\"29.15\", \"110.15\"],\n },\n \"total_clicks\": {\n \"description\": \"Total number of clicks generated by the marketing activity.\",\n \"values_sample\": [\"3\", \"7\"],\n },\n \"total_views\": {\n \"description\": \"Total number of times the marketing activity was viewed.\",\n \"values_sample\": [\"306\", \"1404\"],\n },\n \"total_impressions\": {\n \"description\": \"Total number of times the marketing activity was displayed.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_orders\": {\n \"description\": \"Number of orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_revenue\": {\n \"description\": \"Revenue generated from orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"keyword\": {\n \"description\": \"Keyword used in the marketing activity (if applicable).\",\n \"values_sample\": [None],\n },\n \"_synced_at\": {\n \"description\": \"Timestamp indicating when the data was last synced.\",\n \"values_sample\": [\"2024-07-16T21:32:08.452+00:00\"],\n },\n },\n}","messages":[{"content":"You are an advanced AI trained to generate SQL queries based\n on a given context. Your task is to write an SQL query that accurately \n retrieves the requested data from the provided table schema. Do not answer with any explanations -- just the SQL query.\n Output only plain text. Do not output markdown. \n Please ensure that the SQL query matches the exact table name and column names\n specified in the TABLE_DESCRIPTIONS = {\n \"order_values\": \"This table contains order information aggregated across multiple sources for an e-commerce brand. The table is unique at an Order ID - SKU ID level. The table includes, but is not limited to, all pricing information (like gross sales, tax, net sales, shipping charge, duties, etc.), information related to the product (like SKU, product id\/title, price, etc.), order related information (timestamp of order), payment information and shipping information.\",\n \"marketing_performance\": \"This table contains detailed marketing performance data for an e-commerce brand, capturing data from various marketing activities and platforms. It provides a comprehensive overview of campaign performance, including spend, clicks, views, impressions, and attributed revenue.\",\n}\n\nCOLUMNS = {\n \"order_values\": {\n \"order_line_item_id\": {\n \"description\": \"Unique identifier for each line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"source\": {\"description\": \"Source of the order\", \"values_sample\": [\"shopify\"]},\n \"order_id\": {\n \"description\": \"Unique identifier for each order\",\n \"values_sample\": [\"shopify_5667598663969\"],\n },\n \"ordered_quantity\": {\n \"description\": \"Quantity of each item of a line item\",\n \"values_sample\": [1],\n },\n \"tax_percent\": {\n \"description\": \"Tax percentage applied to the order\",\n \"values_sample\": [0.17999949556658],\n },\n \"total_price_tax\": {\n \"description\": \"Total price including tax\",\n \"values_sample\": [152.389468594368],\n },\n \"gross_sales_price_before_tax\": {\n \"description\": \"Gross sales price before applying tax\",\n \"values_sample\": [846.610531405632],\n },\n \"total_discount_after_tax\": {\n \"description\": \"Total discount after applying tax\",\n \"values_sample\": [0],\n },\n \"total_discount_tax\": {\n \"description\": \"Total discount amount subject to tax\",\n \"values_sample\": [0],\n },\n \"total_discount_before_tax\": {\n \"description\": \"Total discount before applying tax\",\n \"values_sample\": [0],\n },\n \"total_returns_before_tax\": {\n \"description\": \"Total return\/refund amount before tax\",\n \"values_sample\": [846.610531405632],\n },\n \"net_sales_before_tax\": {\n \"description\": \"Net sales amount before applying tax\",\n \"values_sample\": [0],\n },\n \"item_shipping_charge\": {\n \"description\": \"Shipping charge for an item\",\n \"values_sample\": [0],\n },\n \"item_duties\": {\n \"description\": \"Duties charged for an item\",\n \"values_sample\": [0],\n },\n \"item_additional_feels\": {\n \"description\": \"Additional fees charged for an item\",\n \"values_sample\": [0],\n },\n \"total_tax\": {\"description\": \"Total tax amount\", \"values_sample\": [0]},\n \"total_sales_after_tax\": {\n \"description\": \"Total sales amount after applying tax\",\n \"values_sample\": [0],\n },\n \"sku_id\": {\n \"description\": \"Unique identifier for each stock keeping unit (SKU)\",\n \"values_sample\": [\"shopify_8848983261473_47478863036705\"],\n },\n \"sku_code\": {\n \"description\": \"Code assigned to each stock keeping unit (SKU)\",\n \"values_sample\": [\"BSL-D-SIP-0001\"],\n },\n \"product_category\": {\n \"description\": \"Category of the product\",\n \"values_sample\": [\"Insulated Sipper\"],\n },\n \"product_id\": {\n \"description\": \"Unique identifier for each product\",\n \"values_sample\": [\"shopify_8848983261473\"],\n },\n \"product_title\": {\n \"description\": \"Title of the product\",\n \"values_sample\": [\"Kids Sipper (430 ml)\"],\n },\n \"product_price\": {\n \"description\": \"Price of the product\",\n \"values_sample\": [999],\n },\n \"customer_id\": {\n \"description\": \"Unique identifier for each customer\",\n \"values_sample\": [\"shopify_7694075199777\"],\n },\n \"first_ordered_at\": {\n \"description\": \"Timestamp of the first order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_refund_line_item_id\": {\n \"description\": \"Unique identifier for each refunded line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"order_date_time\": {\n \"description\": \"Date and time of the order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_date\": {\n \"description\": \"Date of the order\",\n \"values_sample\": [\"2024-02-14\"],\n },\n \"order_year\": {\"description\": \"Year of the order\", \"values_sample\": [2024]},\n \"order_quarter\": {\n \"description\": \"Quarter of the year of the order\",\n \"values_sample\": [1],\n },\n \"order_month\": {\"description\": \"Month of the order\", \"values_sample\": [2]},\n \"order_day_of_month\": {\n \"description\": \"Day of the month of the order\",\n \"values_sample\": [14],\n },\n \"order_week\": {\n \"description\": \"Week of the year of the order\",\n \"values_sample\": [7],\n },\n \"order_day_of_week\": {\n \"description\": \"Day of the week of the order\",\n \"values_sample\": [4],\n },\n \"order_hour\": {\n \"description\": \"Hour of the day of the order\",\n \"values_sample\": [16],\n },\n \"order_minute\": {\n \"description\": \"Minute of the hour of the order\",\n \"values_sample\": [0],\n },\n \"order_time\": {\"description\": \"Time of the order\", \"values_sample\": [\"16:00\"]},\n \"cancellation_status\": {\n \"description\": \"Status of order cancellation\",\n \"values_sample\": [\"false\"],\n },\n \"refund_status\": {\n \"description\": \"Status of order refund\",\n \"values_sample\": [\"false\"],\n },\n \"order_status\": {\n \"description\": \"Status of the order\",\n \"values_sample\": [\"unknown\"],\n },\n \"payment_status\": {\n \"description\": \"Status of payment for the order\",\n \"values_sample\": [\"pending\"],\n },\n \"shipping_address_city\": {\n \"description\": \"City of the shipping address\",\n \"values_sample\": [\"Surat\"],\n },\n \"shipping_address_state\": {\n \"description\": \"State of the shipping address\",\n \"values_sample\": [\"Gujarat\"],\n },\n \"shipping_address_country\": {\n \"description\": \"Country of the shipping address\",\n \"values_sample\": [\"India\"],\n },\n }\n}\n \"marketing_performance\": {\n \"marketing_id\": {\n \"description\": \"Unique identifier for each marketing activity.\",\n \"values_sample\": [\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_304143034868101_310419640566194_productAdsamazon_ads_sponsored_products_548576666024459\",\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_405826215303183_448674135385556_productAdsamazon_ads_sponsored_products_511545631860472\",\n ],\n },\n \"activity_date_time\": {\n \"description\": \"Timestamp of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_date\": {\n \"description\": \"Date of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_year\": {\n \"description\": \"Year of the marketing activity.\",\n \"values_sample\": [\"2024\"],\n },\n \"activity_quarter\": {\n \"description\": \"Quarter of the year in which the marketing activity took place.\",\n \"values_sample\": [\"2\"],\n },\n \"activity_month\": {\n \"description\": \"Month of the year in which the marketing activity took place.\",\n \"values_sample\": [\"4\"],\n },\n \"activity_day_of_month\": {\n \"description\": \"Day of the month on which the marketing activity took place.\",\n \"values_sample\": [\"1\"],\n },\n \"activity_week\": {\n \"description\": \"Week of the year in which the marketing activity took place.\",\n \"values_sample\": [\"14\"],\n },\n \"activity_day_of_week\": {\n \"description\": \"Day of the week on which the marketing activity took place (1 for Monday, 7 for Sunday).\",\n \"values_sample\": [\"2\"],\n },\n \"activity_hour\": {\n \"description\": \"Hour of the day in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_minute\": {\n \"description\": \"Minute of the hour in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_time\": {\n \"description\": \"Formatted string representation of the marketing activity time.\",\n \"values_sample\": [\"00:00\"],\n },\n \"channel\": {\n \"description\": \"Marketing channel used for the activity (e.g., Google Ads, Facebook Ads, Email Marketing).\",\n \"values_sample\": [\"sponsored product\"],\n },\n \"vendor\": {\n \"description\": \"Vendor or platform responsible for the marketing activity (e.g., Google, Facebook, Mailchimp).\",\n \"values_sample\": [\"amazon\"],\n },\n \"ad_account_id\": {\n \"description\": \"Unique identifier for the ad account associated with the activity.\",\n \"values_sample\": [\"A5IVEQE4ZPVNJ\"],\n },\n \"ad_account_name\": {\n \"description\": \"Name of the ad account associated with the activity.\",\n \"values_sample\": [\"Famyo\"],\n },\n \"property_name\": {\n \"description\": \"Name of the property or website where the marketing activity was run.\",\n \"values_sample\": [\"amazon sponsored product\"],\n },\n \"network_type\": {\n \"description\": \"Type of advertising network used (e.g., Search, Display, Video).\",\n \"values_sample\": [\"amazon\"],\n },\n \"campaign_id\": {\n \"description\": \"Unique identifier for the marketing campaign.\",\n \"values_sample\": [\n \"304143034868101\",\n \"405826215303183\",\n ],\n },\n \"campaign_name\": {\n \"description\": \"Name of the marketing campaign.\",\n \"values_sample\": [\n \"Football Campaign with presets - B0CT662KJL - 15\/2\/2024 23:09:44\",\n \"Hvs_Tar_SP_Blankets_Genric_Mix\",\n ],\n },\n \"campaign_status\": {\n \"description\": \"Current status of the marketing campaign (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"PAUSED\", \"ENABLED\"],\n },\n \"adset_id\": {\n \"description\": \"Unique identifier for the ad set within the campaign.\",\n \"values_sample\": [\n \"310419640566194\",\n \"448674135385556\",\n ],\n },\n \"adset_name\": {\n \"description\": \"Name of the ad set within the campaign.\",\n \"values_sample\": [\n \"Ad group - 15\/2\/2024 23:09:44\",\n \"Glow Blankets C1\",\n ],\n },\n \"adset_status\": {\n \"description\": \"Current status of the ad set (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"ad_id\": {\n \"description\": \"Unique identifier for the individual ad within the ad set.\",\n \"values_sample\": [\n \"548576666024459\",\n \"511545631860472\",\n ],\n },\n \"ad_name\": {\n \"description\": \"Name of the individual ad.\",\n \"values_sample\": [\"B0CT662KJL\", \"B0CT6428LV\"],\n },\n \"ad_description\": {\n \"description\": \"Description of the individual ad.\",\n \"values_sample\": [\n \"FM_GIDB_Football\",\n \"FM_GIDB_Astronaut\",\n ],\n },\n \"ad_status\": {\n \"description\": \"Current status of the individual ad (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"total_spend\": {\n \"description\": \"Total amount spent on the marketing activity.\",\n \"values_sample\": [\"29.15\", \"110.15\"],\n },\n \"total_clicks\": {\n \"description\": \"Total number of clicks generated by the marketing activity.\",\n \"values_sample\": [\"3\", \"7\"],\n },\n \"total_views\": {\n \"description\": \"Total number of times the marketing activity was viewed.\",\n \"values_sample\": [\"306\", \"1404\"],\n },\n \"total_impressions\": {\n \"description\": \"Total number of times the marketing activity was displayed.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_orders\": {\n \"description\": \"Number of orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_revenue\": {\n \"description\": \"Revenue generated from orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"keyword\": {\n \"description\": \"Keyword used in the marketing activity (if applicable).\",\n \"values_sample\": [None],\n },\n \"_synced_at\": {\n \"description\": \"Timestamp indicating when the data was last synced.\",\n \"values_sample\": [\"2024-07-16T21:32:08.452+00:00\"],\n },\n },\n} in context I am giving you complete DB and table info in details, user context is bit lengthy so go line by line then answer properly","role":"system"},{"content":"Compare the return rates for each product category in the last year.","role":"user"},{"content":"SELECT product_category, ROUND(SUM(CASE WHEN total_returns_before_tax > 0 THEN 1 ELSE 0 END) \/ COUNT(*) * 100.0) AS return_rate FROM order_values WHERE order_year = YEAR(DATE_SUB(CURRENT_DATE, 365)) GROUP BY product_category;","role":"assistant"}]} -{"question":"What are the top performing categories for Q1 2024?","answer":"SELECT LOWER(product_category) AS category, SUM(COALESCE(net_sales_before_tax, 0)) AS total_net_sales FROM order_values WHERE order_year = 2024 AND order_quarter = 1 GROUP BY LOWER(product_category) ORDER BY total_net_sales DESC;","llama-3-sqlcoder-8b":"SELECT o.product_category, SUM(o.total_sales_after_tax) AS total_sales FROM order_values o WHERE o.order_year = 2024 AND o.order_quarter = 1 GROUP BY o.product_category ORDER BY total_sales DESC NULLS LAST LIMIT 5;","llama-3.1-8b":"SELECT product_category FROM order_values WHERE order_year = 2024 AND order_quarter = 1 GROUP BY product_category ORDER BY SUM(total_sales_after_tax) DESC LIMIT 5","context":"TABLE_DESCRIPTIONS = {\n \"order_values\": \"This table contains order information aggregated across multiple sources for an e-commerce brand. The table is unique at an Order ID - SKU ID level. The table includes, but is not limited to, all pricing information (like gross sales, tax, net sales, shipping charge, duties, etc.), information related to the product (like SKU, product id\/title, price, etc.), order related information (timestamp of order), payment information and shipping information.\",\n \"marketing_performance\": \"This table contains detailed marketing performance data for an e-commerce brand, capturing data from various marketing activities and platforms. It provides a comprehensive overview of campaign performance, including spend, clicks, views, impressions, and attributed revenue.\",\n}\n\nCOLUMNS = {\n \"order_values\": {\n \"order_line_item_id\": {\n \"description\": \"Unique identifier for each line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"source\": {\"description\": \"Source of the order\", \"values_sample\": [\"shopify\"]},\n \"order_id\": {\n \"description\": \"Unique identifier for each order\",\n \"values_sample\": [\"shopify_5667598663969\"],\n },\n \"ordered_quantity\": {\n \"description\": \"Quantity of each item of a line item\",\n \"values_sample\": [1],\n },\n \"tax_percent\": {\n \"description\": \"Tax percentage applied to the order\",\n \"values_sample\": [0.17999949556658],\n },\n \"total_price_tax\": {\n \"description\": \"Total price including tax\",\n \"values_sample\": [152.389468594368],\n },\n \"gross_sales_price_before_tax\": {\n \"description\": \"Gross sales price before applying tax\",\n \"values_sample\": [846.610531405632],\n },\n \"total_discount_after_tax\": {\n \"description\": \"Total discount after applying tax\",\n \"values_sample\": [0],\n },\n \"total_discount_tax\": {\n \"description\": \"Total discount amount subject to tax\",\n \"values_sample\": [0],\n },\n \"total_discount_before_tax\": {\n \"description\": \"Total discount before applying tax\",\n \"values_sample\": [0],\n },\n \"total_returns_before_tax\": {\n \"description\": \"Total return\/refund amount before tax\",\n \"values_sample\": [846.610531405632],\n },\n \"net_sales_before_tax\": {\n \"description\": \"Net sales amount before applying tax\",\n \"values_sample\": [0],\n },\n \"item_shipping_charge\": {\n \"description\": \"Shipping charge for an item\",\n \"values_sample\": [0],\n },\n \"item_duties\": {\n \"description\": \"Duties charged for an item\",\n \"values_sample\": [0],\n },\n \"item_additional_feels\": {\n \"description\": \"Additional fees charged for an item\",\n \"values_sample\": [0],\n },\n \"total_tax\": {\"description\": \"Total tax amount\", \"values_sample\": [0]},\n \"total_sales_after_tax\": {\n \"description\": \"Total sales amount after applying tax\",\n \"values_sample\": [0],\n },\n \"sku_id\": {\n \"description\": \"Unique identifier for each stock keeping unit (SKU)\",\n \"values_sample\": [\"shopify_8848983261473_47478863036705\"],\n },\n \"sku_code\": {\n \"description\": \"Code assigned to each stock keeping unit (SKU)\",\n \"values_sample\": [\"BSL-D-SIP-0001\"],\n },\n \"product_category\": {\n \"description\": \"Category of the product\",\n \"values_sample\": [\"Insulated Sipper\"],\n },\n \"product_id\": {\n \"description\": \"Unique identifier for each product\",\n \"values_sample\": [\"shopify_8848983261473\"],\n },\n \"product_title\": {\n \"description\": \"Title of the product\",\n \"values_sample\": [\"Kids Sipper (430 ml)\"],\n },\n \"product_price\": {\n \"description\": \"Price of the product\",\n \"values_sample\": [999],\n },\n \"customer_id\": {\n \"description\": \"Unique identifier for each customer\",\n \"values_sample\": [\"shopify_7694075199777\"],\n },\n \"first_ordered_at\": {\n \"description\": \"Timestamp of the first order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_refund_line_item_id\": {\n \"description\": \"Unique identifier for each refunded line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"order_date_time\": {\n \"description\": \"Date and time of the order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_date\": {\n \"description\": \"Date of the order\",\n \"values_sample\": [\"2024-02-14\"],\n },\n \"order_year\": {\"description\": \"Year of the order\", \"values_sample\": [2024]},\n \"order_quarter\": {\n \"description\": \"Quarter of the year of the order\",\n \"values_sample\": [1],\n },\n \"order_month\": {\"description\": \"Month of the order\", \"values_sample\": [2]},\n \"order_day_of_month\": {\n \"description\": \"Day of the month of the order\",\n \"values_sample\": [14],\n },\n \"order_week\": {\n \"description\": \"Week of the year of the order\",\n \"values_sample\": [7],\n },\n \"order_day_of_week\": {\n \"description\": \"Day of the week of the order\",\n \"values_sample\": [4],\n },\n \"order_hour\": {\n \"description\": \"Hour of the day of the order\",\n \"values_sample\": [16],\n },\n \"order_minute\": {\n \"description\": \"Minute of the hour of the order\",\n \"values_sample\": [0],\n },\n \"order_time\": {\"description\": \"Time of the order\", \"values_sample\": [\"16:00\"]},\n \"cancellation_status\": {\n \"description\": \"Status of order cancellation\",\n \"values_sample\": [\"false\"],\n },\n \"refund_status\": {\n \"description\": \"Status of order refund\",\n \"values_sample\": [\"false\"],\n },\n \"order_status\": {\n \"description\": \"Status of the order\",\n \"values_sample\": [\"unknown\"],\n },\n \"payment_status\": {\n \"description\": \"Status of payment for the order\",\n \"values_sample\": [\"pending\"],\n },\n \"shipping_address_city\": {\n \"description\": \"City of the shipping address\",\n \"values_sample\": [\"Surat\"],\n },\n \"shipping_address_state\": {\n \"description\": \"State of the shipping address\",\n \"values_sample\": [\"Gujarat\"],\n },\n \"shipping_address_country\": {\n \"description\": \"Country of the shipping address\",\n \"values_sample\": [\"India\"],\n },\n }\n}\n \"marketing_performance\": {\n \"marketing_id\": {\n \"description\": \"Unique identifier for each marketing activity.\",\n \"values_sample\": [\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_304143034868101_310419640566194_productAdsamazon_ads_sponsored_products_548576666024459\",\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_405826215303183_448674135385556_productAdsamazon_ads_sponsored_products_511545631860472\",\n ],\n },\n \"activity_date_time\": {\n \"description\": \"Timestamp of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_date\": {\n \"description\": \"Date of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_year\": {\n \"description\": \"Year of the marketing activity.\",\n \"values_sample\": [\"2024\"],\n },\n \"activity_quarter\": {\n \"description\": \"Quarter of the year in which the marketing activity took place.\",\n \"values_sample\": [\"2\"],\n },\n \"activity_month\": {\n \"description\": \"Month of the year in which the marketing activity took place.\",\n \"values_sample\": [\"4\"],\n },\n \"activity_day_of_month\": {\n \"description\": \"Day of the month on which the marketing activity took place.\",\n \"values_sample\": [\"1\"],\n },\n \"activity_week\": {\n \"description\": \"Week of the year in which the marketing activity took place.\",\n \"values_sample\": [\"14\"],\n },\n \"activity_day_of_week\": {\n \"description\": \"Day of the week on which the marketing activity took place (1 for Monday, 7 for Sunday).\",\n \"values_sample\": [\"2\"],\n },\n \"activity_hour\": {\n \"description\": \"Hour of the day in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_minute\": {\n \"description\": \"Minute of the hour in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_time\": {\n \"description\": \"Formatted string representation of the marketing activity time.\",\n \"values_sample\": [\"00:00\"],\n },\n \"channel\": {\n \"description\": \"Marketing channel used for the activity (e.g., Google Ads, Facebook Ads, Email Marketing).\",\n \"values_sample\": [\"sponsored product\"],\n },\n \"vendor\": {\n \"description\": \"Vendor or platform responsible for the marketing activity (e.g., Google, Facebook, Mailchimp).\",\n \"values_sample\": [\"amazon\"],\n },\n \"ad_account_id\": {\n \"description\": \"Unique identifier for the ad account associated with the activity.\",\n \"values_sample\": [\"A5IVEQE4ZPVNJ\"],\n },\n \"ad_account_name\": {\n \"description\": \"Name of the ad account associated with the activity.\",\n \"values_sample\": [\"Famyo\"],\n },\n \"property_name\": {\n \"description\": \"Name of the property or website where the marketing activity was run.\",\n \"values_sample\": [\"amazon sponsored product\"],\n },\n \"network_type\": {\n \"description\": \"Type of advertising network used (e.g., Search, Display, Video).\",\n \"values_sample\": [\"amazon\"],\n },\n \"campaign_id\": {\n \"description\": \"Unique identifier for the marketing campaign.\",\n \"values_sample\": [\n \"304143034868101\",\n \"405826215303183\",\n ],\n },\n \"campaign_name\": {\n \"description\": \"Name of the marketing campaign.\",\n \"values_sample\": [\n \"Football Campaign with presets - B0CT662KJL - 15\/2\/2024 23:09:44\",\n \"Hvs_Tar_SP_Blankets_Genric_Mix\",\n ],\n },\n \"campaign_status\": {\n \"description\": \"Current status of the marketing campaign (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"PAUSED\", \"ENABLED\"],\n },\n \"adset_id\": {\n \"description\": \"Unique identifier for the ad set within the campaign.\",\n \"values_sample\": [\n \"310419640566194\",\n \"448674135385556\",\n ],\n },\n \"adset_name\": {\n \"description\": \"Name of the ad set within the campaign.\",\n \"values_sample\": [\n \"Ad group - 15\/2\/2024 23:09:44\",\n \"Glow Blankets C1\",\n ],\n },\n \"adset_status\": {\n \"description\": \"Current status of the ad set (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"ad_id\": {\n \"description\": \"Unique identifier for the individual ad within the ad set.\",\n \"values_sample\": [\n \"548576666024459\",\n \"511545631860472\",\n ],\n },\n \"ad_name\": {\n \"description\": \"Name of the individual ad.\",\n \"values_sample\": [\"B0CT662KJL\", \"B0CT6428LV\"],\n },\n \"ad_description\": {\n \"description\": \"Description of the individual ad.\",\n \"values_sample\": [\n \"FM_GIDB_Football\",\n \"FM_GIDB_Astronaut\",\n ],\n },\n \"ad_status\": {\n \"description\": \"Current status of the individual ad (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"total_spend\": {\n \"description\": \"Total amount spent on the marketing activity.\",\n \"values_sample\": [\"29.15\", \"110.15\"],\n },\n \"total_clicks\": {\n \"description\": \"Total number of clicks generated by the marketing activity.\",\n \"values_sample\": [\"3\", \"7\"],\n },\n \"total_views\": {\n \"description\": \"Total number of times the marketing activity was viewed.\",\n \"values_sample\": [\"306\", \"1404\"],\n },\n \"total_impressions\": {\n \"description\": \"Total number of times the marketing activity was displayed.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_orders\": {\n \"description\": \"Number of orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_revenue\": {\n \"description\": \"Revenue generated from orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"keyword\": {\n \"description\": \"Keyword used in the marketing activity (if applicable).\",\n \"values_sample\": [None],\n },\n \"_synced_at\": {\n \"description\": \"Timestamp indicating when the data was last synced.\",\n \"values_sample\": [\"2024-07-16T21:32:08.452+00:00\"],\n },\n },\n}","messages":[{"content":"You are an advanced AI trained to generate SQL queries based\n on a given context. Your task is to write an SQL query that accurately \n retrieves the requested data from the provided table schema. Do not answer with any explanations -- just the SQL query.\n Output only plain text. Do not output markdown. \n Please ensure that the SQL query matches the exact table name and column names\n specified in the TABLE_DESCRIPTIONS = {\n \"order_values\": \"This table contains order information aggregated across multiple sources for an e-commerce brand. The table is unique at an Order ID - SKU ID level. The table includes, but is not limited to, all pricing information (like gross sales, tax, net sales, shipping charge, duties, etc.), information related to the product (like SKU, product id\/title, price, etc.), order related information (timestamp of order), payment information and shipping information.\",\n \"marketing_performance\": \"This table contains detailed marketing performance data for an e-commerce brand, capturing data from various marketing activities and platforms. It provides a comprehensive overview of campaign performance, including spend, clicks, views, impressions, and attributed revenue.\",\n}\n\nCOLUMNS = {\n \"order_values\": {\n \"order_line_item_id\": {\n \"description\": \"Unique identifier for each line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"source\": {\"description\": \"Source of the order\", \"values_sample\": [\"shopify\"]},\n \"order_id\": {\n \"description\": \"Unique identifier for each order\",\n \"values_sample\": [\"shopify_5667598663969\"],\n },\n \"ordered_quantity\": {\n \"description\": \"Quantity of each item of a line item\",\n \"values_sample\": [1],\n },\n \"tax_percent\": {\n \"description\": \"Tax percentage applied to the order\",\n \"values_sample\": [0.17999949556658],\n },\n \"total_price_tax\": {\n \"description\": \"Total price including tax\",\n \"values_sample\": [152.389468594368],\n },\n \"gross_sales_price_before_tax\": {\n \"description\": \"Gross sales price before applying tax\",\n \"values_sample\": [846.610531405632],\n },\n \"total_discount_after_tax\": {\n \"description\": \"Total discount after applying tax\",\n \"values_sample\": [0],\n },\n \"total_discount_tax\": {\n \"description\": \"Total discount amount subject to tax\",\n \"values_sample\": [0],\n },\n \"total_discount_before_tax\": {\n \"description\": \"Total discount before applying tax\",\n \"values_sample\": [0],\n },\n \"total_returns_before_tax\": {\n \"description\": \"Total return\/refund amount before tax\",\n \"values_sample\": [846.610531405632],\n },\n \"net_sales_before_tax\": {\n \"description\": \"Net sales amount before applying tax\",\n \"values_sample\": [0],\n },\n \"item_shipping_charge\": {\n \"description\": \"Shipping charge for an item\",\n \"values_sample\": [0],\n },\n \"item_duties\": {\n \"description\": \"Duties charged for an item\",\n \"values_sample\": [0],\n },\n \"item_additional_feels\": {\n \"description\": \"Additional fees charged for an item\",\n \"values_sample\": [0],\n },\n \"total_tax\": {\"description\": \"Total tax amount\", \"values_sample\": [0]},\n \"total_sales_after_tax\": {\n \"description\": \"Total sales amount after applying tax\",\n \"values_sample\": [0],\n },\n \"sku_id\": {\n \"description\": \"Unique identifier for each stock keeping unit (SKU)\",\n \"values_sample\": [\"shopify_8848983261473_47478863036705\"],\n },\n \"sku_code\": {\n \"description\": \"Code assigned to each stock keeping unit (SKU)\",\n \"values_sample\": [\"BSL-D-SIP-0001\"],\n },\n \"product_category\": {\n \"description\": \"Category of the product\",\n \"values_sample\": [\"Insulated Sipper\"],\n },\n \"product_id\": {\n \"description\": \"Unique identifier for each product\",\n \"values_sample\": [\"shopify_8848983261473\"],\n },\n \"product_title\": {\n \"description\": \"Title of the product\",\n \"values_sample\": [\"Kids Sipper (430 ml)\"],\n },\n \"product_price\": {\n \"description\": \"Price of the product\",\n \"values_sample\": [999],\n },\n \"customer_id\": {\n \"description\": \"Unique identifier for each customer\",\n \"values_sample\": [\"shopify_7694075199777\"],\n },\n \"first_ordered_at\": {\n \"description\": \"Timestamp of the first order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_refund_line_item_id\": {\n \"description\": \"Unique identifier for each refunded line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"order_date_time\": {\n \"description\": \"Date and time of the order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_date\": {\n \"description\": \"Date of the order\",\n \"values_sample\": [\"2024-02-14\"],\n },\n \"order_year\": {\"description\": \"Year of the order\", \"values_sample\": [2024]},\n \"order_quarter\": {\n \"description\": \"Quarter of the year of the order\",\n \"values_sample\": [1],\n },\n \"order_month\": {\"description\": \"Month of the order\", \"values_sample\": [2]},\n \"order_day_of_month\": {\n \"description\": \"Day of the month of the order\",\n \"values_sample\": [14],\n },\n \"order_week\": {\n \"description\": \"Week of the year of the order\",\n \"values_sample\": [7],\n },\n \"order_day_of_week\": {\n \"description\": \"Day of the week of the order\",\n \"values_sample\": [4],\n },\n \"order_hour\": {\n \"description\": \"Hour of the day of the order\",\n \"values_sample\": [16],\n },\n \"order_minute\": {\n \"description\": \"Minute of the hour of the order\",\n \"values_sample\": [0],\n },\n \"order_time\": {\"description\": \"Time of the order\", \"values_sample\": [\"16:00\"]},\n \"cancellation_status\": {\n \"description\": \"Status of order cancellation\",\n \"values_sample\": [\"false\"],\n },\n \"refund_status\": {\n \"description\": \"Status of order refund\",\n \"values_sample\": [\"false\"],\n },\n \"order_status\": {\n \"description\": \"Status of the order\",\n \"values_sample\": [\"unknown\"],\n },\n \"payment_status\": {\n \"description\": \"Status of payment for the order\",\n \"values_sample\": [\"pending\"],\n },\n \"shipping_address_city\": {\n \"description\": \"City of the shipping address\",\n \"values_sample\": [\"Surat\"],\n },\n \"shipping_address_state\": {\n \"description\": \"State of the shipping address\",\n \"values_sample\": [\"Gujarat\"],\n },\n \"shipping_address_country\": {\n \"description\": \"Country of the shipping address\",\n \"values_sample\": [\"India\"],\n },\n }\n}\n \"marketing_performance\": {\n \"marketing_id\": {\n \"description\": \"Unique identifier for each marketing activity.\",\n \"values_sample\": [\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_304143034868101_310419640566194_productAdsamazon_ads_sponsored_products_548576666024459\",\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_405826215303183_448674135385556_productAdsamazon_ads_sponsored_products_511545631860472\",\n ],\n },\n \"activity_date_time\": {\n \"description\": \"Timestamp of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_date\": {\n \"description\": \"Date of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_year\": {\n \"description\": \"Year of the marketing activity.\",\n \"values_sample\": [\"2024\"],\n },\n \"activity_quarter\": {\n \"description\": \"Quarter of the year in which the marketing activity took place.\",\n \"values_sample\": [\"2\"],\n },\n \"activity_month\": {\n \"description\": \"Month of the year in which the marketing activity took place.\",\n \"values_sample\": [\"4\"],\n },\n \"activity_day_of_month\": {\n \"description\": \"Day of the month on which the marketing activity took place.\",\n \"values_sample\": [\"1\"],\n },\n \"activity_week\": {\n \"description\": \"Week of the year in which the marketing activity took place.\",\n \"values_sample\": [\"14\"],\n },\n \"activity_day_of_week\": {\n \"description\": \"Day of the week on which the marketing activity took place (1 for Monday, 7 for Sunday).\",\n \"values_sample\": [\"2\"],\n },\n \"activity_hour\": {\n \"description\": \"Hour of the day in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_minute\": {\n \"description\": \"Minute of the hour in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_time\": {\n \"description\": \"Formatted string representation of the marketing activity time.\",\n \"values_sample\": [\"00:00\"],\n },\n \"channel\": {\n \"description\": \"Marketing channel used for the activity (e.g., Google Ads, Facebook Ads, Email Marketing).\",\n \"values_sample\": [\"sponsored product\"],\n },\n \"vendor\": {\n \"description\": \"Vendor or platform responsible for the marketing activity (e.g., Google, Facebook, Mailchimp).\",\n \"values_sample\": [\"amazon\"],\n },\n \"ad_account_id\": {\n \"description\": \"Unique identifier for the ad account associated with the activity.\",\n \"values_sample\": [\"A5IVEQE4ZPVNJ\"],\n },\n \"ad_account_name\": {\n \"description\": \"Name of the ad account associated with the activity.\",\n \"values_sample\": [\"Famyo\"],\n },\n \"property_name\": {\n \"description\": \"Name of the property or website where the marketing activity was run.\",\n \"values_sample\": [\"amazon sponsored product\"],\n },\n \"network_type\": {\n \"description\": \"Type of advertising network used (e.g., Search, Display, Video).\",\n \"values_sample\": [\"amazon\"],\n },\n \"campaign_id\": {\n \"description\": \"Unique identifier for the marketing campaign.\",\n \"values_sample\": [\n \"304143034868101\",\n \"405826215303183\",\n ],\n },\n \"campaign_name\": {\n \"description\": \"Name of the marketing campaign.\",\n \"values_sample\": [\n \"Football Campaign with presets - B0CT662KJL - 15\/2\/2024 23:09:44\",\n \"Hvs_Tar_SP_Blankets_Genric_Mix\",\n ],\n },\n \"campaign_status\": {\n \"description\": \"Current status of the marketing campaign (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"PAUSED\", \"ENABLED\"],\n },\n \"adset_id\": {\n \"description\": \"Unique identifier for the ad set within the campaign.\",\n \"values_sample\": [\n \"310419640566194\",\n \"448674135385556\",\n ],\n },\n \"adset_name\": {\n \"description\": \"Name of the ad set within the campaign.\",\n \"values_sample\": [\n \"Ad group - 15\/2\/2024 23:09:44\",\n \"Glow Blankets C1\",\n ],\n },\n \"adset_status\": {\n \"description\": \"Current status of the ad set (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"ad_id\": {\n \"description\": \"Unique identifier for the individual ad within the ad set.\",\n \"values_sample\": [\n \"548576666024459\",\n \"511545631860472\",\n ],\n },\n \"ad_name\": {\n \"description\": \"Name of the individual ad.\",\n \"values_sample\": [\"B0CT662KJL\", \"B0CT6428LV\"],\n },\n \"ad_description\": {\n \"description\": \"Description of the individual ad.\",\n \"values_sample\": [\n \"FM_GIDB_Football\",\n \"FM_GIDB_Astronaut\",\n ],\n },\n \"ad_status\": {\n \"description\": \"Current status of the individual ad (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"total_spend\": {\n \"description\": \"Total amount spent on the marketing activity.\",\n \"values_sample\": [\"29.15\", \"110.15\"],\n },\n \"total_clicks\": {\n \"description\": \"Total number of clicks generated by the marketing activity.\",\n \"values_sample\": [\"3\", \"7\"],\n },\n \"total_views\": {\n \"description\": \"Total number of times the marketing activity was viewed.\",\n \"values_sample\": [\"306\", \"1404\"],\n },\n \"total_impressions\": {\n \"description\": \"Total number of times the marketing activity was displayed.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_orders\": {\n \"description\": \"Number of orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_revenue\": {\n \"description\": \"Revenue generated from orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"keyword\": {\n \"description\": \"Keyword used in the marketing activity (if applicable).\",\n \"values_sample\": [None],\n },\n \"_synced_at\": {\n \"description\": \"Timestamp indicating when the data was last synced.\",\n \"values_sample\": [\"2024-07-16T21:32:08.452+00:00\"],\n },\n },\n} in context I am giving you complete DB and table info in details, user context is bit lengthy so go line by line then answer properly","role":"system"},{"content":"What are the top performing categories for Q1 2024?","role":"user"},{"content":"SELECT LOWER(product_category) AS category, SUM(COALESCE(net_sales_before_tax, 0)) AS total_net_sales FROM order_values WHERE order_year = 2024 AND order_quarter = 1 GROUP BY LOWER(product_category) ORDER BY total_net_sales DESC;","role":"assistant"}]} -{"question":"What percentage of total revenue came from international sales in the last year?","answer":"SELECT ROUND((SUM(CASE WHEN LOWER(billing_address_country) != 'india' THEN net_sales_before_tax ELSE 0 END) \/ SUM(net_sales_before_tax)) * 100, 2) AS international_sales_percentage FROM order_values WHERE order_year = YEAR(DATE_SUB(CURRENT_DATE, DAYOFYEAR(CURRENT_DATE)))","llama-3-sqlcoder-8b":"WITH international_sales AS (SELECT SUM(total_sales_after_tax) AS total_international_sales FROM order_values WHERE shipping_address_country!= 'India'), total_revenue AS (SELECT SUM(total_sales_after_tax) AS total_revenue FROM order_values) SELECT ((international_sales.total_international_sales \/ NULLIF(total_revenue.total_revenue, 0)) * 100) AS percentage_of_international_sales FROM international_sales, total_revenue;","llama-3.1-8b":"SELECT CAST(SUM(CASE WHEN shipping_address_country = 'India' THEN total_sales_after_tax ELSE 0 END) AS DECIMAL(10,2)) * 100 \/ SUM(total_sales_after_tax) FROM order_values WHERE order_year = 2024","context":"TABLE_DESCRIPTIONS = {\n \"order_values\": \"This table contains order information aggregated across multiple sources for an e-commerce brand. The table is unique at an Order ID - SKU ID level. The table includes, but is not limited to, all pricing information (like gross sales, tax, net sales, shipping charge, duties, etc.), information related to the product (like SKU, product id\/title, price, etc.), order related information (timestamp of order), payment information and shipping information.\",\n \"marketing_performance\": \"This table contains detailed marketing performance data for an e-commerce brand, capturing data from various marketing activities and platforms. It provides a comprehensive overview of campaign performance, including spend, clicks, views, impressions, and attributed revenue.\",\n}\n\nCOLUMNS = {\n \"order_values\": {\n \"order_line_item_id\": {\n \"description\": \"Unique identifier for each line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"source\": {\"description\": \"Source of the order\", \"values_sample\": [\"shopify\"]},\n \"order_id\": {\n \"description\": \"Unique identifier for each order\",\n \"values_sample\": [\"shopify_5667598663969\"],\n },\n \"ordered_quantity\": {\n \"description\": \"Quantity of each item of a line item\",\n \"values_sample\": [1],\n },\n \"tax_percent\": {\n \"description\": \"Tax percentage applied to the order\",\n \"values_sample\": [0.17999949556658],\n },\n \"total_price_tax\": {\n \"description\": \"Total price including tax\",\n \"values_sample\": [152.389468594368],\n },\n \"gross_sales_price_before_tax\": {\n \"description\": \"Gross sales price before applying tax\",\n \"values_sample\": [846.610531405632],\n },\n \"total_discount_after_tax\": {\n \"description\": \"Total discount after applying tax\",\n \"values_sample\": [0],\n },\n \"total_discount_tax\": {\n \"description\": \"Total discount amount subject to tax\",\n \"values_sample\": [0],\n },\n \"total_discount_before_tax\": {\n \"description\": \"Total discount before applying tax\",\n \"values_sample\": [0],\n },\n \"total_returns_before_tax\": {\n \"description\": \"Total return\/refund amount before tax\",\n \"values_sample\": [846.610531405632],\n },\n \"net_sales_before_tax\": {\n \"description\": \"Net sales amount before applying tax\",\n \"values_sample\": [0],\n },\n \"item_shipping_charge\": {\n \"description\": \"Shipping charge for an item\",\n \"values_sample\": [0],\n },\n \"item_duties\": {\n \"description\": \"Duties charged for an item\",\n \"values_sample\": [0],\n },\n \"item_additional_feels\": {\n \"description\": \"Additional fees charged for an item\",\n \"values_sample\": [0],\n },\n \"total_tax\": {\"description\": \"Total tax amount\", \"values_sample\": [0]},\n \"total_sales_after_tax\": {\n \"description\": \"Total sales amount after applying tax\",\n \"values_sample\": [0],\n },\n \"sku_id\": {\n \"description\": \"Unique identifier for each stock keeping unit (SKU)\",\n \"values_sample\": [\"shopify_8848983261473_47478863036705\"],\n },\n \"sku_code\": {\n \"description\": \"Code assigned to each stock keeping unit (SKU)\",\n \"values_sample\": [\"BSL-D-SIP-0001\"],\n },\n \"product_category\": {\n \"description\": \"Category of the product\",\n \"values_sample\": [\"Insulated Sipper\"],\n },\n \"product_id\": {\n \"description\": \"Unique identifier for each product\",\n \"values_sample\": [\"shopify_8848983261473\"],\n },\n \"product_title\": {\n \"description\": \"Title of the product\",\n \"values_sample\": [\"Kids Sipper (430 ml)\"],\n },\n \"product_price\": {\n \"description\": \"Price of the product\",\n \"values_sample\": [999],\n },\n \"customer_id\": {\n \"description\": \"Unique identifier for each customer\",\n \"values_sample\": [\"shopify_7694075199777\"],\n },\n \"first_ordered_at\": {\n \"description\": \"Timestamp of the first order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_refund_line_item_id\": {\n \"description\": \"Unique identifier for each refunded line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"order_date_time\": {\n \"description\": \"Date and time of the order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_date\": {\n \"description\": \"Date of the order\",\n \"values_sample\": [\"2024-02-14\"],\n },\n \"order_year\": {\"description\": \"Year of the order\", \"values_sample\": [2024]},\n \"order_quarter\": {\n \"description\": \"Quarter of the year of the order\",\n \"values_sample\": [1],\n },\n \"order_month\": {\"description\": \"Month of the order\", \"values_sample\": [2]},\n \"order_day_of_month\": {\n \"description\": \"Day of the month of the order\",\n \"values_sample\": [14],\n },\n \"order_week\": {\n \"description\": \"Week of the year of the order\",\n \"values_sample\": [7],\n },\n \"order_day_of_week\": {\n \"description\": \"Day of the week of the order\",\n \"values_sample\": [4],\n },\n \"order_hour\": {\n \"description\": \"Hour of the day of the order\",\n \"values_sample\": [16],\n },\n \"order_minute\": {\n \"description\": \"Minute of the hour of the order\",\n \"values_sample\": [0],\n },\n \"order_time\": {\"description\": \"Time of the order\", \"values_sample\": [\"16:00\"]},\n \"cancellation_status\": {\n \"description\": \"Status of order cancellation\",\n \"values_sample\": [\"false\"],\n },\n \"refund_status\": {\n \"description\": \"Status of order refund\",\n \"values_sample\": [\"false\"],\n },\n \"order_status\": {\n \"description\": \"Status of the order\",\n \"values_sample\": [\"unknown\"],\n },\n \"payment_status\": {\n \"description\": \"Status of payment for the order\",\n \"values_sample\": [\"pending\"],\n },\n \"shipping_address_city\": {\n \"description\": \"City of the shipping address\",\n \"values_sample\": [\"Surat\"],\n },\n \"shipping_address_state\": {\n \"description\": \"State of the shipping address\",\n \"values_sample\": [\"Gujarat\"],\n },\n \"shipping_address_country\": {\n \"description\": \"Country of the shipping address\",\n \"values_sample\": [\"India\"],\n },\n }\n}\n \"marketing_performance\": {\n \"marketing_id\": {\n \"description\": \"Unique identifier for each marketing activity.\",\n \"values_sample\": [\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_304143034868101_310419640566194_productAdsamazon_ads_sponsored_products_548576666024459\",\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_405826215303183_448674135385556_productAdsamazon_ads_sponsored_products_511545631860472\",\n ],\n },\n \"activity_date_time\": {\n \"description\": \"Timestamp of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_date\": {\n \"description\": \"Date of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_year\": {\n \"description\": \"Year of the marketing activity.\",\n \"values_sample\": [\"2024\"],\n },\n \"activity_quarter\": {\n \"description\": \"Quarter of the year in which the marketing activity took place.\",\n \"values_sample\": [\"2\"],\n },\n \"activity_month\": {\n \"description\": \"Month of the year in which the marketing activity took place.\",\n \"values_sample\": [\"4\"],\n },\n \"activity_day_of_month\": {\n \"description\": \"Day of the month on which the marketing activity took place.\",\n \"values_sample\": [\"1\"],\n },\n \"activity_week\": {\n \"description\": \"Week of the year in which the marketing activity took place.\",\n \"values_sample\": [\"14\"],\n },\n \"activity_day_of_week\": {\n \"description\": \"Day of the week on which the marketing activity took place (1 for Monday, 7 for Sunday).\",\n \"values_sample\": [\"2\"],\n },\n \"activity_hour\": {\n \"description\": \"Hour of the day in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_minute\": {\n \"description\": \"Minute of the hour in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_time\": {\n \"description\": \"Formatted string representation of the marketing activity time.\",\n \"values_sample\": [\"00:00\"],\n },\n \"channel\": {\n \"description\": \"Marketing channel used for the activity (e.g., Google Ads, Facebook Ads, Email Marketing).\",\n \"values_sample\": [\"sponsored product\"],\n },\n \"vendor\": {\n \"description\": \"Vendor or platform responsible for the marketing activity (e.g., Google, Facebook, Mailchimp).\",\n \"values_sample\": [\"amazon\"],\n },\n \"ad_account_id\": {\n \"description\": \"Unique identifier for the ad account associated with the activity.\",\n \"values_sample\": [\"A5IVEQE4ZPVNJ\"],\n },\n \"ad_account_name\": {\n \"description\": \"Name of the ad account associated with the activity.\",\n \"values_sample\": [\"Famyo\"],\n },\n \"property_name\": {\n \"description\": \"Name of the property or website where the marketing activity was run.\",\n \"values_sample\": [\"amazon sponsored product\"],\n },\n \"network_type\": {\n \"description\": \"Type of advertising network used (e.g., Search, Display, Video).\",\n \"values_sample\": [\"amazon\"],\n },\n \"campaign_id\": {\n \"description\": \"Unique identifier for the marketing campaign.\",\n \"values_sample\": [\n \"304143034868101\",\n \"405826215303183\",\n ],\n },\n \"campaign_name\": {\n \"description\": \"Name of the marketing campaign.\",\n \"values_sample\": [\n \"Football Campaign with presets - B0CT662KJL - 15\/2\/2024 23:09:44\",\n \"Hvs_Tar_SP_Blankets_Genric_Mix\",\n ],\n },\n \"campaign_status\": {\n \"description\": \"Current status of the marketing campaign (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"PAUSED\", \"ENABLED\"],\n },\n \"adset_id\": {\n \"description\": \"Unique identifier for the ad set within the campaign.\",\n \"values_sample\": [\n \"310419640566194\",\n \"448674135385556\",\n ],\n },\n \"adset_name\": {\n \"description\": \"Name of the ad set within the campaign.\",\n \"values_sample\": [\n \"Ad group - 15\/2\/2024 23:09:44\",\n \"Glow Blankets C1\",\n ],\n },\n \"adset_status\": {\n \"description\": \"Current status of the ad set (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"ad_id\": {\n \"description\": \"Unique identifier for the individual ad within the ad set.\",\n \"values_sample\": [\n \"548576666024459\",\n \"511545631860472\",\n ],\n },\n \"ad_name\": {\n \"description\": \"Name of the individual ad.\",\n \"values_sample\": [\"B0CT662KJL\", \"B0CT6428LV\"],\n },\n \"ad_description\": {\n \"description\": \"Description of the individual ad.\",\n \"values_sample\": [\n \"FM_GIDB_Football\",\n \"FM_GIDB_Astronaut\",\n ],\n },\n \"ad_status\": {\n \"description\": \"Current status of the individual ad (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"total_spend\": {\n \"description\": \"Total amount spent on the marketing activity.\",\n \"values_sample\": [\"29.15\", \"110.15\"],\n },\n \"total_clicks\": {\n \"description\": \"Total number of clicks generated by the marketing activity.\",\n \"values_sample\": [\"3\", \"7\"],\n },\n \"total_views\": {\n \"description\": \"Total number of times the marketing activity was viewed.\",\n \"values_sample\": [\"306\", \"1404\"],\n },\n \"total_impressions\": {\n \"description\": \"Total number of times the marketing activity was displayed.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_orders\": {\n \"description\": \"Number of orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_revenue\": {\n \"description\": \"Revenue generated from orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"keyword\": {\n \"description\": \"Keyword used in the marketing activity (if applicable).\",\n \"values_sample\": [None],\n },\n \"_synced_at\": {\n \"description\": \"Timestamp indicating when the data was last synced.\",\n \"values_sample\": [\"2024-07-16T21:32:08.452+00:00\"],\n },\n },\n}","messages":[{"content":"You are an advanced AI trained to generate SQL queries based\n on a given context. Your task is to write an SQL query that accurately \n retrieves the requested data from the provided table schema. Do not answer with any explanations -- just the SQL query.\n Output only plain text. Do not output markdown. \n Please ensure that the SQL query matches the exact table name and column names\n specified in the TABLE_DESCRIPTIONS = {\n \"order_values\": \"This table contains order information aggregated across multiple sources for an e-commerce brand. The table is unique at an Order ID - SKU ID level. The table includes, but is not limited to, all pricing information (like gross sales, tax, net sales, shipping charge, duties, etc.), information related to the product (like SKU, product id\/title, price, etc.), order related information (timestamp of order), payment information and shipping information.\",\n \"marketing_performance\": \"This table contains detailed marketing performance data for an e-commerce brand, capturing data from various marketing activities and platforms. It provides a comprehensive overview of campaign performance, including spend, clicks, views, impressions, and attributed revenue.\",\n}\n\nCOLUMNS = {\n \"order_values\": {\n \"order_line_item_id\": {\n \"description\": \"Unique identifier for each line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"source\": {\"description\": \"Source of the order\", \"values_sample\": [\"shopify\"]},\n \"order_id\": {\n \"description\": \"Unique identifier for each order\",\n \"values_sample\": [\"shopify_5667598663969\"],\n },\n \"ordered_quantity\": {\n \"description\": \"Quantity of each item of a line item\",\n \"values_sample\": [1],\n },\n \"tax_percent\": {\n \"description\": \"Tax percentage applied to the order\",\n \"values_sample\": [0.17999949556658],\n },\n \"total_price_tax\": {\n \"description\": \"Total price including tax\",\n \"values_sample\": [152.389468594368],\n },\n \"gross_sales_price_before_tax\": {\n \"description\": \"Gross sales price before applying tax\",\n \"values_sample\": [846.610531405632],\n },\n \"total_discount_after_tax\": {\n \"description\": \"Total discount after applying tax\",\n \"values_sample\": [0],\n },\n \"total_discount_tax\": {\n \"description\": \"Total discount amount subject to tax\",\n \"values_sample\": [0],\n },\n \"total_discount_before_tax\": {\n \"description\": \"Total discount before applying tax\",\n \"values_sample\": [0],\n },\n \"total_returns_before_tax\": {\n \"description\": \"Total return\/refund amount before tax\",\n \"values_sample\": [846.610531405632],\n },\n \"net_sales_before_tax\": {\n \"description\": \"Net sales amount before applying tax\",\n \"values_sample\": [0],\n },\n \"item_shipping_charge\": {\n \"description\": \"Shipping charge for an item\",\n \"values_sample\": [0],\n },\n \"item_duties\": {\n \"description\": \"Duties charged for an item\",\n \"values_sample\": [0],\n },\n \"item_additional_feels\": {\n \"description\": \"Additional fees charged for an item\",\n \"values_sample\": [0],\n },\n \"total_tax\": {\"description\": \"Total tax amount\", \"values_sample\": [0]},\n \"total_sales_after_tax\": {\n \"description\": \"Total sales amount after applying tax\",\n \"values_sample\": [0],\n },\n \"sku_id\": {\n \"description\": \"Unique identifier for each stock keeping unit (SKU)\",\n \"values_sample\": [\"shopify_8848983261473_47478863036705\"],\n },\n \"sku_code\": {\n \"description\": \"Code assigned to each stock keeping unit (SKU)\",\n \"values_sample\": [\"BSL-D-SIP-0001\"],\n },\n \"product_category\": {\n \"description\": \"Category of the product\",\n \"values_sample\": [\"Insulated Sipper\"],\n },\n \"product_id\": {\n \"description\": \"Unique identifier for each product\",\n \"values_sample\": [\"shopify_8848983261473\"],\n },\n \"product_title\": {\n \"description\": \"Title of the product\",\n \"values_sample\": [\"Kids Sipper (430 ml)\"],\n },\n \"product_price\": {\n \"description\": \"Price of the product\",\n \"values_sample\": [999],\n },\n \"customer_id\": {\n \"description\": \"Unique identifier for each customer\",\n \"values_sample\": [\"shopify_7694075199777\"],\n },\n \"first_ordered_at\": {\n \"description\": \"Timestamp of the first order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_refund_line_item_id\": {\n \"description\": \"Unique identifier for each refunded line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"order_date_time\": {\n \"description\": \"Date and time of the order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_date\": {\n \"description\": \"Date of the order\",\n \"values_sample\": [\"2024-02-14\"],\n },\n \"order_year\": {\"description\": \"Year of the order\", \"values_sample\": [2024]},\n \"order_quarter\": {\n \"description\": \"Quarter of the year of the order\",\n \"values_sample\": [1],\n },\n \"order_month\": {\"description\": \"Month of the order\", \"values_sample\": [2]},\n \"order_day_of_month\": {\n \"description\": \"Day of the month of the order\",\n \"values_sample\": [14],\n },\n \"order_week\": {\n \"description\": \"Week of the year of the order\",\n \"values_sample\": [7],\n },\n \"order_day_of_week\": {\n \"description\": \"Day of the week of the order\",\n \"values_sample\": [4],\n },\n \"order_hour\": {\n \"description\": \"Hour of the day of the order\",\n \"values_sample\": [16],\n },\n \"order_minute\": {\n \"description\": \"Minute of the hour of the order\",\n \"values_sample\": [0],\n },\n \"order_time\": {\"description\": \"Time of the order\", \"values_sample\": [\"16:00\"]},\n \"cancellation_status\": {\n \"description\": \"Status of order cancellation\",\n \"values_sample\": [\"false\"],\n },\n \"refund_status\": {\n \"description\": \"Status of order refund\",\n \"values_sample\": [\"false\"],\n },\n \"order_status\": {\n \"description\": \"Status of the order\",\n \"values_sample\": [\"unknown\"],\n },\n \"payment_status\": {\n \"description\": \"Status of payment for the order\",\n \"values_sample\": [\"pending\"],\n },\n \"shipping_address_city\": {\n \"description\": \"City of the shipping address\",\n \"values_sample\": [\"Surat\"],\n },\n \"shipping_address_state\": {\n \"description\": \"State of the shipping address\",\n \"values_sample\": [\"Gujarat\"],\n },\n \"shipping_address_country\": {\n \"description\": \"Country of the shipping address\",\n \"values_sample\": [\"India\"],\n },\n }\n}\n \"marketing_performance\": {\n \"marketing_id\": {\n \"description\": \"Unique identifier for each marketing activity.\",\n \"values_sample\": [\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_304143034868101_310419640566194_productAdsamazon_ads_sponsored_products_548576666024459\",\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_405826215303183_448674135385556_productAdsamazon_ads_sponsored_products_511545631860472\",\n ],\n },\n \"activity_date_time\": {\n \"description\": \"Timestamp of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_date\": {\n \"description\": \"Date of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_year\": {\n \"description\": \"Year of the marketing activity.\",\n \"values_sample\": [\"2024\"],\n },\n \"activity_quarter\": {\n \"description\": \"Quarter of the year in which the marketing activity took place.\",\n \"values_sample\": [\"2\"],\n },\n \"activity_month\": {\n \"description\": \"Month of the year in which the marketing activity took place.\",\n \"values_sample\": [\"4\"],\n },\n \"activity_day_of_month\": {\n \"description\": \"Day of the month on which the marketing activity took place.\",\n \"values_sample\": [\"1\"],\n },\n \"activity_week\": {\n \"description\": \"Week of the year in which the marketing activity took place.\",\n \"values_sample\": [\"14\"],\n },\n \"activity_day_of_week\": {\n \"description\": \"Day of the week on which the marketing activity took place (1 for Monday, 7 for Sunday).\",\n \"values_sample\": [\"2\"],\n },\n \"activity_hour\": {\n \"description\": \"Hour of the day in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_minute\": {\n \"description\": \"Minute of the hour in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_time\": {\n \"description\": \"Formatted string representation of the marketing activity time.\",\n \"values_sample\": [\"00:00\"],\n },\n \"channel\": {\n \"description\": \"Marketing channel used for the activity (e.g., Google Ads, Facebook Ads, Email Marketing).\",\n \"values_sample\": [\"sponsored product\"],\n },\n \"vendor\": {\n \"description\": \"Vendor or platform responsible for the marketing activity (e.g., Google, Facebook, Mailchimp).\",\n \"values_sample\": [\"amazon\"],\n },\n \"ad_account_id\": {\n \"description\": \"Unique identifier for the ad account associated with the activity.\",\n \"values_sample\": [\"A5IVEQE4ZPVNJ\"],\n },\n \"ad_account_name\": {\n \"description\": \"Name of the ad account associated with the activity.\",\n \"values_sample\": [\"Famyo\"],\n },\n \"property_name\": {\n \"description\": \"Name of the property or website where the marketing activity was run.\",\n \"values_sample\": [\"amazon sponsored product\"],\n },\n \"network_type\": {\n \"description\": \"Type of advertising network used (e.g., Search, Display, Video).\",\n \"values_sample\": [\"amazon\"],\n },\n \"campaign_id\": {\n \"description\": \"Unique identifier for the marketing campaign.\",\n \"values_sample\": [\n \"304143034868101\",\n \"405826215303183\",\n ],\n },\n \"campaign_name\": {\n \"description\": \"Name of the marketing campaign.\",\n \"values_sample\": [\n \"Football Campaign with presets - B0CT662KJL - 15\/2\/2024 23:09:44\",\n \"Hvs_Tar_SP_Blankets_Genric_Mix\",\n ],\n },\n \"campaign_status\": {\n \"description\": \"Current status of the marketing campaign (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"PAUSED\", \"ENABLED\"],\n },\n \"adset_id\": {\n \"description\": \"Unique identifier for the ad set within the campaign.\",\n \"values_sample\": [\n \"310419640566194\",\n \"448674135385556\",\n ],\n },\n \"adset_name\": {\n \"description\": \"Name of the ad set within the campaign.\",\n \"values_sample\": [\n \"Ad group - 15\/2\/2024 23:09:44\",\n \"Glow Blankets C1\",\n ],\n },\n \"adset_status\": {\n \"description\": \"Current status of the ad set (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"ad_id\": {\n \"description\": \"Unique identifier for the individual ad within the ad set.\",\n \"values_sample\": [\n \"548576666024459\",\n \"511545631860472\",\n ],\n },\n \"ad_name\": {\n \"description\": \"Name of the individual ad.\",\n \"values_sample\": [\"B0CT662KJL\", \"B0CT6428LV\"],\n },\n \"ad_description\": {\n \"description\": \"Description of the individual ad.\",\n \"values_sample\": [\n \"FM_GIDB_Football\",\n \"FM_GIDB_Astronaut\",\n ],\n },\n \"ad_status\": {\n \"description\": \"Current status of the individual ad (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"total_spend\": {\n \"description\": \"Total amount spent on the marketing activity.\",\n \"values_sample\": [\"29.15\", \"110.15\"],\n },\n \"total_clicks\": {\n \"description\": \"Total number of clicks generated by the marketing activity.\",\n \"values_sample\": [\"3\", \"7\"],\n },\n \"total_views\": {\n \"description\": \"Total number of times the marketing activity was viewed.\",\n \"values_sample\": [\"306\", \"1404\"],\n },\n \"total_impressions\": {\n \"description\": \"Total number of times the marketing activity was displayed.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_orders\": {\n \"description\": \"Number of orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_revenue\": {\n \"description\": \"Revenue generated from orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"keyword\": {\n \"description\": \"Keyword used in the marketing activity (if applicable).\",\n \"values_sample\": [None],\n },\n \"_synced_at\": {\n \"description\": \"Timestamp indicating when the data was last synced.\",\n \"values_sample\": [\"2024-07-16T21:32:08.452+00:00\"],\n },\n },\n} in context I am giving you complete DB and table info in details, user context is bit lengthy so go line by line then answer properly","role":"system"},{"content":"What percentage of total revenue came from international sales in the last year?","role":"user"},{"content":"SELECT ROUND((SUM(CASE WHEN LOWER(billing_address_country) != 'india' THEN net_sales_before_tax ELSE 0 END) \/ SUM(net_sales_before_tax)) * 100, 2) AS international_sales_percentage FROM order_values WHERE order_year = YEAR(DATE_SUB(CURRENT_DATE, DAYOFYEAR(CURRENT_DATE)))","role":"assistant"}]} -{"question":"Show me trend of sales for the last 6 months","answer":"SELECT CONCAT(order_year, '-', LPAD(order_month, 2, '0')) AS order_date, SUM(COALESCE(net_sales_before_tax, 0)) AS net_sales FROM order_values WHERE TO_DATE(CONCAT(order_year, '-', LPAD(order_month, 2, '0')), 'yyyy-MM') >= DATE_TRUNC('month', ADD_MONTHS(CURRENT_DATE, -6)) AND TO_DATE(CONCAT(order_year, '-', LPAD(order_month, 2, '0')), 'yyyy-MM') < DATE_TRUNC('month', CURRENT_DATE) GROUP BY order_year, order_month ORDER BY order_year, order_month;","llama-3-sqlcoder-8b":"WITH monthly_sales AS (SELECT DATE_TRUNC('month', o.order_date) AS MONTH, SUM(o.total_sales_after_tax) AS total_sales FROM order_values o WHERE o.order_date >= (CURRENT_DATE - INTERVAL '6 months') GROUP BY DATE_TRUNC('month', o.order_date)) SELECT ms.MONTH, ms.total_sales FROM monthly_sales ms ORDER BY ms.MONTH;","llama-3.1-8b":"SELECT order_date, SUM(total_sales_after_tax) AS total_sales FROM order_values GROUP BY order_date ORDER BY order_date DESC LIMIT 6","context":"TABLE_DESCRIPTIONS = {\n \"order_values\": \"This table contains order information aggregated across multiple sources for an e-commerce brand. The table is unique at an Order ID - SKU ID level. The table includes, but is not limited to, all pricing information (like gross sales, tax, net sales, shipping charge, duties, etc.), information related to the product (like SKU, product id\/title, price, etc.), order related information (timestamp of order), payment information and shipping information.\",\n \"marketing_performance\": \"This table contains detailed marketing performance data for an e-commerce brand, capturing data from various marketing activities and platforms. It provides a comprehensive overview of campaign performance, including spend, clicks, views, impressions, and attributed revenue.\",\n}\n\nCOLUMNS = {\n \"order_values\": {\n \"order_line_item_id\": {\n \"description\": \"Unique identifier for each line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"source\": {\"description\": \"Source of the order\", \"values_sample\": [\"shopify\"]},\n \"order_id\": {\n \"description\": \"Unique identifier for each order\",\n \"values_sample\": [\"shopify_5667598663969\"],\n },\n \"ordered_quantity\": {\n \"description\": \"Quantity of each item of a line item\",\n \"values_sample\": [1],\n },\n \"tax_percent\": {\n \"description\": \"Tax percentage applied to the order\",\n \"values_sample\": [0.17999949556658],\n },\n \"total_price_tax\": {\n \"description\": \"Total price including tax\",\n \"values_sample\": [152.389468594368],\n },\n \"gross_sales_price_before_tax\": {\n \"description\": \"Gross sales price before applying tax\",\n \"values_sample\": [846.610531405632],\n },\n \"total_discount_after_tax\": {\n \"description\": \"Total discount after applying tax\",\n \"values_sample\": [0],\n },\n \"total_discount_tax\": {\n \"description\": \"Total discount amount subject to tax\",\n \"values_sample\": [0],\n },\n \"total_discount_before_tax\": {\n \"description\": \"Total discount before applying tax\",\n \"values_sample\": [0],\n },\n \"total_returns_before_tax\": {\n \"description\": \"Total return\/refund amount before tax\",\n \"values_sample\": [846.610531405632],\n },\n \"net_sales_before_tax\": {\n \"description\": \"Net sales amount before applying tax\",\n \"values_sample\": [0],\n },\n \"item_shipping_charge\": {\n \"description\": \"Shipping charge for an item\",\n \"values_sample\": [0],\n },\n \"item_duties\": {\n \"description\": \"Duties charged for an item\",\n \"values_sample\": [0],\n },\n \"item_additional_feels\": {\n \"description\": \"Additional fees charged for an item\",\n \"values_sample\": [0],\n },\n \"total_tax\": {\"description\": \"Total tax amount\", \"values_sample\": [0]},\n \"total_sales_after_tax\": {\n \"description\": \"Total sales amount after applying tax\",\n \"values_sample\": [0],\n },\n \"sku_id\": {\n \"description\": \"Unique identifier for each stock keeping unit (SKU)\",\n \"values_sample\": [\"shopify_8848983261473_47478863036705\"],\n },\n \"sku_code\": {\n \"description\": \"Code assigned to each stock keeping unit (SKU)\",\n \"values_sample\": [\"BSL-D-SIP-0001\"],\n },\n \"product_category\": {\n \"description\": \"Category of the product\",\n \"values_sample\": [\"Insulated Sipper\"],\n },\n \"product_id\": {\n \"description\": \"Unique identifier for each product\",\n \"values_sample\": [\"shopify_8848983261473\"],\n },\n \"product_title\": {\n \"description\": \"Title of the product\",\n \"values_sample\": [\"Kids Sipper (430 ml)\"],\n },\n \"product_price\": {\n \"description\": \"Price of the product\",\n \"values_sample\": [999],\n },\n \"customer_id\": {\n \"description\": \"Unique identifier for each customer\",\n \"values_sample\": [\"shopify_7694075199777\"],\n },\n \"first_ordered_at\": {\n \"description\": \"Timestamp of the first order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_refund_line_item_id\": {\n \"description\": \"Unique identifier for each refunded line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"order_date_time\": {\n \"description\": \"Date and time of the order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_date\": {\n \"description\": \"Date of the order\",\n \"values_sample\": [\"2024-02-14\"],\n },\n \"order_year\": {\"description\": \"Year of the order\", \"values_sample\": [2024]},\n \"order_quarter\": {\n \"description\": \"Quarter of the year of the order\",\n \"values_sample\": [1],\n },\n \"order_month\": {\"description\": \"Month of the order\", \"values_sample\": [2]},\n \"order_day_of_month\": {\n \"description\": \"Day of the month of the order\",\n \"values_sample\": [14],\n },\n \"order_week\": {\n \"description\": \"Week of the year of the order\",\n \"values_sample\": [7],\n },\n \"order_day_of_week\": {\n \"description\": \"Day of the week of the order\",\n \"values_sample\": [4],\n },\n \"order_hour\": {\n \"description\": \"Hour of the day of the order\",\n \"values_sample\": [16],\n },\n \"order_minute\": {\n \"description\": \"Minute of the hour of the order\",\n \"values_sample\": [0],\n },\n \"order_time\": {\"description\": \"Time of the order\", \"values_sample\": [\"16:00\"]},\n \"cancellation_status\": {\n \"description\": \"Status of order cancellation\",\n \"values_sample\": [\"false\"],\n },\n \"refund_status\": {\n \"description\": \"Status of order refund\",\n \"values_sample\": [\"false\"],\n },\n \"order_status\": {\n \"description\": \"Status of the order\",\n \"values_sample\": [\"unknown\"],\n },\n \"payment_status\": {\n \"description\": \"Status of payment for the order\",\n \"values_sample\": [\"pending\"],\n },\n \"shipping_address_city\": {\n \"description\": \"City of the shipping address\",\n \"values_sample\": [\"Surat\"],\n },\n \"shipping_address_state\": {\n \"description\": \"State of the shipping address\",\n \"values_sample\": [\"Gujarat\"],\n },\n \"shipping_address_country\": {\n \"description\": \"Country of the shipping address\",\n \"values_sample\": [\"India\"],\n },\n }\n}\n \"marketing_performance\": {\n \"marketing_id\": {\n \"description\": \"Unique identifier for each marketing activity.\",\n \"values_sample\": [\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_304143034868101_310419640566194_productAdsamazon_ads_sponsored_products_548576666024459\",\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_405826215303183_448674135385556_productAdsamazon_ads_sponsored_products_511545631860472\",\n ],\n },\n \"activity_date_time\": {\n \"description\": \"Timestamp of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_date\": {\n \"description\": \"Date of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_year\": {\n \"description\": \"Year of the marketing activity.\",\n \"values_sample\": [\"2024\"],\n },\n \"activity_quarter\": {\n \"description\": \"Quarter of the year in which the marketing activity took place.\",\n \"values_sample\": [\"2\"],\n },\n \"activity_month\": {\n \"description\": \"Month of the year in which the marketing activity took place.\",\n \"values_sample\": [\"4\"],\n },\n \"activity_day_of_month\": {\n \"description\": \"Day of the month on which the marketing activity took place.\",\n \"values_sample\": [\"1\"],\n },\n \"activity_week\": {\n \"description\": \"Week of the year in which the marketing activity took place.\",\n \"values_sample\": [\"14\"],\n },\n \"activity_day_of_week\": {\n \"description\": \"Day of the week on which the marketing activity took place (1 for Monday, 7 for Sunday).\",\n \"values_sample\": [\"2\"],\n },\n \"activity_hour\": {\n \"description\": \"Hour of the day in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_minute\": {\n \"description\": \"Minute of the hour in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_time\": {\n \"description\": \"Formatted string representation of the marketing activity time.\",\n \"values_sample\": [\"00:00\"],\n },\n \"channel\": {\n \"description\": \"Marketing channel used for the activity (e.g., Google Ads, Facebook Ads, Email Marketing).\",\n \"values_sample\": [\"sponsored product\"],\n },\n \"vendor\": {\n \"description\": \"Vendor or platform responsible for the marketing activity (e.g., Google, Facebook, Mailchimp).\",\n \"values_sample\": [\"amazon\"],\n },\n \"ad_account_id\": {\n \"description\": \"Unique identifier for the ad account associated with the activity.\",\n \"values_sample\": [\"A5IVEQE4ZPVNJ\"],\n },\n \"ad_account_name\": {\n \"description\": \"Name of the ad account associated with the activity.\",\n \"values_sample\": [\"Famyo\"],\n },\n \"property_name\": {\n \"description\": \"Name of the property or website where the marketing activity was run.\",\n \"values_sample\": [\"amazon sponsored product\"],\n },\n \"network_type\": {\n \"description\": \"Type of advertising network used (e.g., Search, Display, Video).\",\n \"values_sample\": [\"amazon\"],\n },\n \"campaign_id\": {\n \"description\": \"Unique identifier for the marketing campaign.\",\n \"values_sample\": [\n \"304143034868101\",\n \"405826215303183\",\n ],\n },\n \"campaign_name\": {\n \"description\": \"Name of the marketing campaign.\",\n \"values_sample\": [\n \"Football Campaign with presets - B0CT662KJL - 15\/2\/2024 23:09:44\",\n \"Hvs_Tar_SP_Blankets_Genric_Mix\",\n ],\n },\n \"campaign_status\": {\n \"description\": \"Current status of the marketing campaign (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"PAUSED\", \"ENABLED\"],\n },\n \"adset_id\": {\n \"description\": \"Unique identifier for the ad set within the campaign.\",\n \"values_sample\": [\n \"310419640566194\",\n \"448674135385556\",\n ],\n },\n \"adset_name\": {\n \"description\": \"Name of the ad set within the campaign.\",\n \"values_sample\": [\n \"Ad group - 15\/2\/2024 23:09:44\",\n \"Glow Blankets C1\",\n ],\n },\n \"adset_status\": {\n \"description\": \"Current status of the ad set (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"ad_id\": {\n \"description\": \"Unique identifier for the individual ad within the ad set.\",\n \"values_sample\": [\n \"548576666024459\",\n \"511545631860472\",\n ],\n },\n \"ad_name\": {\n \"description\": \"Name of the individual ad.\",\n \"values_sample\": [\"B0CT662KJL\", \"B0CT6428LV\"],\n },\n \"ad_description\": {\n \"description\": \"Description of the individual ad.\",\n \"values_sample\": [\n \"FM_GIDB_Football\",\n \"FM_GIDB_Astronaut\",\n ],\n },\n \"ad_status\": {\n \"description\": \"Current status of the individual ad (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"total_spend\": {\n \"description\": \"Total amount spent on the marketing activity.\",\n \"values_sample\": [\"29.15\", \"110.15\"],\n },\n \"total_clicks\": {\n \"description\": \"Total number of clicks generated by the marketing activity.\",\n \"values_sample\": [\"3\", \"7\"],\n },\n \"total_views\": {\n \"description\": \"Total number of times the marketing activity was viewed.\",\n \"values_sample\": [\"306\", \"1404\"],\n },\n \"total_impressions\": {\n \"description\": \"Total number of times the marketing activity was displayed.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_orders\": {\n \"description\": \"Number of orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_revenue\": {\n \"description\": \"Revenue generated from orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"keyword\": {\n \"description\": \"Keyword used in the marketing activity (if applicable).\",\n \"values_sample\": [None],\n },\n \"_synced_at\": {\n \"description\": \"Timestamp indicating when the data was last synced.\",\n \"values_sample\": [\"2024-07-16T21:32:08.452+00:00\"],\n },\n },\n}","messages":[{"content":"You are an advanced AI trained to generate SQL queries based\n on a given context. Your task is to write an SQL query that accurately \n retrieves the requested data from the provided table schema. Do not answer with any explanations -- just the SQL query.\n Output only plain text. Do not output markdown. \n Please ensure that the SQL query matches the exact table name and column names\n specified in the TABLE_DESCRIPTIONS = {\n \"order_values\": \"This table contains order information aggregated across multiple sources for an e-commerce brand. The table is unique at an Order ID - SKU ID level. The table includes, but is not limited to, all pricing information (like gross sales, tax, net sales, shipping charge, duties, etc.), information related to the product (like SKU, product id\/title, price, etc.), order related information (timestamp of order), payment information and shipping information.\",\n \"marketing_performance\": \"This table contains detailed marketing performance data for an e-commerce brand, capturing data from various marketing activities and platforms. It provides a comprehensive overview of campaign performance, including spend, clicks, views, impressions, and attributed revenue.\",\n}\n\nCOLUMNS = {\n \"order_values\": {\n \"order_line_item_id\": {\n \"description\": \"Unique identifier for each line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"source\": {\"description\": \"Source of the order\", \"values_sample\": [\"shopify\"]},\n \"order_id\": {\n \"description\": \"Unique identifier for each order\",\n \"values_sample\": [\"shopify_5667598663969\"],\n },\n \"ordered_quantity\": {\n \"description\": \"Quantity of each item of a line item\",\n \"values_sample\": [1],\n },\n \"tax_percent\": {\n \"description\": \"Tax percentage applied to the order\",\n \"values_sample\": [0.17999949556658],\n },\n \"total_price_tax\": {\n \"description\": \"Total price including tax\",\n \"values_sample\": [152.389468594368],\n },\n \"gross_sales_price_before_tax\": {\n \"description\": \"Gross sales price before applying tax\",\n \"values_sample\": [846.610531405632],\n },\n \"total_discount_after_tax\": {\n \"description\": \"Total discount after applying tax\",\n \"values_sample\": [0],\n },\n \"total_discount_tax\": {\n \"description\": \"Total discount amount subject to tax\",\n \"values_sample\": [0],\n },\n \"total_discount_before_tax\": {\n \"description\": \"Total discount before applying tax\",\n \"values_sample\": [0],\n },\n \"total_returns_before_tax\": {\n \"description\": \"Total return\/refund amount before tax\",\n \"values_sample\": [846.610531405632],\n },\n \"net_sales_before_tax\": {\n \"description\": \"Net sales amount before applying tax\",\n \"values_sample\": [0],\n },\n \"item_shipping_charge\": {\n \"description\": \"Shipping charge for an item\",\n \"values_sample\": [0],\n },\n \"item_duties\": {\n \"description\": \"Duties charged for an item\",\n \"values_sample\": [0],\n },\n \"item_additional_feels\": {\n \"description\": \"Additional fees charged for an item\",\n \"values_sample\": [0],\n },\n \"total_tax\": {\"description\": \"Total tax amount\", \"values_sample\": [0]},\n \"total_sales_after_tax\": {\n \"description\": \"Total sales amount after applying tax\",\n \"values_sample\": [0],\n },\n \"sku_id\": {\n \"description\": \"Unique identifier for each stock keeping unit (SKU)\",\n \"values_sample\": [\"shopify_8848983261473_47478863036705\"],\n },\n \"sku_code\": {\n \"description\": \"Code assigned to each stock keeping unit (SKU)\",\n \"values_sample\": [\"BSL-D-SIP-0001\"],\n },\n \"product_category\": {\n \"description\": \"Category of the product\",\n \"values_sample\": [\"Insulated Sipper\"],\n },\n \"product_id\": {\n \"description\": \"Unique identifier for each product\",\n \"values_sample\": [\"shopify_8848983261473\"],\n },\n \"product_title\": {\n \"description\": \"Title of the product\",\n \"values_sample\": [\"Kids Sipper (430 ml)\"],\n },\n \"product_price\": {\n \"description\": \"Price of the product\",\n \"values_sample\": [999],\n },\n \"customer_id\": {\n \"description\": \"Unique identifier for each customer\",\n \"values_sample\": [\"shopify_7694075199777\"],\n },\n \"first_ordered_at\": {\n \"description\": \"Timestamp of the first order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_refund_line_item_id\": {\n \"description\": \"Unique identifier for each refunded line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"order_date_time\": {\n \"description\": \"Date and time of the order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_date\": {\n \"description\": \"Date of the order\",\n \"values_sample\": [\"2024-02-14\"],\n },\n \"order_year\": {\"description\": \"Year of the order\", \"values_sample\": [2024]},\n \"order_quarter\": {\n \"description\": \"Quarter of the year of the order\",\n \"values_sample\": [1],\n },\n \"order_month\": {\"description\": \"Month of the order\", \"values_sample\": [2]},\n \"order_day_of_month\": {\n \"description\": \"Day of the month of the order\",\n \"values_sample\": [14],\n },\n \"order_week\": {\n \"description\": \"Week of the year of the order\",\n \"values_sample\": [7],\n },\n \"order_day_of_week\": {\n \"description\": \"Day of the week of the order\",\n \"values_sample\": [4],\n },\n \"order_hour\": {\n \"description\": \"Hour of the day of the order\",\n \"values_sample\": [16],\n },\n \"order_minute\": {\n \"description\": \"Minute of the hour of the order\",\n \"values_sample\": [0],\n },\n \"order_time\": {\"description\": \"Time of the order\", \"values_sample\": [\"16:00\"]},\n \"cancellation_status\": {\n \"description\": \"Status of order cancellation\",\n \"values_sample\": [\"false\"],\n },\n \"refund_status\": {\n \"description\": \"Status of order refund\",\n \"values_sample\": [\"false\"],\n },\n \"order_status\": {\n \"description\": \"Status of the order\",\n \"values_sample\": [\"unknown\"],\n },\n \"payment_status\": {\n \"description\": \"Status of payment for the order\",\n \"values_sample\": [\"pending\"],\n },\n \"shipping_address_city\": {\n \"description\": \"City of the shipping address\",\n \"values_sample\": [\"Surat\"],\n },\n \"shipping_address_state\": {\n \"description\": \"State of the shipping address\",\n \"values_sample\": [\"Gujarat\"],\n },\n \"shipping_address_country\": {\n \"description\": \"Country of the shipping address\",\n \"values_sample\": [\"India\"],\n },\n }\n}\n \"marketing_performance\": {\n \"marketing_id\": {\n \"description\": \"Unique identifier for each marketing activity.\",\n \"values_sample\": [\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_304143034868101_310419640566194_productAdsamazon_ads_sponsored_products_548576666024459\",\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_405826215303183_448674135385556_productAdsamazon_ads_sponsored_products_511545631860472\",\n ],\n },\n \"activity_date_time\": {\n \"description\": \"Timestamp of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_date\": {\n \"description\": \"Date of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_year\": {\n \"description\": \"Year of the marketing activity.\",\n \"values_sample\": [\"2024\"],\n },\n \"activity_quarter\": {\n \"description\": \"Quarter of the year in which the marketing activity took place.\",\n \"values_sample\": [\"2\"],\n },\n \"activity_month\": {\n \"description\": \"Month of the year in which the marketing activity took place.\",\n \"values_sample\": [\"4\"],\n },\n \"activity_day_of_month\": {\n \"description\": \"Day of the month on which the marketing activity took place.\",\n \"values_sample\": [\"1\"],\n },\n \"activity_week\": {\n \"description\": \"Week of the year in which the marketing activity took place.\",\n \"values_sample\": [\"14\"],\n },\n \"activity_day_of_week\": {\n \"description\": \"Day of the week on which the marketing activity took place (1 for Monday, 7 for Sunday).\",\n \"values_sample\": [\"2\"],\n },\n \"activity_hour\": {\n \"description\": \"Hour of the day in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_minute\": {\n \"description\": \"Minute of the hour in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_time\": {\n \"description\": \"Formatted string representation of the marketing activity time.\",\n \"values_sample\": [\"00:00\"],\n },\n \"channel\": {\n \"description\": \"Marketing channel used for the activity (e.g., Google Ads, Facebook Ads, Email Marketing).\",\n \"values_sample\": [\"sponsored product\"],\n },\n \"vendor\": {\n \"description\": \"Vendor or platform responsible for the marketing activity (e.g., Google, Facebook, Mailchimp).\",\n \"values_sample\": [\"amazon\"],\n },\n \"ad_account_id\": {\n \"description\": \"Unique identifier for the ad account associated with the activity.\",\n \"values_sample\": [\"A5IVEQE4ZPVNJ\"],\n },\n \"ad_account_name\": {\n \"description\": \"Name of the ad account associated with the activity.\",\n \"values_sample\": [\"Famyo\"],\n },\n \"property_name\": {\n \"description\": \"Name of the property or website where the marketing activity was run.\",\n \"values_sample\": [\"amazon sponsored product\"],\n },\n \"network_type\": {\n \"description\": \"Type of advertising network used (e.g., Search, Display, Video).\",\n \"values_sample\": [\"amazon\"],\n },\n \"campaign_id\": {\n \"description\": \"Unique identifier for the marketing campaign.\",\n \"values_sample\": [\n \"304143034868101\",\n \"405826215303183\",\n ],\n },\n \"campaign_name\": {\n \"description\": \"Name of the marketing campaign.\",\n \"values_sample\": [\n \"Football Campaign with presets - B0CT662KJL - 15\/2\/2024 23:09:44\",\n \"Hvs_Tar_SP_Blankets_Genric_Mix\",\n ],\n },\n \"campaign_status\": {\n \"description\": \"Current status of the marketing campaign (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"PAUSED\", \"ENABLED\"],\n },\n \"adset_id\": {\n \"description\": \"Unique identifier for the ad set within the campaign.\",\n \"values_sample\": [\n \"310419640566194\",\n \"448674135385556\",\n ],\n },\n \"adset_name\": {\n \"description\": \"Name of the ad set within the campaign.\",\n \"values_sample\": [\n \"Ad group - 15\/2\/2024 23:09:44\",\n \"Glow Blankets C1\",\n ],\n },\n \"adset_status\": {\n \"description\": \"Current status of the ad set (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"ad_id\": {\n \"description\": \"Unique identifier for the individual ad within the ad set.\",\n \"values_sample\": [\n \"548576666024459\",\n \"511545631860472\",\n ],\n },\n \"ad_name\": {\n \"description\": \"Name of the individual ad.\",\n \"values_sample\": [\"B0CT662KJL\", \"B0CT6428LV\"],\n },\n \"ad_description\": {\n \"description\": \"Description of the individual ad.\",\n \"values_sample\": [\n \"FM_GIDB_Football\",\n \"FM_GIDB_Astronaut\",\n ],\n },\n \"ad_status\": {\n \"description\": \"Current status of the individual ad (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"total_spend\": {\n \"description\": \"Total amount spent on the marketing activity.\",\n \"values_sample\": [\"29.15\", \"110.15\"],\n },\n \"total_clicks\": {\n \"description\": \"Total number of clicks generated by the marketing activity.\",\n \"values_sample\": [\"3\", \"7\"],\n },\n \"total_views\": {\n \"description\": \"Total number of times the marketing activity was viewed.\",\n \"values_sample\": [\"306\", \"1404\"],\n },\n \"total_impressions\": {\n \"description\": \"Total number of times the marketing activity was displayed.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_orders\": {\n \"description\": \"Number of orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_revenue\": {\n \"description\": \"Revenue generated from orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"keyword\": {\n \"description\": \"Keyword used in the marketing activity (if applicable).\",\n \"values_sample\": [None],\n },\n \"_synced_at\": {\n \"description\": \"Timestamp indicating when the data was last synced.\",\n \"values_sample\": [\"2024-07-16T21:32:08.452+00:00\"],\n },\n },\n} in context I am giving you complete DB and table info in details, user context is bit lengthy so go line by line then answer properly","role":"system"},{"content":"Show me trend of sales for the last 6 months","role":"user"},{"content":"SELECT CONCAT(order_year, '-', LPAD(order_month, 2, '0')) AS order_date, SUM(COALESCE(net_sales_before_tax, 0)) AS net_sales FROM order_values WHERE TO_DATE(CONCAT(order_year, '-', LPAD(order_month, 2, '0')), 'yyyy-MM') >= DATE_TRUNC('month', ADD_MONTHS(CURRENT_DATE, -6)) AND TO_DATE(CONCAT(order_year, '-', LPAD(order_month, 2, '0')), 'yyyy-MM') < DATE_TRUNC('month', CURRENT_DATE) GROUP BY order_year, order_month ORDER BY order_year, order_month;","role":"assistant"}]} -{"question":"sales trend for last 6 months","answer":"SELECT CONCAT(order_year, '-', LPAD(order_month, 2, '0')) AS order_date, SUM(COALESCE(net_sales_before_tax, 0)) AS net_sales FROM order_values WHERE TO_DATE(CONCAT(order_year, '-', LPAD(order_month, 2, '0')), 'yyyy-MM') >= DATE_TRUNC('month', ADD_MONTHS(CURRENT_DATE, -6)) AND TO_DATE(CONCAT(order_year, '-', LPAD(order_month, 2, '0')), 'yyyy-MM') < DATE_TRUNC('month', CURRENT_DATE) GROUP BY order_year, order_month ORDER BY order_year, order_month;","llama-3-sqlcoder-8b":"WITH monthly_sales AS (SELECT DATE_TRUNC('month', o.order_date) AS MONTH, SUM(o.total_sales_after_tax) AS total_sales FROM order_values o WHERE o.order_date >= DATE_TRUNC('month', CURRENT_DATE) - INTERVAL '6 months' GROUP BY DATE_TRUNC('month', o.order_date)) SELECT ms.MONTH, ms.total_sales FROM monthly_sales ms ORDER BY ms.MONTH;","llama-3.1-8b":"SELECT SUM(total_sales_after_tax) FROM order_values WHERE order_month BETWEEN (SELECT MAX(order_month) - 5 FROM order_values) AND MAX(order_month)","context":"TABLE_DESCRIPTIONS = {\n \"order_values\": \"This table contains order information aggregated across multiple sources for an e-commerce brand. The table is unique at an Order ID - SKU ID level. The table includes, but is not limited to, all pricing information (like gross sales, tax, net sales, shipping charge, duties, etc.), information related to the product (like SKU, product id\/title, price, etc.), order related information (timestamp of order), payment information and shipping information.\",\n \"marketing_performance\": \"This table contains detailed marketing performance data for an e-commerce brand, capturing data from various marketing activities and platforms. It provides a comprehensive overview of campaign performance, including spend, clicks, views, impressions, and attributed revenue.\",\n}\n\nCOLUMNS = {\n \"order_values\": {\n \"order_line_item_id\": {\n \"description\": \"Unique identifier for each line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"source\": {\"description\": \"Source of the order\", \"values_sample\": [\"shopify\"]},\n \"order_id\": {\n \"description\": \"Unique identifier for each order\",\n \"values_sample\": [\"shopify_5667598663969\"],\n },\n \"ordered_quantity\": {\n \"description\": \"Quantity of each item of a line item\",\n \"values_sample\": [1],\n },\n \"tax_percent\": {\n \"description\": \"Tax percentage applied to the order\",\n \"values_sample\": [0.17999949556658],\n },\n \"total_price_tax\": {\n \"description\": \"Total price including tax\",\n \"values_sample\": [152.389468594368],\n },\n \"gross_sales_price_before_tax\": {\n \"description\": \"Gross sales price before applying tax\",\n \"values_sample\": [846.610531405632],\n },\n \"total_discount_after_tax\": {\n \"description\": \"Total discount after applying tax\",\n \"values_sample\": [0],\n },\n \"total_discount_tax\": {\n \"description\": \"Total discount amount subject to tax\",\n \"values_sample\": [0],\n },\n \"total_discount_before_tax\": {\n \"description\": \"Total discount before applying tax\",\n \"values_sample\": [0],\n },\n \"total_returns_before_tax\": {\n \"description\": \"Total return\/refund amount before tax\",\n \"values_sample\": [846.610531405632],\n },\n \"net_sales_before_tax\": {\n \"description\": \"Net sales amount before applying tax\",\n \"values_sample\": [0],\n },\n \"item_shipping_charge\": {\n \"description\": \"Shipping charge for an item\",\n \"values_sample\": [0],\n },\n \"item_duties\": {\n \"description\": \"Duties charged for an item\",\n \"values_sample\": [0],\n },\n \"item_additional_feels\": {\n \"description\": \"Additional fees charged for an item\",\n \"values_sample\": [0],\n },\n \"total_tax\": {\"description\": \"Total tax amount\", \"values_sample\": [0]},\n \"total_sales_after_tax\": {\n \"description\": \"Total sales amount after applying tax\",\n \"values_sample\": [0],\n },\n \"sku_id\": {\n \"description\": \"Unique identifier for each stock keeping unit (SKU)\",\n \"values_sample\": [\"shopify_8848983261473_47478863036705\"],\n },\n \"sku_code\": {\n \"description\": \"Code assigned to each stock keeping unit (SKU)\",\n \"values_sample\": [\"BSL-D-SIP-0001\"],\n },\n \"product_category\": {\n \"description\": \"Category of the product\",\n \"values_sample\": [\"Insulated Sipper\"],\n },\n \"product_id\": {\n \"description\": \"Unique identifier for each product\",\n \"values_sample\": [\"shopify_8848983261473\"],\n },\n \"product_title\": {\n \"description\": \"Title of the product\",\n \"values_sample\": [\"Kids Sipper (430 ml)\"],\n },\n \"product_price\": {\n \"description\": \"Price of the product\",\n \"values_sample\": [999],\n },\n \"customer_id\": {\n \"description\": \"Unique identifier for each customer\",\n \"values_sample\": [\"shopify_7694075199777\"],\n },\n \"first_ordered_at\": {\n \"description\": \"Timestamp of the first order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_refund_line_item_id\": {\n \"description\": \"Unique identifier for each refunded line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"order_date_time\": {\n \"description\": \"Date and time of the order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_date\": {\n \"description\": \"Date of the order\",\n \"values_sample\": [\"2024-02-14\"],\n },\n \"order_year\": {\"description\": \"Year of the order\", \"values_sample\": [2024]},\n \"order_quarter\": {\n \"description\": \"Quarter of the year of the order\",\n \"values_sample\": [1],\n },\n \"order_month\": {\"description\": \"Month of the order\", \"values_sample\": [2]},\n \"order_day_of_month\": {\n \"description\": \"Day of the month of the order\",\n \"values_sample\": [14],\n },\n \"order_week\": {\n \"description\": \"Week of the year of the order\",\n \"values_sample\": [7],\n },\n \"order_day_of_week\": {\n \"description\": \"Day of the week of the order\",\n \"values_sample\": [4],\n },\n \"order_hour\": {\n \"description\": \"Hour of the day of the order\",\n \"values_sample\": [16],\n },\n \"order_minute\": {\n \"description\": \"Minute of the hour of the order\",\n \"values_sample\": [0],\n },\n \"order_time\": {\"description\": \"Time of the order\", \"values_sample\": [\"16:00\"]},\n \"cancellation_status\": {\n \"description\": \"Status of order cancellation\",\n \"values_sample\": [\"false\"],\n },\n \"refund_status\": {\n \"description\": \"Status of order refund\",\n \"values_sample\": [\"false\"],\n },\n \"order_status\": {\n \"description\": \"Status of the order\",\n \"values_sample\": [\"unknown\"],\n },\n \"payment_status\": {\n \"description\": \"Status of payment for the order\",\n \"values_sample\": [\"pending\"],\n },\n \"shipping_address_city\": {\n \"description\": \"City of the shipping address\",\n \"values_sample\": [\"Surat\"],\n },\n \"shipping_address_state\": {\n \"description\": \"State of the shipping address\",\n \"values_sample\": [\"Gujarat\"],\n },\n \"shipping_address_country\": {\n \"description\": \"Country of the shipping address\",\n \"values_sample\": [\"India\"],\n },\n }\n}\n \"marketing_performance\": {\n \"marketing_id\": {\n \"description\": \"Unique identifier for each marketing activity.\",\n \"values_sample\": [\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_304143034868101_310419640566194_productAdsamazon_ads_sponsored_products_548576666024459\",\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_405826215303183_448674135385556_productAdsamazon_ads_sponsored_products_511545631860472\",\n ],\n },\n \"activity_date_time\": {\n \"description\": \"Timestamp of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_date\": {\n \"description\": \"Date of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_year\": {\n \"description\": \"Year of the marketing activity.\",\n \"values_sample\": [\"2024\"],\n },\n \"activity_quarter\": {\n \"description\": \"Quarter of the year in which the marketing activity took place.\",\n \"values_sample\": [\"2\"],\n },\n \"activity_month\": {\n \"description\": \"Month of the year in which the marketing activity took place.\",\n \"values_sample\": [\"4\"],\n },\n \"activity_day_of_month\": {\n \"description\": \"Day of the month on which the marketing activity took place.\",\n \"values_sample\": [\"1\"],\n },\n \"activity_week\": {\n \"description\": \"Week of the year in which the marketing activity took place.\",\n \"values_sample\": [\"14\"],\n },\n \"activity_day_of_week\": {\n \"description\": \"Day of the week on which the marketing activity took place (1 for Monday, 7 for Sunday).\",\n \"values_sample\": [\"2\"],\n },\n \"activity_hour\": {\n \"description\": \"Hour of the day in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_minute\": {\n \"description\": \"Minute of the hour in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_time\": {\n \"description\": \"Formatted string representation of the marketing activity time.\",\n \"values_sample\": [\"00:00\"],\n },\n \"channel\": {\n \"description\": \"Marketing channel used for the activity (e.g., Google Ads, Facebook Ads, Email Marketing).\",\n \"values_sample\": [\"sponsored product\"],\n },\n \"vendor\": {\n \"description\": \"Vendor or platform responsible for the marketing activity (e.g., Google, Facebook, Mailchimp).\",\n \"values_sample\": [\"amazon\"],\n },\n \"ad_account_id\": {\n \"description\": \"Unique identifier for the ad account associated with the activity.\",\n \"values_sample\": [\"A5IVEQE4ZPVNJ\"],\n },\n \"ad_account_name\": {\n \"description\": \"Name of the ad account associated with the activity.\",\n \"values_sample\": [\"Famyo\"],\n },\n \"property_name\": {\n \"description\": \"Name of the property or website where the marketing activity was run.\",\n \"values_sample\": [\"amazon sponsored product\"],\n },\n \"network_type\": {\n \"description\": \"Type of advertising network used (e.g., Search, Display, Video).\",\n \"values_sample\": [\"amazon\"],\n },\n \"campaign_id\": {\n \"description\": \"Unique identifier for the marketing campaign.\",\n \"values_sample\": [\n \"304143034868101\",\n \"405826215303183\",\n ],\n },\n \"campaign_name\": {\n \"description\": \"Name of the marketing campaign.\",\n \"values_sample\": [\n \"Football Campaign with presets - B0CT662KJL - 15\/2\/2024 23:09:44\",\n \"Hvs_Tar_SP_Blankets_Genric_Mix\",\n ],\n },\n \"campaign_status\": {\n \"description\": \"Current status of the marketing campaign (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"PAUSED\", \"ENABLED\"],\n },\n \"adset_id\": {\n \"description\": \"Unique identifier for the ad set within the campaign.\",\n \"values_sample\": [\n \"310419640566194\",\n \"448674135385556\",\n ],\n },\n \"adset_name\": {\n \"description\": \"Name of the ad set within the campaign.\",\n \"values_sample\": [\n \"Ad group - 15\/2\/2024 23:09:44\",\n \"Glow Blankets C1\",\n ],\n },\n \"adset_status\": {\n \"description\": \"Current status of the ad set (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"ad_id\": {\n \"description\": \"Unique identifier for the individual ad within the ad set.\",\n \"values_sample\": [\n \"548576666024459\",\n \"511545631860472\",\n ],\n },\n \"ad_name\": {\n \"description\": \"Name of the individual ad.\",\n \"values_sample\": [\"B0CT662KJL\", \"B0CT6428LV\"],\n },\n \"ad_description\": {\n \"description\": \"Description of the individual ad.\",\n \"values_sample\": [\n \"FM_GIDB_Football\",\n \"FM_GIDB_Astronaut\",\n ],\n },\n \"ad_status\": {\n \"description\": \"Current status of the individual ad (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"total_spend\": {\n \"description\": \"Total amount spent on the marketing activity.\",\n \"values_sample\": [\"29.15\", \"110.15\"],\n },\n \"total_clicks\": {\n \"description\": \"Total number of clicks generated by the marketing activity.\",\n \"values_sample\": [\"3\", \"7\"],\n },\n \"total_views\": {\n \"description\": \"Total number of times the marketing activity was viewed.\",\n \"values_sample\": [\"306\", \"1404\"],\n },\n \"total_impressions\": {\n \"description\": \"Total number of times the marketing activity was displayed.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_orders\": {\n \"description\": \"Number of orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_revenue\": {\n \"description\": \"Revenue generated from orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"keyword\": {\n \"description\": \"Keyword used in the marketing activity (if applicable).\",\n \"values_sample\": [None],\n },\n \"_synced_at\": {\n \"description\": \"Timestamp indicating when the data was last synced.\",\n \"values_sample\": [\"2024-07-16T21:32:08.452+00:00\"],\n },\n },\n}","messages":[{"content":"You are an advanced AI trained to generate SQL queries based\n on a given context. Your task is to write an SQL query that accurately \n retrieves the requested data from the provided table schema. Do not answer with any explanations -- just the SQL query.\n Output only plain text. Do not output markdown. \n Please ensure that the SQL query matches the exact table name and column names\n specified in the TABLE_DESCRIPTIONS = {\n \"order_values\": \"This table contains order information aggregated across multiple sources for an e-commerce brand. The table is unique at an Order ID - SKU ID level. The table includes, but is not limited to, all pricing information (like gross sales, tax, net sales, shipping charge, duties, etc.), information related to the product (like SKU, product id\/title, price, etc.), order related information (timestamp of order), payment information and shipping information.\",\n \"marketing_performance\": \"This table contains detailed marketing performance data for an e-commerce brand, capturing data from various marketing activities and platforms. It provides a comprehensive overview of campaign performance, including spend, clicks, views, impressions, and attributed revenue.\",\n}\n\nCOLUMNS = {\n \"order_values\": {\n \"order_line_item_id\": {\n \"description\": \"Unique identifier for each line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"source\": {\"description\": \"Source of the order\", \"values_sample\": [\"shopify\"]},\n \"order_id\": {\n \"description\": \"Unique identifier for each order\",\n \"values_sample\": [\"shopify_5667598663969\"],\n },\n \"ordered_quantity\": {\n \"description\": \"Quantity of each item of a line item\",\n \"values_sample\": [1],\n },\n \"tax_percent\": {\n \"description\": \"Tax percentage applied to the order\",\n \"values_sample\": [0.17999949556658],\n },\n \"total_price_tax\": {\n \"description\": \"Total price including tax\",\n \"values_sample\": [152.389468594368],\n },\n \"gross_sales_price_before_tax\": {\n \"description\": \"Gross sales price before applying tax\",\n \"values_sample\": [846.610531405632],\n },\n \"total_discount_after_tax\": {\n \"description\": \"Total discount after applying tax\",\n \"values_sample\": [0],\n },\n \"total_discount_tax\": {\n \"description\": \"Total discount amount subject to tax\",\n \"values_sample\": [0],\n },\n \"total_discount_before_tax\": {\n \"description\": \"Total discount before applying tax\",\n \"values_sample\": [0],\n },\n \"total_returns_before_tax\": {\n \"description\": \"Total return\/refund amount before tax\",\n \"values_sample\": [846.610531405632],\n },\n \"net_sales_before_tax\": {\n \"description\": \"Net sales amount before applying tax\",\n \"values_sample\": [0],\n },\n \"item_shipping_charge\": {\n \"description\": \"Shipping charge for an item\",\n \"values_sample\": [0],\n },\n \"item_duties\": {\n \"description\": \"Duties charged for an item\",\n \"values_sample\": [0],\n },\n \"item_additional_feels\": {\n \"description\": \"Additional fees charged for an item\",\n \"values_sample\": [0],\n },\n \"total_tax\": {\"description\": \"Total tax amount\", \"values_sample\": [0]},\n \"total_sales_after_tax\": {\n \"description\": \"Total sales amount after applying tax\",\n \"values_sample\": [0],\n },\n \"sku_id\": {\n \"description\": \"Unique identifier for each stock keeping unit (SKU)\",\n \"values_sample\": [\"shopify_8848983261473_47478863036705\"],\n },\n \"sku_code\": {\n \"description\": \"Code assigned to each stock keeping unit (SKU)\",\n \"values_sample\": [\"BSL-D-SIP-0001\"],\n },\n \"product_category\": {\n \"description\": \"Category of the product\",\n \"values_sample\": [\"Insulated Sipper\"],\n },\n \"product_id\": {\n \"description\": \"Unique identifier for each product\",\n \"values_sample\": [\"shopify_8848983261473\"],\n },\n \"product_title\": {\n \"description\": \"Title of the product\",\n \"values_sample\": [\"Kids Sipper (430 ml)\"],\n },\n \"product_price\": {\n \"description\": \"Price of the product\",\n \"values_sample\": [999],\n },\n \"customer_id\": {\n \"description\": \"Unique identifier for each customer\",\n \"values_sample\": [\"shopify_7694075199777\"],\n },\n \"first_ordered_at\": {\n \"description\": \"Timestamp of the first order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_refund_line_item_id\": {\n \"description\": \"Unique identifier for each refunded line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"order_date_time\": {\n \"description\": \"Date and time of the order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_date\": {\n \"description\": \"Date of the order\",\n \"values_sample\": [\"2024-02-14\"],\n },\n \"order_year\": {\"description\": \"Year of the order\", \"values_sample\": [2024]},\n \"order_quarter\": {\n \"description\": \"Quarter of the year of the order\",\n \"values_sample\": [1],\n },\n \"order_month\": {\"description\": \"Month of the order\", \"values_sample\": [2]},\n \"order_day_of_month\": {\n \"description\": \"Day of the month of the order\",\n \"values_sample\": [14],\n },\n \"order_week\": {\n \"description\": \"Week of the year of the order\",\n \"values_sample\": [7],\n },\n \"order_day_of_week\": {\n \"description\": \"Day of the week of the order\",\n \"values_sample\": [4],\n },\n \"order_hour\": {\n \"description\": \"Hour of the day of the order\",\n \"values_sample\": [16],\n },\n \"order_minute\": {\n \"description\": \"Minute of the hour of the order\",\n \"values_sample\": [0],\n },\n \"order_time\": {\"description\": \"Time of the order\", \"values_sample\": [\"16:00\"]},\n \"cancellation_status\": {\n \"description\": \"Status of order cancellation\",\n \"values_sample\": [\"false\"],\n },\n \"refund_status\": {\n \"description\": \"Status of order refund\",\n \"values_sample\": [\"false\"],\n },\n \"order_status\": {\n \"description\": \"Status of the order\",\n \"values_sample\": [\"unknown\"],\n },\n \"payment_status\": {\n \"description\": \"Status of payment for the order\",\n \"values_sample\": [\"pending\"],\n },\n \"shipping_address_city\": {\n \"description\": \"City of the shipping address\",\n \"values_sample\": [\"Surat\"],\n },\n \"shipping_address_state\": {\n \"description\": \"State of the shipping address\",\n \"values_sample\": [\"Gujarat\"],\n },\n \"shipping_address_country\": {\n \"description\": \"Country of the shipping address\",\n \"values_sample\": [\"India\"],\n },\n }\n}\n \"marketing_performance\": {\n \"marketing_id\": {\n \"description\": \"Unique identifier for each marketing activity.\",\n \"values_sample\": [\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_304143034868101_310419640566194_productAdsamazon_ads_sponsored_products_548576666024459\",\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_405826215303183_448674135385556_productAdsamazon_ads_sponsored_products_511545631860472\",\n ],\n },\n \"activity_date_time\": {\n \"description\": \"Timestamp of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_date\": {\n \"description\": \"Date of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_year\": {\n \"description\": \"Year of the marketing activity.\",\n \"values_sample\": [\"2024\"],\n },\n \"activity_quarter\": {\n \"description\": \"Quarter of the year in which the marketing activity took place.\",\n \"values_sample\": [\"2\"],\n },\n \"activity_month\": {\n \"description\": \"Month of the year in which the marketing activity took place.\",\n \"values_sample\": [\"4\"],\n },\n \"activity_day_of_month\": {\n \"description\": \"Day of the month on which the marketing activity took place.\",\n \"values_sample\": [\"1\"],\n },\n \"activity_week\": {\n \"description\": \"Week of the year in which the marketing activity took place.\",\n \"values_sample\": [\"14\"],\n },\n \"activity_day_of_week\": {\n \"description\": \"Day of the week on which the marketing activity took place (1 for Monday, 7 for Sunday).\",\n \"values_sample\": [\"2\"],\n },\n \"activity_hour\": {\n \"description\": \"Hour of the day in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_minute\": {\n \"description\": \"Minute of the hour in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_time\": {\n \"description\": \"Formatted string representation of the marketing activity time.\",\n \"values_sample\": [\"00:00\"],\n },\n \"channel\": {\n \"description\": \"Marketing channel used for the activity (e.g., Google Ads, Facebook Ads, Email Marketing).\",\n \"values_sample\": [\"sponsored product\"],\n },\n \"vendor\": {\n \"description\": \"Vendor or platform responsible for the marketing activity (e.g., Google, Facebook, Mailchimp).\",\n \"values_sample\": [\"amazon\"],\n },\n \"ad_account_id\": {\n \"description\": \"Unique identifier for the ad account associated with the activity.\",\n \"values_sample\": [\"A5IVEQE4ZPVNJ\"],\n },\n \"ad_account_name\": {\n \"description\": \"Name of the ad account associated with the activity.\",\n \"values_sample\": [\"Famyo\"],\n },\n \"property_name\": {\n \"description\": \"Name of the property or website where the marketing activity was run.\",\n \"values_sample\": [\"amazon sponsored product\"],\n },\n \"network_type\": {\n \"description\": \"Type of advertising network used (e.g., Search, Display, Video).\",\n \"values_sample\": [\"amazon\"],\n },\n \"campaign_id\": {\n \"description\": \"Unique identifier for the marketing campaign.\",\n \"values_sample\": [\n \"304143034868101\",\n \"405826215303183\",\n ],\n },\n \"campaign_name\": {\n \"description\": \"Name of the marketing campaign.\",\n \"values_sample\": [\n \"Football Campaign with presets - B0CT662KJL - 15\/2\/2024 23:09:44\",\n \"Hvs_Tar_SP_Blankets_Genric_Mix\",\n ],\n },\n \"campaign_status\": {\n \"description\": \"Current status of the marketing campaign (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"PAUSED\", \"ENABLED\"],\n },\n \"adset_id\": {\n \"description\": \"Unique identifier for the ad set within the campaign.\",\n \"values_sample\": [\n \"310419640566194\",\n \"448674135385556\",\n ],\n },\n \"adset_name\": {\n \"description\": \"Name of the ad set within the campaign.\",\n \"values_sample\": [\n \"Ad group - 15\/2\/2024 23:09:44\",\n \"Glow Blankets C1\",\n ],\n },\n \"adset_status\": {\n \"description\": \"Current status of the ad set (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"ad_id\": {\n \"description\": \"Unique identifier for the individual ad within the ad set.\",\n \"values_sample\": [\n \"548576666024459\",\n \"511545631860472\",\n ],\n },\n \"ad_name\": {\n \"description\": \"Name of the individual ad.\",\n \"values_sample\": [\"B0CT662KJL\", \"B0CT6428LV\"],\n },\n \"ad_description\": {\n \"description\": \"Description of the individual ad.\",\n \"values_sample\": [\n \"FM_GIDB_Football\",\n \"FM_GIDB_Astronaut\",\n ],\n },\n \"ad_status\": {\n \"description\": \"Current status of the individual ad (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"total_spend\": {\n \"description\": \"Total amount spent on the marketing activity.\",\n \"values_sample\": [\"29.15\", \"110.15\"],\n },\n \"total_clicks\": {\n \"description\": \"Total number of clicks generated by the marketing activity.\",\n \"values_sample\": [\"3\", \"7\"],\n },\n \"total_views\": {\n \"description\": \"Total number of times the marketing activity was viewed.\",\n \"values_sample\": [\"306\", \"1404\"],\n },\n \"total_impressions\": {\n \"description\": \"Total number of times the marketing activity was displayed.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_orders\": {\n \"description\": \"Number of orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_revenue\": {\n \"description\": \"Revenue generated from orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"keyword\": {\n \"description\": \"Keyword used in the marketing activity (if applicable).\",\n \"values_sample\": [None],\n },\n \"_synced_at\": {\n \"description\": \"Timestamp indicating when the data was last synced.\",\n \"values_sample\": [\"2024-07-16T21:32:08.452+00:00\"],\n },\n },\n} in context I am giving you complete DB and table info in details, user context is bit lengthy so go line by line then answer properly","role":"system"},{"content":"sales trend for last 6 months","role":"user"},{"content":"SELECT CONCAT(order_year, '-', LPAD(order_month, 2, '0')) AS order_date, SUM(COALESCE(net_sales_before_tax, 0)) AS net_sales FROM order_values WHERE TO_DATE(CONCAT(order_year, '-', LPAD(order_month, 2, '0')), 'yyyy-MM') >= DATE_TRUNC('month', ADD_MONTHS(CURRENT_DATE, -6)) AND TO_DATE(CONCAT(order_year, '-', LPAD(order_month, 2, '0')), 'yyyy-MM') < DATE_TRUNC('month', CURRENT_DATE) GROUP BY order_year, order_month ORDER BY order_year, order_month;","role":"assistant"}]} -{"question":"Compare the sales performance during peak hours vs. non-peak hours.","answer":"WITH peak_hours AS (SELECT order_id, SUM(net_sales_before_tax) AS total_net_sales FROM order_values WHERE order_date < DATE_TRUNC('month', CURRENT_DATE) AND order_date >= DATE_TRUNC('month', ADD_MONTHS(CURRENT_DATE, -12)) AND order_hour BETWEEN 18 AND 23 GROUP BY order_id), non_peak_hours AS (SELECT order_id, SUM(net_sales_before_tax) AS total_net_sales FROM order_values WHERE order_date < DATE_TRUNC('month', CURRENT_DATE) AND order_date >= DATE_TRUNC('month', ADD_MONTHS(CURRENT_DATE, -12)) AND order_hour NOT BETWEEN 18 AND 23 GROUP BY order_id) SELECT 'peak_hours' AS time_period, SUM(total_net_sales) AS net_sales FROM peak_hours UNION ALL SELECT 'non_peak_hours' AS time_period, SUM(total_net_sales) AS net_sales FROM non_peak_hours;\",","llama-3-sqlcoder-8b":"SELECT tvh.order_hour, SUM(CASE WHEN tvh.cancellation_status = 'false' THEN tvh.total_sales_after_tax ELSE 0 END) AS total_sales_during_hour, SUM(CASE WHEN tvh.cancellation_status = 'true' THEN tvh.total_sales_after_tax ELSE 0 END) AS total_sales_during_hour_with_cancellations FROM order_values tvh WHERE tvh.order_hour BETWEEN 12 AND 20 GROUP BY tvh.order_hour ORDER BY tvh.order_hour NULLS LAST;","llama-3.1-8b":"SELECT order_id, SUM(total_sales_after_tax) AS peak_hour_sales, SUM(CASE WHEN order_hour BETWEEN 12 AND 16 THEN total_sales_after_tax ELSE 0 END) AS non_peak_hour_sales FROM order_values GROUP BY order_id","context":"TABLE_DESCRIPTIONS = {\n \"order_values\": \"This table contains order information aggregated across multiple sources for an e-commerce brand. The table is unique at an Order ID - SKU ID level. The table includes, but is not limited to, all pricing information (like gross sales, tax, net sales, shipping charge, duties, etc.), information related to the product (like SKU, product id\/title, price, etc.), order related information (timestamp of order), payment information and shipping information.\",\n \"marketing_performance\": \"This table contains detailed marketing performance data for an e-commerce brand, capturing data from various marketing activities and platforms. It provides a comprehensive overview of campaign performance, including spend, clicks, views, impressions, and attributed revenue.\",\n}\n\nCOLUMNS = {\n \"order_values\": {\n \"order_line_item_id\": {\n \"description\": \"Unique identifier for each line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"source\": {\"description\": \"Source of the order\", \"values_sample\": [\"shopify\"]},\n \"order_id\": {\n \"description\": \"Unique identifier for each order\",\n \"values_sample\": [\"shopify_5667598663969\"],\n },\n \"ordered_quantity\": {\n \"description\": \"Quantity of each item of a line item\",\n \"values_sample\": [1],\n },\n \"tax_percent\": {\n \"description\": \"Tax percentage applied to the order\",\n \"values_sample\": [0.17999949556658],\n },\n \"total_price_tax\": {\n \"description\": \"Total price including tax\",\n \"values_sample\": [152.389468594368],\n },\n \"gross_sales_price_before_tax\": {\n \"description\": \"Gross sales price before applying tax\",\n \"values_sample\": [846.610531405632],\n },\n \"total_discount_after_tax\": {\n \"description\": \"Total discount after applying tax\",\n \"values_sample\": [0],\n },\n \"total_discount_tax\": {\n \"description\": \"Total discount amount subject to tax\",\n \"values_sample\": [0],\n },\n \"total_discount_before_tax\": {\n \"description\": \"Total discount before applying tax\",\n \"values_sample\": [0],\n },\n \"total_returns_before_tax\": {\n \"description\": \"Total return\/refund amount before tax\",\n \"values_sample\": [846.610531405632],\n },\n \"net_sales_before_tax\": {\n \"description\": \"Net sales amount before applying tax\",\n \"values_sample\": [0],\n },\n \"item_shipping_charge\": {\n \"description\": \"Shipping charge for an item\",\n \"values_sample\": [0],\n },\n \"item_duties\": {\n \"description\": \"Duties charged for an item\",\n \"values_sample\": [0],\n },\n \"item_additional_feels\": {\n \"description\": \"Additional fees charged for an item\",\n \"values_sample\": [0],\n },\n \"total_tax\": {\"description\": \"Total tax amount\", \"values_sample\": [0]},\n \"total_sales_after_tax\": {\n \"description\": \"Total sales amount after applying tax\",\n \"values_sample\": [0],\n },\n \"sku_id\": {\n \"description\": \"Unique identifier for each stock keeping unit (SKU)\",\n \"values_sample\": [\"shopify_8848983261473_47478863036705\"],\n },\n \"sku_code\": {\n \"description\": \"Code assigned to each stock keeping unit (SKU)\",\n \"values_sample\": [\"BSL-D-SIP-0001\"],\n },\n \"product_category\": {\n \"description\": \"Category of the product\",\n \"values_sample\": [\"Insulated Sipper\"],\n },\n \"product_id\": {\n \"description\": \"Unique identifier for each product\",\n \"values_sample\": [\"shopify_8848983261473\"],\n },\n \"product_title\": {\n \"description\": \"Title of the product\",\n \"values_sample\": [\"Kids Sipper (430 ml)\"],\n },\n \"product_price\": {\n \"description\": \"Price of the product\",\n \"values_sample\": [999],\n },\n \"customer_id\": {\n \"description\": \"Unique identifier for each customer\",\n \"values_sample\": [\"shopify_7694075199777\"],\n },\n \"first_ordered_at\": {\n \"description\": \"Timestamp of the first order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_refund_line_item_id\": {\n \"description\": \"Unique identifier for each refunded line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"order_date_time\": {\n \"description\": \"Date and time of the order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_date\": {\n \"description\": \"Date of the order\",\n \"values_sample\": [\"2024-02-14\"],\n },\n \"order_year\": {\"description\": \"Year of the order\", \"values_sample\": [2024]},\n \"order_quarter\": {\n \"description\": \"Quarter of the year of the order\",\n \"values_sample\": [1],\n },\n \"order_month\": {\"description\": \"Month of the order\", \"values_sample\": [2]},\n \"order_day_of_month\": {\n \"description\": \"Day of the month of the order\",\n \"values_sample\": [14],\n },\n \"order_week\": {\n \"description\": \"Week of the year of the order\",\n \"values_sample\": [7],\n },\n \"order_day_of_week\": {\n \"description\": \"Day of the week of the order\",\n \"values_sample\": [4],\n },\n \"order_hour\": {\n \"description\": \"Hour of the day of the order\",\n \"values_sample\": [16],\n },\n \"order_minute\": {\n \"description\": \"Minute of the hour of the order\",\n \"values_sample\": [0],\n },\n \"order_time\": {\"description\": \"Time of the order\", \"values_sample\": [\"16:00\"]},\n \"cancellation_status\": {\n \"description\": \"Status of order cancellation\",\n \"values_sample\": [\"false\"],\n },\n \"refund_status\": {\n \"description\": \"Status of order refund\",\n \"values_sample\": [\"false\"],\n },\n \"order_status\": {\n \"description\": \"Status of the order\",\n \"values_sample\": [\"unknown\"],\n },\n \"payment_status\": {\n \"description\": \"Status of payment for the order\",\n \"values_sample\": [\"pending\"],\n },\n \"shipping_address_city\": {\n \"description\": \"City of the shipping address\",\n \"values_sample\": [\"Surat\"],\n },\n \"shipping_address_state\": {\n \"description\": \"State of the shipping address\",\n \"values_sample\": [\"Gujarat\"],\n },\n \"shipping_address_country\": {\n \"description\": \"Country of the shipping address\",\n \"values_sample\": [\"India\"],\n },\n }\n}\n \"marketing_performance\": {\n \"marketing_id\": {\n \"description\": \"Unique identifier for each marketing activity.\",\n \"values_sample\": [\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_304143034868101_310419640566194_productAdsamazon_ads_sponsored_products_548576666024459\",\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_405826215303183_448674135385556_productAdsamazon_ads_sponsored_products_511545631860472\",\n ],\n },\n \"activity_date_time\": {\n \"description\": \"Timestamp of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_date\": {\n \"description\": \"Date of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_year\": {\n \"description\": \"Year of the marketing activity.\",\n \"values_sample\": [\"2024\"],\n },\n \"activity_quarter\": {\n \"description\": \"Quarter of the year in which the marketing activity took place.\",\n \"values_sample\": [\"2\"],\n },\n \"activity_month\": {\n \"description\": \"Month of the year in which the marketing activity took place.\",\n \"values_sample\": [\"4\"],\n },\n \"activity_day_of_month\": {\n \"description\": \"Day of the month on which the marketing activity took place.\",\n \"values_sample\": [\"1\"],\n },\n \"activity_week\": {\n \"description\": \"Week of the year in which the marketing activity took place.\",\n \"values_sample\": [\"14\"],\n },\n \"activity_day_of_week\": {\n \"description\": \"Day of the week on which the marketing activity took place (1 for Monday, 7 for Sunday).\",\n \"values_sample\": [\"2\"],\n },\n \"activity_hour\": {\n \"description\": \"Hour of the day in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_minute\": {\n \"description\": \"Minute of the hour in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_time\": {\n \"description\": \"Formatted string representation of the marketing activity time.\",\n \"values_sample\": [\"00:00\"],\n },\n \"channel\": {\n \"description\": \"Marketing channel used for the activity (e.g., Google Ads, Facebook Ads, Email Marketing).\",\n \"values_sample\": [\"sponsored product\"],\n },\n \"vendor\": {\n \"description\": \"Vendor or platform responsible for the marketing activity (e.g., Google, Facebook, Mailchimp).\",\n \"values_sample\": [\"amazon\"],\n },\n \"ad_account_id\": {\n \"description\": \"Unique identifier for the ad account associated with the activity.\",\n \"values_sample\": [\"A5IVEQE4ZPVNJ\"],\n },\n \"ad_account_name\": {\n \"description\": \"Name of the ad account associated with the activity.\",\n \"values_sample\": [\"Famyo\"],\n },\n \"property_name\": {\n \"description\": \"Name of the property or website where the marketing activity was run.\",\n \"values_sample\": [\"amazon sponsored product\"],\n },\n \"network_type\": {\n \"description\": \"Type of advertising network used (e.g., Search, Display, Video).\",\n \"values_sample\": [\"amazon\"],\n },\n \"campaign_id\": {\n \"description\": \"Unique identifier for the marketing campaign.\",\n \"values_sample\": [\n \"304143034868101\",\n \"405826215303183\",\n ],\n },\n \"campaign_name\": {\n \"description\": \"Name of the marketing campaign.\",\n \"values_sample\": [\n \"Football Campaign with presets - B0CT662KJL - 15\/2\/2024 23:09:44\",\n \"Hvs_Tar_SP_Blankets_Genric_Mix\",\n ],\n },\n \"campaign_status\": {\n \"description\": \"Current status of the marketing campaign (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"PAUSED\", \"ENABLED\"],\n },\n \"adset_id\": {\n \"description\": \"Unique identifier for the ad set within the campaign.\",\n \"values_sample\": [\n \"310419640566194\",\n \"448674135385556\",\n ],\n },\n \"adset_name\": {\n \"description\": \"Name of the ad set within the campaign.\",\n \"values_sample\": [\n \"Ad group - 15\/2\/2024 23:09:44\",\n \"Glow Blankets C1\",\n ],\n },\n \"adset_status\": {\n \"description\": \"Current status of the ad set (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"ad_id\": {\n \"description\": \"Unique identifier for the individual ad within the ad set.\",\n \"values_sample\": [\n \"548576666024459\",\n \"511545631860472\",\n ],\n },\n \"ad_name\": {\n \"description\": \"Name of the individual ad.\",\n \"values_sample\": [\"B0CT662KJL\", \"B0CT6428LV\"],\n },\n \"ad_description\": {\n \"description\": \"Description of the individual ad.\",\n \"values_sample\": [\n \"FM_GIDB_Football\",\n \"FM_GIDB_Astronaut\",\n ],\n },\n \"ad_status\": {\n \"description\": \"Current status of the individual ad (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"total_spend\": {\n \"description\": \"Total amount spent on the marketing activity.\",\n \"values_sample\": [\"29.15\", \"110.15\"],\n },\n \"total_clicks\": {\n \"description\": \"Total number of clicks generated by the marketing activity.\",\n \"values_sample\": [\"3\", \"7\"],\n },\n \"total_views\": {\n \"description\": \"Total number of times the marketing activity was viewed.\",\n \"values_sample\": [\"306\", \"1404\"],\n },\n \"total_impressions\": {\n \"description\": \"Total number of times the marketing activity was displayed.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_orders\": {\n \"description\": \"Number of orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_revenue\": {\n \"description\": \"Revenue generated from orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"keyword\": {\n \"description\": \"Keyword used in the marketing activity (if applicable).\",\n \"values_sample\": [None],\n },\n \"_synced_at\": {\n \"description\": \"Timestamp indicating when the data was last synced.\",\n \"values_sample\": [\"2024-07-16T21:32:08.452+00:00\"],\n },\n },\n}","messages":[{"content":"You are an advanced AI trained to generate SQL queries based\n on a given context. Your task is to write an SQL query that accurately \n retrieves the requested data from the provided table schema. Do not answer with any explanations -- just the SQL query.\n Output only plain text. Do not output markdown. \n Please ensure that the SQL query matches the exact table name and column names\n specified in the TABLE_DESCRIPTIONS = {\n \"order_values\": \"This table contains order information aggregated across multiple sources for an e-commerce brand. The table is unique at an Order ID - SKU ID level. The table includes, but is not limited to, all pricing information (like gross sales, tax, net sales, shipping charge, duties, etc.), information related to the product (like SKU, product id\/title, price, etc.), order related information (timestamp of order), payment information and shipping information.\",\n \"marketing_performance\": \"This table contains detailed marketing performance data for an e-commerce brand, capturing data from various marketing activities and platforms. It provides a comprehensive overview of campaign performance, including spend, clicks, views, impressions, and attributed revenue.\",\n}\n\nCOLUMNS = {\n \"order_values\": {\n \"order_line_item_id\": {\n \"description\": \"Unique identifier for each line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"source\": {\"description\": \"Source of the order\", \"values_sample\": [\"shopify\"]},\n \"order_id\": {\n \"description\": \"Unique identifier for each order\",\n \"values_sample\": [\"shopify_5667598663969\"],\n },\n \"ordered_quantity\": {\n \"description\": \"Quantity of each item of a line item\",\n \"values_sample\": [1],\n },\n \"tax_percent\": {\n \"description\": \"Tax percentage applied to the order\",\n \"values_sample\": [0.17999949556658],\n },\n \"total_price_tax\": {\n \"description\": \"Total price including tax\",\n \"values_sample\": [152.389468594368],\n },\n \"gross_sales_price_before_tax\": {\n \"description\": \"Gross sales price before applying tax\",\n \"values_sample\": [846.610531405632],\n },\n \"total_discount_after_tax\": {\n \"description\": \"Total discount after applying tax\",\n \"values_sample\": [0],\n },\n \"total_discount_tax\": {\n \"description\": \"Total discount amount subject to tax\",\n \"values_sample\": [0],\n },\n \"total_discount_before_tax\": {\n \"description\": \"Total discount before applying tax\",\n \"values_sample\": [0],\n },\n \"total_returns_before_tax\": {\n \"description\": \"Total return\/refund amount before tax\",\n \"values_sample\": [846.610531405632],\n },\n \"net_sales_before_tax\": {\n \"description\": \"Net sales amount before applying tax\",\n \"values_sample\": [0],\n },\n \"item_shipping_charge\": {\n \"description\": \"Shipping charge for an item\",\n \"values_sample\": [0],\n },\n \"item_duties\": {\n \"description\": \"Duties charged for an item\",\n \"values_sample\": [0],\n },\n \"item_additional_feels\": {\n \"description\": \"Additional fees charged for an item\",\n \"values_sample\": [0],\n },\n \"total_tax\": {\"description\": \"Total tax amount\", \"values_sample\": [0]},\n \"total_sales_after_tax\": {\n \"description\": \"Total sales amount after applying tax\",\n \"values_sample\": [0],\n },\n \"sku_id\": {\n \"description\": \"Unique identifier for each stock keeping unit (SKU)\",\n \"values_sample\": [\"shopify_8848983261473_47478863036705\"],\n },\n \"sku_code\": {\n \"description\": \"Code assigned to each stock keeping unit (SKU)\",\n \"values_sample\": [\"BSL-D-SIP-0001\"],\n },\n \"product_category\": {\n \"description\": \"Category of the product\",\n \"values_sample\": [\"Insulated Sipper\"],\n },\n \"product_id\": {\n \"description\": \"Unique identifier for each product\",\n \"values_sample\": [\"shopify_8848983261473\"],\n },\n \"product_title\": {\n \"description\": \"Title of the product\",\n \"values_sample\": [\"Kids Sipper (430 ml)\"],\n },\n \"product_price\": {\n \"description\": \"Price of the product\",\n \"values_sample\": [999],\n },\n \"customer_id\": {\n \"description\": \"Unique identifier for each customer\",\n \"values_sample\": [\"shopify_7694075199777\"],\n },\n \"first_ordered_at\": {\n \"description\": \"Timestamp of the first order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_refund_line_item_id\": {\n \"description\": \"Unique identifier for each refunded line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"order_date_time\": {\n \"description\": \"Date and time of the order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_date\": {\n \"description\": \"Date of the order\",\n \"values_sample\": [\"2024-02-14\"],\n },\n \"order_year\": {\"description\": \"Year of the order\", \"values_sample\": [2024]},\n \"order_quarter\": {\n \"description\": \"Quarter of the year of the order\",\n \"values_sample\": [1],\n },\n \"order_month\": {\"description\": \"Month of the order\", \"values_sample\": [2]},\n \"order_day_of_month\": {\n \"description\": \"Day of the month of the order\",\n \"values_sample\": [14],\n },\n \"order_week\": {\n \"description\": \"Week of the year of the order\",\n \"values_sample\": [7],\n },\n \"order_day_of_week\": {\n \"description\": \"Day of the week of the order\",\n \"values_sample\": [4],\n },\n \"order_hour\": {\n \"description\": \"Hour of the day of the order\",\n \"values_sample\": [16],\n },\n \"order_minute\": {\n \"description\": \"Minute of the hour of the order\",\n \"values_sample\": [0],\n },\n \"order_time\": {\"description\": \"Time of the order\", \"values_sample\": [\"16:00\"]},\n \"cancellation_status\": {\n \"description\": \"Status of order cancellation\",\n \"values_sample\": [\"false\"],\n },\n \"refund_status\": {\n \"description\": \"Status of order refund\",\n \"values_sample\": [\"false\"],\n },\n \"order_status\": {\n \"description\": \"Status of the order\",\n \"values_sample\": [\"unknown\"],\n },\n \"payment_status\": {\n \"description\": \"Status of payment for the order\",\n \"values_sample\": [\"pending\"],\n },\n \"shipping_address_city\": {\n \"description\": \"City of the shipping address\",\n \"values_sample\": [\"Surat\"],\n },\n \"shipping_address_state\": {\n \"description\": \"State of the shipping address\",\n \"values_sample\": [\"Gujarat\"],\n },\n \"shipping_address_country\": {\n \"description\": \"Country of the shipping address\",\n \"values_sample\": [\"India\"],\n },\n }\n}\n \"marketing_performance\": {\n \"marketing_id\": {\n \"description\": \"Unique identifier for each marketing activity.\",\n \"values_sample\": [\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_304143034868101_310419640566194_productAdsamazon_ads_sponsored_products_548576666024459\",\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_405826215303183_448674135385556_productAdsamazon_ads_sponsored_products_511545631860472\",\n ],\n },\n \"activity_date_time\": {\n \"description\": \"Timestamp of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_date\": {\n \"description\": \"Date of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_year\": {\n \"description\": \"Year of the marketing activity.\",\n \"values_sample\": [\"2024\"],\n },\n \"activity_quarter\": {\n \"description\": \"Quarter of the year in which the marketing activity took place.\",\n \"values_sample\": [\"2\"],\n },\n \"activity_month\": {\n \"description\": \"Month of the year in which the marketing activity took place.\",\n \"values_sample\": [\"4\"],\n },\n \"activity_day_of_month\": {\n \"description\": \"Day of the month on which the marketing activity took place.\",\n \"values_sample\": [\"1\"],\n },\n \"activity_week\": {\n \"description\": \"Week of the year in which the marketing activity took place.\",\n \"values_sample\": [\"14\"],\n },\n \"activity_day_of_week\": {\n \"description\": \"Day of the week on which the marketing activity took place (1 for Monday, 7 for Sunday).\",\n \"values_sample\": [\"2\"],\n },\n \"activity_hour\": {\n \"description\": \"Hour of the day in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_minute\": {\n \"description\": \"Minute of the hour in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_time\": {\n \"description\": \"Formatted string representation of the marketing activity time.\",\n \"values_sample\": [\"00:00\"],\n },\n \"channel\": {\n \"description\": \"Marketing channel used for the activity (e.g., Google Ads, Facebook Ads, Email Marketing).\",\n \"values_sample\": [\"sponsored product\"],\n },\n \"vendor\": {\n \"description\": \"Vendor or platform responsible for the marketing activity (e.g., Google, Facebook, Mailchimp).\",\n \"values_sample\": [\"amazon\"],\n },\n \"ad_account_id\": {\n \"description\": \"Unique identifier for the ad account associated with the activity.\",\n \"values_sample\": [\"A5IVEQE4ZPVNJ\"],\n },\n \"ad_account_name\": {\n \"description\": \"Name of the ad account associated with the activity.\",\n \"values_sample\": [\"Famyo\"],\n },\n \"property_name\": {\n \"description\": \"Name of the property or website where the marketing activity was run.\",\n \"values_sample\": [\"amazon sponsored product\"],\n },\n \"network_type\": {\n \"description\": \"Type of advertising network used (e.g., Search, Display, Video).\",\n \"values_sample\": [\"amazon\"],\n },\n \"campaign_id\": {\n \"description\": \"Unique identifier for the marketing campaign.\",\n \"values_sample\": [\n \"304143034868101\",\n \"405826215303183\",\n ],\n },\n \"campaign_name\": {\n \"description\": \"Name of the marketing campaign.\",\n \"values_sample\": [\n \"Football Campaign with presets - B0CT662KJL - 15\/2\/2024 23:09:44\",\n \"Hvs_Tar_SP_Blankets_Genric_Mix\",\n ],\n },\n \"campaign_status\": {\n \"description\": \"Current status of the marketing campaign (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"PAUSED\", \"ENABLED\"],\n },\n \"adset_id\": {\n \"description\": \"Unique identifier for the ad set within the campaign.\",\n \"values_sample\": [\n \"310419640566194\",\n \"448674135385556\",\n ],\n },\n \"adset_name\": {\n \"description\": \"Name of the ad set within the campaign.\",\n \"values_sample\": [\n \"Ad group - 15\/2\/2024 23:09:44\",\n \"Glow Blankets C1\",\n ],\n },\n \"adset_status\": {\n \"description\": \"Current status of the ad set (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"ad_id\": {\n \"description\": \"Unique identifier for the individual ad within the ad set.\",\n \"values_sample\": [\n \"548576666024459\",\n \"511545631860472\",\n ],\n },\n \"ad_name\": {\n \"description\": \"Name of the individual ad.\",\n \"values_sample\": [\"B0CT662KJL\", \"B0CT6428LV\"],\n },\n \"ad_description\": {\n \"description\": \"Description of the individual ad.\",\n \"values_sample\": [\n \"FM_GIDB_Football\",\n \"FM_GIDB_Astronaut\",\n ],\n },\n \"ad_status\": {\n \"description\": \"Current status of the individual ad (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"total_spend\": {\n \"description\": \"Total amount spent on the marketing activity.\",\n \"values_sample\": [\"29.15\", \"110.15\"],\n },\n \"total_clicks\": {\n \"description\": \"Total number of clicks generated by the marketing activity.\",\n \"values_sample\": [\"3\", \"7\"],\n },\n \"total_views\": {\n \"description\": \"Total number of times the marketing activity was viewed.\",\n \"values_sample\": [\"306\", \"1404\"],\n },\n \"total_impressions\": {\n \"description\": \"Total number of times the marketing activity was displayed.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_orders\": {\n \"description\": \"Number of orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_revenue\": {\n \"description\": \"Revenue generated from orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"keyword\": {\n \"description\": \"Keyword used in the marketing activity (if applicable).\",\n \"values_sample\": [None],\n },\n \"_synced_at\": {\n \"description\": \"Timestamp indicating when the data was last synced.\",\n \"values_sample\": [\"2024-07-16T21:32:08.452+00:00\"],\n },\n },\n} in context I am giving you complete DB and table info in details, user context is bit lengthy so go line by line then answer properly","role":"system"},{"content":"Compare the sales performance during peak hours vs. non-peak hours.","role":"user"},{"content":"WITH peak_hours AS (SELECT order_id, SUM(net_sales_before_tax) AS total_net_sales FROM order_values WHERE order_date < DATE_TRUNC('month', CURRENT_DATE) AND order_date >= DATE_TRUNC('month', ADD_MONTHS(CURRENT_DATE, -12)) AND order_hour BETWEEN 18 AND 23 GROUP BY order_id), non_peak_hours AS (SELECT order_id, SUM(net_sales_before_tax) AS total_net_sales FROM order_values WHERE order_date < DATE_TRUNC('month', CURRENT_DATE) AND order_date >= DATE_TRUNC('month', ADD_MONTHS(CURRENT_DATE, -12)) AND order_hour NOT BETWEEN 18 AND 23 GROUP BY order_id) SELECT 'peak_hours' AS time_period, SUM(total_net_sales) AS net_sales FROM peak_hours UNION ALL SELECT 'non_peak_hours' AS time_period, SUM(total_net_sales) AS net_sales FROM non_peak_hours;\",","role":"assistant"}]} -{"question":"What is the overall CTR for all campaigns in the last 3 months?","answer":"SELECT COALESCE(TRY_DIVIDE(SUM(total_clicks), SUM(total_impressions)), 0) AS overall_ctr FROM marketing_performance WHERE activity_date >= DATE_TRUNC('month', CURRENT_DATE - INTERVAL '3 month') AND activity_date < DATE_TRUNC('month', CURRENT_DATE);","llama-3-sqlcoder-8b":"SELECT SUM(t.total_clicks) \/ NULLIF(SUM(t.total_impressions), 0) AS overall_ctr FROM marketing_performance t WHERE t.activity_date >= (CURRENT_DATE - INTERVAL '3 months');","llama-3.1-8b":"SELECT AVG(total_clicks) \/ AVG(total_impressions) AS ctr FROM marketing_performance WHERE activity_month > DATE_SUB(CURRENT_DATE, INTERVAL 3 MONTH)","context":"TABLE_DESCRIPTIONS = {\n \"order_values\": \"This table contains order information aggregated across multiple sources for an e-commerce brand. The table is unique at an Order ID - SKU ID level. The table includes, but is not limited to, all pricing information (like gross sales, tax, net sales, shipping charge, duties, etc.), information related to the product (like SKU, product id\/title, price, etc.), order related information (timestamp of order), payment information and shipping information.\",\n \"marketing_performance\": \"This table contains detailed marketing performance data for an e-commerce brand, capturing data from various marketing activities and platforms. It provides a comprehensive overview of campaign performance, including spend, clicks, views, impressions, and attributed revenue.\",\n}\n\nCOLUMNS = {\n \"order_values\": {\n \"order_line_item_id\": {\n \"description\": \"Unique identifier for each line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"source\": {\"description\": \"Source of the order\", \"values_sample\": [\"shopify\"]},\n \"order_id\": {\n \"description\": \"Unique identifier for each order\",\n \"values_sample\": [\"shopify_5667598663969\"],\n },\n \"ordered_quantity\": {\n \"description\": \"Quantity of each item of a line item\",\n \"values_sample\": [1],\n },\n \"tax_percent\": {\n \"description\": \"Tax percentage applied to the order\",\n \"values_sample\": [0.17999949556658],\n },\n \"total_price_tax\": {\n \"description\": \"Total price including tax\",\n \"values_sample\": [152.389468594368],\n },\n \"gross_sales_price_before_tax\": {\n \"description\": \"Gross sales price before applying tax\",\n \"values_sample\": [846.610531405632],\n },\n \"total_discount_after_tax\": {\n \"description\": \"Total discount after applying tax\",\n \"values_sample\": [0],\n },\n \"total_discount_tax\": {\n \"description\": \"Total discount amount subject to tax\",\n \"values_sample\": [0],\n },\n \"total_discount_before_tax\": {\n \"description\": \"Total discount before applying tax\",\n \"values_sample\": [0],\n },\n \"total_returns_before_tax\": {\n \"description\": \"Total return\/refund amount before tax\",\n \"values_sample\": [846.610531405632],\n },\n \"net_sales_before_tax\": {\n \"description\": \"Net sales amount before applying tax\",\n \"values_sample\": [0],\n },\n \"item_shipping_charge\": {\n \"description\": \"Shipping charge for an item\",\n \"values_sample\": [0],\n },\n \"item_duties\": {\n \"description\": \"Duties charged for an item\",\n \"values_sample\": [0],\n },\n \"item_additional_feels\": {\n \"description\": \"Additional fees charged for an item\",\n \"values_sample\": [0],\n },\n \"total_tax\": {\"description\": \"Total tax amount\", \"values_sample\": [0]},\n \"total_sales_after_tax\": {\n \"description\": \"Total sales amount after applying tax\",\n \"values_sample\": [0],\n },\n \"sku_id\": {\n \"description\": \"Unique identifier for each stock keeping unit (SKU)\",\n \"values_sample\": [\"shopify_8848983261473_47478863036705\"],\n },\n \"sku_code\": {\n \"description\": \"Code assigned to each stock keeping unit (SKU)\",\n \"values_sample\": [\"BSL-D-SIP-0001\"],\n },\n \"product_category\": {\n \"description\": \"Category of the product\",\n \"values_sample\": [\"Insulated Sipper\"],\n },\n \"product_id\": {\n \"description\": \"Unique identifier for each product\",\n \"values_sample\": [\"shopify_8848983261473\"],\n },\n \"product_title\": {\n \"description\": \"Title of the product\",\n \"values_sample\": [\"Kids Sipper (430 ml)\"],\n },\n \"product_price\": {\n \"description\": \"Price of the product\",\n \"values_sample\": [999],\n },\n \"customer_id\": {\n \"description\": \"Unique identifier for each customer\",\n \"values_sample\": [\"shopify_7694075199777\"],\n },\n \"first_ordered_at\": {\n \"description\": \"Timestamp of the first order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_refund_line_item_id\": {\n \"description\": \"Unique identifier for each refunded line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"order_date_time\": {\n \"description\": \"Date and time of the order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_date\": {\n \"description\": \"Date of the order\",\n \"values_sample\": [\"2024-02-14\"],\n },\n \"order_year\": {\"description\": \"Year of the order\", \"values_sample\": [2024]},\n \"order_quarter\": {\n \"description\": \"Quarter of the year of the order\",\n \"values_sample\": [1],\n },\n \"order_month\": {\"description\": \"Month of the order\", \"values_sample\": [2]},\n \"order_day_of_month\": {\n \"description\": \"Day of the month of the order\",\n \"values_sample\": [14],\n },\n \"order_week\": {\n \"description\": \"Week of the year of the order\",\n \"values_sample\": [7],\n },\n \"order_day_of_week\": {\n \"description\": \"Day of the week of the order\",\n \"values_sample\": [4],\n },\n \"order_hour\": {\n \"description\": \"Hour of the day of the order\",\n \"values_sample\": [16],\n },\n \"order_minute\": {\n \"description\": \"Minute of the hour of the order\",\n \"values_sample\": [0],\n },\n \"order_time\": {\"description\": \"Time of the order\", \"values_sample\": [\"16:00\"]},\n \"cancellation_status\": {\n \"description\": \"Status of order cancellation\",\n \"values_sample\": [\"false\"],\n },\n \"refund_status\": {\n \"description\": \"Status of order refund\",\n \"values_sample\": [\"false\"],\n },\n \"order_status\": {\n \"description\": \"Status of the order\",\n \"values_sample\": [\"unknown\"],\n },\n \"payment_status\": {\n \"description\": \"Status of payment for the order\",\n \"values_sample\": [\"pending\"],\n },\n \"shipping_address_city\": {\n \"description\": \"City of the shipping address\",\n \"values_sample\": [\"Surat\"],\n },\n \"shipping_address_state\": {\n \"description\": \"State of the shipping address\",\n \"values_sample\": [\"Gujarat\"],\n },\n \"shipping_address_country\": {\n \"description\": \"Country of the shipping address\",\n \"values_sample\": [\"India\"],\n },\n }\n}\n \"marketing_performance\": {\n \"marketing_id\": {\n \"description\": \"Unique identifier for each marketing activity.\",\n \"values_sample\": [\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_304143034868101_310419640566194_productAdsamazon_ads_sponsored_products_548576666024459\",\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_405826215303183_448674135385556_productAdsamazon_ads_sponsored_products_511545631860472\",\n ],\n },\n \"activity_date_time\": {\n \"description\": \"Timestamp of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_date\": {\n \"description\": \"Date of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_year\": {\n \"description\": \"Year of the marketing activity.\",\n \"values_sample\": [\"2024\"],\n },\n \"activity_quarter\": {\n \"description\": \"Quarter of the year in which the marketing activity took place.\",\n \"values_sample\": [\"2\"],\n },\n \"activity_month\": {\n \"description\": \"Month of the year in which the marketing activity took place.\",\n \"values_sample\": [\"4\"],\n },\n \"activity_day_of_month\": {\n \"description\": \"Day of the month on which the marketing activity took place.\",\n \"values_sample\": [\"1\"],\n },\n \"activity_week\": {\n \"description\": \"Week of the year in which the marketing activity took place.\",\n \"values_sample\": [\"14\"],\n },\n \"activity_day_of_week\": {\n \"description\": \"Day of the week on which the marketing activity took place (1 for Monday, 7 for Sunday).\",\n \"values_sample\": [\"2\"],\n },\n \"activity_hour\": {\n \"description\": \"Hour of the day in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_minute\": {\n \"description\": \"Minute of the hour in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_time\": {\n \"description\": \"Formatted string representation of the marketing activity time.\",\n \"values_sample\": [\"00:00\"],\n },\n \"channel\": {\n \"description\": \"Marketing channel used for the activity (e.g., Google Ads, Facebook Ads, Email Marketing).\",\n \"values_sample\": [\"sponsored product\"],\n },\n \"vendor\": {\n \"description\": \"Vendor or platform responsible for the marketing activity (e.g., Google, Facebook, Mailchimp).\",\n \"values_sample\": [\"amazon\"],\n },\n \"ad_account_id\": {\n \"description\": \"Unique identifier for the ad account associated with the activity.\",\n \"values_sample\": [\"A5IVEQE4ZPVNJ\"],\n },\n \"ad_account_name\": {\n \"description\": \"Name of the ad account associated with the activity.\",\n \"values_sample\": [\"Famyo\"],\n },\n \"property_name\": {\n \"description\": \"Name of the property or website where the marketing activity was run.\",\n \"values_sample\": [\"amazon sponsored product\"],\n },\n \"network_type\": {\n \"description\": \"Type of advertising network used (e.g., Search, Display, Video).\",\n \"values_sample\": [\"amazon\"],\n },\n \"campaign_id\": {\n \"description\": \"Unique identifier for the marketing campaign.\",\n \"values_sample\": [\n \"304143034868101\",\n \"405826215303183\",\n ],\n },\n \"campaign_name\": {\n \"description\": \"Name of the marketing campaign.\",\n \"values_sample\": [\n \"Football Campaign with presets - B0CT662KJL - 15\/2\/2024 23:09:44\",\n \"Hvs_Tar_SP_Blankets_Genric_Mix\",\n ],\n },\n \"campaign_status\": {\n \"description\": \"Current status of the marketing campaign (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"PAUSED\", \"ENABLED\"],\n },\n \"adset_id\": {\n \"description\": \"Unique identifier for the ad set within the campaign.\",\n \"values_sample\": [\n \"310419640566194\",\n \"448674135385556\",\n ],\n },\n \"adset_name\": {\n \"description\": \"Name of the ad set within the campaign.\",\n \"values_sample\": [\n \"Ad group - 15\/2\/2024 23:09:44\",\n \"Glow Blankets C1\",\n ],\n },\n \"adset_status\": {\n \"description\": \"Current status of the ad set (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"ad_id\": {\n \"description\": \"Unique identifier for the individual ad within the ad set.\",\n \"values_sample\": [\n \"548576666024459\",\n \"511545631860472\",\n ],\n },\n \"ad_name\": {\n \"description\": \"Name of the individual ad.\",\n \"values_sample\": [\"B0CT662KJL\", \"B0CT6428LV\"],\n },\n \"ad_description\": {\n \"description\": \"Description of the individual ad.\",\n \"values_sample\": [\n \"FM_GIDB_Football\",\n \"FM_GIDB_Astronaut\",\n ],\n },\n \"ad_status\": {\n \"description\": \"Current status of the individual ad (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"total_spend\": {\n \"description\": \"Total amount spent on the marketing activity.\",\n \"values_sample\": [\"29.15\", \"110.15\"],\n },\n \"total_clicks\": {\n \"description\": \"Total number of clicks generated by the marketing activity.\",\n \"values_sample\": [\"3\", \"7\"],\n },\n \"total_views\": {\n \"description\": \"Total number of times the marketing activity was viewed.\",\n \"values_sample\": [\"306\", \"1404\"],\n },\n \"total_impressions\": {\n \"description\": \"Total number of times the marketing activity was displayed.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_orders\": {\n \"description\": \"Number of orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_revenue\": {\n \"description\": \"Revenue generated from orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"keyword\": {\n \"description\": \"Keyword used in the marketing activity (if applicable).\",\n \"values_sample\": [None],\n },\n \"_synced_at\": {\n \"description\": \"Timestamp indicating when the data was last synced.\",\n \"values_sample\": [\"2024-07-16T21:32:08.452+00:00\"],\n },\n },\n}","messages":[{"content":"You are an advanced AI trained to generate SQL queries based\n on a given context. Your task is to write an SQL query that accurately \n retrieves the requested data from the provided table schema. Do not answer with any explanations -- just the SQL query.\n Output only plain text. Do not output markdown. \n Please ensure that the SQL query matches the exact table name and column names\n specified in the TABLE_DESCRIPTIONS = {\n \"order_values\": \"This table contains order information aggregated across multiple sources for an e-commerce brand. The table is unique at an Order ID - SKU ID level. The table includes, but is not limited to, all pricing information (like gross sales, tax, net sales, shipping charge, duties, etc.), information related to the product (like SKU, product id\/title, price, etc.), order related information (timestamp of order), payment information and shipping information.\",\n \"marketing_performance\": \"This table contains detailed marketing performance data for an e-commerce brand, capturing data from various marketing activities and platforms. It provides a comprehensive overview of campaign performance, including spend, clicks, views, impressions, and attributed revenue.\",\n}\n\nCOLUMNS = {\n \"order_values\": {\n \"order_line_item_id\": {\n \"description\": \"Unique identifier for each line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"source\": {\"description\": \"Source of the order\", \"values_sample\": [\"shopify\"]},\n \"order_id\": {\n \"description\": \"Unique identifier for each order\",\n \"values_sample\": [\"shopify_5667598663969\"],\n },\n \"ordered_quantity\": {\n \"description\": \"Quantity of each item of a line item\",\n \"values_sample\": [1],\n },\n \"tax_percent\": {\n \"description\": \"Tax percentage applied to the order\",\n \"values_sample\": [0.17999949556658],\n },\n \"total_price_tax\": {\n \"description\": \"Total price including tax\",\n \"values_sample\": [152.389468594368],\n },\n \"gross_sales_price_before_tax\": {\n \"description\": \"Gross sales price before applying tax\",\n \"values_sample\": [846.610531405632],\n },\n \"total_discount_after_tax\": {\n \"description\": \"Total discount after applying tax\",\n \"values_sample\": [0],\n },\n \"total_discount_tax\": {\n \"description\": \"Total discount amount subject to tax\",\n \"values_sample\": [0],\n },\n \"total_discount_before_tax\": {\n \"description\": \"Total discount before applying tax\",\n \"values_sample\": [0],\n },\n \"total_returns_before_tax\": {\n \"description\": \"Total return\/refund amount before tax\",\n \"values_sample\": [846.610531405632],\n },\n \"net_sales_before_tax\": {\n \"description\": \"Net sales amount before applying tax\",\n \"values_sample\": [0],\n },\n \"item_shipping_charge\": {\n \"description\": \"Shipping charge for an item\",\n \"values_sample\": [0],\n },\n \"item_duties\": {\n \"description\": \"Duties charged for an item\",\n \"values_sample\": [0],\n },\n \"item_additional_feels\": {\n \"description\": \"Additional fees charged for an item\",\n \"values_sample\": [0],\n },\n \"total_tax\": {\"description\": \"Total tax amount\", \"values_sample\": [0]},\n \"total_sales_after_tax\": {\n \"description\": \"Total sales amount after applying tax\",\n \"values_sample\": [0],\n },\n \"sku_id\": {\n \"description\": \"Unique identifier for each stock keeping unit (SKU)\",\n \"values_sample\": [\"shopify_8848983261473_47478863036705\"],\n },\n \"sku_code\": {\n \"description\": \"Code assigned to each stock keeping unit (SKU)\",\n \"values_sample\": [\"BSL-D-SIP-0001\"],\n },\n \"product_category\": {\n \"description\": \"Category of the product\",\n \"values_sample\": [\"Insulated Sipper\"],\n },\n \"product_id\": {\n \"description\": \"Unique identifier for each product\",\n \"values_sample\": [\"shopify_8848983261473\"],\n },\n \"product_title\": {\n \"description\": \"Title of the product\",\n \"values_sample\": [\"Kids Sipper (430 ml)\"],\n },\n \"product_price\": {\n \"description\": \"Price of the product\",\n \"values_sample\": [999],\n },\n \"customer_id\": {\n \"description\": \"Unique identifier for each customer\",\n \"values_sample\": [\"shopify_7694075199777\"],\n },\n \"first_ordered_at\": {\n \"description\": \"Timestamp of the first order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_refund_line_item_id\": {\n \"description\": \"Unique identifier for each refunded line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"order_date_time\": {\n \"description\": \"Date and time of the order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_date\": {\n \"description\": \"Date of the order\",\n \"values_sample\": [\"2024-02-14\"],\n },\n \"order_year\": {\"description\": \"Year of the order\", \"values_sample\": [2024]},\n \"order_quarter\": {\n \"description\": \"Quarter of the year of the order\",\n \"values_sample\": [1],\n },\n \"order_month\": {\"description\": \"Month of the order\", \"values_sample\": [2]},\n \"order_day_of_month\": {\n \"description\": \"Day of the month of the order\",\n \"values_sample\": [14],\n },\n \"order_week\": {\n \"description\": \"Week of the year of the order\",\n \"values_sample\": [7],\n },\n \"order_day_of_week\": {\n \"description\": \"Day of the week of the order\",\n \"values_sample\": [4],\n },\n \"order_hour\": {\n \"description\": \"Hour of the day of the order\",\n \"values_sample\": [16],\n },\n \"order_minute\": {\n \"description\": \"Minute of the hour of the order\",\n \"values_sample\": [0],\n },\n \"order_time\": {\"description\": \"Time of the order\", \"values_sample\": [\"16:00\"]},\n \"cancellation_status\": {\n \"description\": \"Status of order cancellation\",\n \"values_sample\": [\"false\"],\n },\n \"refund_status\": {\n \"description\": \"Status of order refund\",\n \"values_sample\": [\"false\"],\n },\n \"order_status\": {\n \"description\": \"Status of the order\",\n \"values_sample\": [\"unknown\"],\n },\n \"payment_status\": {\n \"description\": \"Status of payment for the order\",\n \"values_sample\": [\"pending\"],\n },\n \"shipping_address_city\": {\n \"description\": \"City of the shipping address\",\n \"values_sample\": [\"Surat\"],\n },\n \"shipping_address_state\": {\n \"description\": \"State of the shipping address\",\n \"values_sample\": [\"Gujarat\"],\n },\n \"shipping_address_country\": {\n \"description\": \"Country of the shipping address\",\n \"values_sample\": [\"India\"],\n },\n }\n}\n \"marketing_performance\": {\n \"marketing_id\": {\n \"description\": \"Unique identifier for each marketing activity.\",\n \"values_sample\": [\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_304143034868101_310419640566194_productAdsamazon_ads_sponsored_products_548576666024459\",\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_405826215303183_448674135385556_productAdsamazon_ads_sponsored_products_511545631860472\",\n ],\n },\n \"activity_date_time\": {\n \"description\": \"Timestamp of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_date\": {\n \"description\": \"Date of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_year\": {\n \"description\": \"Year of the marketing activity.\",\n \"values_sample\": [\"2024\"],\n },\n \"activity_quarter\": {\n \"description\": \"Quarter of the year in which the marketing activity took place.\",\n \"values_sample\": [\"2\"],\n },\n \"activity_month\": {\n \"description\": \"Month of the year in which the marketing activity took place.\",\n \"values_sample\": [\"4\"],\n },\n \"activity_day_of_month\": {\n \"description\": \"Day of the month on which the marketing activity took place.\",\n \"values_sample\": [\"1\"],\n },\n \"activity_week\": {\n \"description\": \"Week of the year in which the marketing activity took place.\",\n \"values_sample\": [\"14\"],\n },\n \"activity_day_of_week\": {\n \"description\": \"Day of the week on which the marketing activity took place (1 for Monday, 7 for Sunday).\",\n \"values_sample\": [\"2\"],\n },\n \"activity_hour\": {\n \"description\": \"Hour of the day in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_minute\": {\n \"description\": \"Minute of the hour in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_time\": {\n \"description\": \"Formatted string representation of the marketing activity time.\",\n \"values_sample\": [\"00:00\"],\n },\n \"channel\": {\n \"description\": \"Marketing channel used for the activity (e.g., Google Ads, Facebook Ads, Email Marketing).\",\n \"values_sample\": [\"sponsored product\"],\n },\n \"vendor\": {\n \"description\": \"Vendor or platform responsible for the marketing activity (e.g., Google, Facebook, Mailchimp).\",\n \"values_sample\": [\"amazon\"],\n },\n \"ad_account_id\": {\n \"description\": \"Unique identifier for the ad account associated with the activity.\",\n \"values_sample\": [\"A5IVEQE4ZPVNJ\"],\n },\n \"ad_account_name\": {\n \"description\": \"Name of the ad account associated with the activity.\",\n \"values_sample\": [\"Famyo\"],\n },\n \"property_name\": {\n \"description\": \"Name of the property or website where the marketing activity was run.\",\n \"values_sample\": [\"amazon sponsored product\"],\n },\n \"network_type\": {\n \"description\": \"Type of advertising network used (e.g., Search, Display, Video).\",\n \"values_sample\": [\"amazon\"],\n },\n \"campaign_id\": {\n \"description\": \"Unique identifier for the marketing campaign.\",\n \"values_sample\": [\n \"304143034868101\",\n \"405826215303183\",\n ],\n },\n \"campaign_name\": {\n \"description\": \"Name of the marketing campaign.\",\n \"values_sample\": [\n \"Football Campaign with presets - B0CT662KJL - 15\/2\/2024 23:09:44\",\n \"Hvs_Tar_SP_Blankets_Genric_Mix\",\n ],\n },\n \"campaign_status\": {\n \"description\": \"Current status of the marketing campaign (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"PAUSED\", \"ENABLED\"],\n },\n \"adset_id\": {\n \"description\": \"Unique identifier for the ad set within the campaign.\",\n \"values_sample\": [\n \"310419640566194\",\n \"448674135385556\",\n ],\n },\n \"adset_name\": {\n \"description\": \"Name of the ad set within the campaign.\",\n \"values_sample\": [\n \"Ad group - 15\/2\/2024 23:09:44\",\n \"Glow Blankets C1\",\n ],\n },\n \"adset_status\": {\n \"description\": \"Current status of the ad set (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"ad_id\": {\n \"description\": \"Unique identifier for the individual ad within the ad set.\",\n \"values_sample\": [\n \"548576666024459\",\n \"511545631860472\",\n ],\n },\n \"ad_name\": {\n \"description\": \"Name of the individual ad.\",\n \"values_sample\": [\"B0CT662KJL\", \"B0CT6428LV\"],\n },\n \"ad_description\": {\n \"description\": \"Description of the individual ad.\",\n \"values_sample\": [\n \"FM_GIDB_Football\",\n \"FM_GIDB_Astronaut\",\n ],\n },\n \"ad_status\": {\n \"description\": \"Current status of the individual ad (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"total_spend\": {\n \"description\": \"Total amount spent on the marketing activity.\",\n \"values_sample\": [\"29.15\", \"110.15\"],\n },\n \"total_clicks\": {\n \"description\": \"Total number of clicks generated by the marketing activity.\",\n \"values_sample\": [\"3\", \"7\"],\n },\n \"total_views\": {\n \"description\": \"Total number of times the marketing activity was viewed.\",\n \"values_sample\": [\"306\", \"1404\"],\n },\n \"total_impressions\": {\n \"description\": \"Total number of times the marketing activity was displayed.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_orders\": {\n \"description\": \"Number of orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_revenue\": {\n \"description\": \"Revenue generated from orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"keyword\": {\n \"description\": \"Keyword used in the marketing activity (if applicable).\",\n \"values_sample\": [None],\n },\n \"_synced_at\": {\n \"description\": \"Timestamp indicating when the data was last synced.\",\n \"values_sample\": [\"2024-07-16T21:32:08.452+00:00\"],\n },\n },\n} in context I am giving you complete DB and table info in details, user context is bit lengthy so go line by line then answer properly","role":"system"},{"content":"What is the overall CTR for all campaigns in the last 3 months?","role":"user"},{"content":"SELECT COALESCE(TRY_DIVIDE(SUM(total_clicks), SUM(total_impressions)), 0) AS overall_ctr FROM marketing_performance WHERE activity_date >= DATE_TRUNC('month', CURRENT_DATE - INTERVAL '3 month') AND activity_date < DATE_TRUNC('month', CURRENT_DATE);","role":"assistant"}]} -{"question":"Show me the trend of orders from Shopify for this year","answer":"SELECT CONCAT(order_year, '-', LPAD(order_month, 2, '0')) AS order_date, COUNT(DISTINCT order_id) AS order_count FROM order_values WHERE source='Shopify' AND order_year = YEAR(CURRENT_DATE) GROUP BY order_year, order_month ORDER BY order_year, order_month;","llama-3-sqlcoder-8b":"SELECT COUNT(*) AS total_orders, EXTRACT(MONTH FROM o.order_date) AS order_month, EXTRACT(YEAR FROM o.order_date) AS order_year FROM order_values o WHERE o.source ='shopify' AND EXTRACT(YEAR FROM o.order_date) = 2024 GROUP BY order_month, order_year ORDER BY order_year, order_month NULLS LAST;","llama-3.1-8b":"SELECT order_date FROM order_values WHERE source ='shopify' AND order_year = 2024","context":"TABLE_DESCRIPTIONS = {\n \"order_values\": \"This table contains order information aggregated across multiple sources for an e-commerce brand. The table is unique at an Order ID - SKU ID level. The table includes, but is not limited to, all pricing information (like gross sales, tax, net sales, shipping charge, duties, etc.), information related to the product (like SKU, product id\/title, price, etc.), order related information (timestamp of order), payment information and shipping information.\",\n \"marketing_performance\": \"This table contains detailed marketing performance data for an e-commerce brand, capturing data from various marketing activities and platforms. It provides a comprehensive overview of campaign performance, including spend, clicks, views, impressions, and attributed revenue.\",\n}\n\nCOLUMNS = {\n \"order_values\": {\n \"order_line_item_id\": {\n \"description\": \"Unique identifier for each line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"source\": {\"description\": \"Source of the order\", \"values_sample\": [\"shopify\"]},\n \"order_id\": {\n \"description\": \"Unique identifier for each order\",\n \"values_sample\": [\"shopify_5667598663969\"],\n },\n \"ordered_quantity\": {\n \"description\": \"Quantity of each item of a line item\",\n \"values_sample\": [1],\n },\n \"tax_percent\": {\n \"description\": \"Tax percentage applied to the order\",\n \"values_sample\": [0.17999949556658],\n },\n \"total_price_tax\": {\n \"description\": \"Total price including tax\",\n \"values_sample\": [152.389468594368],\n },\n \"gross_sales_price_before_tax\": {\n \"description\": \"Gross sales price before applying tax\",\n \"values_sample\": [846.610531405632],\n },\n \"total_discount_after_tax\": {\n \"description\": \"Total discount after applying tax\",\n \"values_sample\": [0],\n },\n \"total_discount_tax\": {\n \"description\": \"Total discount amount subject to tax\",\n \"values_sample\": [0],\n },\n \"total_discount_before_tax\": {\n \"description\": \"Total discount before applying tax\",\n \"values_sample\": [0],\n },\n \"total_returns_before_tax\": {\n \"description\": \"Total return\/refund amount before tax\",\n \"values_sample\": [846.610531405632],\n },\n \"net_sales_before_tax\": {\n \"description\": \"Net sales amount before applying tax\",\n \"values_sample\": [0],\n },\n \"item_shipping_charge\": {\n \"description\": \"Shipping charge for an item\",\n \"values_sample\": [0],\n },\n \"item_duties\": {\n \"description\": \"Duties charged for an item\",\n \"values_sample\": [0],\n },\n \"item_additional_feels\": {\n \"description\": \"Additional fees charged for an item\",\n \"values_sample\": [0],\n },\n \"total_tax\": {\"description\": \"Total tax amount\", \"values_sample\": [0]},\n \"total_sales_after_tax\": {\n \"description\": \"Total sales amount after applying tax\",\n \"values_sample\": [0],\n },\n \"sku_id\": {\n \"description\": \"Unique identifier for each stock keeping unit (SKU)\",\n \"values_sample\": [\"shopify_8848983261473_47478863036705\"],\n },\n \"sku_code\": {\n \"description\": \"Code assigned to each stock keeping unit (SKU)\",\n \"values_sample\": [\"BSL-D-SIP-0001\"],\n },\n \"product_category\": {\n \"description\": \"Category of the product\",\n \"values_sample\": [\"Insulated Sipper\"],\n },\n \"product_id\": {\n \"description\": \"Unique identifier for each product\",\n \"values_sample\": [\"shopify_8848983261473\"],\n },\n \"product_title\": {\n \"description\": \"Title of the product\",\n \"values_sample\": [\"Kids Sipper (430 ml)\"],\n },\n \"product_price\": {\n \"description\": \"Price of the product\",\n \"values_sample\": [999],\n },\n \"customer_id\": {\n \"description\": \"Unique identifier for each customer\",\n \"values_sample\": [\"shopify_7694075199777\"],\n },\n \"first_ordered_at\": {\n \"description\": \"Timestamp of the first order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_refund_line_item_id\": {\n \"description\": \"Unique identifier for each refunded line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"order_date_time\": {\n \"description\": \"Date and time of the order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_date\": {\n \"description\": \"Date of the order\",\n \"values_sample\": [\"2024-02-14\"],\n },\n \"order_year\": {\"description\": \"Year of the order\", \"values_sample\": [2024]},\n \"order_quarter\": {\n \"description\": \"Quarter of the year of the order\",\n \"values_sample\": [1],\n },\n \"order_month\": {\"description\": \"Month of the order\", \"values_sample\": [2]},\n \"order_day_of_month\": {\n \"description\": \"Day of the month of the order\",\n \"values_sample\": [14],\n },\n \"order_week\": {\n \"description\": \"Week of the year of the order\",\n \"values_sample\": [7],\n },\n \"order_day_of_week\": {\n \"description\": \"Day of the week of the order\",\n \"values_sample\": [4],\n },\n \"order_hour\": {\n \"description\": \"Hour of the day of the order\",\n \"values_sample\": [16],\n },\n \"order_minute\": {\n \"description\": \"Minute of the hour of the order\",\n \"values_sample\": [0],\n },\n \"order_time\": {\"description\": \"Time of the order\", \"values_sample\": [\"16:00\"]},\n \"cancellation_status\": {\n \"description\": \"Status of order cancellation\",\n \"values_sample\": [\"false\"],\n },\n \"refund_status\": {\n \"description\": \"Status of order refund\",\n \"values_sample\": [\"false\"],\n },\n \"order_status\": {\n \"description\": \"Status of the order\",\n \"values_sample\": [\"unknown\"],\n },\n \"payment_status\": {\n \"description\": \"Status of payment for the order\",\n \"values_sample\": [\"pending\"],\n },\n \"shipping_address_city\": {\n \"description\": \"City of the shipping address\",\n \"values_sample\": [\"Surat\"],\n },\n \"shipping_address_state\": {\n \"description\": \"State of the shipping address\",\n \"values_sample\": [\"Gujarat\"],\n },\n \"shipping_address_country\": {\n \"description\": \"Country of the shipping address\",\n \"values_sample\": [\"India\"],\n },\n }\n}\n \"marketing_performance\": {\n \"marketing_id\": {\n \"description\": \"Unique identifier for each marketing activity.\",\n \"values_sample\": [\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_304143034868101_310419640566194_productAdsamazon_ads_sponsored_products_548576666024459\",\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_405826215303183_448674135385556_productAdsamazon_ads_sponsored_products_511545631860472\",\n ],\n },\n \"activity_date_time\": {\n \"description\": \"Timestamp of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_date\": {\n \"description\": \"Date of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_year\": {\n \"description\": \"Year of the marketing activity.\",\n \"values_sample\": [\"2024\"],\n },\n \"activity_quarter\": {\n \"description\": \"Quarter of the year in which the marketing activity took place.\",\n \"values_sample\": [\"2\"],\n },\n \"activity_month\": {\n \"description\": \"Month of the year in which the marketing activity took place.\",\n \"values_sample\": [\"4\"],\n },\n \"activity_day_of_month\": {\n \"description\": \"Day of the month on which the marketing activity took place.\",\n \"values_sample\": [\"1\"],\n },\n \"activity_week\": {\n \"description\": \"Week of the year in which the marketing activity took place.\",\n \"values_sample\": [\"14\"],\n },\n \"activity_day_of_week\": {\n \"description\": \"Day of the week on which the marketing activity took place (1 for Monday, 7 for Sunday).\",\n \"values_sample\": [\"2\"],\n },\n \"activity_hour\": {\n \"description\": \"Hour of the day in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_minute\": {\n \"description\": \"Minute of the hour in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_time\": {\n \"description\": \"Formatted string representation of the marketing activity time.\",\n \"values_sample\": [\"00:00\"],\n },\n \"channel\": {\n \"description\": \"Marketing channel used for the activity (e.g., Google Ads, Facebook Ads, Email Marketing).\",\n \"values_sample\": [\"sponsored product\"],\n },\n \"vendor\": {\n \"description\": \"Vendor or platform responsible for the marketing activity (e.g., Google, Facebook, Mailchimp).\",\n \"values_sample\": [\"amazon\"],\n },\n \"ad_account_id\": {\n \"description\": \"Unique identifier for the ad account associated with the activity.\",\n \"values_sample\": [\"A5IVEQE4ZPVNJ\"],\n },\n \"ad_account_name\": {\n \"description\": \"Name of the ad account associated with the activity.\",\n \"values_sample\": [\"Famyo\"],\n },\n \"property_name\": {\n \"description\": \"Name of the property or website where the marketing activity was run.\",\n \"values_sample\": [\"amazon sponsored product\"],\n },\n \"network_type\": {\n \"description\": \"Type of advertising network used (e.g., Search, Display, Video).\",\n \"values_sample\": [\"amazon\"],\n },\n \"campaign_id\": {\n \"description\": \"Unique identifier for the marketing campaign.\",\n \"values_sample\": [\n \"304143034868101\",\n \"405826215303183\",\n ],\n },\n \"campaign_name\": {\n \"description\": \"Name of the marketing campaign.\",\n \"values_sample\": [\n \"Football Campaign with presets - B0CT662KJL - 15\/2\/2024 23:09:44\",\n \"Hvs_Tar_SP_Blankets_Genric_Mix\",\n ],\n },\n \"campaign_status\": {\n \"description\": \"Current status of the marketing campaign (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"PAUSED\", \"ENABLED\"],\n },\n \"adset_id\": {\n \"description\": \"Unique identifier for the ad set within the campaign.\",\n \"values_sample\": [\n \"310419640566194\",\n \"448674135385556\",\n ],\n },\n \"adset_name\": {\n \"description\": \"Name of the ad set within the campaign.\",\n \"values_sample\": [\n \"Ad group - 15\/2\/2024 23:09:44\",\n \"Glow Blankets C1\",\n ],\n },\n \"adset_status\": {\n \"description\": \"Current status of the ad set (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"ad_id\": {\n \"description\": \"Unique identifier for the individual ad within the ad set.\",\n \"values_sample\": [\n \"548576666024459\",\n \"511545631860472\",\n ],\n },\n \"ad_name\": {\n \"description\": \"Name of the individual ad.\",\n \"values_sample\": [\"B0CT662KJL\", \"B0CT6428LV\"],\n },\n \"ad_description\": {\n \"description\": \"Description of the individual ad.\",\n \"values_sample\": [\n \"FM_GIDB_Football\",\n \"FM_GIDB_Astronaut\",\n ],\n },\n \"ad_status\": {\n \"description\": \"Current status of the individual ad (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"total_spend\": {\n \"description\": \"Total amount spent on the marketing activity.\",\n \"values_sample\": [\"29.15\", \"110.15\"],\n },\n \"total_clicks\": {\n \"description\": \"Total number of clicks generated by the marketing activity.\",\n \"values_sample\": [\"3\", \"7\"],\n },\n \"total_views\": {\n \"description\": \"Total number of times the marketing activity was viewed.\",\n \"values_sample\": [\"306\", \"1404\"],\n },\n \"total_impressions\": {\n \"description\": \"Total number of times the marketing activity was displayed.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_orders\": {\n \"description\": \"Number of orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_revenue\": {\n \"description\": \"Revenue generated from orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"keyword\": {\n \"description\": \"Keyword used in the marketing activity (if applicable).\",\n \"values_sample\": [None],\n },\n \"_synced_at\": {\n \"description\": \"Timestamp indicating when the data was last synced.\",\n \"values_sample\": [\"2024-07-16T21:32:08.452+00:00\"],\n },\n },\n}","messages":[{"content":"You are an advanced AI trained to generate SQL queries based\n on a given context. Your task is to write an SQL query that accurately \n retrieves the requested data from the provided table schema. Do not answer with any explanations -- just the SQL query.\n Output only plain text. Do not output markdown. \n Please ensure that the SQL query matches the exact table name and column names\n specified in the TABLE_DESCRIPTIONS = {\n \"order_values\": \"This table contains order information aggregated across multiple sources for an e-commerce brand. The table is unique at an Order ID - SKU ID level. The table includes, but is not limited to, all pricing information (like gross sales, tax, net sales, shipping charge, duties, etc.), information related to the product (like SKU, product id\/title, price, etc.), order related information (timestamp of order), payment information and shipping information.\",\n \"marketing_performance\": \"This table contains detailed marketing performance data for an e-commerce brand, capturing data from various marketing activities and platforms. It provides a comprehensive overview of campaign performance, including spend, clicks, views, impressions, and attributed revenue.\",\n}\n\nCOLUMNS = {\n \"order_values\": {\n \"order_line_item_id\": {\n \"description\": \"Unique identifier for each line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"source\": {\"description\": \"Source of the order\", \"values_sample\": [\"shopify\"]},\n \"order_id\": {\n \"description\": \"Unique identifier for each order\",\n \"values_sample\": [\"shopify_5667598663969\"],\n },\n \"ordered_quantity\": {\n \"description\": \"Quantity of each item of a line item\",\n \"values_sample\": [1],\n },\n \"tax_percent\": {\n \"description\": \"Tax percentage applied to the order\",\n \"values_sample\": [0.17999949556658],\n },\n \"total_price_tax\": {\n \"description\": \"Total price including tax\",\n \"values_sample\": [152.389468594368],\n },\n \"gross_sales_price_before_tax\": {\n \"description\": \"Gross sales price before applying tax\",\n \"values_sample\": [846.610531405632],\n },\n \"total_discount_after_tax\": {\n \"description\": \"Total discount after applying tax\",\n \"values_sample\": [0],\n },\n \"total_discount_tax\": {\n \"description\": \"Total discount amount subject to tax\",\n \"values_sample\": [0],\n },\n \"total_discount_before_tax\": {\n \"description\": \"Total discount before applying tax\",\n \"values_sample\": [0],\n },\n \"total_returns_before_tax\": {\n \"description\": \"Total return\/refund amount before tax\",\n \"values_sample\": [846.610531405632],\n },\n \"net_sales_before_tax\": {\n \"description\": \"Net sales amount before applying tax\",\n \"values_sample\": [0],\n },\n \"item_shipping_charge\": {\n \"description\": \"Shipping charge for an item\",\n \"values_sample\": [0],\n },\n \"item_duties\": {\n \"description\": \"Duties charged for an item\",\n \"values_sample\": [0],\n },\n \"item_additional_feels\": {\n \"description\": \"Additional fees charged for an item\",\n \"values_sample\": [0],\n },\n \"total_tax\": {\"description\": \"Total tax amount\", \"values_sample\": [0]},\n \"total_sales_after_tax\": {\n \"description\": \"Total sales amount after applying tax\",\n \"values_sample\": [0],\n },\n \"sku_id\": {\n \"description\": \"Unique identifier for each stock keeping unit (SKU)\",\n \"values_sample\": [\"shopify_8848983261473_47478863036705\"],\n },\n \"sku_code\": {\n \"description\": \"Code assigned to each stock keeping unit (SKU)\",\n \"values_sample\": [\"BSL-D-SIP-0001\"],\n },\n \"product_category\": {\n \"description\": \"Category of the product\",\n \"values_sample\": [\"Insulated Sipper\"],\n },\n \"product_id\": {\n \"description\": \"Unique identifier for each product\",\n \"values_sample\": [\"shopify_8848983261473\"],\n },\n \"product_title\": {\n \"description\": \"Title of the product\",\n \"values_sample\": [\"Kids Sipper (430 ml)\"],\n },\n \"product_price\": {\n \"description\": \"Price of the product\",\n \"values_sample\": [999],\n },\n \"customer_id\": {\n \"description\": \"Unique identifier for each customer\",\n \"values_sample\": [\"shopify_7694075199777\"],\n },\n \"first_ordered_at\": {\n \"description\": \"Timestamp of the first order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_refund_line_item_id\": {\n \"description\": \"Unique identifier for each refunded line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"order_date_time\": {\n \"description\": \"Date and time of the order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_date\": {\n \"description\": \"Date of the order\",\n \"values_sample\": [\"2024-02-14\"],\n },\n \"order_year\": {\"description\": \"Year of the order\", \"values_sample\": [2024]},\n \"order_quarter\": {\n \"description\": \"Quarter of the year of the order\",\n \"values_sample\": [1],\n },\n \"order_month\": {\"description\": \"Month of the order\", \"values_sample\": [2]},\n \"order_day_of_month\": {\n \"description\": \"Day of the month of the order\",\n \"values_sample\": [14],\n },\n \"order_week\": {\n \"description\": \"Week of the year of the order\",\n \"values_sample\": [7],\n },\n \"order_day_of_week\": {\n \"description\": \"Day of the week of the order\",\n \"values_sample\": [4],\n },\n \"order_hour\": {\n \"description\": \"Hour of the day of the order\",\n \"values_sample\": [16],\n },\n \"order_minute\": {\n \"description\": \"Minute of the hour of the order\",\n \"values_sample\": [0],\n },\n \"order_time\": {\"description\": \"Time of the order\", \"values_sample\": [\"16:00\"]},\n \"cancellation_status\": {\n \"description\": \"Status of order cancellation\",\n \"values_sample\": [\"false\"],\n },\n \"refund_status\": {\n \"description\": \"Status of order refund\",\n \"values_sample\": [\"false\"],\n },\n \"order_status\": {\n \"description\": \"Status of the order\",\n \"values_sample\": [\"unknown\"],\n },\n \"payment_status\": {\n \"description\": \"Status of payment for the order\",\n \"values_sample\": [\"pending\"],\n },\n \"shipping_address_city\": {\n \"description\": \"City of the shipping address\",\n \"values_sample\": [\"Surat\"],\n },\n \"shipping_address_state\": {\n \"description\": \"State of the shipping address\",\n \"values_sample\": [\"Gujarat\"],\n },\n \"shipping_address_country\": {\n \"description\": \"Country of the shipping address\",\n \"values_sample\": [\"India\"],\n },\n }\n}\n \"marketing_performance\": {\n \"marketing_id\": {\n \"description\": \"Unique identifier for each marketing activity.\",\n \"values_sample\": [\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_304143034868101_310419640566194_productAdsamazon_ads_sponsored_products_548576666024459\",\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_405826215303183_448674135385556_productAdsamazon_ads_sponsored_products_511545631860472\",\n ],\n },\n \"activity_date_time\": {\n \"description\": \"Timestamp of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_date\": {\n \"description\": \"Date of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_year\": {\n \"description\": \"Year of the marketing activity.\",\n \"values_sample\": [\"2024\"],\n },\n \"activity_quarter\": {\n \"description\": \"Quarter of the year in which the marketing activity took place.\",\n \"values_sample\": [\"2\"],\n },\n \"activity_month\": {\n \"description\": \"Month of the year in which the marketing activity took place.\",\n \"values_sample\": [\"4\"],\n },\n \"activity_day_of_month\": {\n \"description\": \"Day of the month on which the marketing activity took place.\",\n \"values_sample\": [\"1\"],\n },\n \"activity_week\": {\n \"description\": \"Week of the year in which the marketing activity took place.\",\n \"values_sample\": [\"14\"],\n },\n \"activity_day_of_week\": {\n \"description\": \"Day of the week on which the marketing activity took place (1 for Monday, 7 for Sunday).\",\n \"values_sample\": [\"2\"],\n },\n \"activity_hour\": {\n \"description\": \"Hour of the day in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_minute\": {\n \"description\": \"Minute of the hour in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_time\": {\n \"description\": \"Formatted string representation of the marketing activity time.\",\n \"values_sample\": [\"00:00\"],\n },\n \"channel\": {\n \"description\": \"Marketing channel used for the activity (e.g., Google Ads, Facebook Ads, Email Marketing).\",\n \"values_sample\": [\"sponsored product\"],\n },\n \"vendor\": {\n \"description\": \"Vendor or platform responsible for the marketing activity (e.g., Google, Facebook, Mailchimp).\",\n \"values_sample\": [\"amazon\"],\n },\n \"ad_account_id\": {\n \"description\": \"Unique identifier for the ad account associated with the activity.\",\n \"values_sample\": [\"A5IVEQE4ZPVNJ\"],\n },\n \"ad_account_name\": {\n \"description\": \"Name of the ad account associated with the activity.\",\n \"values_sample\": [\"Famyo\"],\n },\n \"property_name\": {\n \"description\": \"Name of the property or website where the marketing activity was run.\",\n \"values_sample\": [\"amazon sponsored product\"],\n },\n \"network_type\": {\n \"description\": \"Type of advertising network used (e.g., Search, Display, Video).\",\n \"values_sample\": [\"amazon\"],\n },\n \"campaign_id\": {\n \"description\": \"Unique identifier for the marketing campaign.\",\n \"values_sample\": [\n \"304143034868101\",\n \"405826215303183\",\n ],\n },\n \"campaign_name\": {\n \"description\": \"Name of the marketing campaign.\",\n \"values_sample\": [\n \"Football Campaign with presets - B0CT662KJL - 15\/2\/2024 23:09:44\",\n \"Hvs_Tar_SP_Blankets_Genric_Mix\",\n ],\n },\n \"campaign_status\": {\n \"description\": \"Current status of the marketing campaign (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"PAUSED\", \"ENABLED\"],\n },\n \"adset_id\": {\n \"description\": \"Unique identifier for the ad set within the campaign.\",\n \"values_sample\": [\n \"310419640566194\",\n \"448674135385556\",\n ],\n },\n \"adset_name\": {\n \"description\": \"Name of the ad set within the campaign.\",\n \"values_sample\": [\n \"Ad group - 15\/2\/2024 23:09:44\",\n \"Glow Blankets C1\",\n ],\n },\n \"adset_status\": {\n \"description\": \"Current status of the ad set (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"ad_id\": {\n \"description\": \"Unique identifier for the individual ad within the ad set.\",\n \"values_sample\": [\n \"548576666024459\",\n \"511545631860472\",\n ],\n },\n \"ad_name\": {\n \"description\": \"Name of the individual ad.\",\n \"values_sample\": [\"B0CT662KJL\", \"B0CT6428LV\"],\n },\n \"ad_description\": {\n \"description\": \"Description of the individual ad.\",\n \"values_sample\": [\n \"FM_GIDB_Football\",\n \"FM_GIDB_Astronaut\",\n ],\n },\n \"ad_status\": {\n \"description\": \"Current status of the individual ad (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"total_spend\": {\n \"description\": \"Total amount spent on the marketing activity.\",\n \"values_sample\": [\"29.15\", \"110.15\"],\n },\n \"total_clicks\": {\n \"description\": \"Total number of clicks generated by the marketing activity.\",\n \"values_sample\": [\"3\", \"7\"],\n },\n \"total_views\": {\n \"description\": \"Total number of times the marketing activity was viewed.\",\n \"values_sample\": [\"306\", \"1404\"],\n },\n \"total_impressions\": {\n \"description\": \"Total number of times the marketing activity was displayed.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_orders\": {\n \"description\": \"Number of orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_revenue\": {\n \"description\": \"Revenue generated from orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"keyword\": {\n \"description\": \"Keyword used in the marketing activity (if applicable).\",\n \"values_sample\": [None],\n },\n \"_synced_at\": {\n \"description\": \"Timestamp indicating when the data was last synced.\",\n \"values_sample\": [\"2024-07-16T21:32:08.452+00:00\"],\n },\n },\n} in context I am giving you complete DB and table info in details, user context is bit lengthy so go line by line then answer properly","role":"system"},{"content":"Show me the trend of orders from Shopify for this year","role":"user"},{"content":"SELECT CONCAT(order_year, '-', LPAD(order_month, 2, '0')) AS order_date, COUNT(DISTINCT order_id) AS order_count FROM order_values WHERE source='Shopify' AND order_year = YEAR(CURRENT_DATE) GROUP BY order_year, order_month ORDER BY order_year, order_month;","role":"assistant"}]} -{"question":"Which marketing channel generated the highest revenue last month?","answer":"SELECT channel, SUM(vendor_reported_revenue) AS total_revenue FROM marketing_performance WHERE activity_date >= DATE_TRUNC('month', CURRENT_DATE - INTERVAL '1 month') AND activity_date < DATE_TRUNC('month', CURRENT_DATE) GROUP BY channel ORDER BY total_revenue DESC LIMIT 1;","llama-3-sqlcoder-8b":"WITH channel_revenue AS (SELECT m.channel, SUM(m.total_spend) AS revenue FROM marketing_performance m WHERE m.activity_date >= (CURRENT_DATE - INTERVAL '1 month') GROUP BY m.channel) SELECT cr.channel, cr.revenue FROM channel_revenue cr ORDER BY cr.revenue DESC NULLS LAST LIMIT 1;","llama-3.1-8b":"SELECT T1.channel FROM marketing_performance AS T1 INNER JOIN ( SELECT channel, MAX(total_spend) AS max_spend FROM marketing_performance WHERE activity_month = 4 GROUP BY channel ) AS T2 ON T1.channel = T2.channel WHERE T1.total_spend = T2.max_spend","context":"TABLE_DESCRIPTIONS = {\n \"order_values\": \"This table contains order information aggregated across multiple sources for an e-commerce brand. The table is unique at an Order ID - SKU ID level. The table includes, but is not limited to, all pricing information (like gross sales, tax, net sales, shipping charge, duties, etc.), information related to the product (like SKU, product id\/title, price, etc.), order related information (timestamp of order), payment information and shipping information.\",\n \"marketing_performance\": \"This table contains detailed marketing performance data for an e-commerce brand, capturing data from various marketing activities and platforms. It provides a comprehensive overview of campaign performance, including spend, clicks, views, impressions, and attributed revenue.\",\n}\n\nCOLUMNS = {\n \"order_values\": {\n \"order_line_item_id\": {\n \"description\": \"Unique identifier for each line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"source\": {\"description\": \"Source of the order\", \"values_sample\": [\"shopify\"]},\n \"order_id\": {\n \"description\": \"Unique identifier for each order\",\n \"values_sample\": [\"shopify_5667598663969\"],\n },\n \"ordered_quantity\": {\n \"description\": \"Quantity of each item of a line item\",\n \"values_sample\": [1],\n },\n \"tax_percent\": {\n \"description\": \"Tax percentage applied to the order\",\n \"values_sample\": [0.17999949556658],\n },\n \"total_price_tax\": {\n \"description\": \"Total price including tax\",\n \"values_sample\": [152.389468594368],\n },\n \"gross_sales_price_before_tax\": {\n \"description\": \"Gross sales price before applying tax\",\n \"values_sample\": [846.610531405632],\n },\n \"total_discount_after_tax\": {\n \"description\": \"Total discount after applying tax\",\n \"values_sample\": [0],\n },\n \"total_discount_tax\": {\n \"description\": \"Total discount amount subject to tax\",\n \"values_sample\": [0],\n },\n \"total_discount_before_tax\": {\n \"description\": \"Total discount before applying tax\",\n \"values_sample\": [0],\n },\n \"total_returns_before_tax\": {\n \"description\": \"Total return\/refund amount before tax\",\n \"values_sample\": [846.610531405632],\n },\n \"net_sales_before_tax\": {\n \"description\": \"Net sales amount before applying tax\",\n \"values_sample\": [0],\n },\n \"item_shipping_charge\": {\n \"description\": \"Shipping charge for an item\",\n \"values_sample\": [0],\n },\n \"item_duties\": {\n \"description\": \"Duties charged for an item\",\n \"values_sample\": [0],\n },\n \"item_additional_feels\": {\n \"description\": \"Additional fees charged for an item\",\n \"values_sample\": [0],\n },\n \"total_tax\": {\"description\": \"Total tax amount\", \"values_sample\": [0]},\n \"total_sales_after_tax\": {\n \"description\": \"Total sales amount after applying tax\",\n \"values_sample\": [0],\n },\n \"sku_id\": {\n \"description\": \"Unique identifier for each stock keeping unit (SKU)\",\n \"values_sample\": [\"shopify_8848983261473_47478863036705\"],\n },\n \"sku_code\": {\n \"description\": \"Code assigned to each stock keeping unit (SKU)\",\n \"values_sample\": [\"BSL-D-SIP-0001\"],\n },\n \"product_category\": {\n \"description\": \"Category of the product\",\n \"values_sample\": [\"Insulated Sipper\"],\n },\n \"product_id\": {\n \"description\": \"Unique identifier for each product\",\n \"values_sample\": [\"shopify_8848983261473\"],\n },\n \"product_title\": {\n \"description\": \"Title of the product\",\n \"values_sample\": [\"Kids Sipper (430 ml)\"],\n },\n \"product_price\": {\n \"description\": \"Price of the product\",\n \"values_sample\": [999],\n },\n \"customer_id\": {\n \"description\": \"Unique identifier for each customer\",\n \"values_sample\": [\"shopify_7694075199777\"],\n },\n \"first_ordered_at\": {\n \"description\": \"Timestamp of the first order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_refund_line_item_id\": {\n \"description\": \"Unique identifier for each refunded line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"order_date_time\": {\n \"description\": \"Date and time of the order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_date\": {\n \"description\": \"Date of the order\",\n \"values_sample\": [\"2024-02-14\"],\n },\n \"order_year\": {\"description\": \"Year of the order\", \"values_sample\": [2024]},\n \"order_quarter\": {\n \"description\": \"Quarter of the year of the order\",\n \"values_sample\": [1],\n },\n \"order_month\": {\"description\": \"Month of the order\", \"values_sample\": [2]},\n \"order_day_of_month\": {\n \"description\": \"Day of the month of the order\",\n \"values_sample\": [14],\n },\n \"order_week\": {\n \"description\": \"Week of the year of the order\",\n \"values_sample\": [7],\n },\n \"order_day_of_week\": {\n \"description\": \"Day of the week of the order\",\n \"values_sample\": [4],\n },\n \"order_hour\": {\n \"description\": \"Hour of the day of the order\",\n \"values_sample\": [16],\n },\n \"order_minute\": {\n \"description\": \"Minute of the hour of the order\",\n \"values_sample\": [0],\n },\n \"order_time\": {\"description\": \"Time of the order\", \"values_sample\": [\"16:00\"]},\n \"cancellation_status\": {\n \"description\": \"Status of order cancellation\",\n \"values_sample\": [\"false\"],\n },\n \"refund_status\": {\n \"description\": \"Status of order refund\",\n \"values_sample\": [\"false\"],\n },\n \"order_status\": {\n \"description\": \"Status of the order\",\n \"values_sample\": [\"unknown\"],\n },\n \"payment_status\": {\n \"description\": \"Status of payment for the order\",\n \"values_sample\": [\"pending\"],\n },\n \"shipping_address_city\": {\n \"description\": \"City of the shipping address\",\n \"values_sample\": [\"Surat\"],\n },\n \"shipping_address_state\": {\n \"description\": \"State of the shipping address\",\n \"values_sample\": [\"Gujarat\"],\n },\n \"shipping_address_country\": {\n \"description\": \"Country of the shipping address\",\n \"values_sample\": [\"India\"],\n },\n }\n}\n \"marketing_performance\": {\n \"marketing_id\": {\n \"description\": \"Unique identifier for each marketing activity.\",\n \"values_sample\": [\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_304143034868101_310419640566194_productAdsamazon_ads_sponsored_products_548576666024459\",\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_405826215303183_448674135385556_productAdsamazon_ads_sponsored_products_511545631860472\",\n ],\n },\n \"activity_date_time\": {\n \"description\": \"Timestamp of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_date\": {\n \"description\": \"Date of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_year\": {\n \"description\": \"Year of the marketing activity.\",\n \"values_sample\": [\"2024\"],\n },\n \"activity_quarter\": {\n \"description\": \"Quarter of the year in which the marketing activity took place.\",\n \"values_sample\": [\"2\"],\n },\n \"activity_month\": {\n \"description\": \"Month of the year in which the marketing activity took place.\",\n \"values_sample\": [\"4\"],\n },\n \"activity_day_of_month\": {\n \"description\": \"Day of the month on which the marketing activity took place.\",\n \"values_sample\": [\"1\"],\n },\n \"activity_week\": {\n \"description\": \"Week of the year in which the marketing activity took place.\",\n \"values_sample\": [\"14\"],\n },\n \"activity_day_of_week\": {\n \"description\": \"Day of the week on which the marketing activity took place (1 for Monday, 7 for Sunday).\",\n \"values_sample\": [\"2\"],\n },\n \"activity_hour\": {\n \"description\": \"Hour of the day in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_minute\": {\n \"description\": \"Minute of the hour in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_time\": {\n \"description\": \"Formatted string representation of the marketing activity time.\",\n \"values_sample\": [\"00:00\"],\n },\n \"channel\": {\n \"description\": \"Marketing channel used for the activity (e.g., Google Ads, Facebook Ads, Email Marketing).\",\n \"values_sample\": [\"sponsored product\"],\n },\n \"vendor\": {\n \"description\": \"Vendor or platform responsible for the marketing activity (e.g., Google, Facebook, Mailchimp).\",\n \"values_sample\": [\"amazon\"],\n },\n \"ad_account_id\": {\n \"description\": \"Unique identifier for the ad account associated with the activity.\",\n \"values_sample\": [\"A5IVEQE4ZPVNJ\"],\n },\n \"ad_account_name\": {\n \"description\": \"Name of the ad account associated with the activity.\",\n \"values_sample\": [\"Famyo\"],\n },\n \"property_name\": {\n \"description\": \"Name of the property or website where the marketing activity was run.\",\n \"values_sample\": [\"amazon sponsored product\"],\n },\n \"network_type\": {\n \"description\": \"Type of advertising network used (e.g., Search, Display, Video).\",\n \"values_sample\": [\"amazon\"],\n },\n \"campaign_id\": {\n \"description\": \"Unique identifier for the marketing campaign.\",\n \"values_sample\": [\n \"304143034868101\",\n \"405826215303183\",\n ],\n },\n \"campaign_name\": {\n \"description\": \"Name of the marketing campaign.\",\n \"values_sample\": [\n \"Football Campaign with presets - B0CT662KJL - 15\/2\/2024 23:09:44\",\n \"Hvs_Tar_SP_Blankets_Genric_Mix\",\n ],\n },\n \"campaign_status\": {\n \"description\": \"Current status of the marketing campaign (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"PAUSED\", \"ENABLED\"],\n },\n \"adset_id\": {\n \"description\": \"Unique identifier for the ad set within the campaign.\",\n \"values_sample\": [\n \"310419640566194\",\n \"448674135385556\",\n ],\n },\n \"adset_name\": {\n \"description\": \"Name of the ad set within the campaign.\",\n \"values_sample\": [\n \"Ad group - 15\/2\/2024 23:09:44\",\n \"Glow Blankets C1\",\n ],\n },\n \"adset_status\": {\n \"description\": \"Current status of the ad set (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"ad_id\": {\n \"description\": \"Unique identifier for the individual ad within the ad set.\",\n \"values_sample\": [\n \"548576666024459\",\n \"511545631860472\",\n ],\n },\n \"ad_name\": {\n \"description\": \"Name of the individual ad.\",\n \"values_sample\": [\"B0CT662KJL\", \"B0CT6428LV\"],\n },\n \"ad_description\": {\n \"description\": \"Description of the individual ad.\",\n \"values_sample\": [\n \"FM_GIDB_Football\",\n \"FM_GIDB_Astronaut\",\n ],\n },\n \"ad_status\": {\n \"description\": \"Current status of the individual ad (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"total_spend\": {\n \"description\": \"Total amount spent on the marketing activity.\",\n \"values_sample\": [\"29.15\", \"110.15\"],\n },\n \"total_clicks\": {\n \"description\": \"Total number of clicks generated by the marketing activity.\",\n \"values_sample\": [\"3\", \"7\"],\n },\n \"total_views\": {\n \"description\": \"Total number of times the marketing activity was viewed.\",\n \"values_sample\": [\"306\", \"1404\"],\n },\n \"total_impressions\": {\n \"description\": \"Total number of times the marketing activity was displayed.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_orders\": {\n \"description\": \"Number of orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_revenue\": {\n \"description\": \"Revenue generated from orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"keyword\": {\n \"description\": \"Keyword used in the marketing activity (if applicable).\",\n \"values_sample\": [None],\n },\n \"_synced_at\": {\n \"description\": \"Timestamp indicating when the data was last synced.\",\n \"values_sample\": [\"2024-07-16T21:32:08.452+00:00\"],\n },\n },\n}","messages":[{"content":"You are an advanced AI trained to generate SQL queries based\n on a given context. Your task is to write an SQL query that accurately \n retrieves the requested data from the provided table schema. Do not answer with any explanations -- just the SQL query.\n Output only plain text. Do not output markdown. \n Please ensure that the SQL query matches the exact table name and column names\n specified in the TABLE_DESCRIPTIONS = {\n \"order_values\": \"This table contains order information aggregated across multiple sources for an e-commerce brand. The table is unique at an Order ID - SKU ID level. The table includes, but is not limited to, all pricing information (like gross sales, tax, net sales, shipping charge, duties, etc.), information related to the product (like SKU, product id\/title, price, etc.), order related information (timestamp of order), payment information and shipping information.\",\n \"marketing_performance\": \"This table contains detailed marketing performance data for an e-commerce brand, capturing data from various marketing activities and platforms. It provides a comprehensive overview of campaign performance, including spend, clicks, views, impressions, and attributed revenue.\",\n}\n\nCOLUMNS = {\n \"order_values\": {\n \"order_line_item_id\": {\n \"description\": \"Unique identifier for each line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"source\": {\"description\": \"Source of the order\", \"values_sample\": [\"shopify\"]},\n \"order_id\": {\n \"description\": \"Unique identifier for each order\",\n \"values_sample\": [\"shopify_5667598663969\"],\n },\n \"ordered_quantity\": {\n \"description\": \"Quantity of each item of a line item\",\n \"values_sample\": [1],\n },\n \"tax_percent\": {\n \"description\": \"Tax percentage applied to the order\",\n \"values_sample\": [0.17999949556658],\n },\n \"total_price_tax\": {\n \"description\": \"Total price including tax\",\n \"values_sample\": [152.389468594368],\n },\n \"gross_sales_price_before_tax\": {\n \"description\": \"Gross sales price before applying tax\",\n \"values_sample\": [846.610531405632],\n },\n \"total_discount_after_tax\": {\n \"description\": \"Total discount after applying tax\",\n \"values_sample\": [0],\n },\n \"total_discount_tax\": {\n \"description\": \"Total discount amount subject to tax\",\n \"values_sample\": [0],\n },\n \"total_discount_before_tax\": {\n \"description\": \"Total discount before applying tax\",\n \"values_sample\": [0],\n },\n \"total_returns_before_tax\": {\n \"description\": \"Total return\/refund amount before tax\",\n \"values_sample\": [846.610531405632],\n },\n \"net_sales_before_tax\": {\n \"description\": \"Net sales amount before applying tax\",\n \"values_sample\": [0],\n },\n \"item_shipping_charge\": {\n \"description\": \"Shipping charge for an item\",\n \"values_sample\": [0],\n },\n \"item_duties\": {\n \"description\": \"Duties charged for an item\",\n \"values_sample\": [0],\n },\n \"item_additional_feels\": {\n \"description\": \"Additional fees charged for an item\",\n \"values_sample\": [0],\n },\n \"total_tax\": {\"description\": \"Total tax amount\", \"values_sample\": [0]},\n \"total_sales_after_tax\": {\n \"description\": \"Total sales amount after applying tax\",\n \"values_sample\": [0],\n },\n \"sku_id\": {\n \"description\": \"Unique identifier for each stock keeping unit (SKU)\",\n \"values_sample\": [\"shopify_8848983261473_47478863036705\"],\n },\n \"sku_code\": {\n \"description\": \"Code assigned to each stock keeping unit (SKU)\",\n \"values_sample\": [\"BSL-D-SIP-0001\"],\n },\n \"product_category\": {\n \"description\": \"Category of the product\",\n \"values_sample\": [\"Insulated Sipper\"],\n },\n \"product_id\": {\n \"description\": \"Unique identifier for each product\",\n \"values_sample\": [\"shopify_8848983261473\"],\n },\n \"product_title\": {\n \"description\": \"Title of the product\",\n \"values_sample\": [\"Kids Sipper (430 ml)\"],\n },\n \"product_price\": {\n \"description\": \"Price of the product\",\n \"values_sample\": [999],\n },\n \"customer_id\": {\n \"description\": \"Unique identifier for each customer\",\n \"values_sample\": [\"shopify_7694075199777\"],\n },\n \"first_ordered_at\": {\n \"description\": \"Timestamp of the first order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_refund_line_item_id\": {\n \"description\": \"Unique identifier for each refunded line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"order_date_time\": {\n \"description\": \"Date and time of the order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_date\": {\n \"description\": \"Date of the order\",\n \"values_sample\": [\"2024-02-14\"],\n },\n \"order_year\": {\"description\": \"Year of the order\", \"values_sample\": [2024]},\n \"order_quarter\": {\n \"description\": \"Quarter of the year of the order\",\n \"values_sample\": [1],\n },\n \"order_month\": {\"description\": \"Month of the order\", \"values_sample\": [2]},\n \"order_day_of_month\": {\n \"description\": \"Day of the month of the order\",\n \"values_sample\": [14],\n },\n \"order_week\": {\n \"description\": \"Week of the year of the order\",\n \"values_sample\": [7],\n },\n \"order_day_of_week\": {\n \"description\": \"Day of the week of the order\",\n \"values_sample\": [4],\n },\n \"order_hour\": {\n \"description\": \"Hour of the day of the order\",\n \"values_sample\": [16],\n },\n \"order_minute\": {\n \"description\": \"Minute of the hour of the order\",\n \"values_sample\": [0],\n },\n \"order_time\": {\"description\": \"Time of the order\", \"values_sample\": [\"16:00\"]},\n \"cancellation_status\": {\n \"description\": \"Status of order cancellation\",\n \"values_sample\": [\"false\"],\n },\n \"refund_status\": {\n \"description\": \"Status of order refund\",\n \"values_sample\": [\"false\"],\n },\n \"order_status\": {\n \"description\": \"Status of the order\",\n \"values_sample\": [\"unknown\"],\n },\n \"payment_status\": {\n \"description\": \"Status of payment for the order\",\n \"values_sample\": [\"pending\"],\n },\n \"shipping_address_city\": {\n \"description\": \"City of the shipping address\",\n \"values_sample\": [\"Surat\"],\n },\n \"shipping_address_state\": {\n \"description\": \"State of the shipping address\",\n \"values_sample\": [\"Gujarat\"],\n },\n \"shipping_address_country\": {\n \"description\": \"Country of the shipping address\",\n \"values_sample\": [\"India\"],\n },\n }\n}\n \"marketing_performance\": {\n \"marketing_id\": {\n \"description\": \"Unique identifier for each marketing activity.\",\n \"values_sample\": [\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_304143034868101_310419640566194_productAdsamazon_ads_sponsored_products_548576666024459\",\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_405826215303183_448674135385556_productAdsamazon_ads_sponsored_products_511545631860472\",\n ],\n },\n \"activity_date_time\": {\n \"description\": \"Timestamp of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_date\": {\n \"description\": \"Date of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_year\": {\n \"description\": \"Year of the marketing activity.\",\n \"values_sample\": [\"2024\"],\n },\n \"activity_quarter\": {\n \"description\": \"Quarter of the year in which the marketing activity took place.\",\n \"values_sample\": [\"2\"],\n },\n \"activity_month\": {\n \"description\": \"Month of the year in which the marketing activity took place.\",\n \"values_sample\": [\"4\"],\n },\n \"activity_day_of_month\": {\n \"description\": \"Day of the month on which the marketing activity took place.\",\n \"values_sample\": [\"1\"],\n },\n \"activity_week\": {\n \"description\": \"Week of the year in which the marketing activity took place.\",\n \"values_sample\": [\"14\"],\n },\n \"activity_day_of_week\": {\n \"description\": \"Day of the week on which the marketing activity took place (1 for Monday, 7 for Sunday).\",\n \"values_sample\": [\"2\"],\n },\n \"activity_hour\": {\n \"description\": \"Hour of the day in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_minute\": {\n \"description\": \"Minute of the hour in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_time\": {\n \"description\": \"Formatted string representation of the marketing activity time.\",\n \"values_sample\": [\"00:00\"],\n },\n \"channel\": {\n \"description\": \"Marketing channel used for the activity (e.g., Google Ads, Facebook Ads, Email Marketing).\",\n \"values_sample\": [\"sponsored product\"],\n },\n \"vendor\": {\n \"description\": \"Vendor or platform responsible for the marketing activity (e.g., Google, Facebook, Mailchimp).\",\n \"values_sample\": [\"amazon\"],\n },\n \"ad_account_id\": {\n \"description\": \"Unique identifier for the ad account associated with the activity.\",\n \"values_sample\": [\"A5IVEQE4ZPVNJ\"],\n },\n \"ad_account_name\": {\n \"description\": \"Name of the ad account associated with the activity.\",\n \"values_sample\": [\"Famyo\"],\n },\n \"property_name\": {\n \"description\": \"Name of the property or website where the marketing activity was run.\",\n \"values_sample\": [\"amazon sponsored product\"],\n },\n \"network_type\": {\n \"description\": \"Type of advertising network used (e.g., Search, Display, Video).\",\n \"values_sample\": [\"amazon\"],\n },\n \"campaign_id\": {\n \"description\": \"Unique identifier for the marketing campaign.\",\n \"values_sample\": [\n \"304143034868101\",\n \"405826215303183\",\n ],\n },\n \"campaign_name\": {\n \"description\": \"Name of the marketing campaign.\",\n \"values_sample\": [\n \"Football Campaign with presets - B0CT662KJL - 15\/2\/2024 23:09:44\",\n \"Hvs_Tar_SP_Blankets_Genric_Mix\",\n ],\n },\n \"campaign_status\": {\n \"description\": \"Current status of the marketing campaign (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"PAUSED\", \"ENABLED\"],\n },\n \"adset_id\": {\n \"description\": \"Unique identifier for the ad set within the campaign.\",\n \"values_sample\": [\n \"310419640566194\",\n \"448674135385556\",\n ],\n },\n \"adset_name\": {\n \"description\": \"Name of the ad set within the campaign.\",\n \"values_sample\": [\n \"Ad group - 15\/2\/2024 23:09:44\",\n \"Glow Blankets C1\",\n ],\n },\n \"adset_status\": {\n \"description\": \"Current status of the ad set (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"ad_id\": {\n \"description\": \"Unique identifier for the individual ad within the ad set.\",\n \"values_sample\": [\n \"548576666024459\",\n \"511545631860472\",\n ],\n },\n \"ad_name\": {\n \"description\": \"Name of the individual ad.\",\n \"values_sample\": [\"B0CT662KJL\", \"B0CT6428LV\"],\n },\n \"ad_description\": {\n \"description\": \"Description of the individual ad.\",\n \"values_sample\": [\n \"FM_GIDB_Football\",\n \"FM_GIDB_Astronaut\",\n ],\n },\n \"ad_status\": {\n \"description\": \"Current status of the individual ad (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"total_spend\": {\n \"description\": \"Total amount spent on the marketing activity.\",\n \"values_sample\": [\"29.15\", \"110.15\"],\n },\n \"total_clicks\": {\n \"description\": \"Total number of clicks generated by the marketing activity.\",\n \"values_sample\": [\"3\", \"7\"],\n },\n \"total_views\": {\n \"description\": \"Total number of times the marketing activity was viewed.\",\n \"values_sample\": [\"306\", \"1404\"],\n },\n \"total_impressions\": {\n \"description\": \"Total number of times the marketing activity was displayed.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_orders\": {\n \"description\": \"Number of orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_revenue\": {\n \"description\": \"Revenue generated from orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"keyword\": {\n \"description\": \"Keyword used in the marketing activity (if applicable).\",\n \"values_sample\": [None],\n },\n \"_synced_at\": {\n \"description\": \"Timestamp indicating when the data was last synced.\",\n \"values_sample\": [\"2024-07-16T21:32:08.452+00:00\"],\n },\n },\n} in context I am giving you complete DB and table info in details, user context is bit lengthy so go line by line then answer properly","role":"system"},{"content":"Which marketing channel generated the highest revenue last month?","role":"user"},{"content":"SELECT channel, SUM(vendor_reported_revenue) AS total_revenue FROM marketing_performance WHERE activity_date >= DATE_TRUNC('month', CURRENT_DATE - INTERVAL '1 month') AND activity_date < DATE_TRUNC('month', CURRENT_DATE) GROUP BY channel ORDER BY total_revenue DESC LIMIT 1;","role":"assistant"}]} +{"question":"What is the MoM (month-over-month) growth rate of sales for the last 12 months?","answer":"WITH monthly_sales AS (SELECT CONCAT(order_year, '-', LPAD(order_month, 2, '0')) AS order_month, SUM(COALESCE(net_sales_before_tax, 0)) AS net_sales FROM order_values WHERE TO_DATE(CONCAT(order_year, '-', LPAD(order_month, 2, '0')), 'yyyy-MM') >= DATE_TRUNC('month', ADD_MONTHS(CURRENT_DATE, -12)) AND TO_DATE(CONCAT(order_year, '-', LPAD(order_month, 2, '0')), 'yyyy-MM') < DATE_TRUNC('month', CURRENT_DATE) GROUP BY order_year, order_month ORDER BY order_year, order_month), sales_growth AS (SELECT order_month, net_sales, LAG(net_sales) OVER (ORDER BY order_month) AS previous_month_sales FROM monthly_sales) SELECT order_month, ROUND((net_sales - previous_month_sales) \/ NULLIF(previous_month_sales, 0) * 100, 2) AS mom_growth_rate FROM sales_growth;","llama-3-sqlcoder-8b":"SELECT EXTRACT(MONTH FROM o.order_date) AS order_month, SUM(o.total_sales_after_tax) AS total_sales, LAG(SUM(o.total_sales_after_tax), 1) OVER (ORDER BY EXTRACT(MONTH FROM o.order_date)) AS previous_month_sales FROM order_values o WHERE o.order_date >= (CURRENT_DATE - INTERVAL '12 months') GROUP BY EXTRACT(MONTH FROM o.order_date) ORDER BY EXTRACT(MONTH FROM o.order_date) NULLS LAST; WITH monthly_sales AS (SELECT order_month, total_sales, previous_month_sales FROM (SELECT order_month, total_sales, LAG(total_sales, 1) OVER (ORDER BY order_month) AS previous_month_sales FROM (SELECT order_month, SUM(total_sales_after_tax) AS total_sales FROM order_values WHERE order_date >= (CURRENT_DATE - INTERVAL '12 months') GROUP BY order_month) AS subquery1) AS subquery2) SELECT order_month, total_sales, ((total_sales - previous_month_sales) \/ NULLIF(previous_month_sales, 0)) * 100 AS growth_rate FROM monthly_sales ORDER BY order_month NULLS LAST;assistant I'd be happy to help you with your question. However, I","llama-3.1-8b":"SELECT EXTRACT(YEAR FROM order_date) AS year, EXTRACT(MONTH FROM order_date) AS month, SUM(total_sales_after_tax) AS sales, LAG(SUM(total_sales_after_tax), 1) OVER (ORDER BY EXTRACT(YEAR FROM order_date), EXTRACT(MONTH FROM order_date)) AS prev_month_sales FROM order_values WHERE EXTRACT(YEAR FROM order_date) = EXTRACT(YEAR FROM CURRENT_DATE) - 1 GROUP BY EXTRACT(YEAR FROM order_date), EXTRACT(MONTH FROM order_date)","context":"TABLE_DESCRIPTIONS = {\n \"order_values\": \"This table contains order information aggregated across multiple sources for an e-commerce brand. The table is unique at an Order ID - SKU ID level. The table includes, but is not limited to, all pricing information (like gross sales, tax, net sales, shipping charge, duties, etc.), information related to the product (like SKU, product id\/title, price, etc.), order related information (timestamp of order), payment information and shipping information.\",\n \"marketing_performance\": \"This table contains detailed marketing performance data for an e-commerce brand, capturing data from various marketing activities and platforms. It provides a comprehensive overview of campaign performance, including spend, clicks, views, impressions, and attributed revenue.\",\n}\n\nCOLUMNS = {\n \"order_values\": {\n \"order_line_item_id\": {\n \"description\": \"Unique identifier for each line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"source\": {\"description\": \"Source of the order\", \"values_sample\": [\"shopify\"]},\n \"order_id\": {\n \"description\": \"Unique identifier for each order\",\n \"values_sample\": [\"shopify_5667598663969\"],\n },\n \"ordered_quantity\": {\n \"description\": \"Quantity of each item of a line item\",\n \"values_sample\": [1],\n },\n \"tax_percent\": {\n \"description\": \"Tax percentage applied to the order\",\n \"values_sample\": [0.17999949556658],\n },\n \"total_price_tax\": {\n \"description\": \"Total price including tax\",\n \"values_sample\": [152.389468594368],\n },\n \"gross_sales_price_before_tax\": {\n \"description\": \"Gross sales price before applying tax\",\n \"values_sample\": [846.610531405632],\n },\n \"total_discount_after_tax\": {\n \"description\": \"Total discount after applying tax\",\n \"values_sample\": [0],\n },\n \"total_discount_tax\": {\n \"description\": \"Total discount amount subject to tax\",\n \"values_sample\": [0],\n },\n \"total_discount_before_tax\": {\n \"description\": \"Total discount before applying tax\",\n \"values_sample\": [0],\n },\n \"total_returns_before_tax\": {\n \"description\": \"Total return\/refund amount before tax\",\n \"values_sample\": [846.610531405632],\n },\n \"net_sales_before_tax\": {\n \"description\": \"Net sales amount before applying tax\",\n \"values_sample\": [0],\n },\n \"item_shipping_charge\": {\n \"description\": \"Shipping charge for an item\",\n \"values_sample\": [0],\n },\n \"item_duties\": {\n \"description\": \"Duties charged for an item\",\n \"values_sample\": [0],\n },\n \"item_additional_feels\": {\n \"description\": \"Additional fees charged for an item\",\n \"values_sample\": [0],\n },\n \"total_tax\": {\"description\": \"Total tax amount\", \"values_sample\": [0]},\n \"total_sales_after_tax\": {\n \"description\": \"Total sales amount after applying tax\",\n \"values_sample\": [0],\n },\n \"sku_id\": {\n \"description\": \"Unique identifier for each stock keeping unit (SKU)\",\n \"values_sample\": [\"shopify_8848983261473_47478863036705\"],\n },\n \"sku_code\": {\n \"description\": \"Code assigned to each stock keeping unit (SKU)\",\n \"values_sample\": [\"BSL-D-SIP-0001\"],\n },\n \"product_category\": {\n \"description\": \"Category of the product\",\n \"values_sample\": [\"Insulated Sipper\"],\n },\n \"product_id\": {\n \"description\": \"Unique identifier for each product\",\n \"values_sample\": [\"shopify_8848983261473\"],\n },\n \"product_title\": {\n \"description\": \"Title of the product\",\n \"values_sample\": [\"Kids Sipper (430 ml)\"],\n },\n \"product_price\": {\n \"description\": \"Price of the product\",\n \"values_sample\": [999],\n },\n \"customer_id\": {\n \"description\": \"Unique identifier for each customer\",\n \"values_sample\": [\"shopify_7694075199777\"],\n },\n \"first_ordered_at\": {\n \"description\": \"Timestamp of the first order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_refund_line_item_id\": {\n \"description\": \"Unique identifier for each refunded line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"order_date_time\": {\n \"description\": \"Date and time of the order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_date\": {\n \"description\": \"Date of the order\",\n \"values_sample\": [\"2024-02-14\"],\n },\n \"order_year\": {\"description\": \"Year of the order\", \"values_sample\": [2024]},\n \"order_quarter\": {\n \"description\": \"Quarter of the year of the order\",\n \"values_sample\": [1],\n },\n \"order_month\": {\"description\": \"Month of the order\", \"values_sample\": [2]},\n \"order_day_of_month\": {\n \"description\": \"Day of the month of the order\",\n \"values_sample\": [14],\n },\n \"order_week\": {\n \"description\": \"Week of the year of the order\",\n \"values_sample\": [7],\n },\n \"order_day_of_week\": {\n \"description\": \"Day of the week of the order\",\n \"values_sample\": [4],\n },\n \"order_hour\": {\n \"description\": \"Hour of the day of the order\",\n \"values_sample\": [16],\n },\n \"order_minute\": {\n \"description\": \"Minute of the hour of the order\",\n \"values_sample\": [0],\n },\n \"order_time\": {\"description\": \"Time of the order\", \"values_sample\": [\"16:00\"]},\n \"cancellation_status\": {\n \"description\": \"Status of order cancellation\",\n \"values_sample\": [\"false\"],\n },\n \"refund_status\": {\n \"description\": \"Status of order refund\",\n \"values_sample\": [\"false\"],\n },\n \"order_status\": {\n \"description\": \"Status of the order\",\n \"values_sample\": [\"unknown\"],\n },\n \"payment_status\": {\n \"description\": \"Status of payment for the order\",\n \"values_sample\": [\"pending\"],\n },\n \"shipping_address_city\": {\n \"description\": \"City of the shipping address\",\n \"values_sample\": [\"Surat\"],\n },\n \"shipping_address_state\": {\n \"description\": \"State of the shipping address\",\n \"values_sample\": [\"Gujarat\"],\n },\n \"shipping_address_country\": {\n \"description\": \"Country of the shipping address\",\n \"values_sample\": [\"India\"],\n },\n }\n}\n \"marketing_performance\": {\n \"marketing_id\": {\n \"description\": \"Unique identifier for each marketing activity.\",\n \"values_sample\": [\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_304143034868101_310419640566194_productAdsamazon_ads_sponsored_products_548576666024459\",\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_405826215303183_448674135385556_productAdsamazon_ads_sponsored_products_511545631860472\",\n ],\n },\n \"activity_date_time\": {\n \"description\": \"Timestamp of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_date\": {\n \"description\": \"Date of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_year\": {\n \"description\": \"Year of the marketing activity.\",\n \"values_sample\": [\"2024\"],\n },\n \"activity_quarter\": {\n \"description\": \"Quarter of the year in which the marketing activity took place.\",\n \"values_sample\": [\"2\"],\n },\n \"activity_month\": {\n \"description\": \"Month of the year in which the marketing activity took place.\",\n \"values_sample\": [\"4\"],\n },\n \"activity_day_of_month\": {\n \"description\": \"Day of the month on which the marketing activity took place.\",\n \"values_sample\": [\"1\"],\n },\n \"activity_week\": {\n \"description\": \"Week of the year in which the marketing activity took place.\",\n \"values_sample\": [\"14\"],\n },\n \"activity_day_of_week\": {\n \"description\": \"Day of the week on which the marketing activity took place (1 for Monday, 7 for Sunday).\",\n \"values_sample\": [\"2\"],\n },\n \"activity_hour\": {\n \"description\": \"Hour of the day in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_minute\": {\n \"description\": \"Minute of the hour in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_time\": {\n \"description\": \"Formatted string representation of the marketing activity time.\",\n \"values_sample\": [\"00:00\"],\n },\n \"channel\": {\n \"description\": \"Marketing channel used for the activity (e.g., Google Ads, Facebook Ads, Email Marketing).\",\n \"values_sample\": [\"sponsored product\"],\n },\n \"vendor\": {\n \"description\": \"Vendor or platform responsible for the marketing activity (e.g., Google, Facebook, Mailchimp).\",\n \"values_sample\": [\"amazon\"],\n },\n \"ad_account_id\": {\n \"description\": \"Unique identifier for the ad account associated with the activity.\",\n \"values_sample\": [\"A5IVEQE4ZPVNJ\"],\n },\n \"ad_account_name\": {\n \"description\": \"Name of the ad account associated with the activity.\",\n \"values_sample\": [\"Famyo\"],\n },\n \"property_name\": {\n \"description\": \"Name of the property or website where the marketing activity was run.\",\n \"values_sample\": [\"amazon sponsored product\"],\n },\n \"network_type\": {\n \"description\": \"Type of advertising network used (e.g., Search, Display, Video).\",\n \"values_sample\": [\"amazon\"],\n },\n \"campaign_id\": {\n \"description\": \"Unique identifier for the marketing campaign.\",\n \"values_sample\": [\n \"304143034868101\",\n \"405826215303183\",\n ],\n },\n \"campaign_name\": {\n \"description\": \"Name of the marketing campaign.\",\n \"values_sample\": [\n \"Football Campaign with presets - B0CT662KJL - 15\/2\/2024 23:09:44\",\n \"Hvs_Tar_SP_Blankets_Genric_Mix\",\n ],\n },\n \"campaign_status\": {\n \"description\": \"Current status of the marketing campaign (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"PAUSED\", \"ENABLED\"],\n },\n \"adset_id\": {\n \"description\": \"Unique identifier for the ad set within the campaign.\",\n \"values_sample\": [\n \"310419640566194\",\n \"448674135385556\",\n ],\n },\n \"adset_name\": {\n \"description\": \"Name of the ad set within the campaign.\",\n \"values_sample\": [\n \"Ad group - 15\/2\/2024 23:09:44\",\n \"Glow Blankets C1\",\n ],\n },\n \"adset_status\": {\n \"description\": \"Current status of the ad set (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"ad_id\": {\n \"description\": \"Unique identifier for the individual ad within the ad set.\",\n \"values_sample\": [\n \"548576666024459\",\n \"511545631860472\",\n ],\n },\n \"ad_name\": {\n \"description\": \"Name of the individual ad.\",\n \"values_sample\": [\"B0CT662KJL\", \"B0CT6428LV\"],\n },\n \"ad_description\": {\n \"description\": \"Description of the individual ad.\",\n \"values_sample\": [\n \"FM_GIDB_Football\",\n \"FM_GIDB_Astronaut\",\n ],\n },\n \"ad_status\": {\n \"description\": \"Current status of the individual ad (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"total_spend\": {\n \"description\": \"Total amount spent on the marketing activity.\",\n \"values_sample\": [\"29.15\", \"110.15\"],\n },\n \"total_clicks\": {\n \"description\": \"Total number of clicks generated by the marketing activity.\",\n \"values_sample\": [\"3\", \"7\"],\n },\n \"total_views\": {\n \"description\": \"Total number of times the marketing activity was viewed.\",\n \"values_sample\": [\"306\", \"1404\"],\n },\n \"total_impressions\": {\n \"description\": \"Total number of times the marketing activity was displayed.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_orders\": {\n \"description\": \"Number of orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_revenue\": {\n \"description\": \"Revenue generated from orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"keyword\": {\n \"description\": \"Keyword used in the marketing activity (if applicable).\",\n \"values_sample\": [None],\n },\n \"_synced_at\": {\n \"description\": \"Timestamp indicating when the data was last synced.\",\n \"values_sample\": [\"2024-07-16T21:32:08.452+00:00\"],\n },\n },\n}","messages":[{"content":"You are an advanced AI trained to generate SQL queries based\n on a given context. Your task is to write an SQL query that accurately \n retrieves the requested data from the provided table schema. Do not answer with any explanations -- just the SQL query.\n Output only plain text. Do not output markdown. \n Please ensure that the SQL query matches the exact table name and column names\n specified in the TABLE_DESCRIPTIONS = {\n \"order_values\": \"This table contains order information aggregated across multiple sources for an e-commerce brand. The table is unique at an Order ID - SKU ID level. The table includes, but is not limited to, all pricing information (like gross sales, tax, net sales, shipping charge, duties, etc.), information related to the product (like SKU, product id\/title, price, etc.), order related information (timestamp of order), payment information and shipping information.\",\n \"marketing_performance\": \"This table contains detailed marketing performance data for an e-commerce brand, capturing data from various marketing activities and platforms. It provides a comprehensive overview of campaign performance, including spend, clicks, views, impressions, and attributed revenue.\",\n}\n\nCOLUMNS = {\n \"order_values\": {\n \"order_line_item_id\": {\n \"description\": \"Unique identifier for each line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"source\": {\"description\": \"Source of the order\", \"values_sample\": [\"shopify\"]},\n \"order_id\": {\n \"description\": \"Unique identifier for each order\",\n \"values_sample\": [\"shopify_5667598663969\"],\n },\n \"ordered_quantity\": {\n \"description\": \"Quantity of each item of a line item\",\n \"values_sample\": [1],\n },\n \"tax_percent\": {\n \"description\": \"Tax percentage applied to the order\",\n \"values_sample\": [0.17999949556658],\n },\n \"total_price_tax\": {\n \"description\": \"Total price including tax\",\n \"values_sample\": [152.389468594368],\n },\n \"gross_sales_price_before_tax\": {\n \"description\": \"Gross sales price before applying tax\",\n \"values_sample\": [846.610531405632],\n },\n \"total_discount_after_tax\": {\n \"description\": \"Total discount after applying tax\",\n \"values_sample\": [0],\n },\n \"total_discount_tax\": {\n \"description\": \"Total discount amount subject to tax\",\n \"values_sample\": [0],\n },\n \"total_discount_before_tax\": {\n \"description\": \"Total discount before applying tax\",\n \"values_sample\": [0],\n },\n \"total_returns_before_tax\": {\n \"description\": \"Total return\/refund amount before tax\",\n \"values_sample\": [846.610531405632],\n },\n \"net_sales_before_tax\": {\n \"description\": \"Net sales amount before applying tax\",\n \"values_sample\": [0],\n },\n \"item_shipping_charge\": {\n \"description\": \"Shipping charge for an item\",\n \"values_sample\": [0],\n },\n \"item_duties\": {\n \"description\": \"Duties charged for an item\",\n \"values_sample\": [0],\n },\n \"item_additional_feels\": {\n \"description\": \"Additional fees charged for an item\",\n \"values_sample\": [0],\n },\n \"total_tax\": {\"description\": \"Total tax amount\", \"values_sample\": [0]},\n \"total_sales_after_tax\": {\n \"description\": \"Total sales amount after applying tax\",\n \"values_sample\": [0],\n },\n \"sku_id\": {\n \"description\": \"Unique identifier for each stock keeping unit (SKU)\",\n \"values_sample\": [\"shopify_8848983261473_47478863036705\"],\n },\n \"sku_code\": {\n \"description\": \"Code assigned to each stock keeping unit (SKU)\",\n \"values_sample\": [\"BSL-D-SIP-0001\"],\n },\n \"product_category\": {\n \"description\": \"Category of the product\",\n \"values_sample\": [\"Insulated Sipper\"],\n },\n \"product_id\": {\n \"description\": \"Unique identifier for each product\",\n \"values_sample\": [\"shopify_8848983261473\"],\n },\n \"product_title\": {\n \"description\": \"Title of the product\",\n \"values_sample\": [\"Kids Sipper (430 ml)\"],\n },\n \"product_price\": {\n \"description\": \"Price of the product\",\n \"values_sample\": [999],\n },\n \"customer_id\": {\n \"description\": \"Unique identifier for each customer\",\n \"values_sample\": [\"shopify_7694075199777\"],\n },\n \"first_ordered_at\": {\n \"description\": \"Timestamp of the first order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_refund_line_item_id\": {\n \"description\": \"Unique identifier for each refunded line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"order_date_time\": {\n \"description\": \"Date and time of the order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_date\": {\n \"description\": \"Date of the order\",\n \"values_sample\": [\"2024-02-14\"],\n },\n \"order_year\": {\"description\": \"Year of the order\", \"values_sample\": [2024]},\n \"order_quarter\": {\n \"description\": \"Quarter of the year of the order\",\n \"values_sample\": [1],\n },\n \"order_month\": {\"description\": \"Month of the order\", \"values_sample\": [2]},\n \"order_day_of_month\": {\n \"description\": \"Day of the month of the order\",\n \"values_sample\": [14],\n },\n \"order_week\": {\n \"description\": \"Week of the year of the order\",\n \"values_sample\": [7],\n },\n \"order_day_of_week\": {\n \"description\": \"Day of the week of the order\",\n \"values_sample\": [4],\n },\n \"order_hour\": {\n \"description\": \"Hour of the day of the order\",\n \"values_sample\": [16],\n },\n \"order_minute\": {\n \"description\": \"Minute of the hour of the order\",\n \"values_sample\": [0],\n },\n \"order_time\": {\"description\": \"Time of the order\", \"values_sample\": [\"16:00\"]},\n \"cancellation_status\": {\n \"description\": \"Status of order cancellation\",\n \"values_sample\": [\"false\"],\n },\n \"refund_status\": {\n \"description\": \"Status of order refund\",\n \"values_sample\": [\"false\"],\n },\n \"order_status\": {\n \"description\": \"Status of the order\",\n \"values_sample\": [\"unknown\"],\n },\n \"payment_status\": {\n \"description\": \"Status of payment for the order\",\n \"values_sample\": [\"pending\"],\n },\n \"shipping_address_city\": {\n \"description\": \"City of the shipping address\",\n \"values_sample\": [\"Surat\"],\n },\n \"shipping_address_state\": {\n \"description\": \"State of the shipping address\",\n \"values_sample\": [\"Gujarat\"],\n },\n \"shipping_address_country\": {\n \"description\": \"Country of the shipping address\",\n \"values_sample\": [\"India\"],\n },\n }\n}\n \"marketing_performance\": {\n \"marketing_id\": {\n \"description\": \"Unique identifier for each marketing activity.\",\n \"values_sample\": [\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_304143034868101_310419640566194_productAdsamazon_ads_sponsored_products_548576666024459\",\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_405826215303183_448674135385556_productAdsamazon_ads_sponsored_products_511545631860472\",\n ],\n },\n \"activity_date_time\": {\n \"description\": \"Timestamp of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_date\": {\n \"description\": \"Date of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_year\": {\n \"description\": \"Year of the marketing activity.\",\n \"values_sample\": [\"2024\"],\n },\n \"activity_quarter\": {\n \"description\": \"Quarter of the year in which the marketing activity took place.\",\n \"values_sample\": [\"2\"],\n },\n \"activity_month\": {\n \"description\": \"Month of the year in which the marketing activity took place.\",\n \"values_sample\": [\"4\"],\n },\n \"activity_day_of_month\": {\n \"description\": \"Day of the month on which the marketing activity took place.\",\n \"values_sample\": [\"1\"],\n },\n \"activity_week\": {\n \"description\": \"Week of the year in which the marketing activity took place.\",\n \"values_sample\": [\"14\"],\n },\n \"activity_day_of_week\": {\n \"description\": \"Day of the week on which the marketing activity took place (1 for Monday, 7 for Sunday).\",\n \"values_sample\": [\"2\"],\n },\n \"activity_hour\": {\n \"description\": \"Hour of the day in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_minute\": {\n \"description\": \"Minute of the hour in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_time\": {\n \"description\": \"Formatted string representation of the marketing activity time.\",\n \"values_sample\": [\"00:00\"],\n },\n \"channel\": {\n \"description\": \"Marketing channel used for the activity (e.g., Google Ads, Facebook Ads, Email Marketing).\",\n \"values_sample\": [\"sponsored product\"],\n },\n \"vendor\": {\n \"description\": \"Vendor or platform responsible for the marketing activity (e.g., Google, Facebook, Mailchimp).\",\n \"values_sample\": [\"amazon\"],\n },\n \"ad_account_id\": {\n \"description\": \"Unique identifier for the ad account associated with the activity.\",\n \"values_sample\": [\"A5IVEQE4ZPVNJ\"],\n },\n \"ad_account_name\": {\n \"description\": \"Name of the ad account associated with the activity.\",\n \"values_sample\": [\"Famyo\"],\n },\n \"property_name\": {\n \"description\": \"Name of the property or website where the marketing activity was run.\",\n \"values_sample\": [\"amazon sponsored product\"],\n },\n \"network_type\": {\n \"description\": \"Type of advertising network used (e.g., Search, Display, Video).\",\n \"values_sample\": [\"amazon\"],\n },\n \"campaign_id\": {\n \"description\": \"Unique identifier for the marketing campaign.\",\n \"values_sample\": [\n \"304143034868101\",\n \"405826215303183\",\n ],\n },\n \"campaign_name\": {\n \"description\": \"Name of the marketing campaign.\",\n \"values_sample\": [\n \"Football Campaign with presets - B0CT662KJL - 15\/2\/2024 23:09:44\",\n \"Hvs_Tar_SP_Blankets_Genric_Mix\",\n ],\n },\n \"campaign_status\": {\n \"description\": \"Current status of the marketing campaign (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"PAUSED\", \"ENABLED\"],\n },\n \"adset_id\": {\n \"description\": \"Unique identifier for the ad set within the campaign.\",\n \"values_sample\": [\n \"310419640566194\",\n \"448674135385556\",\n ],\n },\n \"adset_name\": {\n \"description\": \"Name of the ad set within the campaign.\",\n \"values_sample\": [\n \"Ad group - 15\/2\/2024 23:09:44\",\n \"Glow Blankets C1\",\n ],\n },\n \"adset_status\": {\n \"description\": \"Current status of the ad set (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"ad_id\": {\n \"description\": \"Unique identifier for the individual ad within the ad set.\",\n \"values_sample\": [\n \"548576666024459\",\n \"511545631860472\",\n ],\n },\n \"ad_name\": {\n \"description\": \"Name of the individual ad.\",\n \"values_sample\": [\"B0CT662KJL\", \"B0CT6428LV\"],\n },\n \"ad_description\": {\n \"description\": \"Description of the individual ad.\",\n \"values_sample\": [\n \"FM_GIDB_Football\",\n \"FM_GIDB_Astronaut\",\n ],\n },\n \"ad_status\": {\n \"description\": \"Current status of the individual ad (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"total_spend\": {\n \"description\": \"Total amount spent on the marketing activity.\",\n \"values_sample\": [\"29.15\", \"110.15\"],\n },\n \"total_clicks\": {\n \"description\": \"Total number of clicks generated by the marketing activity.\",\n \"values_sample\": [\"3\", \"7\"],\n },\n \"total_views\": {\n \"description\": \"Total number of times the marketing activity was viewed.\",\n \"values_sample\": [\"306\", \"1404\"],\n },\n \"total_impressions\": {\n \"description\": \"Total number of times the marketing activity was displayed.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_orders\": {\n \"description\": \"Number of orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_revenue\": {\n \"description\": \"Revenue generated from orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"keyword\": {\n \"description\": \"Keyword used in the marketing activity (if applicable).\",\n \"values_sample\": [None],\n },\n \"_synced_at\": {\n \"description\": \"Timestamp indicating when the data was last synced.\",\n \"values_sample\": [\"2024-07-16T21:32:08.452+00:00\"],\n },\n },\n}, I am giving you complete DB and table info in details, user context is bit lengthy so go line by line then answer properly","role":"system"},{"content":"What is the MoM (month-over-month) growth rate of sales for the last 12 months?","role":"user"},{"content":"WITH monthly_sales AS (SELECT CONCAT(order_year, '-', LPAD(order_month, 2, '0')) AS order_month, SUM(COALESCE(net_sales_before_tax, 0)) AS net_sales FROM order_values WHERE TO_DATE(CONCAT(order_year, '-', LPAD(order_month, 2, '0')), 'yyyy-MM') >= DATE_TRUNC('month', ADD_MONTHS(CURRENT_DATE, -12)) AND TO_DATE(CONCAT(order_year, '-', LPAD(order_month, 2, '0')), 'yyyy-MM') < DATE_TRUNC('month', CURRENT_DATE) GROUP BY order_year, order_month ORDER BY order_year, order_month), sales_growth AS (SELECT order_month, net_sales, LAG(net_sales) OVER (ORDER BY order_month) AS previous_month_sales FROM monthly_sales) SELECT order_month, ROUND((net_sales - previous_month_sales) \/ NULLIF(previous_month_sales, 0) * 100, 2) AS mom_growth_rate FROM sales_growth;","role":"assistant"}]} +{"question":"Compare the return rates for each product category in the last year.","answer":"SELECT product_category, ROUND(SUM(CASE WHEN total_returns_before_tax > 0 THEN 1 ELSE 0 END) \/ COUNT(*) * 100.0) AS return_rate FROM order_values WHERE order_year = YEAR(DATE_SUB(CURRENT_DATE, 365)) GROUP BY product_category;","llama-3-sqlcoder-8b":"SELECT tv.product_category, SUM(tv.total_returns_before_tax) \/ NULLIF(SUM(tv.total_sales_after_tax), 0) AS return_rate FROM order_values tv WHERE tv.order_date > CURRENT_DATE - INTERVAL '1 year' GROUP BY tv.product_category ORDER BY return_rate DESC NULLS LAST;","llama-3.1-8b":"SELECT product_category, SUM(CASE WHEN total_returns_before_tax > 0 THEN 1 ELSE 0 END) AS return_count, SUM(CASE WHEN total_returns_before_tax = 0 THEN 1 ELSE 0 END) AS no_return_count FROM order_values WHERE order_year = 2024 GROUP BY product_category","context":"TABLE_DESCRIPTIONS = {\n \"order_values\": \"This table contains order information aggregated across multiple sources for an e-commerce brand. The table is unique at an Order ID - SKU ID level. The table includes, but is not limited to, all pricing information (like gross sales, tax, net sales, shipping charge, duties, etc.), information related to the product (like SKU, product id\/title, price, etc.), order related information (timestamp of order), payment information and shipping information.\",\n \"marketing_performance\": \"This table contains detailed marketing performance data for an e-commerce brand, capturing data from various marketing activities and platforms. It provides a comprehensive overview of campaign performance, including spend, clicks, views, impressions, and attributed revenue.\",\n}\n\nCOLUMNS = {\n \"order_values\": {\n \"order_line_item_id\": {\n \"description\": \"Unique identifier for each line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"source\": {\"description\": \"Source of the order\", \"values_sample\": [\"shopify\"]},\n \"order_id\": {\n \"description\": \"Unique identifier for each order\",\n \"values_sample\": [\"shopify_5667598663969\"],\n },\n \"ordered_quantity\": {\n \"description\": \"Quantity of each item of a line item\",\n \"values_sample\": [1],\n },\n \"tax_percent\": {\n \"description\": \"Tax percentage applied to the order\",\n \"values_sample\": [0.17999949556658],\n },\n \"total_price_tax\": {\n \"description\": \"Total price including tax\",\n \"values_sample\": [152.389468594368],\n },\n \"gross_sales_price_before_tax\": {\n \"description\": \"Gross sales price before applying tax\",\n \"values_sample\": [846.610531405632],\n },\n \"total_discount_after_tax\": {\n \"description\": \"Total discount after applying tax\",\n \"values_sample\": [0],\n },\n \"total_discount_tax\": {\n \"description\": \"Total discount amount subject to tax\",\n \"values_sample\": [0],\n },\n \"total_discount_before_tax\": {\n \"description\": \"Total discount before applying tax\",\n \"values_sample\": [0],\n },\n \"total_returns_before_tax\": {\n \"description\": \"Total return\/refund amount before tax\",\n \"values_sample\": [846.610531405632],\n },\n \"net_sales_before_tax\": {\n \"description\": \"Net sales amount before applying tax\",\n \"values_sample\": [0],\n },\n \"item_shipping_charge\": {\n \"description\": \"Shipping charge for an item\",\n \"values_sample\": [0],\n },\n \"item_duties\": {\n \"description\": \"Duties charged for an item\",\n \"values_sample\": [0],\n },\n \"item_additional_feels\": {\n \"description\": \"Additional fees charged for an item\",\n \"values_sample\": [0],\n },\n \"total_tax\": {\"description\": \"Total tax amount\", \"values_sample\": [0]},\n \"total_sales_after_tax\": {\n \"description\": \"Total sales amount after applying tax\",\n \"values_sample\": [0],\n },\n \"sku_id\": {\n \"description\": \"Unique identifier for each stock keeping unit (SKU)\",\n \"values_sample\": [\"shopify_8848983261473_47478863036705\"],\n },\n \"sku_code\": {\n \"description\": \"Code assigned to each stock keeping unit (SKU)\",\n \"values_sample\": [\"BSL-D-SIP-0001\"],\n },\n \"product_category\": {\n \"description\": \"Category of the product\",\n \"values_sample\": [\"Insulated Sipper\"],\n },\n \"product_id\": {\n \"description\": \"Unique identifier for each product\",\n \"values_sample\": [\"shopify_8848983261473\"],\n },\n \"product_title\": {\n \"description\": \"Title of the product\",\n \"values_sample\": [\"Kids Sipper (430 ml)\"],\n },\n \"product_price\": {\n \"description\": \"Price of the product\",\n \"values_sample\": [999],\n },\n \"customer_id\": {\n \"description\": \"Unique identifier for each customer\",\n \"values_sample\": [\"shopify_7694075199777\"],\n },\n \"first_ordered_at\": {\n \"description\": \"Timestamp of the first order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_refund_line_item_id\": {\n \"description\": \"Unique identifier for each refunded line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"order_date_time\": {\n \"description\": \"Date and time of the order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_date\": {\n \"description\": \"Date of the order\",\n \"values_sample\": [\"2024-02-14\"],\n },\n \"order_year\": {\"description\": \"Year of the order\", \"values_sample\": [2024]},\n \"order_quarter\": {\n \"description\": \"Quarter of the year of the order\",\n \"values_sample\": [1],\n },\n \"order_month\": {\"description\": \"Month of the order\", \"values_sample\": [2]},\n \"order_day_of_month\": {\n \"description\": \"Day of the month of the order\",\n \"values_sample\": [14],\n },\n \"order_week\": {\n \"description\": \"Week of the year of the order\",\n \"values_sample\": [7],\n },\n \"order_day_of_week\": {\n \"description\": \"Day of the week of the order\",\n \"values_sample\": [4],\n },\n \"order_hour\": {\n \"description\": \"Hour of the day of the order\",\n \"values_sample\": [16],\n },\n \"order_minute\": {\n \"description\": \"Minute of the hour of the order\",\n \"values_sample\": [0],\n },\n \"order_time\": {\"description\": \"Time of the order\", \"values_sample\": [\"16:00\"]},\n \"cancellation_status\": {\n \"description\": \"Status of order cancellation\",\n \"values_sample\": [\"false\"],\n },\n \"refund_status\": {\n \"description\": \"Status of order refund\",\n \"values_sample\": [\"false\"],\n },\n \"order_status\": {\n \"description\": \"Status of the order\",\n \"values_sample\": [\"unknown\"],\n },\n \"payment_status\": {\n \"description\": \"Status of payment for the order\",\n \"values_sample\": [\"pending\"],\n },\n \"shipping_address_city\": {\n \"description\": \"City of the shipping address\",\n \"values_sample\": [\"Surat\"],\n },\n \"shipping_address_state\": {\n \"description\": \"State of the shipping address\",\n \"values_sample\": [\"Gujarat\"],\n },\n \"shipping_address_country\": {\n \"description\": \"Country of the shipping address\",\n \"values_sample\": [\"India\"],\n },\n }\n}\n \"marketing_performance\": {\n \"marketing_id\": {\n \"description\": \"Unique identifier for each marketing activity.\",\n \"values_sample\": [\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_304143034868101_310419640566194_productAdsamazon_ads_sponsored_products_548576666024459\",\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_405826215303183_448674135385556_productAdsamazon_ads_sponsored_products_511545631860472\",\n ],\n },\n \"activity_date_time\": {\n \"description\": \"Timestamp of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_date\": {\n \"description\": \"Date of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_year\": {\n \"description\": \"Year of the marketing activity.\",\n \"values_sample\": [\"2024\"],\n },\n \"activity_quarter\": {\n \"description\": \"Quarter of the year in which the marketing activity took place.\",\n \"values_sample\": [\"2\"],\n },\n \"activity_month\": {\n \"description\": \"Month of the year in which the marketing activity took place.\",\n \"values_sample\": [\"4\"],\n },\n \"activity_day_of_month\": {\n \"description\": \"Day of the month on which the marketing activity took place.\",\n \"values_sample\": [\"1\"],\n },\n \"activity_week\": {\n \"description\": \"Week of the year in which the marketing activity took place.\",\n \"values_sample\": [\"14\"],\n },\n \"activity_day_of_week\": {\n \"description\": \"Day of the week on which the marketing activity took place (1 for Monday, 7 for Sunday).\",\n \"values_sample\": [\"2\"],\n },\n \"activity_hour\": {\n \"description\": \"Hour of the day in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_minute\": {\n \"description\": \"Minute of the hour in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_time\": {\n \"description\": \"Formatted string representation of the marketing activity time.\",\n \"values_sample\": [\"00:00\"],\n },\n \"channel\": {\n \"description\": \"Marketing channel used for the activity (e.g., Google Ads, Facebook Ads, Email Marketing).\",\n \"values_sample\": [\"sponsored product\"],\n },\n \"vendor\": {\n \"description\": \"Vendor or platform responsible for the marketing activity (e.g., Google, Facebook, Mailchimp).\",\n \"values_sample\": [\"amazon\"],\n },\n \"ad_account_id\": {\n \"description\": \"Unique identifier for the ad account associated with the activity.\",\n \"values_sample\": [\"A5IVEQE4ZPVNJ\"],\n },\n \"ad_account_name\": {\n \"description\": \"Name of the ad account associated with the activity.\",\n \"values_sample\": [\"Famyo\"],\n },\n \"property_name\": {\n \"description\": \"Name of the property or website where the marketing activity was run.\",\n \"values_sample\": [\"amazon sponsored product\"],\n },\n \"network_type\": {\n \"description\": \"Type of advertising network used (e.g., Search, Display, Video).\",\n \"values_sample\": [\"amazon\"],\n },\n \"campaign_id\": {\n \"description\": \"Unique identifier for the marketing campaign.\",\n \"values_sample\": [\n \"304143034868101\",\n \"405826215303183\",\n ],\n },\n \"campaign_name\": {\n \"description\": \"Name of the marketing campaign.\",\n \"values_sample\": [\n \"Football Campaign with presets - B0CT662KJL - 15\/2\/2024 23:09:44\",\n \"Hvs_Tar_SP_Blankets_Genric_Mix\",\n ],\n },\n \"campaign_status\": {\n \"description\": \"Current status of the marketing campaign (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"PAUSED\", \"ENABLED\"],\n },\n \"adset_id\": {\n \"description\": \"Unique identifier for the ad set within the campaign.\",\n \"values_sample\": [\n \"310419640566194\",\n \"448674135385556\",\n ],\n },\n \"adset_name\": {\n \"description\": \"Name of the ad set within the campaign.\",\n \"values_sample\": [\n \"Ad group - 15\/2\/2024 23:09:44\",\n \"Glow Blankets C1\",\n ],\n },\n \"adset_status\": {\n \"description\": \"Current status of the ad set (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"ad_id\": {\n \"description\": \"Unique identifier for the individual ad within the ad set.\",\n \"values_sample\": [\n \"548576666024459\",\n \"511545631860472\",\n ],\n },\n \"ad_name\": {\n \"description\": \"Name of the individual ad.\",\n \"values_sample\": [\"B0CT662KJL\", \"B0CT6428LV\"],\n },\n \"ad_description\": {\n \"description\": \"Description of the individual ad.\",\n \"values_sample\": [\n \"FM_GIDB_Football\",\n \"FM_GIDB_Astronaut\",\n ],\n },\n \"ad_status\": {\n \"description\": \"Current status of the individual ad (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"total_spend\": {\n \"description\": \"Total amount spent on the marketing activity.\",\n \"values_sample\": [\"29.15\", \"110.15\"],\n },\n \"total_clicks\": {\n \"description\": \"Total number of clicks generated by the marketing activity.\",\n \"values_sample\": [\"3\", \"7\"],\n },\n \"total_views\": {\n \"description\": \"Total number of times the marketing activity was viewed.\",\n \"values_sample\": [\"306\", \"1404\"],\n },\n \"total_impressions\": {\n \"description\": \"Total number of times the marketing activity was displayed.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_orders\": {\n \"description\": \"Number of orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_revenue\": {\n \"description\": \"Revenue generated from orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"keyword\": {\n \"description\": \"Keyword used in the marketing activity (if applicable).\",\n \"values_sample\": [None],\n },\n \"_synced_at\": {\n \"description\": \"Timestamp indicating when the data was last synced.\",\n \"values_sample\": [\"2024-07-16T21:32:08.452+00:00\"],\n },\n },\n}","messages":[{"content":"You are an advanced AI trained to generate SQL queries based\n on a given context. Your task is to write an SQL query that accurately \n retrieves the requested data from the provided table schema. Do not answer with any explanations -- just the SQL query.\n Output only plain text. Do not output markdown. \n Please ensure that the SQL query matches the exact table name and column names\n specified in the TABLE_DESCRIPTIONS = {\n \"order_values\": \"This table contains order information aggregated across multiple sources for an e-commerce brand. The table is unique at an Order ID - SKU ID level. The table includes, but is not limited to, all pricing information (like gross sales, tax, net sales, shipping charge, duties, etc.), information related to the product (like SKU, product id\/title, price, etc.), order related information (timestamp of order), payment information and shipping information.\",\n \"marketing_performance\": \"This table contains detailed marketing performance data for an e-commerce brand, capturing data from various marketing activities and platforms. It provides a comprehensive overview of campaign performance, including spend, clicks, views, impressions, and attributed revenue.\",\n}\n\nCOLUMNS = {\n \"order_values\": {\n \"order_line_item_id\": {\n \"description\": \"Unique identifier for each line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"source\": {\"description\": \"Source of the order\", \"values_sample\": [\"shopify\"]},\n \"order_id\": {\n \"description\": \"Unique identifier for each order\",\n \"values_sample\": [\"shopify_5667598663969\"],\n },\n \"ordered_quantity\": {\n \"description\": \"Quantity of each item of a line item\",\n \"values_sample\": [1],\n },\n \"tax_percent\": {\n \"description\": \"Tax percentage applied to the order\",\n \"values_sample\": [0.17999949556658],\n },\n \"total_price_tax\": {\n \"description\": \"Total price including tax\",\n \"values_sample\": [152.389468594368],\n },\n \"gross_sales_price_before_tax\": {\n \"description\": \"Gross sales price before applying tax\",\n \"values_sample\": [846.610531405632],\n },\n \"total_discount_after_tax\": {\n \"description\": \"Total discount after applying tax\",\n \"values_sample\": [0],\n },\n \"total_discount_tax\": {\n \"description\": \"Total discount amount subject to tax\",\n \"values_sample\": [0],\n },\n \"total_discount_before_tax\": {\n \"description\": \"Total discount before applying tax\",\n \"values_sample\": [0],\n },\n \"total_returns_before_tax\": {\n \"description\": \"Total return\/refund amount before tax\",\n \"values_sample\": [846.610531405632],\n },\n \"net_sales_before_tax\": {\n \"description\": \"Net sales amount before applying tax\",\n \"values_sample\": [0],\n },\n \"item_shipping_charge\": {\n \"description\": \"Shipping charge for an item\",\n \"values_sample\": [0],\n },\n \"item_duties\": {\n \"description\": \"Duties charged for an item\",\n \"values_sample\": [0],\n },\n \"item_additional_feels\": {\n \"description\": \"Additional fees charged for an item\",\n \"values_sample\": [0],\n },\n \"total_tax\": {\"description\": \"Total tax amount\", \"values_sample\": [0]},\n \"total_sales_after_tax\": {\n \"description\": \"Total sales amount after applying tax\",\n \"values_sample\": [0],\n },\n \"sku_id\": {\n \"description\": \"Unique identifier for each stock keeping unit (SKU)\",\n \"values_sample\": [\"shopify_8848983261473_47478863036705\"],\n },\n \"sku_code\": {\n \"description\": \"Code assigned to each stock keeping unit (SKU)\",\n \"values_sample\": [\"BSL-D-SIP-0001\"],\n },\n \"product_category\": {\n \"description\": \"Category of the product\",\n \"values_sample\": [\"Insulated Sipper\"],\n },\n \"product_id\": {\n \"description\": \"Unique identifier for each product\",\n \"values_sample\": [\"shopify_8848983261473\"],\n },\n \"product_title\": {\n \"description\": \"Title of the product\",\n \"values_sample\": [\"Kids Sipper (430 ml)\"],\n },\n \"product_price\": {\n \"description\": \"Price of the product\",\n \"values_sample\": [999],\n },\n \"customer_id\": {\n \"description\": \"Unique identifier for each customer\",\n \"values_sample\": [\"shopify_7694075199777\"],\n },\n \"first_ordered_at\": {\n \"description\": \"Timestamp of the first order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_refund_line_item_id\": {\n \"description\": \"Unique identifier for each refunded line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"order_date_time\": {\n \"description\": \"Date and time of the order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_date\": {\n \"description\": \"Date of the order\",\n \"values_sample\": [\"2024-02-14\"],\n },\n \"order_year\": {\"description\": \"Year of the order\", \"values_sample\": [2024]},\n \"order_quarter\": {\n \"description\": \"Quarter of the year of the order\",\n \"values_sample\": [1],\n },\n \"order_month\": {\"description\": \"Month of the order\", \"values_sample\": [2]},\n \"order_day_of_month\": {\n \"description\": \"Day of the month of the order\",\n \"values_sample\": [14],\n },\n \"order_week\": {\n \"description\": \"Week of the year of the order\",\n \"values_sample\": [7],\n },\n \"order_day_of_week\": {\n \"description\": \"Day of the week of the order\",\n \"values_sample\": [4],\n },\n \"order_hour\": {\n \"description\": \"Hour of the day of the order\",\n \"values_sample\": [16],\n },\n \"order_minute\": {\n \"description\": \"Minute of the hour of the order\",\n \"values_sample\": [0],\n },\n \"order_time\": {\"description\": \"Time of the order\", \"values_sample\": [\"16:00\"]},\n \"cancellation_status\": {\n \"description\": \"Status of order cancellation\",\n \"values_sample\": [\"false\"],\n },\n \"refund_status\": {\n \"description\": \"Status of order refund\",\n \"values_sample\": [\"false\"],\n },\n \"order_status\": {\n \"description\": \"Status of the order\",\n \"values_sample\": [\"unknown\"],\n },\n \"payment_status\": {\n \"description\": \"Status of payment for the order\",\n \"values_sample\": [\"pending\"],\n },\n \"shipping_address_city\": {\n \"description\": \"City of the shipping address\",\n \"values_sample\": [\"Surat\"],\n },\n \"shipping_address_state\": {\n \"description\": \"State of the shipping address\",\n \"values_sample\": [\"Gujarat\"],\n },\n \"shipping_address_country\": {\n \"description\": \"Country of the shipping address\",\n \"values_sample\": [\"India\"],\n },\n }\n}\n \"marketing_performance\": {\n \"marketing_id\": {\n \"description\": \"Unique identifier for each marketing activity.\",\n \"values_sample\": [\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_304143034868101_310419640566194_productAdsamazon_ads_sponsored_products_548576666024459\",\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_405826215303183_448674135385556_productAdsamazon_ads_sponsored_products_511545631860472\",\n ],\n },\n \"activity_date_time\": {\n \"description\": \"Timestamp of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_date\": {\n \"description\": \"Date of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_year\": {\n \"description\": \"Year of the marketing activity.\",\n \"values_sample\": [\"2024\"],\n },\n \"activity_quarter\": {\n \"description\": \"Quarter of the year in which the marketing activity took place.\",\n \"values_sample\": [\"2\"],\n },\n \"activity_month\": {\n \"description\": \"Month of the year in which the marketing activity took place.\",\n \"values_sample\": [\"4\"],\n },\n \"activity_day_of_month\": {\n \"description\": \"Day of the month on which the marketing activity took place.\",\n \"values_sample\": [\"1\"],\n },\n \"activity_week\": {\n \"description\": \"Week of the year in which the marketing activity took place.\",\n \"values_sample\": [\"14\"],\n },\n \"activity_day_of_week\": {\n \"description\": \"Day of the week on which the marketing activity took place (1 for Monday, 7 for Sunday).\",\n \"values_sample\": [\"2\"],\n },\n \"activity_hour\": {\n \"description\": \"Hour of the day in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_minute\": {\n \"description\": \"Minute of the hour in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_time\": {\n \"description\": \"Formatted string representation of the marketing activity time.\",\n \"values_sample\": [\"00:00\"],\n },\n \"channel\": {\n \"description\": \"Marketing channel used for the activity (e.g., Google Ads, Facebook Ads, Email Marketing).\",\n \"values_sample\": [\"sponsored product\"],\n },\n \"vendor\": {\n \"description\": \"Vendor or platform responsible for the marketing activity (e.g., Google, Facebook, Mailchimp).\",\n \"values_sample\": [\"amazon\"],\n },\n \"ad_account_id\": {\n \"description\": \"Unique identifier for the ad account associated with the activity.\",\n \"values_sample\": [\"A5IVEQE4ZPVNJ\"],\n },\n \"ad_account_name\": {\n \"description\": \"Name of the ad account associated with the activity.\",\n \"values_sample\": [\"Famyo\"],\n },\n \"property_name\": {\n \"description\": \"Name of the property or website where the marketing activity was run.\",\n \"values_sample\": [\"amazon sponsored product\"],\n },\n \"network_type\": {\n \"description\": \"Type of advertising network used (e.g., Search, Display, Video).\",\n \"values_sample\": [\"amazon\"],\n },\n \"campaign_id\": {\n \"description\": \"Unique identifier for the marketing campaign.\",\n \"values_sample\": [\n \"304143034868101\",\n \"405826215303183\",\n ],\n },\n \"campaign_name\": {\n \"description\": \"Name of the marketing campaign.\",\n \"values_sample\": [\n \"Football Campaign with presets - B0CT662KJL - 15\/2\/2024 23:09:44\",\n \"Hvs_Tar_SP_Blankets_Genric_Mix\",\n ],\n },\n \"campaign_status\": {\n \"description\": \"Current status of the marketing campaign (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"PAUSED\", \"ENABLED\"],\n },\n \"adset_id\": {\n \"description\": \"Unique identifier for the ad set within the campaign.\",\n \"values_sample\": [\n \"310419640566194\",\n \"448674135385556\",\n ],\n },\n \"adset_name\": {\n \"description\": \"Name of the ad set within the campaign.\",\n \"values_sample\": [\n \"Ad group - 15\/2\/2024 23:09:44\",\n \"Glow Blankets C1\",\n ],\n },\n \"adset_status\": {\n \"description\": \"Current status of the ad set (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"ad_id\": {\n \"description\": \"Unique identifier for the individual ad within the ad set.\",\n \"values_sample\": [\n \"548576666024459\",\n \"511545631860472\",\n ],\n },\n \"ad_name\": {\n \"description\": \"Name of the individual ad.\",\n \"values_sample\": [\"B0CT662KJL\", \"B0CT6428LV\"],\n },\n \"ad_description\": {\n \"description\": \"Description of the individual ad.\",\n \"values_sample\": [\n \"FM_GIDB_Football\",\n \"FM_GIDB_Astronaut\",\n ],\n },\n \"ad_status\": {\n \"description\": \"Current status of the individual ad (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"total_spend\": {\n \"description\": \"Total amount spent on the marketing activity.\",\n \"values_sample\": [\"29.15\", \"110.15\"],\n },\n \"total_clicks\": {\n \"description\": \"Total number of clicks generated by the marketing activity.\",\n \"values_sample\": [\"3\", \"7\"],\n },\n \"total_views\": {\n \"description\": \"Total number of times the marketing activity was viewed.\",\n \"values_sample\": [\"306\", \"1404\"],\n },\n \"total_impressions\": {\n \"description\": \"Total number of times the marketing activity was displayed.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_orders\": {\n \"description\": \"Number of orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_revenue\": {\n \"description\": \"Revenue generated from orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"keyword\": {\n \"description\": \"Keyword used in the marketing activity (if applicable).\",\n \"values_sample\": [None],\n },\n \"_synced_at\": {\n \"description\": \"Timestamp indicating when the data was last synced.\",\n \"values_sample\": [\"2024-07-16T21:32:08.452+00:00\"],\n },\n },\n}, I am giving you complete DB and table info in details, user context is bit lengthy so go line by line then answer properly","role":"system"},{"content":"Compare the return rates for each product category in the last year.","role":"user"},{"content":"SELECT product_category, ROUND(SUM(CASE WHEN total_returns_before_tax > 0 THEN 1 ELSE 0 END) \/ COUNT(*) * 100.0) AS return_rate FROM order_values WHERE order_year = YEAR(DATE_SUB(CURRENT_DATE, 365)) GROUP BY product_category;","role":"assistant"}]} +{"question":"What are the top performing categories for Q1 2024?","answer":"SELECT LOWER(product_category) AS category, SUM(COALESCE(net_sales_before_tax, 0)) AS total_net_sales FROM order_values WHERE order_year = 2024 AND order_quarter = 1 GROUP BY LOWER(product_category) ORDER BY total_net_sales DESC;","llama-3-sqlcoder-8b":"SELECT o.product_category, SUM(o.total_sales_after_tax) AS total_sales FROM order_values o WHERE o.order_year = 2024 AND o.order_quarter = 1 GROUP BY o.product_category ORDER BY total_sales DESC NULLS LAST LIMIT 5;","llama-3.1-8b":"SELECT product_category FROM order_values WHERE order_year = 2024 AND order_quarter = 1 GROUP BY product_category ORDER BY SUM(total_sales_after_tax) DESC LIMIT 5","context":"TABLE_DESCRIPTIONS = {\n \"order_values\": \"This table contains order information aggregated across multiple sources for an e-commerce brand. The table is unique at an Order ID - SKU ID level. The table includes, but is not limited to, all pricing information (like gross sales, tax, net sales, shipping charge, duties, etc.), information related to the product (like SKU, product id\/title, price, etc.), order related information (timestamp of order), payment information and shipping information.\",\n \"marketing_performance\": \"This table contains detailed marketing performance data for an e-commerce brand, capturing data from various marketing activities and platforms. It provides a comprehensive overview of campaign performance, including spend, clicks, views, impressions, and attributed revenue.\",\n}\n\nCOLUMNS = {\n \"order_values\": {\n \"order_line_item_id\": {\n \"description\": \"Unique identifier for each line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"source\": {\"description\": \"Source of the order\", \"values_sample\": [\"shopify\"]},\n \"order_id\": {\n \"description\": \"Unique identifier for each order\",\n \"values_sample\": [\"shopify_5667598663969\"],\n },\n \"ordered_quantity\": {\n \"description\": \"Quantity of each item of a line item\",\n \"values_sample\": [1],\n },\n \"tax_percent\": {\n \"description\": \"Tax percentage applied to the order\",\n \"values_sample\": [0.17999949556658],\n },\n \"total_price_tax\": {\n \"description\": \"Total price including tax\",\n \"values_sample\": [152.389468594368],\n },\n \"gross_sales_price_before_tax\": {\n \"description\": \"Gross sales price before applying tax\",\n \"values_sample\": [846.610531405632],\n },\n \"total_discount_after_tax\": {\n \"description\": \"Total discount after applying tax\",\n \"values_sample\": [0],\n },\n \"total_discount_tax\": {\n \"description\": \"Total discount amount subject to tax\",\n \"values_sample\": [0],\n },\n \"total_discount_before_tax\": {\n \"description\": \"Total discount before applying tax\",\n \"values_sample\": [0],\n },\n \"total_returns_before_tax\": {\n \"description\": \"Total return\/refund amount before tax\",\n \"values_sample\": [846.610531405632],\n },\n \"net_sales_before_tax\": {\n \"description\": \"Net sales amount before applying tax\",\n \"values_sample\": [0],\n },\n \"item_shipping_charge\": {\n \"description\": \"Shipping charge for an item\",\n \"values_sample\": [0],\n },\n \"item_duties\": {\n \"description\": \"Duties charged for an item\",\n \"values_sample\": [0],\n },\n \"item_additional_feels\": {\n \"description\": \"Additional fees charged for an item\",\n \"values_sample\": [0],\n },\n \"total_tax\": {\"description\": \"Total tax amount\", \"values_sample\": [0]},\n \"total_sales_after_tax\": {\n \"description\": \"Total sales amount after applying tax\",\n \"values_sample\": [0],\n },\n \"sku_id\": {\n \"description\": \"Unique identifier for each stock keeping unit (SKU)\",\n \"values_sample\": [\"shopify_8848983261473_47478863036705\"],\n },\n \"sku_code\": {\n \"description\": \"Code assigned to each stock keeping unit (SKU)\",\n \"values_sample\": [\"BSL-D-SIP-0001\"],\n },\n \"product_category\": {\n \"description\": \"Category of the product\",\n \"values_sample\": [\"Insulated Sipper\"],\n },\n \"product_id\": {\n \"description\": \"Unique identifier for each product\",\n \"values_sample\": [\"shopify_8848983261473\"],\n },\n \"product_title\": {\n \"description\": \"Title of the product\",\n \"values_sample\": [\"Kids Sipper (430 ml)\"],\n },\n \"product_price\": {\n \"description\": \"Price of the product\",\n \"values_sample\": [999],\n },\n \"customer_id\": {\n \"description\": \"Unique identifier for each customer\",\n \"values_sample\": [\"shopify_7694075199777\"],\n },\n \"first_ordered_at\": {\n \"description\": \"Timestamp of the first order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_refund_line_item_id\": {\n \"description\": \"Unique identifier for each refunded line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"order_date_time\": {\n \"description\": \"Date and time of the order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_date\": {\n \"description\": \"Date of the order\",\n \"values_sample\": [\"2024-02-14\"],\n },\n \"order_year\": {\"description\": \"Year of the order\", \"values_sample\": [2024]},\n \"order_quarter\": {\n \"description\": \"Quarter of the year of the order\",\n \"values_sample\": [1],\n },\n \"order_month\": {\"description\": \"Month of the order\", \"values_sample\": [2]},\n \"order_day_of_month\": {\n \"description\": \"Day of the month of the order\",\n \"values_sample\": [14],\n },\n \"order_week\": {\n \"description\": \"Week of the year of the order\",\n \"values_sample\": [7],\n },\n \"order_day_of_week\": {\n \"description\": \"Day of the week of the order\",\n \"values_sample\": [4],\n },\n \"order_hour\": {\n \"description\": \"Hour of the day of the order\",\n \"values_sample\": [16],\n },\n \"order_minute\": {\n \"description\": \"Minute of the hour of the order\",\n \"values_sample\": [0],\n },\n \"order_time\": {\"description\": \"Time of the order\", \"values_sample\": [\"16:00\"]},\n \"cancellation_status\": {\n \"description\": \"Status of order cancellation\",\n \"values_sample\": [\"false\"],\n },\n \"refund_status\": {\n \"description\": \"Status of order refund\",\n \"values_sample\": [\"false\"],\n },\n \"order_status\": {\n \"description\": \"Status of the order\",\n \"values_sample\": [\"unknown\"],\n },\n \"payment_status\": {\n \"description\": \"Status of payment for the order\",\n \"values_sample\": [\"pending\"],\n },\n \"shipping_address_city\": {\n \"description\": \"City of the shipping address\",\n \"values_sample\": [\"Surat\"],\n },\n \"shipping_address_state\": {\n \"description\": \"State of the shipping address\",\n \"values_sample\": [\"Gujarat\"],\n },\n \"shipping_address_country\": {\n \"description\": \"Country of the shipping address\",\n \"values_sample\": [\"India\"],\n },\n }\n}\n \"marketing_performance\": {\n \"marketing_id\": {\n \"description\": \"Unique identifier for each marketing activity.\",\n \"values_sample\": [\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_304143034868101_310419640566194_productAdsamazon_ads_sponsored_products_548576666024459\",\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_405826215303183_448674135385556_productAdsamazon_ads_sponsored_products_511545631860472\",\n ],\n },\n \"activity_date_time\": {\n \"description\": \"Timestamp of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_date\": {\n \"description\": \"Date of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_year\": {\n \"description\": \"Year of the marketing activity.\",\n \"values_sample\": [\"2024\"],\n },\n \"activity_quarter\": {\n \"description\": \"Quarter of the year in which the marketing activity took place.\",\n \"values_sample\": [\"2\"],\n },\n \"activity_month\": {\n \"description\": \"Month of the year in which the marketing activity took place.\",\n \"values_sample\": [\"4\"],\n },\n \"activity_day_of_month\": {\n \"description\": \"Day of the month on which the marketing activity took place.\",\n \"values_sample\": [\"1\"],\n },\n \"activity_week\": {\n \"description\": \"Week of the year in which the marketing activity took place.\",\n \"values_sample\": [\"14\"],\n },\n \"activity_day_of_week\": {\n \"description\": \"Day of the week on which the marketing activity took place (1 for Monday, 7 for Sunday).\",\n \"values_sample\": [\"2\"],\n },\n \"activity_hour\": {\n \"description\": \"Hour of the day in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_minute\": {\n \"description\": \"Minute of the hour in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_time\": {\n \"description\": \"Formatted string representation of the marketing activity time.\",\n \"values_sample\": [\"00:00\"],\n },\n \"channel\": {\n \"description\": \"Marketing channel used for the activity (e.g., Google Ads, Facebook Ads, Email Marketing).\",\n \"values_sample\": [\"sponsored product\"],\n },\n \"vendor\": {\n \"description\": \"Vendor or platform responsible for the marketing activity (e.g., Google, Facebook, Mailchimp).\",\n \"values_sample\": [\"amazon\"],\n },\n \"ad_account_id\": {\n \"description\": \"Unique identifier for the ad account associated with the activity.\",\n \"values_sample\": [\"A5IVEQE4ZPVNJ\"],\n },\n \"ad_account_name\": {\n \"description\": \"Name of the ad account associated with the activity.\",\n \"values_sample\": [\"Famyo\"],\n },\n \"property_name\": {\n \"description\": \"Name of the property or website where the marketing activity was run.\",\n \"values_sample\": [\"amazon sponsored product\"],\n },\n \"network_type\": {\n \"description\": \"Type of advertising network used (e.g., Search, Display, Video).\",\n \"values_sample\": [\"amazon\"],\n },\n \"campaign_id\": {\n \"description\": \"Unique identifier for the marketing campaign.\",\n \"values_sample\": [\n \"304143034868101\",\n \"405826215303183\",\n ],\n },\n \"campaign_name\": {\n \"description\": \"Name of the marketing campaign.\",\n \"values_sample\": [\n \"Football Campaign with presets - B0CT662KJL - 15\/2\/2024 23:09:44\",\n \"Hvs_Tar_SP_Blankets_Genric_Mix\",\n ],\n },\n \"campaign_status\": {\n \"description\": \"Current status of the marketing campaign (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"PAUSED\", \"ENABLED\"],\n },\n \"adset_id\": {\n \"description\": \"Unique identifier for the ad set within the campaign.\",\n \"values_sample\": [\n \"310419640566194\",\n \"448674135385556\",\n ],\n },\n \"adset_name\": {\n \"description\": \"Name of the ad set within the campaign.\",\n \"values_sample\": [\n \"Ad group - 15\/2\/2024 23:09:44\",\n \"Glow Blankets C1\",\n ],\n },\n \"adset_status\": {\n \"description\": \"Current status of the ad set (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"ad_id\": {\n \"description\": \"Unique identifier for the individual ad within the ad set.\",\n \"values_sample\": [\n \"548576666024459\",\n \"511545631860472\",\n ],\n },\n \"ad_name\": {\n \"description\": \"Name of the individual ad.\",\n \"values_sample\": [\"B0CT662KJL\", \"B0CT6428LV\"],\n },\n \"ad_description\": {\n \"description\": \"Description of the individual ad.\",\n \"values_sample\": [\n \"FM_GIDB_Football\",\n \"FM_GIDB_Astronaut\",\n ],\n },\n \"ad_status\": {\n \"description\": \"Current status of the individual ad (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"total_spend\": {\n \"description\": \"Total amount spent on the marketing activity.\",\n \"values_sample\": [\"29.15\", \"110.15\"],\n },\n \"total_clicks\": {\n \"description\": \"Total number of clicks generated by the marketing activity.\",\n \"values_sample\": [\"3\", \"7\"],\n },\n \"total_views\": {\n \"description\": \"Total number of times the marketing activity was viewed.\",\n \"values_sample\": [\"306\", \"1404\"],\n },\n \"total_impressions\": {\n \"description\": \"Total number of times the marketing activity was displayed.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_orders\": {\n \"description\": \"Number of orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_revenue\": {\n \"description\": \"Revenue generated from orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"keyword\": {\n \"description\": \"Keyword used in the marketing activity (if applicable).\",\n \"values_sample\": [None],\n },\n \"_synced_at\": {\n \"description\": \"Timestamp indicating when the data was last synced.\",\n \"values_sample\": [\"2024-07-16T21:32:08.452+00:00\"],\n },\n },\n}","messages":[{"content":"You are an advanced AI trained to generate SQL queries based\n on a given context. Your task is to write an SQL query that accurately \n retrieves the requested data from the provided table schema. Do not answer with any explanations -- just the SQL query.\n Output only plain text. Do not output markdown. \n Please ensure that the SQL query matches the exact table name and column names\n specified in the TABLE_DESCRIPTIONS = {\n \"order_values\": \"This table contains order information aggregated across multiple sources for an e-commerce brand. The table is unique at an Order ID - SKU ID level. The table includes, but is not limited to, all pricing information (like gross sales, tax, net sales, shipping charge, duties, etc.), information related to the product (like SKU, product id\/title, price, etc.), order related information (timestamp of order), payment information and shipping information.\",\n \"marketing_performance\": \"This table contains detailed marketing performance data for an e-commerce brand, capturing data from various marketing activities and platforms. It provides a comprehensive overview of campaign performance, including spend, clicks, views, impressions, and attributed revenue.\",\n}\n\nCOLUMNS = {\n \"order_values\": {\n \"order_line_item_id\": {\n \"description\": \"Unique identifier for each line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"source\": {\"description\": \"Source of the order\", \"values_sample\": [\"shopify\"]},\n \"order_id\": {\n \"description\": \"Unique identifier for each order\",\n \"values_sample\": [\"shopify_5667598663969\"],\n },\n \"ordered_quantity\": {\n \"description\": \"Quantity of each item of a line item\",\n \"values_sample\": [1],\n },\n \"tax_percent\": {\n \"description\": \"Tax percentage applied to the order\",\n \"values_sample\": [0.17999949556658],\n },\n \"total_price_tax\": {\n \"description\": \"Total price including tax\",\n \"values_sample\": [152.389468594368],\n },\n \"gross_sales_price_before_tax\": {\n \"description\": \"Gross sales price before applying tax\",\n \"values_sample\": [846.610531405632],\n },\n \"total_discount_after_tax\": {\n \"description\": \"Total discount after applying tax\",\n \"values_sample\": [0],\n },\n \"total_discount_tax\": {\n \"description\": \"Total discount amount subject to tax\",\n \"values_sample\": [0],\n },\n \"total_discount_before_tax\": {\n \"description\": \"Total discount before applying tax\",\n \"values_sample\": [0],\n },\n \"total_returns_before_tax\": {\n \"description\": \"Total return\/refund amount before tax\",\n \"values_sample\": [846.610531405632],\n },\n \"net_sales_before_tax\": {\n \"description\": \"Net sales amount before applying tax\",\n \"values_sample\": [0],\n },\n \"item_shipping_charge\": {\n \"description\": \"Shipping charge for an item\",\n \"values_sample\": [0],\n },\n \"item_duties\": {\n \"description\": \"Duties charged for an item\",\n \"values_sample\": [0],\n },\n \"item_additional_feels\": {\n \"description\": \"Additional fees charged for an item\",\n \"values_sample\": [0],\n },\n \"total_tax\": {\"description\": \"Total tax amount\", \"values_sample\": [0]},\n \"total_sales_after_tax\": {\n \"description\": \"Total sales amount after applying tax\",\n \"values_sample\": [0],\n },\n \"sku_id\": {\n \"description\": \"Unique identifier for each stock keeping unit (SKU)\",\n \"values_sample\": [\"shopify_8848983261473_47478863036705\"],\n },\n \"sku_code\": {\n \"description\": \"Code assigned to each stock keeping unit (SKU)\",\n \"values_sample\": [\"BSL-D-SIP-0001\"],\n },\n \"product_category\": {\n \"description\": \"Category of the product\",\n \"values_sample\": [\"Insulated Sipper\"],\n },\n \"product_id\": {\n \"description\": \"Unique identifier for each product\",\n \"values_sample\": [\"shopify_8848983261473\"],\n },\n \"product_title\": {\n \"description\": \"Title of the product\",\n \"values_sample\": [\"Kids Sipper (430 ml)\"],\n },\n \"product_price\": {\n \"description\": \"Price of the product\",\n \"values_sample\": [999],\n },\n \"customer_id\": {\n \"description\": \"Unique identifier for each customer\",\n \"values_sample\": [\"shopify_7694075199777\"],\n },\n \"first_ordered_at\": {\n \"description\": \"Timestamp of the first order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_refund_line_item_id\": {\n \"description\": \"Unique identifier for each refunded line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"order_date_time\": {\n \"description\": \"Date and time of the order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_date\": {\n \"description\": \"Date of the order\",\n \"values_sample\": [\"2024-02-14\"],\n },\n \"order_year\": {\"description\": \"Year of the order\", \"values_sample\": [2024]},\n \"order_quarter\": {\n \"description\": \"Quarter of the year of the order\",\n \"values_sample\": [1],\n },\n \"order_month\": {\"description\": \"Month of the order\", \"values_sample\": [2]},\n \"order_day_of_month\": {\n \"description\": \"Day of the month of the order\",\n \"values_sample\": [14],\n },\n \"order_week\": {\n \"description\": \"Week of the year of the order\",\n \"values_sample\": [7],\n },\n \"order_day_of_week\": {\n \"description\": \"Day of the week of the order\",\n \"values_sample\": [4],\n },\n \"order_hour\": {\n \"description\": \"Hour of the day of the order\",\n \"values_sample\": [16],\n },\n \"order_minute\": {\n \"description\": \"Minute of the hour of the order\",\n \"values_sample\": [0],\n },\n \"order_time\": {\"description\": \"Time of the order\", \"values_sample\": [\"16:00\"]},\n \"cancellation_status\": {\n \"description\": \"Status of order cancellation\",\n \"values_sample\": [\"false\"],\n },\n \"refund_status\": {\n \"description\": \"Status of order refund\",\n \"values_sample\": [\"false\"],\n },\n \"order_status\": {\n \"description\": \"Status of the order\",\n \"values_sample\": [\"unknown\"],\n },\n \"payment_status\": {\n \"description\": \"Status of payment for the order\",\n \"values_sample\": [\"pending\"],\n },\n \"shipping_address_city\": {\n \"description\": \"City of the shipping address\",\n \"values_sample\": [\"Surat\"],\n },\n \"shipping_address_state\": {\n \"description\": \"State of the shipping address\",\n \"values_sample\": [\"Gujarat\"],\n },\n \"shipping_address_country\": {\n \"description\": \"Country of the shipping address\",\n \"values_sample\": [\"India\"],\n },\n }\n}\n \"marketing_performance\": {\n \"marketing_id\": {\n \"description\": \"Unique identifier for each marketing activity.\",\n \"values_sample\": [\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_304143034868101_310419640566194_productAdsamazon_ads_sponsored_products_548576666024459\",\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_405826215303183_448674135385556_productAdsamazon_ads_sponsored_products_511545631860472\",\n ],\n },\n \"activity_date_time\": {\n \"description\": \"Timestamp of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_date\": {\n \"description\": \"Date of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_year\": {\n \"description\": \"Year of the marketing activity.\",\n \"values_sample\": [\"2024\"],\n },\n \"activity_quarter\": {\n \"description\": \"Quarter of the year in which the marketing activity took place.\",\n \"values_sample\": [\"2\"],\n },\n \"activity_month\": {\n \"description\": \"Month of the year in which the marketing activity took place.\",\n \"values_sample\": [\"4\"],\n },\n \"activity_day_of_month\": {\n \"description\": \"Day of the month on which the marketing activity took place.\",\n \"values_sample\": [\"1\"],\n },\n \"activity_week\": {\n \"description\": \"Week of the year in which the marketing activity took place.\",\n \"values_sample\": [\"14\"],\n },\n \"activity_day_of_week\": {\n \"description\": \"Day of the week on which the marketing activity took place (1 for Monday, 7 for Sunday).\",\n \"values_sample\": [\"2\"],\n },\n \"activity_hour\": {\n \"description\": \"Hour of the day in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_minute\": {\n \"description\": \"Minute of the hour in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_time\": {\n \"description\": \"Formatted string representation of the marketing activity time.\",\n \"values_sample\": [\"00:00\"],\n },\n \"channel\": {\n \"description\": \"Marketing channel used for the activity (e.g., Google Ads, Facebook Ads, Email Marketing).\",\n \"values_sample\": [\"sponsored product\"],\n },\n \"vendor\": {\n \"description\": \"Vendor or platform responsible for the marketing activity (e.g., Google, Facebook, Mailchimp).\",\n \"values_sample\": [\"amazon\"],\n },\n \"ad_account_id\": {\n \"description\": \"Unique identifier for the ad account associated with the activity.\",\n \"values_sample\": [\"A5IVEQE4ZPVNJ\"],\n },\n \"ad_account_name\": {\n \"description\": \"Name of the ad account associated with the activity.\",\n \"values_sample\": [\"Famyo\"],\n },\n \"property_name\": {\n \"description\": \"Name of the property or website where the marketing activity was run.\",\n \"values_sample\": [\"amazon sponsored product\"],\n },\n \"network_type\": {\n \"description\": \"Type of advertising network used (e.g., Search, Display, Video).\",\n \"values_sample\": [\"amazon\"],\n },\n \"campaign_id\": {\n \"description\": \"Unique identifier for the marketing campaign.\",\n \"values_sample\": [\n \"304143034868101\",\n \"405826215303183\",\n ],\n },\n \"campaign_name\": {\n \"description\": \"Name of the marketing campaign.\",\n \"values_sample\": [\n \"Football Campaign with presets - B0CT662KJL - 15\/2\/2024 23:09:44\",\n \"Hvs_Tar_SP_Blankets_Genric_Mix\",\n ],\n },\n \"campaign_status\": {\n \"description\": \"Current status of the marketing campaign (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"PAUSED\", \"ENABLED\"],\n },\n \"adset_id\": {\n \"description\": \"Unique identifier for the ad set within the campaign.\",\n \"values_sample\": [\n \"310419640566194\",\n \"448674135385556\",\n ],\n },\n \"adset_name\": {\n \"description\": \"Name of the ad set within the campaign.\",\n \"values_sample\": [\n \"Ad group - 15\/2\/2024 23:09:44\",\n \"Glow Blankets C1\",\n ],\n },\n \"adset_status\": {\n \"description\": \"Current status of the ad set (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"ad_id\": {\n \"description\": \"Unique identifier for the individual ad within the ad set.\",\n \"values_sample\": [\n \"548576666024459\",\n \"511545631860472\",\n ],\n },\n \"ad_name\": {\n \"description\": \"Name of the individual ad.\",\n \"values_sample\": [\"B0CT662KJL\", \"B0CT6428LV\"],\n },\n \"ad_description\": {\n \"description\": \"Description of the individual ad.\",\n \"values_sample\": [\n \"FM_GIDB_Football\",\n \"FM_GIDB_Astronaut\",\n ],\n },\n \"ad_status\": {\n \"description\": \"Current status of the individual ad (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"total_spend\": {\n \"description\": \"Total amount spent on the marketing activity.\",\n \"values_sample\": [\"29.15\", \"110.15\"],\n },\n \"total_clicks\": {\n \"description\": \"Total number of clicks generated by the marketing activity.\",\n \"values_sample\": [\"3\", \"7\"],\n },\n \"total_views\": {\n \"description\": \"Total number of times the marketing activity was viewed.\",\n \"values_sample\": [\"306\", \"1404\"],\n },\n \"total_impressions\": {\n \"description\": \"Total number of times the marketing activity was displayed.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_orders\": {\n \"description\": \"Number of orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_revenue\": {\n \"description\": \"Revenue generated from orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"keyword\": {\n \"description\": \"Keyword used in the marketing activity (if applicable).\",\n \"values_sample\": [None],\n },\n \"_synced_at\": {\n \"description\": \"Timestamp indicating when the data was last synced.\",\n \"values_sample\": [\"2024-07-16T21:32:08.452+00:00\"],\n },\n },\n}, I am giving you complete DB and table info in details, user context is bit lengthy so go line by line then answer properly","role":"system"},{"content":"What are the top performing categories for Q1 2024?","role":"user"},{"content":"SELECT LOWER(product_category) AS category, SUM(COALESCE(net_sales_before_tax, 0)) AS total_net_sales FROM order_values WHERE order_year = 2024 AND order_quarter = 1 GROUP BY LOWER(product_category) ORDER BY total_net_sales DESC;","role":"assistant"}]} +{"question":"What percentage of total revenue came from international sales in the last year?","answer":"SELECT ROUND((SUM(CASE WHEN LOWER(billing_address_country) != 'india' THEN net_sales_before_tax ELSE 0 END) \/ SUM(net_sales_before_tax)) * 100, 2) AS international_sales_percentage FROM order_values WHERE order_year = YEAR(DATE_SUB(CURRENT_DATE, DAYOFYEAR(CURRENT_DATE)))","llama-3-sqlcoder-8b":"WITH international_sales AS (SELECT SUM(total_sales_after_tax) AS total_international_sales FROM order_values WHERE shipping_address_country!= 'India'), total_revenue AS (SELECT SUM(total_sales_after_tax) AS total_revenue FROM order_values) SELECT ((international_sales.total_international_sales \/ NULLIF(total_revenue.total_revenue, 0)) * 100) AS percentage_of_international_sales FROM international_sales, total_revenue;","llama-3.1-8b":"SELECT CAST(SUM(CASE WHEN shipping_address_country = 'India' THEN total_sales_after_tax ELSE 0 END) AS DECIMAL(10,2)) * 100 \/ SUM(total_sales_after_tax) FROM order_values WHERE order_year = 2024","context":"TABLE_DESCRIPTIONS = {\n \"order_values\": \"This table contains order information aggregated across multiple sources for an e-commerce brand. The table is unique at an Order ID - SKU ID level. The table includes, but is not limited to, all pricing information (like gross sales, tax, net sales, shipping charge, duties, etc.), information related to the product (like SKU, product id\/title, price, etc.), order related information (timestamp of order), payment information and shipping information.\",\n \"marketing_performance\": \"This table contains detailed marketing performance data for an e-commerce brand, capturing data from various marketing activities and platforms. It provides a comprehensive overview of campaign performance, including spend, clicks, views, impressions, and attributed revenue.\",\n}\n\nCOLUMNS = {\n \"order_values\": {\n \"order_line_item_id\": {\n \"description\": \"Unique identifier for each line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"source\": {\"description\": \"Source of the order\", \"values_sample\": [\"shopify\"]},\n \"order_id\": {\n \"description\": \"Unique identifier for each order\",\n \"values_sample\": [\"shopify_5667598663969\"],\n },\n \"ordered_quantity\": {\n \"description\": \"Quantity of each item of a line item\",\n \"values_sample\": [1],\n },\n \"tax_percent\": {\n \"description\": \"Tax percentage applied to the order\",\n \"values_sample\": [0.17999949556658],\n },\n \"total_price_tax\": {\n \"description\": \"Total price including tax\",\n \"values_sample\": [152.389468594368],\n },\n \"gross_sales_price_before_tax\": {\n \"description\": \"Gross sales price before applying tax\",\n \"values_sample\": [846.610531405632],\n },\n \"total_discount_after_tax\": {\n \"description\": \"Total discount after applying tax\",\n \"values_sample\": [0],\n },\n \"total_discount_tax\": {\n \"description\": \"Total discount amount subject to tax\",\n \"values_sample\": [0],\n },\n \"total_discount_before_tax\": {\n \"description\": \"Total discount before applying tax\",\n \"values_sample\": [0],\n },\n \"total_returns_before_tax\": {\n \"description\": \"Total return\/refund amount before tax\",\n \"values_sample\": [846.610531405632],\n },\n \"net_sales_before_tax\": {\n \"description\": \"Net sales amount before applying tax\",\n \"values_sample\": [0],\n },\n \"item_shipping_charge\": {\n \"description\": \"Shipping charge for an item\",\n \"values_sample\": [0],\n },\n \"item_duties\": {\n \"description\": \"Duties charged for an item\",\n \"values_sample\": [0],\n },\n \"item_additional_feels\": {\n \"description\": \"Additional fees charged for an item\",\n \"values_sample\": [0],\n },\n \"total_tax\": {\"description\": \"Total tax amount\", \"values_sample\": [0]},\n \"total_sales_after_tax\": {\n \"description\": \"Total sales amount after applying tax\",\n \"values_sample\": [0],\n },\n \"sku_id\": {\n \"description\": \"Unique identifier for each stock keeping unit (SKU)\",\n \"values_sample\": [\"shopify_8848983261473_47478863036705\"],\n },\n \"sku_code\": {\n \"description\": \"Code assigned to each stock keeping unit (SKU)\",\n \"values_sample\": [\"BSL-D-SIP-0001\"],\n },\n \"product_category\": {\n \"description\": \"Category of the product\",\n \"values_sample\": [\"Insulated Sipper\"],\n },\n \"product_id\": {\n \"description\": \"Unique identifier for each product\",\n \"values_sample\": [\"shopify_8848983261473\"],\n },\n \"product_title\": {\n \"description\": \"Title of the product\",\n \"values_sample\": [\"Kids Sipper (430 ml)\"],\n },\n \"product_price\": {\n \"description\": \"Price of the product\",\n \"values_sample\": [999],\n },\n \"customer_id\": {\n \"description\": \"Unique identifier for each customer\",\n \"values_sample\": [\"shopify_7694075199777\"],\n },\n \"first_ordered_at\": {\n \"description\": \"Timestamp of the first order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_refund_line_item_id\": {\n \"description\": \"Unique identifier for each refunded line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"order_date_time\": {\n \"description\": \"Date and time of the order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_date\": {\n \"description\": \"Date of the order\",\n \"values_sample\": [\"2024-02-14\"],\n },\n \"order_year\": {\"description\": \"Year of the order\", \"values_sample\": [2024]},\n \"order_quarter\": {\n \"description\": \"Quarter of the year of the order\",\n \"values_sample\": [1],\n },\n \"order_month\": {\"description\": \"Month of the order\", \"values_sample\": [2]},\n \"order_day_of_month\": {\n \"description\": \"Day of the month of the order\",\n \"values_sample\": [14],\n },\n \"order_week\": {\n \"description\": \"Week of the year of the order\",\n \"values_sample\": [7],\n },\n \"order_day_of_week\": {\n \"description\": \"Day of the week of the order\",\n \"values_sample\": [4],\n },\n \"order_hour\": {\n \"description\": \"Hour of the day of the order\",\n \"values_sample\": [16],\n },\n \"order_minute\": {\n \"description\": \"Minute of the hour of the order\",\n \"values_sample\": [0],\n },\n \"order_time\": {\"description\": \"Time of the order\", \"values_sample\": [\"16:00\"]},\n \"cancellation_status\": {\n \"description\": \"Status of order cancellation\",\n \"values_sample\": [\"false\"],\n },\n \"refund_status\": {\n \"description\": \"Status of order refund\",\n \"values_sample\": [\"false\"],\n },\n \"order_status\": {\n \"description\": \"Status of the order\",\n \"values_sample\": [\"unknown\"],\n },\n \"payment_status\": {\n \"description\": \"Status of payment for the order\",\n \"values_sample\": [\"pending\"],\n },\n \"shipping_address_city\": {\n \"description\": \"City of the shipping address\",\n \"values_sample\": [\"Surat\"],\n },\n \"shipping_address_state\": {\n \"description\": \"State of the shipping address\",\n \"values_sample\": [\"Gujarat\"],\n },\n \"shipping_address_country\": {\n \"description\": \"Country of the shipping address\",\n \"values_sample\": [\"India\"],\n },\n }\n}\n \"marketing_performance\": {\n \"marketing_id\": {\n \"description\": \"Unique identifier for each marketing activity.\",\n \"values_sample\": [\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_304143034868101_310419640566194_productAdsamazon_ads_sponsored_products_548576666024459\",\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_405826215303183_448674135385556_productAdsamazon_ads_sponsored_products_511545631860472\",\n ],\n },\n \"activity_date_time\": {\n \"description\": \"Timestamp of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_date\": {\n \"description\": \"Date of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_year\": {\n \"description\": \"Year of the marketing activity.\",\n \"values_sample\": [\"2024\"],\n },\n \"activity_quarter\": {\n \"description\": \"Quarter of the year in which the marketing activity took place.\",\n \"values_sample\": [\"2\"],\n },\n \"activity_month\": {\n \"description\": \"Month of the year in which the marketing activity took place.\",\n \"values_sample\": [\"4\"],\n },\n \"activity_day_of_month\": {\n \"description\": \"Day of the month on which the marketing activity took place.\",\n \"values_sample\": [\"1\"],\n },\n \"activity_week\": {\n \"description\": \"Week of the year in which the marketing activity took place.\",\n \"values_sample\": [\"14\"],\n },\n \"activity_day_of_week\": {\n \"description\": \"Day of the week on which the marketing activity took place (1 for Monday, 7 for Sunday).\",\n \"values_sample\": [\"2\"],\n },\n \"activity_hour\": {\n \"description\": \"Hour of the day in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_minute\": {\n \"description\": \"Minute of the hour in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_time\": {\n \"description\": \"Formatted string representation of the marketing activity time.\",\n \"values_sample\": [\"00:00\"],\n },\n \"channel\": {\n \"description\": \"Marketing channel used for the activity (e.g., Google Ads, Facebook Ads, Email Marketing).\",\n \"values_sample\": [\"sponsored product\"],\n },\n \"vendor\": {\n \"description\": \"Vendor or platform responsible for the marketing activity (e.g., Google, Facebook, Mailchimp).\",\n \"values_sample\": [\"amazon\"],\n },\n \"ad_account_id\": {\n \"description\": \"Unique identifier for the ad account associated with the activity.\",\n \"values_sample\": [\"A5IVEQE4ZPVNJ\"],\n },\n \"ad_account_name\": {\n \"description\": \"Name of the ad account associated with the activity.\",\n \"values_sample\": [\"Famyo\"],\n },\n \"property_name\": {\n \"description\": \"Name of the property or website where the marketing activity was run.\",\n \"values_sample\": [\"amazon sponsored product\"],\n },\n \"network_type\": {\n \"description\": \"Type of advertising network used (e.g., Search, Display, Video).\",\n \"values_sample\": [\"amazon\"],\n },\n \"campaign_id\": {\n \"description\": \"Unique identifier for the marketing campaign.\",\n \"values_sample\": [\n \"304143034868101\",\n \"405826215303183\",\n ],\n },\n \"campaign_name\": {\n \"description\": \"Name of the marketing campaign.\",\n \"values_sample\": [\n \"Football Campaign with presets - B0CT662KJL - 15\/2\/2024 23:09:44\",\n \"Hvs_Tar_SP_Blankets_Genric_Mix\",\n ],\n },\n \"campaign_status\": {\n \"description\": \"Current status of the marketing campaign (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"PAUSED\", \"ENABLED\"],\n },\n \"adset_id\": {\n \"description\": \"Unique identifier for the ad set within the campaign.\",\n \"values_sample\": [\n \"310419640566194\",\n \"448674135385556\",\n ],\n },\n \"adset_name\": {\n \"description\": \"Name of the ad set within the campaign.\",\n \"values_sample\": [\n \"Ad group - 15\/2\/2024 23:09:44\",\n \"Glow Blankets C1\",\n ],\n },\n \"adset_status\": {\n \"description\": \"Current status of the ad set (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"ad_id\": {\n \"description\": \"Unique identifier for the individual ad within the ad set.\",\n \"values_sample\": [\n \"548576666024459\",\n \"511545631860472\",\n ],\n },\n \"ad_name\": {\n \"description\": \"Name of the individual ad.\",\n \"values_sample\": [\"B0CT662KJL\", \"B0CT6428LV\"],\n },\n \"ad_description\": {\n \"description\": \"Description of the individual ad.\",\n \"values_sample\": [\n \"FM_GIDB_Football\",\n \"FM_GIDB_Astronaut\",\n ],\n },\n \"ad_status\": {\n \"description\": \"Current status of the individual ad (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"total_spend\": {\n \"description\": \"Total amount spent on the marketing activity.\",\n \"values_sample\": [\"29.15\", \"110.15\"],\n },\n \"total_clicks\": {\n \"description\": \"Total number of clicks generated by the marketing activity.\",\n \"values_sample\": [\"3\", \"7\"],\n },\n \"total_views\": {\n \"description\": \"Total number of times the marketing activity was viewed.\",\n \"values_sample\": [\"306\", \"1404\"],\n },\n \"total_impressions\": {\n \"description\": \"Total number of times the marketing activity was displayed.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_orders\": {\n \"description\": \"Number of orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_revenue\": {\n \"description\": \"Revenue generated from orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"keyword\": {\n \"description\": \"Keyword used in the marketing activity (if applicable).\",\n \"values_sample\": [None],\n },\n \"_synced_at\": {\n \"description\": \"Timestamp indicating when the data was last synced.\",\n \"values_sample\": [\"2024-07-16T21:32:08.452+00:00\"],\n },\n },\n}","messages":[{"content":"You are an advanced AI trained to generate SQL queries based\n on a given context. Your task is to write an SQL query that accurately \n retrieves the requested data from the provided table schema. Do not answer with any explanations -- just the SQL query.\n Output only plain text. Do not output markdown. \n Please ensure that the SQL query matches the exact table name and column names\n specified in the TABLE_DESCRIPTIONS = {\n \"order_values\": \"This table contains order information aggregated across multiple sources for an e-commerce brand. The table is unique at an Order ID - SKU ID level. The table includes, but is not limited to, all pricing information (like gross sales, tax, net sales, shipping charge, duties, etc.), information related to the product (like SKU, product id\/title, price, etc.), order related information (timestamp of order), payment information and shipping information.\",\n \"marketing_performance\": \"This table contains detailed marketing performance data for an e-commerce brand, capturing data from various marketing activities and platforms. It provides a comprehensive overview of campaign performance, including spend, clicks, views, impressions, and attributed revenue.\",\n}\n\nCOLUMNS = {\n \"order_values\": {\n \"order_line_item_id\": {\n \"description\": \"Unique identifier for each line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"source\": {\"description\": \"Source of the order\", \"values_sample\": [\"shopify\"]},\n \"order_id\": {\n \"description\": \"Unique identifier for each order\",\n \"values_sample\": [\"shopify_5667598663969\"],\n },\n \"ordered_quantity\": {\n \"description\": \"Quantity of each item of a line item\",\n \"values_sample\": [1],\n },\n \"tax_percent\": {\n \"description\": \"Tax percentage applied to the order\",\n \"values_sample\": [0.17999949556658],\n },\n \"total_price_tax\": {\n \"description\": \"Total price including tax\",\n \"values_sample\": [152.389468594368],\n },\n \"gross_sales_price_before_tax\": {\n \"description\": \"Gross sales price before applying tax\",\n \"values_sample\": [846.610531405632],\n },\n \"total_discount_after_tax\": {\n \"description\": \"Total discount after applying tax\",\n \"values_sample\": [0],\n },\n \"total_discount_tax\": {\n \"description\": \"Total discount amount subject to tax\",\n \"values_sample\": [0],\n },\n \"total_discount_before_tax\": {\n \"description\": \"Total discount before applying tax\",\n \"values_sample\": [0],\n },\n \"total_returns_before_tax\": {\n \"description\": \"Total return\/refund amount before tax\",\n \"values_sample\": [846.610531405632],\n },\n \"net_sales_before_tax\": {\n \"description\": \"Net sales amount before applying tax\",\n \"values_sample\": [0],\n },\n \"item_shipping_charge\": {\n \"description\": \"Shipping charge for an item\",\n \"values_sample\": [0],\n },\n \"item_duties\": {\n \"description\": \"Duties charged for an item\",\n \"values_sample\": [0],\n },\n \"item_additional_feels\": {\n \"description\": \"Additional fees charged for an item\",\n \"values_sample\": [0],\n },\n \"total_tax\": {\"description\": \"Total tax amount\", \"values_sample\": [0]},\n \"total_sales_after_tax\": {\n \"description\": \"Total sales amount after applying tax\",\n \"values_sample\": [0],\n },\n \"sku_id\": {\n \"description\": \"Unique identifier for each stock keeping unit (SKU)\",\n \"values_sample\": [\"shopify_8848983261473_47478863036705\"],\n },\n \"sku_code\": {\n \"description\": \"Code assigned to each stock keeping unit (SKU)\",\n \"values_sample\": [\"BSL-D-SIP-0001\"],\n },\n \"product_category\": {\n \"description\": \"Category of the product\",\n \"values_sample\": [\"Insulated Sipper\"],\n },\n \"product_id\": {\n \"description\": \"Unique identifier for each product\",\n \"values_sample\": [\"shopify_8848983261473\"],\n },\n \"product_title\": {\n \"description\": \"Title of the product\",\n \"values_sample\": [\"Kids Sipper (430 ml)\"],\n },\n \"product_price\": {\n \"description\": \"Price of the product\",\n \"values_sample\": [999],\n },\n \"customer_id\": {\n \"description\": \"Unique identifier for each customer\",\n \"values_sample\": [\"shopify_7694075199777\"],\n },\n \"first_ordered_at\": {\n \"description\": \"Timestamp of the first order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_refund_line_item_id\": {\n \"description\": \"Unique identifier for each refunded line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"order_date_time\": {\n \"description\": \"Date and time of the order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_date\": {\n \"description\": \"Date of the order\",\n \"values_sample\": [\"2024-02-14\"],\n },\n \"order_year\": {\"description\": \"Year of the order\", \"values_sample\": [2024]},\n \"order_quarter\": {\n \"description\": \"Quarter of the year of the order\",\n \"values_sample\": [1],\n },\n \"order_month\": {\"description\": \"Month of the order\", \"values_sample\": [2]},\n \"order_day_of_month\": {\n \"description\": \"Day of the month of the order\",\n \"values_sample\": [14],\n },\n \"order_week\": {\n \"description\": \"Week of the year of the order\",\n \"values_sample\": [7],\n },\n \"order_day_of_week\": {\n \"description\": \"Day of the week of the order\",\n \"values_sample\": [4],\n },\n \"order_hour\": {\n \"description\": \"Hour of the day of the order\",\n \"values_sample\": [16],\n },\n \"order_minute\": {\n \"description\": \"Minute of the hour of the order\",\n \"values_sample\": [0],\n },\n \"order_time\": {\"description\": \"Time of the order\", \"values_sample\": [\"16:00\"]},\n \"cancellation_status\": {\n \"description\": \"Status of order cancellation\",\n \"values_sample\": [\"false\"],\n },\n \"refund_status\": {\n \"description\": \"Status of order refund\",\n \"values_sample\": [\"false\"],\n },\n \"order_status\": {\n \"description\": \"Status of the order\",\n \"values_sample\": [\"unknown\"],\n },\n \"payment_status\": {\n \"description\": \"Status of payment for the order\",\n \"values_sample\": [\"pending\"],\n },\n \"shipping_address_city\": {\n \"description\": \"City of the shipping address\",\n \"values_sample\": [\"Surat\"],\n },\n \"shipping_address_state\": {\n \"description\": \"State of the shipping address\",\n \"values_sample\": [\"Gujarat\"],\n },\n \"shipping_address_country\": {\n \"description\": \"Country of the shipping address\",\n \"values_sample\": [\"India\"],\n },\n }\n}\n \"marketing_performance\": {\n \"marketing_id\": {\n \"description\": \"Unique identifier for each marketing activity.\",\n \"values_sample\": [\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_304143034868101_310419640566194_productAdsamazon_ads_sponsored_products_548576666024459\",\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_405826215303183_448674135385556_productAdsamazon_ads_sponsored_products_511545631860472\",\n ],\n },\n \"activity_date_time\": {\n \"description\": \"Timestamp of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_date\": {\n \"description\": \"Date of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_year\": {\n \"description\": \"Year of the marketing activity.\",\n \"values_sample\": [\"2024\"],\n },\n \"activity_quarter\": {\n \"description\": \"Quarter of the year in which the marketing activity took place.\",\n \"values_sample\": [\"2\"],\n },\n \"activity_month\": {\n \"description\": \"Month of the year in which the marketing activity took place.\",\n \"values_sample\": [\"4\"],\n },\n \"activity_day_of_month\": {\n \"description\": \"Day of the month on which the marketing activity took place.\",\n \"values_sample\": [\"1\"],\n },\n \"activity_week\": {\n \"description\": \"Week of the year in which the marketing activity took place.\",\n \"values_sample\": [\"14\"],\n },\n \"activity_day_of_week\": {\n \"description\": \"Day of the week on which the marketing activity took place (1 for Monday, 7 for Sunday).\",\n \"values_sample\": [\"2\"],\n },\n \"activity_hour\": {\n \"description\": \"Hour of the day in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_minute\": {\n \"description\": \"Minute of the hour in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_time\": {\n \"description\": \"Formatted string representation of the marketing activity time.\",\n \"values_sample\": [\"00:00\"],\n },\n \"channel\": {\n \"description\": \"Marketing channel used for the activity (e.g., Google Ads, Facebook Ads, Email Marketing).\",\n \"values_sample\": [\"sponsored product\"],\n },\n \"vendor\": {\n \"description\": \"Vendor or platform responsible for the marketing activity (e.g., Google, Facebook, Mailchimp).\",\n \"values_sample\": [\"amazon\"],\n },\n \"ad_account_id\": {\n \"description\": \"Unique identifier for the ad account associated with the activity.\",\n \"values_sample\": [\"A5IVEQE4ZPVNJ\"],\n },\n \"ad_account_name\": {\n \"description\": \"Name of the ad account associated with the activity.\",\n \"values_sample\": [\"Famyo\"],\n },\n \"property_name\": {\n \"description\": \"Name of the property or website where the marketing activity was run.\",\n \"values_sample\": [\"amazon sponsored product\"],\n },\n \"network_type\": {\n \"description\": \"Type of advertising network used (e.g., Search, Display, Video).\",\n \"values_sample\": [\"amazon\"],\n },\n \"campaign_id\": {\n \"description\": \"Unique identifier for the marketing campaign.\",\n \"values_sample\": [\n \"304143034868101\",\n \"405826215303183\",\n ],\n },\n \"campaign_name\": {\n \"description\": \"Name of the marketing campaign.\",\n \"values_sample\": [\n \"Football Campaign with presets - B0CT662KJL - 15\/2\/2024 23:09:44\",\n \"Hvs_Tar_SP_Blankets_Genric_Mix\",\n ],\n },\n \"campaign_status\": {\n \"description\": \"Current status of the marketing campaign (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"PAUSED\", \"ENABLED\"],\n },\n \"adset_id\": {\n \"description\": \"Unique identifier for the ad set within the campaign.\",\n \"values_sample\": [\n \"310419640566194\",\n \"448674135385556\",\n ],\n },\n \"adset_name\": {\n \"description\": \"Name of the ad set within the campaign.\",\n \"values_sample\": [\n \"Ad group - 15\/2\/2024 23:09:44\",\n \"Glow Blankets C1\",\n ],\n },\n \"adset_status\": {\n \"description\": \"Current status of the ad set (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"ad_id\": {\n \"description\": \"Unique identifier for the individual ad within the ad set.\",\n \"values_sample\": [\n \"548576666024459\",\n \"511545631860472\",\n ],\n },\n \"ad_name\": {\n \"description\": \"Name of the individual ad.\",\n \"values_sample\": [\"B0CT662KJL\", \"B0CT6428LV\"],\n },\n \"ad_description\": {\n \"description\": \"Description of the individual ad.\",\n \"values_sample\": [\n \"FM_GIDB_Football\",\n \"FM_GIDB_Astronaut\",\n ],\n },\n \"ad_status\": {\n \"description\": \"Current status of the individual ad (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"total_spend\": {\n \"description\": \"Total amount spent on the marketing activity.\",\n \"values_sample\": [\"29.15\", \"110.15\"],\n },\n \"total_clicks\": {\n \"description\": \"Total number of clicks generated by the marketing activity.\",\n \"values_sample\": [\"3\", \"7\"],\n },\n \"total_views\": {\n \"description\": \"Total number of times the marketing activity was viewed.\",\n \"values_sample\": [\"306\", \"1404\"],\n },\n \"total_impressions\": {\n \"description\": \"Total number of times the marketing activity was displayed.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_orders\": {\n \"description\": \"Number of orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_revenue\": {\n \"description\": \"Revenue generated from orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"keyword\": {\n \"description\": \"Keyword used in the marketing activity (if applicable).\",\n \"values_sample\": [None],\n },\n \"_synced_at\": {\n \"description\": \"Timestamp indicating when the data was last synced.\",\n \"values_sample\": [\"2024-07-16T21:32:08.452+00:00\"],\n },\n },\n}, I am giving you complete DB and table info in details, user context is bit lengthy so go line by line then answer properly","role":"system"},{"content":"What percentage of total revenue came from international sales in the last year?","role":"user"},{"content":"SELECT ROUND((SUM(CASE WHEN LOWER(billing_address_country) != 'india' THEN net_sales_before_tax ELSE 0 END) \/ SUM(net_sales_before_tax)) * 100, 2) AS international_sales_percentage FROM order_values WHERE order_year = YEAR(DATE_SUB(CURRENT_DATE, DAYOFYEAR(CURRENT_DATE)))","role":"assistant"}]} +{"question":"Show me trend of sales for the last 6 months","answer":"SELECT CONCAT(order_year, '-', LPAD(order_month, 2, '0')) AS order_date, SUM(COALESCE(net_sales_before_tax, 0)) AS net_sales FROM order_values WHERE TO_DATE(CONCAT(order_year, '-', LPAD(order_month, 2, '0')), 'yyyy-MM') >= DATE_TRUNC('month', ADD_MONTHS(CURRENT_DATE, -6)) AND TO_DATE(CONCAT(order_year, '-', LPAD(order_month, 2, '0')), 'yyyy-MM') < DATE_TRUNC('month', CURRENT_DATE) GROUP BY order_year, order_month ORDER BY order_year, order_month;","llama-3-sqlcoder-8b":"WITH monthly_sales AS (SELECT DATE_TRUNC('month', o.order_date) AS MONTH, SUM(o.total_sales_after_tax) AS total_sales FROM order_values o WHERE o.order_date >= (CURRENT_DATE - INTERVAL '6 months') GROUP BY DATE_TRUNC('month', o.order_date)) SELECT ms.MONTH, ms.total_sales FROM monthly_sales ms ORDER BY ms.MONTH;","llama-3.1-8b":"SELECT order_date, SUM(total_sales_after_tax) AS total_sales FROM order_values GROUP BY order_date ORDER BY order_date DESC LIMIT 6","context":"TABLE_DESCRIPTIONS = {\n \"order_values\": \"This table contains order information aggregated across multiple sources for an e-commerce brand. The table is unique at an Order ID - SKU ID level. The table includes, but is not limited to, all pricing information (like gross sales, tax, net sales, shipping charge, duties, etc.), information related to the product (like SKU, product id\/title, price, etc.), order related information (timestamp of order), payment information and shipping information.\",\n \"marketing_performance\": \"This table contains detailed marketing performance data for an e-commerce brand, capturing data from various marketing activities and platforms. It provides a comprehensive overview of campaign performance, including spend, clicks, views, impressions, and attributed revenue.\",\n}\n\nCOLUMNS = {\n \"order_values\": {\n \"order_line_item_id\": {\n \"description\": \"Unique identifier for each line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"source\": {\"description\": \"Source of the order\", \"values_sample\": [\"shopify\"]},\n \"order_id\": {\n \"description\": \"Unique identifier for each order\",\n \"values_sample\": [\"shopify_5667598663969\"],\n },\n \"ordered_quantity\": {\n \"description\": \"Quantity of each item of a line item\",\n \"values_sample\": [1],\n },\n \"tax_percent\": {\n \"description\": \"Tax percentage applied to the order\",\n \"values_sample\": [0.17999949556658],\n },\n \"total_price_tax\": {\n \"description\": \"Total price including tax\",\n \"values_sample\": [152.389468594368],\n },\n \"gross_sales_price_before_tax\": {\n \"description\": \"Gross sales price before applying tax\",\n \"values_sample\": [846.610531405632],\n },\n \"total_discount_after_tax\": {\n \"description\": \"Total discount after applying tax\",\n \"values_sample\": [0],\n },\n \"total_discount_tax\": {\n \"description\": \"Total discount amount subject to tax\",\n \"values_sample\": [0],\n },\n \"total_discount_before_tax\": {\n \"description\": \"Total discount before applying tax\",\n \"values_sample\": [0],\n },\n \"total_returns_before_tax\": {\n \"description\": \"Total return\/refund amount before tax\",\n \"values_sample\": [846.610531405632],\n },\n \"net_sales_before_tax\": {\n \"description\": \"Net sales amount before applying tax\",\n \"values_sample\": [0],\n },\n \"item_shipping_charge\": {\n \"description\": \"Shipping charge for an item\",\n \"values_sample\": [0],\n },\n \"item_duties\": {\n \"description\": \"Duties charged for an item\",\n \"values_sample\": [0],\n },\n \"item_additional_feels\": {\n \"description\": \"Additional fees charged for an item\",\n \"values_sample\": [0],\n },\n \"total_tax\": {\"description\": \"Total tax amount\", \"values_sample\": [0]},\n \"total_sales_after_tax\": {\n \"description\": \"Total sales amount after applying tax\",\n \"values_sample\": [0],\n },\n \"sku_id\": {\n \"description\": \"Unique identifier for each stock keeping unit (SKU)\",\n \"values_sample\": [\"shopify_8848983261473_47478863036705\"],\n },\n \"sku_code\": {\n \"description\": \"Code assigned to each stock keeping unit (SKU)\",\n \"values_sample\": [\"BSL-D-SIP-0001\"],\n },\n \"product_category\": {\n \"description\": \"Category of the product\",\n \"values_sample\": [\"Insulated Sipper\"],\n },\n \"product_id\": {\n \"description\": \"Unique identifier for each product\",\n \"values_sample\": [\"shopify_8848983261473\"],\n },\n \"product_title\": {\n \"description\": \"Title of the product\",\n \"values_sample\": [\"Kids Sipper (430 ml)\"],\n },\n \"product_price\": {\n \"description\": \"Price of the product\",\n \"values_sample\": [999],\n },\n \"customer_id\": {\n \"description\": \"Unique identifier for each customer\",\n \"values_sample\": [\"shopify_7694075199777\"],\n },\n \"first_ordered_at\": {\n \"description\": \"Timestamp of the first order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_refund_line_item_id\": {\n \"description\": \"Unique identifier for each refunded line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"order_date_time\": {\n \"description\": \"Date and time of the order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_date\": {\n \"description\": \"Date of the order\",\n \"values_sample\": [\"2024-02-14\"],\n },\n \"order_year\": {\"description\": \"Year of the order\", \"values_sample\": [2024]},\n \"order_quarter\": {\n \"description\": \"Quarter of the year of the order\",\n \"values_sample\": [1],\n },\n \"order_month\": {\"description\": \"Month of the order\", \"values_sample\": [2]},\n \"order_day_of_month\": {\n \"description\": \"Day of the month of the order\",\n \"values_sample\": [14],\n },\n \"order_week\": {\n \"description\": \"Week of the year of the order\",\n \"values_sample\": [7],\n },\n \"order_day_of_week\": {\n \"description\": \"Day of the week of the order\",\n \"values_sample\": [4],\n },\n \"order_hour\": {\n \"description\": \"Hour of the day of the order\",\n \"values_sample\": [16],\n },\n \"order_minute\": {\n \"description\": \"Minute of the hour of the order\",\n \"values_sample\": [0],\n },\n \"order_time\": {\"description\": \"Time of the order\", \"values_sample\": [\"16:00\"]},\n \"cancellation_status\": {\n \"description\": \"Status of order cancellation\",\n \"values_sample\": [\"false\"],\n },\n \"refund_status\": {\n \"description\": \"Status of order refund\",\n \"values_sample\": [\"false\"],\n },\n \"order_status\": {\n \"description\": \"Status of the order\",\n \"values_sample\": [\"unknown\"],\n },\n \"payment_status\": {\n \"description\": \"Status of payment for the order\",\n \"values_sample\": [\"pending\"],\n },\n \"shipping_address_city\": {\n \"description\": \"City of the shipping address\",\n \"values_sample\": [\"Surat\"],\n },\n \"shipping_address_state\": {\n \"description\": \"State of the shipping address\",\n \"values_sample\": [\"Gujarat\"],\n },\n \"shipping_address_country\": {\n \"description\": \"Country of the shipping address\",\n \"values_sample\": [\"India\"],\n },\n }\n}\n \"marketing_performance\": {\n \"marketing_id\": {\n \"description\": \"Unique identifier for each marketing activity.\",\n \"values_sample\": [\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_304143034868101_310419640566194_productAdsamazon_ads_sponsored_products_548576666024459\",\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_405826215303183_448674135385556_productAdsamazon_ads_sponsored_products_511545631860472\",\n ],\n },\n \"activity_date_time\": {\n \"description\": \"Timestamp of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_date\": {\n \"description\": \"Date of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_year\": {\n \"description\": \"Year of the marketing activity.\",\n \"values_sample\": [\"2024\"],\n },\n \"activity_quarter\": {\n \"description\": \"Quarter of the year in which the marketing activity took place.\",\n \"values_sample\": [\"2\"],\n },\n \"activity_month\": {\n \"description\": \"Month of the year in which the marketing activity took place.\",\n \"values_sample\": [\"4\"],\n },\n \"activity_day_of_month\": {\n \"description\": \"Day of the month on which the marketing activity took place.\",\n \"values_sample\": [\"1\"],\n },\n \"activity_week\": {\n \"description\": \"Week of the year in which the marketing activity took place.\",\n \"values_sample\": [\"14\"],\n },\n \"activity_day_of_week\": {\n \"description\": \"Day of the week on which the marketing activity took place (1 for Monday, 7 for Sunday).\",\n \"values_sample\": [\"2\"],\n },\n \"activity_hour\": {\n \"description\": \"Hour of the day in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_minute\": {\n \"description\": \"Minute of the hour in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_time\": {\n \"description\": \"Formatted string representation of the marketing activity time.\",\n \"values_sample\": [\"00:00\"],\n },\n \"channel\": {\n \"description\": \"Marketing channel used for the activity (e.g., Google Ads, Facebook Ads, Email Marketing).\",\n \"values_sample\": [\"sponsored product\"],\n },\n \"vendor\": {\n \"description\": \"Vendor or platform responsible for the marketing activity (e.g., Google, Facebook, Mailchimp).\",\n \"values_sample\": [\"amazon\"],\n },\n \"ad_account_id\": {\n \"description\": \"Unique identifier for the ad account associated with the activity.\",\n \"values_sample\": [\"A5IVEQE4ZPVNJ\"],\n },\n \"ad_account_name\": {\n \"description\": \"Name of the ad account associated with the activity.\",\n \"values_sample\": [\"Famyo\"],\n },\n \"property_name\": {\n \"description\": \"Name of the property or website where the marketing activity was run.\",\n \"values_sample\": [\"amazon sponsored product\"],\n },\n \"network_type\": {\n \"description\": \"Type of advertising network used (e.g., Search, Display, Video).\",\n \"values_sample\": [\"amazon\"],\n },\n \"campaign_id\": {\n \"description\": \"Unique identifier for the marketing campaign.\",\n \"values_sample\": [\n \"304143034868101\",\n \"405826215303183\",\n ],\n },\n \"campaign_name\": {\n \"description\": \"Name of the marketing campaign.\",\n \"values_sample\": [\n \"Football Campaign with presets - B0CT662KJL - 15\/2\/2024 23:09:44\",\n \"Hvs_Tar_SP_Blankets_Genric_Mix\",\n ],\n },\n \"campaign_status\": {\n \"description\": \"Current status of the marketing campaign (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"PAUSED\", \"ENABLED\"],\n },\n \"adset_id\": {\n \"description\": \"Unique identifier for the ad set within the campaign.\",\n \"values_sample\": [\n \"310419640566194\",\n \"448674135385556\",\n ],\n },\n \"adset_name\": {\n \"description\": \"Name of the ad set within the campaign.\",\n \"values_sample\": [\n \"Ad group - 15\/2\/2024 23:09:44\",\n \"Glow Blankets C1\",\n ],\n },\n \"adset_status\": {\n \"description\": \"Current status of the ad set (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"ad_id\": {\n \"description\": \"Unique identifier for the individual ad within the ad set.\",\n \"values_sample\": [\n \"548576666024459\",\n \"511545631860472\",\n ],\n },\n \"ad_name\": {\n \"description\": \"Name of the individual ad.\",\n \"values_sample\": [\"B0CT662KJL\", \"B0CT6428LV\"],\n },\n \"ad_description\": {\n \"description\": \"Description of the individual ad.\",\n \"values_sample\": [\n \"FM_GIDB_Football\",\n \"FM_GIDB_Astronaut\",\n ],\n },\n \"ad_status\": {\n \"description\": \"Current status of the individual ad (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"total_spend\": {\n \"description\": \"Total amount spent on the marketing activity.\",\n \"values_sample\": [\"29.15\", \"110.15\"],\n },\n \"total_clicks\": {\n \"description\": \"Total number of clicks generated by the marketing activity.\",\n \"values_sample\": [\"3\", \"7\"],\n },\n \"total_views\": {\n \"description\": \"Total number of times the marketing activity was viewed.\",\n \"values_sample\": [\"306\", \"1404\"],\n },\n \"total_impressions\": {\n \"description\": \"Total number of times the marketing activity was displayed.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_orders\": {\n \"description\": \"Number of orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_revenue\": {\n \"description\": \"Revenue generated from orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"keyword\": {\n \"description\": \"Keyword used in the marketing activity (if applicable).\",\n \"values_sample\": [None],\n },\n \"_synced_at\": {\n \"description\": \"Timestamp indicating when the data was last synced.\",\n \"values_sample\": [\"2024-07-16T21:32:08.452+00:00\"],\n },\n },\n}","messages":[{"content":"You are an advanced AI trained to generate SQL queries based\n on a given context. Your task is to write an SQL query that accurately \n retrieves the requested data from the provided table schema. Do not answer with any explanations -- just the SQL query.\n Output only plain text. Do not output markdown. \n Please ensure that the SQL query matches the exact table name and column names\n specified in the TABLE_DESCRIPTIONS = {\n \"order_values\": \"This table contains order information aggregated across multiple sources for an e-commerce brand. The table is unique at an Order ID - SKU ID level. The table includes, but is not limited to, all pricing information (like gross sales, tax, net sales, shipping charge, duties, etc.), information related to the product (like SKU, product id\/title, price, etc.), order related information (timestamp of order), payment information and shipping information.\",\n \"marketing_performance\": \"This table contains detailed marketing performance data for an e-commerce brand, capturing data from various marketing activities and platforms. It provides a comprehensive overview of campaign performance, including spend, clicks, views, impressions, and attributed revenue.\",\n}\n\nCOLUMNS = {\n \"order_values\": {\n \"order_line_item_id\": {\n \"description\": \"Unique identifier for each line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"source\": {\"description\": \"Source of the order\", \"values_sample\": [\"shopify\"]},\n \"order_id\": {\n \"description\": \"Unique identifier for each order\",\n \"values_sample\": [\"shopify_5667598663969\"],\n },\n \"ordered_quantity\": {\n \"description\": \"Quantity of each item of a line item\",\n \"values_sample\": [1],\n },\n \"tax_percent\": {\n \"description\": \"Tax percentage applied to the order\",\n \"values_sample\": [0.17999949556658],\n },\n \"total_price_tax\": {\n \"description\": \"Total price including tax\",\n \"values_sample\": [152.389468594368],\n },\n \"gross_sales_price_before_tax\": {\n \"description\": \"Gross sales price before applying tax\",\n \"values_sample\": [846.610531405632],\n },\n \"total_discount_after_tax\": {\n \"description\": \"Total discount after applying tax\",\n \"values_sample\": [0],\n },\n \"total_discount_tax\": {\n \"description\": \"Total discount amount subject to tax\",\n \"values_sample\": [0],\n },\n \"total_discount_before_tax\": {\n \"description\": \"Total discount before applying tax\",\n \"values_sample\": [0],\n },\n \"total_returns_before_tax\": {\n \"description\": \"Total return\/refund amount before tax\",\n \"values_sample\": [846.610531405632],\n },\n \"net_sales_before_tax\": {\n \"description\": \"Net sales amount before applying tax\",\n \"values_sample\": [0],\n },\n \"item_shipping_charge\": {\n \"description\": \"Shipping charge for an item\",\n \"values_sample\": [0],\n },\n \"item_duties\": {\n \"description\": \"Duties charged for an item\",\n \"values_sample\": [0],\n },\n \"item_additional_feels\": {\n \"description\": \"Additional fees charged for an item\",\n \"values_sample\": [0],\n },\n \"total_tax\": {\"description\": \"Total tax amount\", \"values_sample\": [0]},\n \"total_sales_after_tax\": {\n \"description\": \"Total sales amount after applying tax\",\n \"values_sample\": [0],\n },\n \"sku_id\": {\n \"description\": \"Unique identifier for each stock keeping unit (SKU)\",\n \"values_sample\": [\"shopify_8848983261473_47478863036705\"],\n },\n \"sku_code\": {\n \"description\": \"Code assigned to each stock keeping unit (SKU)\",\n \"values_sample\": [\"BSL-D-SIP-0001\"],\n },\n \"product_category\": {\n \"description\": \"Category of the product\",\n \"values_sample\": [\"Insulated Sipper\"],\n },\n \"product_id\": {\n \"description\": \"Unique identifier for each product\",\n \"values_sample\": [\"shopify_8848983261473\"],\n },\n \"product_title\": {\n \"description\": \"Title of the product\",\n \"values_sample\": [\"Kids Sipper (430 ml)\"],\n },\n \"product_price\": {\n \"description\": \"Price of the product\",\n \"values_sample\": [999],\n },\n \"customer_id\": {\n \"description\": \"Unique identifier for each customer\",\n \"values_sample\": [\"shopify_7694075199777\"],\n },\n \"first_ordered_at\": {\n \"description\": \"Timestamp of the first order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_refund_line_item_id\": {\n \"description\": \"Unique identifier for each refunded line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"order_date_time\": {\n \"description\": \"Date and time of the order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_date\": {\n \"description\": \"Date of the order\",\n \"values_sample\": [\"2024-02-14\"],\n },\n \"order_year\": {\"description\": \"Year of the order\", \"values_sample\": [2024]},\n \"order_quarter\": {\n \"description\": \"Quarter of the year of the order\",\n \"values_sample\": [1],\n },\n \"order_month\": {\"description\": \"Month of the order\", \"values_sample\": [2]},\n \"order_day_of_month\": {\n \"description\": \"Day of the month of the order\",\n \"values_sample\": [14],\n },\n \"order_week\": {\n \"description\": \"Week of the year of the order\",\n \"values_sample\": [7],\n },\n \"order_day_of_week\": {\n \"description\": \"Day of the week of the order\",\n \"values_sample\": [4],\n },\n \"order_hour\": {\n \"description\": \"Hour of the day of the order\",\n \"values_sample\": [16],\n },\n \"order_minute\": {\n \"description\": \"Minute of the hour of the order\",\n \"values_sample\": [0],\n },\n \"order_time\": {\"description\": \"Time of the order\", \"values_sample\": [\"16:00\"]},\n \"cancellation_status\": {\n \"description\": \"Status of order cancellation\",\n \"values_sample\": [\"false\"],\n },\n \"refund_status\": {\n \"description\": \"Status of order refund\",\n \"values_sample\": [\"false\"],\n },\n \"order_status\": {\n \"description\": \"Status of the order\",\n \"values_sample\": [\"unknown\"],\n },\n \"payment_status\": {\n \"description\": \"Status of payment for the order\",\n \"values_sample\": [\"pending\"],\n },\n \"shipping_address_city\": {\n \"description\": \"City of the shipping address\",\n \"values_sample\": [\"Surat\"],\n },\n \"shipping_address_state\": {\n \"description\": \"State of the shipping address\",\n \"values_sample\": [\"Gujarat\"],\n },\n \"shipping_address_country\": {\n \"description\": \"Country of the shipping address\",\n \"values_sample\": [\"India\"],\n },\n }\n}\n \"marketing_performance\": {\n \"marketing_id\": {\n \"description\": \"Unique identifier for each marketing activity.\",\n \"values_sample\": [\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_304143034868101_310419640566194_productAdsamazon_ads_sponsored_products_548576666024459\",\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_405826215303183_448674135385556_productAdsamazon_ads_sponsored_products_511545631860472\",\n ],\n },\n \"activity_date_time\": {\n \"description\": \"Timestamp of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_date\": {\n \"description\": \"Date of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_year\": {\n \"description\": \"Year of the marketing activity.\",\n \"values_sample\": [\"2024\"],\n },\n \"activity_quarter\": {\n \"description\": \"Quarter of the year in which the marketing activity took place.\",\n \"values_sample\": [\"2\"],\n },\n \"activity_month\": {\n \"description\": \"Month of the year in which the marketing activity took place.\",\n \"values_sample\": [\"4\"],\n },\n \"activity_day_of_month\": {\n \"description\": \"Day of the month on which the marketing activity took place.\",\n \"values_sample\": [\"1\"],\n },\n \"activity_week\": {\n \"description\": \"Week of the year in which the marketing activity took place.\",\n \"values_sample\": [\"14\"],\n },\n \"activity_day_of_week\": {\n \"description\": \"Day of the week on which the marketing activity took place (1 for Monday, 7 for Sunday).\",\n \"values_sample\": [\"2\"],\n },\n \"activity_hour\": {\n \"description\": \"Hour of the day in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_minute\": {\n \"description\": \"Minute of the hour in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_time\": {\n \"description\": \"Formatted string representation of the marketing activity time.\",\n \"values_sample\": [\"00:00\"],\n },\n \"channel\": {\n \"description\": \"Marketing channel used for the activity (e.g., Google Ads, Facebook Ads, Email Marketing).\",\n \"values_sample\": [\"sponsored product\"],\n },\n \"vendor\": {\n \"description\": \"Vendor or platform responsible for the marketing activity (e.g., Google, Facebook, Mailchimp).\",\n \"values_sample\": [\"amazon\"],\n },\n \"ad_account_id\": {\n \"description\": \"Unique identifier for the ad account associated with the activity.\",\n \"values_sample\": [\"A5IVEQE4ZPVNJ\"],\n },\n \"ad_account_name\": {\n \"description\": \"Name of the ad account associated with the activity.\",\n \"values_sample\": [\"Famyo\"],\n },\n \"property_name\": {\n \"description\": \"Name of the property or website where the marketing activity was run.\",\n \"values_sample\": [\"amazon sponsored product\"],\n },\n \"network_type\": {\n \"description\": \"Type of advertising network used (e.g., Search, Display, Video).\",\n \"values_sample\": [\"amazon\"],\n },\n \"campaign_id\": {\n \"description\": \"Unique identifier for the marketing campaign.\",\n \"values_sample\": [\n \"304143034868101\",\n \"405826215303183\",\n ],\n },\n \"campaign_name\": {\n \"description\": \"Name of the marketing campaign.\",\n \"values_sample\": [\n \"Football Campaign with presets - B0CT662KJL - 15\/2\/2024 23:09:44\",\n \"Hvs_Tar_SP_Blankets_Genric_Mix\",\n ],\n },\n \"campaign_status\": {\n \"description\": \"Current status of the marketing campaign (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"PAUSED\", \"ENABLED\"],\n },\n \"adset_id\": {\n \"description\": \"Unique identifier for the ad set within the campaign.\",\n \"values_sample\": [\n \"310419640566194\",\n \"448674135385556\",\n ],\n },\n \"adset_name\": {\n \"description\": \"Name of the ad set within the campaign.\",\n \"values_sample\": [\n \"Ad group - 15\/2\/2024 23:09:44\",\n \"Glow Blankets C1\",\n ],\n },\n \"adset_status\": {\n \"description\": \"Current status of the ad set (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"ad_id\": {\n \"description\": \"Unique identifier for the individual ad within the ad set.\",\n \"values_sample\": [\n \"548576666024459\",\n \"511545631860472\",\n ],\n },\n \"ad_name\": {\n \"description\": \"Name of the individual ad.\",\n \"values_sample\": [\"B0CT662KJL\", \"B0CT6428LV\"],\n },\n \"ad_description\": {\n \"description\": \"Description of the individual ad.\",\n \"values_sample\": [\n \"FM_GIDB_Football\",\n \"FM_GIDB_Astronaut\",\n ],\n },\n \"ad_status\": {\n \"description\": \"Current status of the individual ad (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"total_spend\": {\n \"description\": \"Total amount spent on the marketing activity.\",\n \"values_sample\": [\"29.15\", \"110.15\"],\n },\n \"total_clicks\": {\n \"description\": \"Total number of clicks generated by the marketing activity.\",\n \"values_sample\": [\"3\", \"7\"],\n },\n \"total_views\": {\n \"description\": \"Total number of times the marketing activity was viewed.\",\n \"values_sample\": [\"306\", \"1404\"],\n },\n \"total_impressions\": {\n \"description\": \"Total number of times the marketing activity was displayed.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_orders\": {\n \"description\": \"Number of orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_revenue\": {\n \"description\": \"Revenue generated from orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"keyword\": {\n \"description\": \"Keyword used in the marketing activity (if applicable).\",\n \"values_sample\": [None],\n },\n \"_synced_at\": {\n \"description\": \"Timestamp indicating when the data was last synced.\",\n \"values_sample\": [\"2024-07-16T21:32:08.452+00:00\"],\n },\n },\n}, I am giving you complete DB and table info in details, user context is bit lengthy so go line by line then answer properly","role":"system"},{"content":"Show me trend of sales for the last 6 months","role":"user"},{"content":"SELECT CONCAT(order_year, '-', LPAD(order_month, 2, '0')) AS order_date, SUM(COALESCE(net_sales_before_tax, 0)) AS net_sales FROM order_values WHERE TO_DATE(CONCAT(order_year, '-', LPAD(order_month, 2, '0')), 'yyyy-MM') >= DATE_TRUNC('month', ADD_MONTHS(CURRENT_DATE, -6)) AND TO_DATE(CONCAT(order_year, '-', LPAD(order_month, 2, '0')), 'yyyy-MM') < DATE_TRUNC('month', CURRENT_DATE) GROUP BY order_year, order_month ORDER BY order_year, order_month;","role":"assistant"}]} +{"question":"sales trend for last 6 months","answer":"SELECT CONCAT(order_year, '-', LPAD(order_month, 2, '0')) AS order_date, SUM(COALESCE(net_sales_before_tax, 0)) AS net_sales FROM order_values WHERE TO_DATE(CONCAT(order_year, '-', LPAD(order_month, 2, '0')), 'yyyy-MM') >= DATE_TRUNC('month', ADD_MONTHS(CURRENT_DATE, -6)) AND TO_DATE(CONCAT(order_year, '-', LPAD(order_month, 2, '0')), 'yyyy-MM') < DATE_TRUNC('month', CURRENT_DATE) GROUP BY order_year, order_month ORDER BY order_year, order_month;","llama-3-sqlcoder-8b":"WITH monthly_sales AS (SELECT DATE_TRUNC('month', o.order_date) AS MONTH, SUM(o.total_sales_after_tax) AS total_sales FROM order_values o WHERE o.order_date >= DATE_TRUNC('month', CURRENT_DATE) - INTERVAL '6 months' GROUP BY DATE_TRUNC('month', o.order_date)) SELECT ms.MONTH, ms.total_sales FROM monthly_sales ms ORDER BY ms.MONTH;","llama-3.1-8b":"SELECT SUM(total_sales_after_tax) FROM order_values WHERE order_month BETWEEN (SELECT MAX(order_month) - 5 FROM order_values) AND MAX(order_month)","context":"TABLE_DESCRIPTIONS = {\n \"order_values\": \"This table contains order information aggregated across multiple sources for an e-commerce brand. The table is unique at an Order ID - SKU ID level. The table includes, but is not limited to, all pricing information (like gross sales, tax, net sales, shipping charge, duties, etc.), information related to the product (like SKU, product id\/title, price, etc.), order related information (timestamp of order), payment information and shipping information.\",\n \"marketing_performance\": \"This table contains detailed marketing performance data for an e-commerce brand, capturing data from various marketing activities and platforms. It provides a comprehensive overview of campaign performance, including spend, clicks, views, impressions, and attributed revenue.\",\n}\n\nCOLUMNS = {\n \"order_values\": {\n \"order_line_item_id\": {\n \"description\": \"Unique identifier for each line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"source\": {\"description\": \"Source of the order\", \"values_sample\": [\"shopify\"]},\n \"order_id\": {\n \"description\": \"Unique identifier for each order\",\n \"values_sample\": [\"shopify_5667598663969\"],\n },\n \"ordered_quantity\": {\n \"description\": \"Quantity of each item of a line item\",\n \"values_sample\": [1],\n },\n \"tax_percent\": {\n \"description\": \"Tax percentage applied to the order\",\n \"values_sample\": [0.17999949556658],\n },\n \"total_price_tax\": {\n \"description\": \"Total price including tax\",\n \"values_sample\": [152.389468594368],\n },\n \"gross_sales_price_before_tax\": {\n \"description\": \"Gross sales price before applying tax\",\n \"values_sample\": [846.610531405632],\n },\n \"total_discount_after_tax\": {\n \"description\": \"Total discount after applying tax\",\n \"values_sample\": [0],\n },\n \"total_discount_tax\": {\n \"description\": \"Total discount amount subject to tax\",\n \"values_sample\": [0],\n },\n \"total_discount_before_tax\": {\n \"description\": \"Total discount before applying tax\",\n \"values_sample\": [0],\n },\n \"total_returns_before_tax\": {\n \"description\": \"Total return\/refund amount before tax\",\n \"values_sample\": [846.610531405632],\n },\n \"net_sales_before_tax\": {\n \"description\": \"Net sales amount before applying tax\",\n \"values_sample\": [0],\n },\n \"item_shipping_charge\": {\n \"description\": \"Shipping charge for an item\",\n \"values_sample\": [0],\n },\n \"item_duties\": {\n \"description\": \"Duties charged for an item\",\n \"values_sample\": [0],\n },\n \"item_additional_feels\": {\n \"description\": \"Additional fees charged for an item\",\n \"values_sample\": [0],\n },\n \"total_tax\": {\"description\": \"Total tax amount\", \"values_sample\": [0]},\n \"total_sales_after_tax\": {\n \"description\": \"Total sales amount after applying tax\",\n \"values_sample\": [0],\n },\n \"sku_id\": {\n \"description\": \"Unique identifier for each stock keeping unit (SKU)\",\n \"values_sample\": [\"shopify_8848983261473_47478863036705\"],\n },\n \"sku_code\": {\n \"description\": \"Code assigned to each stock keeping unit (SKU)\",\n \"values_sample\": [\"BSL-D-SIP-0001\"],\n },\n \"product_category\": {\n \"description\": \"Category of the product\",\n \"values_sample\": [\"Insulated Sipper\"],\n },\n \"product_id\": {\n \"description\": \"Unique identifier for each product\",\n \"values_sample\": [\"shopify_8848983261473\"],\n },\n \"product_title\": {\n \"description\": \"Title of the product\",\n \"values_sample\": [\"Kids Sipper (430 ml)\"],\n },\n \"product_price\": {\n \"description\": \"Price of the product\",\n \"values_sample\": [999],\n },\n \"customer_id\": {\n \"description\": \"Unique identifier for each customer\",\n \"values_sample\": [\"shopify_7694075199777\"],\n },\n \"first_ordered_at\": {\n \"description\": \"Timestamp of the first order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_refund_line_item_id\": {\n \"description\": \"Unique identifier for each refunded line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"order_date_time\": {\n \"description\": \"Date and time of the order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_date\": {\n \"description\": \"Date of the order\",\n \"values_sample\": [\"2024-02-14\"],\n },\n \"order_year\": {\"description\": \"Year of the order\", \"values_sample\": [2024]},\n \"order_quarter\": {\n \"description\": \"Quarter of the year of the order\",\n \"values_sample\": [1],\n },\n \"order_month\": {\"description\": \"Month of the order\", \"values_sample\": [2]},\n \"order_day_of_month\": {\n \"description\": \"Day of the month of the order\",\n \"values_sample\": [14],\n },\n \"order_week\": {\n \"description\": \"Week of the year of the order\",\n \"values_sample\": [7],\n },\n \"order_day_of_week\": {\n \"description\": \"Day of the week of the order\",\n \"values_sample\": [4],\n },\n \"order_hour\": {\n \"description\": \"Hour of the day of the order\",\n \"values_sample\": [16],\n },\n \"order_minute\": {\n \"description\": \"Minute of the hour of the order\",\n \"values_sample\": [0],\n },\n \"order_time\": {\"description\": \"Time of the order\", \"values_sample\": [\"16:00\"]},\n \"cancellation_status\": {\n \"description\": \"Status of order cancellation\",\n \"values_sample\": [\"false\"],\n },\n \"refund_status\": {\n \"description\": \"Status of order refund\",\n \"values_sample\": [\"false\"],\n },\n \"order_status\": {\n \"description\": \"Status of the order\",\n \"values_sample\": [\"unknown\"],\n },\n \"payment_status\": {\n \"description\": \"Status of payment for the order\",\n \"values_sample\": [\"pending\"],\n },\n \"shipping_address_city\": {\n \"description\": \"City of the shipping address\",\n \"values_sample\": [\"Surat\"],\n },\n \"shipping_address_state\": {\n \"description\": \"State of the shipping address\",\n \"values_sample\": [\"Gujarat\"],\n },\n \"shipping_address_country\": {\n \"description\": \"Country of the shipping address\",\n \"values_sample\": [\"India\"],\n },\n }\n}\n \"marketing_performance\": {\n \"marketing_id\": {\n \"description\": \"Unique identifier for each marketing activity.\",\n \"values_sample\": [\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_304143034868101_310419640566194_productAdsamazon_ads_sponsored_products_548576666024459\",\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_405826215303183_448674135385556_productAdsamazon_ads_sponsored_products_511545631860472\",\n ],\n },\n \"activity_date_time\": {\n \"description\": \"Timestamp of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_date\": {\n \"description\": \"Date of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_year\": {\n \"description\": \"Year of the marketing activity.\",\n \"values_sample\": [\"2024\"],\n },\n \"activity_quarter\": {\n \"description\": \"Quarter of the year in which the marketing activity took place.\",\n \"values_sample\": [\"2\"],\n },\n \"activity_month\": {\n \"description\": \"Month of the year in which the marketing activity took place.\",\n \"values_sample\": [\"4\"],\n },\n \"activity_day_of_month\": {\n \"description\": \"Day of the month on which the marketing activity took place.\",\n \"values_sample\": [\"1\"],\n },\n \"activity_week\": {\n \"description\": \"Week of the year in which the marketing activity took place.\",\n \"values_sample\": [\"14\"],\n },\n \"activity_day_of_week\": {\n \"description\": \"Day of the week on which the marketing activity took place (1 for Monday, 7 for Sunday).\",\n \"values_sample\": [\"2\"],\n },\n \"activity_hour\": {\n \"description\": \"Hour of the day in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_minute\": {\n \"description\": \"Minute of the hour in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_time\": {\n \"description\": \"Formatted string representation of the marketing activity time.\",\n \"values_sample\": [\"00:00\"],\n },\n \"channel\": {\n \"description\": \"Marketing channel used for the activity (e.g., Google Ads, Facebook Ads, Email Marketing).\",\n \"values_sample\": [\"sponsored product\"],\n },\n \"vendor\": {\n \"description\": \"Vendor or platform responsible for the marketing activity (e.g., Google, Facebook, Mailchimp).\",\n \"values_sample\": [\"amazon\"],\n },\n \"ad_account_id\": {\n \"description\": \"Unique identifier for the ad account associated with the activity.\",\n \"values_sample\": [\"A5IVEQE4ZPVNJ\"],\n },\n \"ad_account_name\": {\n \"description\": \"Name of the ad account associated with the activity.\",\n \"values_sample\": [\"Famyo\"],\n },\n \"property_name\": {\n \"description\": \"Name of the property or website where the marketing activity was run.\",\n \"values_sample\": [\"amazon sponsored product\"],\n },\n \"network_type\": {\n \"description\": \"Type of advertising network used (e.g., Search, Display, Video).\",\n \"values_sample\": [\"amazon\"],\n },\n \"campaign_id\": {\n \"description\": \"Unique identifier for the marketing campaign.\",\n \"values_sample\": [\n \"304143034868101\",\n \"405826215303183\",\n ],\n },\n \"campaign_name\": {\n \"description\": \"Name of the marketing campaign.\",\n \"values_sample\": [\n \"Football Campaign with presets - B0CT662KJL - 15\/2\/2024 23:09:44\",\n \"Hvs_Tar_SP_Blankets_Genric_Mix\",\n ],\n },\n \"campaign_status\": {\n \"description\": \"Current status of the marketing campaign (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"PAUSED\", \"ENABLED\"],\n },\n \"adset_id\": {\n \"description\": \"Unique identifier for the ad set within the campaign.\",\n \"values_sample\": [\n \"310419640566194\",\n \"448674135385556\",\n ],\n },\n \"adset_name\": {\n \"description\": \"Name of the ad set within the campaign.\",\n \"values_sample\": [\n \"Ad group - 15\/2\/2024 23:09:44\",\n \"Glow Blankets C1\",\n ],\n },\n \"adset_status\": {\n \"description\": \"Current status of the ad set (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"ad_id\": {\n \"description\": \"Unique identifier for the individual ad within the ad set.\",\n \"values_sample\": [\n \"548576666024459\",\n \"511545631860472\",\n ],\n },\n \"ad_name\": {\n \"description\": \"Name of the individual ad.\",\n \"values_sample\": [\"B0CT662KJL\", \"B0CT6428LV\"],\n },\n \"ad_description\": {\n \"description\": \"Description of the individual ad.\",\n \"values_sample\": [\n \"FM_GIDB_Football\",\n \"FM_GIDB_Astronaut\",\n ],\n },\n \"ad_status\": {\n \"description\": \"Current status of the individual ad (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"total_spend\": {\n \"description\": \"Total amount spent on the marketing activity.\",\n \"values_sample\": [\"29.15\", \"110.15\"],\n },\n \"total_clicks\": {\n \"description\": \"Total number of clicks generated by the marketing activity.\",\n \"values_sample\": [\"3\", \"7\"],\n },\n \"total_views\": {\n \"description\": \"Total number of times the marketing activity was viewed.\",\n \"values_sample\": [\"306\", \"1404\"],\n },\n \"total_impressions\": {\n \"description\": \"Total number of times the marketing activity was displayed.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_orders\": {\n \"description\": \"Number of orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_revenue\": {\n \"description\": \"Revenue generated from orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"keyword\": {\n \"description\": \"Keyword used in the marketing activity (if applicable).\",\n \"values_sample\": [None],\n },\n \"_synced_at\": {\n \"description\": \"Timestamp indicating when the data was last synced.\",\n \"values_sample\": [\"2024-07-16T21:32:08.452+00:00\"],\n },\n },\n}","messages":[{"content":"You are an advanced AI trained to generate SQL queries based\n on a given context. Your task is to write an SQL query that accurately \n retrieves the requested data from the provided table schema. Do not answer with any explanations -- just the SQL query.\n Output only plain text. Do not output markdown. \n Please ensure that the SQL query matches the exact table name and column names\n specified in the TABLE_DESCRIPTIONS = {\n \"order_values\": \"This table contains order information aggregated across multiple sources for an e-commerce brand. The table is unique at an Order ID - SKU ID level. The table includes, but is not limited to, all pricing information (like gross sales, tax, net sales, shipping charge, duties, etc.), information related to the product (like SKU, product id\/title, price, etc.), order related information (timestamp of order), payment information and shipping information.\",\n \"marketing_performance\": \"This table contains detailed marketing performance data for an e-commerce brand, capturing data from various marketing activities and platforms. It provides a comprehensive overview of campaign performance, including spend, clicks, views, impressions, and attributed revenue.\",\n}\n\nCOLUMNS = {\n \"order_values\": {\n \"order_line_item_id\": {\n \"description\": \"Unique identifier for each line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"source\": {\"description\": \"Source of the order\", \"values_sample\": [\"shopify\"]},\n \"order_id\": {\n \"description\": \"Unique identifier for each order\",\n \"values_sample\": [\"shopify_5667598663969\"],\n },\n \"ordered_quantity\": {\n \"description\": \"Quantity of each item of a line item\",\n \"values_sample\": [1],\n },\n \"tax_percent\": {\n \"description\": \"Tax percentage applied to the order\",\n \"values_sample\": [0.17999949556658],\n },\n \"total_price_tax\": {\n \"description\": \"Total price including tax\",\n \"values_sample\": [152.389468594368],\n },\n \"gross_sales_price_before_tax\": {\n \"description\": \"Gross sales price before applying tax\",\n \"values_sample\": [846.610531405632],\n },\n \"total_discount_after_tax\": {\n \"description\": \"Total discount after applying tax\",\n \"values_sample\": [0],\n },\n \"total_discount_tax\": {\n \"description\": \"Total discount amount subject to tax\",\n \"values_sample\": [0],\n },\n \"total_discount_before_tax\": {\n \"description\": \"Total discount before applying tax\",\n \"values_sample\": [0],\n },\n \"total_returns_before_tax\": {\n \"description\": \"Total return\/refund amount before tax\",\n \"values_sample\": [846.610531405632],\n },\n \"net_sales_before_tax\": {\n \"description\": \"Net sales amount before applying tax\",\n \"values_sample\": [0],\n },\n \"item_shipping_charge\": {\n \"description\": \"Shipping charge for an item\",\n \"values_sample\": [0],\n },\n \"item_duties\": {\n \"description\": \"Duties charged for an item\",\n \"values_sample\": [0],\n },\n \"item_additional_feels\": {\n \"description\": \"Additional fees charged for an item\",\n \"values_sample\": [0],\n },\n \"total_tax\": {\"description\": \"Total tax amount\", \"values_sample\": [0]},\n \"total_sales_after_tax\": {\n \"description\": \"Total sales amount after applying tax\",\n \"values_sample\": [0],\n },\n \"sku_id\": {\n \"description\": \"Unique identifier for each stock keeping unit (SKU)\",\n \"values_sample\": [\"shopify_8848983261473_47478863036705\"],\n },\n \"sku_code\": {\n \"description\": \"Code assigned to each stock keeping unit (SKU)\",\n \"values_sample\": [\"BSL-D-SIP-0001\"],\n },\n \"product_category\": {\n \"description\": \"Category of the product\",\n \"values_sample\": [\"Insulated Sipper\"],\n },\n \"product_id\": {\n \"description\": \"Unique identifier for each product\",\n \"values_sample\": [\"shopify_8848983261473\"],\n },\n \"product_title\": {\n \"description\": \"Title of the product\",\n \"values_sample\": [\"Kids Sipper (430 ml)\"],\n },\n \"product_price\": {\n \"description\": \"Price of the product\",\n \"values_sample\": [999],\n },\n \"customer_id\": {\n \"description\": \"Unique identifier for each customer\",\n \"values_sample\": [\"shopify_7694075199777\"],\n },\n \"first_ordered_at\": {\n \"description\": \"Timestamp of the first order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_refund_line_item_id\": {\n \"description\": \"Unique identifier for each refunded line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"order_date_time\": {\n \"description\": \"Date and time of the order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_date\": {\n \"description\": \"Date of the order\",\n \"values_sample\": [\"2024-02-14\"],\n },\n \"order_year\": {\"description\": \"Year of the order\", \"values_sample\": [2024]},\n \"order_quarter\": {\n \"description\": \"Quarter of the year of the order\",\n \"values_sample\": [1],\n },\n \"order_month\": {\"description\": \"Month of the order\", \"values_sample\": [2]},\n \"order_day_of_month\": {\n \"description\": \"Day of the month of the order\",\n \"values_sample\": [14],\n },\n \"order_week\": {\n \"description\": \"Week of the year of the order\",\n \"values_sample\": [7],\n },\n \"order_day_of_week\": {\n \"description\": \"Day of the week of the order\",\n \"values_sample\": [4],\n },\n \"order_hour\": {\n \"description\": \"Hour of the day of the order\",\n \"values_sample\": [16],\n },\n \"order_minute\": {\n \"description\": \"Minute of the hour of the order\",\n \"values_sample\": [0],\n },\n \"order_time\": {\"description\": \"Time of the order\", \"values_sample\": [\"16:00\"]},\n \"cancellation_status\": {\n \"description\": \"Status of order cancellation\",\n \"values_sample\": [\"false\"],\n },\n \"refund_status\": {\n \"description\": \"Status of order refund\",\n \"values_sample\": [\"false\"],\n },\n \"order_status\": {\n \"description\": \"Status of the order\",\n \"values_sample\": [\"unknown\"],\n },\n \"payment_status\": {\n \"description\": \"Status of payment for the order\",\n \"values_sample\": [\"pending\"],\n },\n \"shipping_address_city\": {\n \"description\": \"City of the shipping address\",\n \"values_sample\": [\"Surat\"],\n },\n \"shipping_address_state\": {\n \"description\": \"State of the shipping address\",\n \"values_sample\": [\"Gujarat\"],\n },\n \"shipping_address_country\": {\n \"description\": \"Country of the shipping address\",\n \"values_sample\": [\"India\"],\n },\n }\n}\n \"marketing_performance\": {\n \"marketing_id\": {\n \"description\": \"Unique identifier for each marketing activity.\",\n \"values_sample\": [\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_304143034868101_310419640566194_productAdsamazon_ads_sponsored_products_548576666024459\",\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_405826215303183_448674135385556_productAdsamazon_ads_sponsored_products_511545631860472\",\n ],\n },\n \"activity_date_time\": {\n \"description\": \"Timestamp of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_date\": {\n \"description\": \"Date of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_year\": {\n \"description\": \"Year of the marketing activity.\",\n \"values_sample\": [\"2024\"],\n },\n \"activity_quarter\": {\n \"description\": \"Quarter of the year in which the marketing activity took place.\",\n \"values_sample\": [\"2\"],\n },\n \"activity_month\": {\n \"description\": \"Month of the year in which the marketing activity took place.\",\n \"values_sample\": [\"4\"],\n },\n \"activity_day_of_month\": {\n \"description\": \"Day of the month on which the marketing activity took place.\",\n \"values_sample\": [\"1\"],\n },\n \"activity_week\": {\n \"description\": \"Week of the year in which the marketing activity took place.\",\n \"values_sample\": [\"14\"],\n },\n \"activity_day_of_week\": {\n \"description\": \"Day of the week on which the marketing activity took place (1 for Monday, 7 for Sunday).\",\n \"values_sample\": [\"2\"],\n },\n \"activity_hour\": {\n \"description\": \"Hour of the day in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_minute\": {\n \"description\": \"Minute of the hour in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_time\": {\n \"description\": \"Formatted string representation of the marketing activity time.\",\n \"values_sample\": [\"00:00\"],\n },\n \"channel\": {\n \"description\": \"Marketing channel used for the activity (e.g., Google Ads, Facebook Ads, Email Marketing).\",\n \"values_sample\": [\"sponsored product\"],\n },\n \"vendor\": {\n \"description\": \"Vendor or platform responsible for the marketing activity (e.g., Google, Facebook, Mailchimp).\",\n \"values_sample\": [\"amazon\"],\n },\n \"ad_account_id\": {\n \"description\": \"Unique identifier for the ad account associated with the activity.\",\n \"values_sample\": [\"A5IVEQE4ZPVNJ\"],\n },\n \"ad_account_name\": {\n \"description\": \"Name of the ad account associated with the activity.\",\n \"values_sample\": [\"Famyo\"],\n },\n \"property_name\": {\n \"description\": \"Name of the property or website where the marketing activity was run.\",\n \"values_sample\": [\"amazon sponsored product\"],\n },\n \"network_type\": {\n \"description\": \"Type of advertising network used (e.g., Search, Display, Video).\",\n \"values_sample\": [\"amazon\"],\n },\n \"campaign_id\": {\n \"description\": \"Unique identifier for the marketing campaign.\",\n \"values_sample\": [\n \"304143034868101\",\n \"405826215303183\",\n ],\n },\n \"campaign_name\": {\n \"description\": \"Name of the marketing campaign.\",\n \"values_sample\": [\n \"Football Campaign with presets - B0CT662KJL - 15\/2\/2024 23:09:44\",\n \"Hvs_Tar_SP_Blankets_Genric_Mix\",\n ],\n },\n \"campaign_status\": {\n \"description\": \"Current status of the marketing campaign (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"PAUSED\", \"ENABLED\"],\n },\n \"adset_id\": {\n \"description\": \"Unique identifier for the ad set within the campaign.\",\n \"values_sample\": [\n \"310419640566194\",\n \"448674135385556\",\n ],\n },\n \"adset_name\": {\n \"description\": \"Name of the ad set within the campaign.\",\n \"values_sample\": [\n \"Ad group - 15\/2\/2024 23:09:44\",\n \"Glow Blankets C1\",\n ],\n },\n \"adset_status\": {\n \"description\": \"Current status of the ad set (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"ad_id\": {\n \"description\": \"Unique identifier for the individual ad within the ad set.\",\n \"values_sample\": [\n \"548576666024459\",\n \"511545631860472\",\n ],\n },\n \"ad_name\": {\n \"description\": \"Name of the individual ad.\",\n \"values_sample\": [\"B0CT662KJL\", \"B0CT6428LV\"],\n },\n \"ad_description\": {\n \"description\": \"Description of the individual ad.\",\n \"values_sample\": [\n \"FM_GIDB_Football\",\n \"FM_GIDB_Astronaut\",\n ],\n },\n \"ad_status\": {\n \"description\": \"Current status of the individual ad (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"total_spend\": {\n \"description\": \"Total amount spent on the marketing activity.\",\n \"values_sample\": [\"29.15\", \"110.15\"],\n },\n \"total_clicks\": {\n \"description\": \"Total number of clicks generated by the marketing activity.\",\n \"values_sample\": [\"3\", \"7\"],\n },\n \"total_views\": {\n \"description\": \"Total number of times the marketing activity was viewed.\",\n \"values_sample\": [\"306\", \"1404\"],\n },\n \"total_impressions\": {\n \"description\": \"Total number of times the marketing activity was displayed.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_orders\": {\n \"description\": \"Number of orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_revenue\": {\n \"description\": \"Revenue generated from orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"keyword\": {\n \"description\": \"Keyword used in the marketing activity (if applicable).\",\n \"values_sample\": [None],\n },\n \"_synced_at\": {\n \"description\": \"Timestamp indicating when the data was last synced.\",\n \"values_sample\": [\"2024-07-16T21:32:08.452+00:00\"],\n },\n },\n}, I am giving you complete DB and table info in details, user context is bit lengthy so go line by line then answer properly","role":"system"},{"content":"sales trend for last 6 months","role":"user"},{"content":"SELECT CONCAT(order_year, '-', LPAD(order_month, 2, '0')) AS order_date, SUM(COALESCE(net_sales_before_tax, 0)) AS net_sales FROM order_values WHERE TO_DATE(CONCAT(order_year, '-', LPAD(order_month, 2, '0')), 'yyyy-MM') >= DATE_TRUNC('month', ADD_MONTHS(CURRENT_DATE, -6)) AND TO_DATE(CONCAT(order_year, '-', LPAD(order_month, 2, '0')), 'yyyy-MM') < DATE_TRUNC('month', CURRENT_DATE) GROUP BY order_year, order_month ORDER BY order_year, order_month;","role":"assistant"}]} +{"question":"Compare the sales performance during peak hours vs. non-peak hours.","answer":"WITH peak_hours AS (SELECT order_id, SUM(net_sales_before_tax) AS total_net_sales FROM order_values WHERE order_date < DATE_TRUNC('month', CURRENT_DATE) AND order_date >= DATE_TRUNC('month', ADD_MONTHS(CURRENT_DATE, -12)) AND order_hour BETWEEN 18 AND 23 GROUP BY order_id), non_peak_hours AS (SELECT order_id, SUM(net_sales_before_tax) AS total_net_sales FROM order_values WHERE order_date < DATE_TRUNC('month', CURRENT_DATE) AND order_date >= DATE_TRUNC('month', ADD_MONTHS(CURRENT_DATE, -12)) AND order_hour NOT BETWEEN 18 AND 23 GROUP BY order_id) SELECT 'peak_hours' AS time_period, SUM(total_net_sales) AS net_sales FROM peak_hours UNION ALL SELECT 'non_peak_hours' AS time_period, SUM(total_net_sales) AS net_sales FROM non_peak_hours;\",","llama-3-sqlcoder-8b":"SELECT tvh.order_hour, SUM(CASE WHEN tvh.cancellation_status = 'false' THEN tvh.total_sales_after_tax ELSE 0 END) AS total_sales_during_hour, SUM(CASE WHEN tvh.cancellation_status = 'true' THEN tvh.total_sales_after_tax ELSE 0 END) AS total_sales_during_hour_with_cancellations FROM order_values tvh WHERE tvh.order_hour BETWEEN 12 AND 20 GROUP BY tvh.order_hour ORDER BY tvh.order_hour NULLS LAST;","llama-3.1-8b":"SELECT order_id, SUM(total_sales_after_tax) AS peak_hour_sales, SUM(CASE WHEN order_hour BETWEEN 12 AND 16 THEN total_sales_after_tax ELSE 0 END) AS non_peak_hour_sales FROM order_values GROUP BY order_id","context":"TABLE_DESCRIPTIONS = {\n \"order_values\": \"This table contains order information aggregated across multiple sources for an e-commerce brand. The table is unique at an Order ID - SKU ID level. The table includes, but is not limited to, all pricing information (like gross sales, tax, net sales, shipping charge, duties, etc.), information related to the product (like SKU, product id\/title, price, etc.), order related information (timestamp of order), payment information and shipping information.\",\n \"marketing_performance\": \"This table contains detailed marketing performance data for an e-commerce brand, capturing data from various marketing activities and platforms. It provides a comprehensive overview of campaign performance, including spend, clicks, views, impressions, and attributed revenue.\",\n}\n\nCOLUMNS = {\n \"order_values\": {\n \"order_line_item_id\": {\n \"description\": \"Unique identifier for each line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"source\": {\"description\": \"Source of the order\", \"values_sample\": [\"shopify\"]},\n \"order_id\": {\n \"description\": \"Unique identifier for each order\",\n \"values_sample\": [\"shopify_5667598663969\"],\n },\n \"ordered_quantity\": {\n \"description\": \"Quantity of each item of a line item\",\n \"values_sample\": [1],\n },\n \"tax_percent\": {\n \"description\": \"Tax percentage applied to the order\",\n \"values_sample\": [0.17999949556658],\n },\n \"total_price_tax\": {\n \"description\": \"Total price including tax\",\n \"values_sample\": [152.389468594368],\n },\n \"gross_sales_price_before_tax\": {\n \"description\": \"Gross sales price before applying tax\",\n \"values_sample\": [846.610531405632],\n },\n \"total_discount_after_tax\": {\n \"description\": \"Total discount after applying tax\",\n \"values_sample\": [0],\n },\n \"total_discount_tax\": {\n \"description\": \"Total discount amount subject to tax\",\n \"values_sample\": [0],\n },\n \"total_discount_before_tax\": {\n \"description\": \"Total discount before applying tax\",\n \"values_sample\": [0],\n },\n \"total_returns_before_tax\": {\n \"description\": \"Total return\/refund amount before tax\",\n \"values_sample\": [846.610531405632],\n },\n \"net_sales_before_tax\": {\n \"description\": \"Net sales amount before applying tax\",\n \"values_sample\": [0],\n },\n \"item_shipping_charge\": {\n \"description\": \"Shipping charge for an item\",\n \"values_sample\": [0],\n },\n \"item_duties\": {\n \"description\": \"Duties charged for an item\",\n \"values_sample\": [0],\n },\n \"item_additional_feels\": {\n \"description\": \"Additional fees charged for an item\",\n \"values_sample\": [0],\n },\n \"total_tax\": {\"description\": \"Total tax amount\", \"values_sample\": [0]},\n \"total_sales_after_tax\": {\n \"description\": \"Total sales amount after applying tax\",\n \"values_sample\": [0],\n },\n \"sku_id\": {\n \"description\": \"Unique identifier for each stock keeping unit (SKU)\",\n \"values_sample\": [\"shopify_8848983261473_47478863036705\"],\n },\n \"sku_code\": {\n \"description\": \"Code assigned to each stock keeping unit (SKU)\",\n \"values_sample\": [\"BSL-D-SIP-0001\"],\n },\n \"product_category\": {\n \"description\": \"Category of the product\",\n \"values_sample\": [\"Insulated Sipper\"],\n },\n \"product_id\": {\n \"description\": \"Unique identifier for each product\",\n \"values_sample\": [\"shopify_8848983261473\"],\n },\n \"product_title\": {\n \"description\": \"Title of the product\",\n \"values_sample\": [\"Kids Sipper (430 ml)\"],\n },\n \"product_price\": {\n \"description\": \"Price of the product\",\n \"values_sample\": [999],\n },\n \"customer_id\": {\n \"description\": \"Unique identifier for each customer\",\n \"values_sample\": [\"shopify_7694075199777\"],\n },\n \"first_ordered_at\": {\n \"description\": \"Timestamp of the first order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_refund_line_item_id\": {\n \"description\": \"Unique identifier for each refunded line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"order_date_time\": {\n \"description\": \"Date and time of the order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_date\": {\n \"description\": \"Date of the order\",\n \"values_sample\": [\"2024-02-14\"],\n },\n \"order_year\": {\"description\": \"Year of the order\", \"values_sample\": [2024]},\n \"order_quarter\": {\n \"description\": \"Quarter of the year of the order\",\n \"values_sample\": [1],\n },\n \"order_month\": {\"description\": \"Month of the order\", \"values_sample\": [2]},\n \"order_day_of_month\": {\n \"description\": \"Day of the month of the order\",\n \"values_sample\": [14],\n },\n \"order_week\": {\n \"description\": \"Week of the year of the order\",\n \"values_sample\": [7],\n },\n \"order_day_of_week\": {\n \"description\": \"Day of the week of the order\",\n \"values_sample\": [4],\n },\n \"order_hour\": {\n \"description\": \"Hour of the day of the order\",\n \"values_sample\": [16],\n },\n \"order_minute\": {\n \"description\": \"Minute of the hour of the order\",\n \"values_sample\": [0],\n },\n \"order_time\": {\"description\": \"Time of the order\", \"values_sample\": [\"16:00\"]},\n \"cancellation_status\": {\n \"description\": \"Status of order cancellation\",\n \"values_sample\": [\"false\"],\n },\n \"refund_status\": {\n \"description\": \"Status of order refund\",\n \"values_sample\": [\"false\"],\n },\n \"order_status\": {\n \"description\": \"Status of the order\",\n \"values_sample\": [\"unknown\"],\n },\n \"payment_status\": {\n \"description\": \"Status of payment for the order\",\n \"values_sample\": [\"pending\"],\n },\n \"shipping_address_city\": {\n \"description\": \"City of the shipping address\",\n \"values_sample\": [\"Surat\"],\n },\n \"shipping_address_state\": {\n \"description\": \"State of the shipping address\",\n \"values_sample\": [\"Gujarat\"],\n },\n \"shipping_address_country\": {\n \"description\": \"Country of the shipping address\",\n \"values_sample\": [\"India\"],\n },\n }\n}\n \"marketing_performance\": {\n \"marketing_id\": {\n \"description\": \"Unique identifier for each marketing activity.\",\n \"values_sample\": [\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_304143034868101_310419640566194_productAdsamazon_ads_sponsored_products_548576666024459\",\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_405826215303183_448674135385556_productAdsamazon_ads_sponsored_products_511545631860472\",\n ],\n },\n \"activity_date_time\": {\n \"description\": \"Timestamp of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_date\": {\n \"description\": \"Date of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_year\": {\n \"description\": \"Year of the marketing activity.\",\n \"values_sample\": [\"2024\"],\n },\n \"activity_quarter\": {\n \"description\": \"Quarter of the year in which the marketing activity took place.\",\n \"values_sample\": [\"2\"],\n },\n \"activity_month\": {\n \"description\": \"Month of the year in which the marketing activity took place.\",\n \"values_sample\": [\"4\"],\n },\n \"activity_day_of_month\": {\n \"description\": \"Day of the month on which the marketing activity took place.\",\n \"values_sample\": [\"1\"],\n },\n \"activity_week\": {\n \"description\": \"Week of the year in which the marketing activity took place.\",\n \"values_sample\": [\"14\"],\n },\n \"activity_day_of_week\": {\n \"description\": \"Day of the week on which the marketing activity took place (1 for Monday, 7 for Sunday).\",\n \"values_sample\": [\"2\"],\n },\n \"activity_hour\": {\n \"description\": \"Hour of the day in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_minute\": {\n \"description\": \"Minute of the hour in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_time\": {\n \"description\": \"Formatted string representation of the marketing activity time.\",\n \"values_sample\": [\"00:00\"],\n },\n \"channel\": {\n \"description\": \"Marketing channel used for the activity (e.g., Google Ads, Facebook Ads, Email Marketing).\",\n \"values_sample\": [\"sponsored product\"],\n },\n \"vendor\": {\n \"description\": \"Vendor or platform responsible for the marketing activity (e.g., Google, Facebook, Mailchimp).\",\n \"values_sample\": [\"amazon\"],\n },\n \"ad_account_id\": {\n \"description\": \"Unique identifier for the ad account associated with the activity.\",\n \"values_sample\": [\"A5IVEQE4ZPVNJ\"],\n },\n \"ad_account_name\": {\n \"description\": \"Name of the ad account associated with the activity.\",\n \"values_sample\": [\"Famyo\"],\n },\n \"property_name\": {\n \"description\": \"Name of the property or website where the marketing activity was run.\",\n \"values_sample\": [\"amazon sponsored product\"],\n },\n \"network_type\": {\n \"description\": \"Type of advertising network used (e.g., Search, Display, Video).\",\n \"values_sample\": [\"amazon\"],\n },\n \"campaign_id\": {\n \"description\": \"Unique identifier for the marketing campaign.\",\n \"values_sample\": [\n \"304143034868101\",\n \"405826215303183\",\n ],\n },\n \"campaign_name\": {\n \"description\": \"Name of the marketing campaign.\",\n \"values_sample\": [\n \"Football Campaign with presets - B0CT662KJL - 15\/2\/2024 23:09:44\",\n \"Hvs_Tar_SP_Blankets_Genric_Mix\",\n ],\n },\n \"campaign_status\": {\n \"description\": \"Current status of the marketing campaign (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"PAUSED\", \"ENABLED\"],\n },\n \"adset_id\": {\n \"description\": \"Unique identifier for the ad set within the campaign.\",\n \"values_sample\": [\n \"310419640566194\",\n \"448674135385556\",\n ],\n },\n \"adset_name\": {\n \"description\": \"Name of the ad set within the campaign.\",\n \"values_sample\": [\n \"Ad group - 15\/2\/2024 23:09:44\",\n \"Glow Blankets C1\",\n ],\n },\n \"adset_status\": {\n \"description\": \"Current status of the ad set (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"ad_id\": {\n \"description\": \"Unique identifier for the individual ad within the ad set.\",\n \"values_sample\": [\n \"548576666024459\",\n \"511545631860472\",\n ],\n },\n \"ad_name\": {\n \"description\": \"Name of the individual ad.\",\n \"values_sample\": [\"B0CT662KJL\", \"B0CT6428LV\"],\n },\n \"ad_description\": {\n \"description\": \"Description of the individual ad.\",\n \"values_sample\": [\n \"FM_GIDB_Football\",\n \"FM_GIDB_Astronaut\",\n ],\n },\n \"ad_status\": {\n \"description\": \"Current status of the individual ad (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"total_spend\": {\n \"description\": \"Total amount spent on the marketing activity.\",\n \"values_sample\": [\"29.15\", \"110.15\"],\n },\n \"total_clicks\": {\n \"description\": \"Total number of clicks generated by the marketing activity.\",\n \"values_sample\": [\"3\", \"7\"],\n },\n \"total_views\": {\n \"description\": \"Total number of times the marketing activity was viewed.\",\n \"values_sample\": [\"306\", \"1404\"],\n },\n \"total_impressions\": {\n \"description\": \"Total number of times the marketing activity was displayed.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_orders\": {\n \"description\": \"Number of orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_revenue\": {\n \"description\": \"Revenue generated from orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"keyword\": {\n \"description\": \"Keyword used in the marketing activity (if applicable).\",\n \"values_sample\": [None],\n },\n \"_synced_at\": {\n \"description\": \"Timestamp indicating when the data was last synced.\",\n \"values_sample\": [\"2024-07-16T21:32:08.452+00:00\"],\n },\n },\n}","messages":[{"content":"You are an advanced AI trained to generate SQL queries based\n on a given context. Your task is to write an SQL query that accurately \n retrieves the requested data from the provided table schema. Do not answer with any explanations -- just the SQL query.\n Output only plain text. Do not output markdown. \n Please ensure that the SQL query matches the exact table name and column names\n specified in the TABLE_DESCRIPTIONS = {\n \"order_values\": \"This table contains order information aggregated across multiple sources for an e-commerce brand. The table is unique at an Order ID - SKU ID level. The table includes, but is not limited to, all pricing information (like gross sales, tax, net sales, shipping charge, duties, etc.), information related to the product (like SKU, product id\/title, price, etc.), order related information (timestamp of order), payment information and shipping information.\",\n \"marketing_performance\": \"This table contains detailed marketing performance data for an e-commerce brand, capturing data from various marketing activities and platforms. It provides a comprehensive overview of campaign performance, including spend, clicks, views, impressions, and attributed revenue.\",\n}\n\nCOLUMNS = {\n \"order_values\": {\n \"order_line_item_id\": {\n \"description\": \"Unique identifier for each line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"source\": {\"description\": \"Source of the order\", \"values_sample\": [\"shopify\"]},\n \"order_id\": {\n \"description\": \"Unique identifier for each order\",\n \"values_sample\": [\"shopify_5667598663969\"],\n },\n \"ordered_quantity\": {\n \"description\": \"Quantity of each item of a line item\",\n \"values_sample\": [1],\n },\n \"tax_percent\": {\n \"description\": \"Tax percentage applied to the order\",\n \"values_sample\": [0.17999949556658],\n },\n \"total_price_tax\": {\n \"description\": \"Total price including tax\",\n \"values_sample\": [152.389468594368],\n },\n \"gross_sales_price_before_tax\": {\n \"description\": \"Gross sales price before applying tax\",\n \"values_sample\": [846.610531405632],\n },\n \"total_discount_after_tax\": {\n \"description\": \"Total discount after applying tax\",\n \"values_sample\": [0],\n },\n \"total_discount_tax\": {\n \"description\": \"Total discount amount subject to tax\",\n \"values_sample\": [0],\n },\n \"total_discount_before_tax\": {\n \"description\": \"Total discount before applying tax\",\n \"values_sample\": [0],\n },\n \"total_returns_before_tax\": {\n \"description\": \"Total return\/refund amount before tax\",\n \"values_sample\": [846.610531405632],\n },\n \"net_sales_before_tax\": {\n \"description\": \"Net sales amount before applying tax\",\n \"values_sample\": [0],\n },\n \"item_shipping_charge\": {\n \"description\": \"Shipping charge for an item\",\n \"values_sample\": [0],\n },\n \"item_duties\": {\n \"description\": \"Duties charged for an item\",\n \"values_sample\": [0],\n },\n \"item_additional_feels\": {\n \"description\": \"Additional fees charged for an item\",\n \"values_sample\": [0],\n },\n \"total_tax\": {\"description\": \"Total tax amount\", \"values_sample\": [0]},\n \"total_sales_after_tax\": {\n \"description\": \"Total sales amount after applying tax\",\n \"values_sample\": [0],\n },\n \"sku_id\": {\n \"description\": \"Unique identifier for each stock keeping unit (SKU)\",\n \"values_sample\": [\"shopify_8848983261473_47478863036705\"],\n },\n \"sku_code\": {\n \"description\": \"Code assigned to each stock keeping unit (SKU)\",\n \"values_sample\": [\"BSL-D-SIP-0001\"],\n },\n \"product_category\": {\n \"description\": \"Category of the product\",\n \"values_sample\": [\"Insulated Sipper\"],\n },\n \"product_id\": {\n \"description\": \"Unique identifier for each product\",\n \"values_sample\": [\"shopify_8848983261473\"],\n },\n \"product_title\": {\n \"description\": \"Title of the product\",\n \"values_sample\": [\"Kids Sipper (430 ml)\"],\n },\n \"product_price\": {\n \"description\": \"Price of the product\",\n \"values_sample\": [999],\n },\n \"customer_id\": {\n \"description\": \"Unique identifier for each customer\",\n \"values_sample\": [\"shopify_7694075199777\"],\n },\n \"first_ordered_at\": {\n \"description\": \"Timestamp of the first order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_refund_line_item_id\": {\n \"description\": \"Unique identifier for each refunded line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"order_date_time\": {\n \"description\": \"Date and time of the order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_date\": {\n \"description\": \"Date of the order\",\n \"values_sample\": [\"2024-02-14\"],\n },\n \"order_year\": {\"description\": \"Year of the order\", \"values_sample\": [2024]},\n \"order_quarter\": {\n \"description\": \"Quarter of the year of the order\",\n \"values_sample\": [1],\n },\n \"order_month\": {\"description\": \"Month of the order\", \"values_sample\": [2]},\n \"order_day_of_month\": {\n \"description\": \"Day of the month of the order\",\n \"values_sample\": [14],\n },\n \"order_week\": {\n \"description\": \"Week of the year of the order\",\n \"values_sample\": [7],\n },\n \"order_day_of_week\": {\n \"description\": \"Day of the week of the order\",\n \"values_sample\": [4],\n },\n \"order_hour\": {\n \"description\": \"Hour of the day of the order\",\n \"values_sample\": [16],\n },\n \"order_minute\": {\n \"description\": \"Minute of the hour of the order\",\n \"values_sample\": [0],\n },\n \"order_time\": {\"description\": \"Time of the order\", \"values_sample\": [\"16:00\"]},\n \"cancellation_status\": {\n \"description\": \"Status of order cancellation\",\n \"values_sample\": [\"false\"],\n },\n \"refund_status\": {\n \"description\": \"Status of order refund\",\n \"values_sample\": [\"false\"],\n },\n \"order_status\": {\n \"description\": \"Status of the order\",\n \"values_sample\": [\"unknown\"],\n },\n \"payment_status\": {\n \"description\": \"Status of payment for the order\",\n \"values_sample\": [\"pending\"],\n },\n \"shipping_address_city\": {\n \"description\": \"City of the shipping address\",\n \"values_sample\": [\"Surat\"],\n },\n \"shipping_address_state\": {\n \"description\": \"State of the shipping address\",\n \"values_sample\": [\"Gujarat\"],\n },\n \"shipping_address_country\": {\n \"description\": \"Country of the shipping address\",\n \"values_sample\": [\"India\"],\n },\n }\n}\n \"marketing_performance\": {\n \"marketing_id\": {\n \"description\": \"Unique identifier for each marketing activity.\",\n \"values_sample\": [\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_304143034868101_310419640566194_productAdsamazon_ads_sponsored_products_548576666024459\",\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_405826215303183_448674135385556_productAdsamazon_ads_sponsored_products_511545631860472\",\n ],\n },\n \"activity_date_time\": {\n \"description\": \"Timestamp of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_date\": {\n \"description\": \"Date of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_year\": {\n \"description\": \"Year of the marketing activity.\",\n \"values_sample\": [\"2024\"],\n },\n \"activity_quarter\": {\n \"description\": \"Quarter of the year in which the marketing activity took place.\",\n \"values_sample\": [\"2\"],\n },\n \"activity_month\": {\n \"description\": \"Month of the year in which the marketing activity took place.\",\n \"values_sample\": [\"4\"],\n },\n \"activity_day_of_month\": {\n \"description\": \"Day of the month on which the marketing activity took place.\",\n \"values_sample\": [\"1\"],\n },\n \"activity_week\": {\n \"description\": \"Week of the year in which the marketing activity took place.\",\n \"values_sample\": [\"14\"],\n },\n \"activity_day_of_week\": {\n \"description\": \"Day of the week on which the marketing activity took place (1 for Monday, 7 for Sunday).\",\n \"values_sample\": [\"2\"],\n },\n \"activity_hour\": {\n \"description\": \"Hour of the day in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_minute\": {\n \"description\": \"Minute of the hour in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_time\": {\n \"description\": \"Formatted string representation of the marketing activity time.\",\n \"values_sample\": [\"00:00\"],\n },\n \"channel\": {\n \"description\": \"Marketing channel used for the activity (e.g., Google Ads, Facebook Ads, Email Marketing).\",\n \"values_sample\": [\"sponsored product\"],\n },\n \"vendor\": {\n \"description\": \"Vendor or platform responsible for the marketing activity (e.g., Google, Facebook, Mailchimp).\",\n \"values_sample\": [\"amazon\"],\n },\n \"ad_account_id\": {\n \"description\": \"Unique identifier for the ad account associated with the activity.\",\n \"values_sample\": [\"A5IVEQE4ZPVNJ\"],\n },\n \"ad_account_name\": {\n \"description\": \"Name of the ad account associated with the activity.\",\n \"values_sample\": [\"Famyo\"],\n },\n \"property_name\": {\n \"description\": \"Name of the property or website where the marketing activity was run.\",\n \"values_sample\": [\"amazon sponsored product\"],\n },\n \"network_type\": {\n \"description\": \"Type of advertising network used (e.g., Search, Display, Video).\",\n \"values_sample\": [\"amazon\"],\n },\n \"campaign_id\": {\n \"description\": \"Unique identifier for the marketing campaign.\",\n \"values_sample\": [\n \"304143034868101\",\n \"405826215303183\",\n ],\n },\n \"campaign_name\": {\n \"description\": \"Name of the marketing campaign.\",\n \"values_sample\": [\n \"Football Campaign with presets - B0CT662KJL - 15\/2\/2024 23:09:44\",\n \"Hvs_Tar_SP_Blankets_Genric_Mix\",\n ],\n },\n \"campaign_status\": {\n \"description\": \"Current status of the marketing campaign (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"PAUSED\", \"ENABLED\"],\n },\n \"adset_id\": {\n \"description\": \"Unique identifier for the ad set within the campaign.\",\n \"values_sample\": [\n \"310419640566194\",\n \"448674135385556\",\n ],\n },\n \"adset_name\": {\n \"description\": \"Name of the ad set within the campaign.\",\n \"values_sample\": [\n \"Ad group - 15\/2\/2024 23:09:44\",\n \"Glow Blankets C1\",\n ],\n },\n \"adset_status\": {\n \"description\": \"Current status of the ad set (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"ad_id\": {\n \"description\": \"Unique identifier for the individual ad within the ad set.\",\n \"values_sample\": [\n \"548576666024459\",\n \"511545631860472\",\n ],\n },\n \"ad_name\": {\n \"description\": \"Name of the individual ad.\",\n \"values_sample\": [\"B0CT662KJL\", \"B0CT6428LV\"],\n },\n \"ad_description\": {\n \"description\": \"Description of the individual ad.\",\n \"values_sample\": [\n \"FM_GIDB_Football\",\n \"FM_GIDB_Astronaut\",\n ],\n },\n \"ad_status\": {\n \"description\": \"Current status of the individual ad (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"total_spend\": {\n \"description\": \"Total amount spent on the marketing activity.\",\n \"values_sample\": [\"29.15\", \"110.15\"],\n },\n \"total_clicks\": {\n \"description\": \"Total number of clicks generated by the marketing activity.\",\n \"values_sample\": [\"3\", \"7\"],\n },\n \"total_views\": {\n \"description\": \"Total number of times the marketing activity was viewed.\",\n \"values_sample\": [\"306\", \"1404\"],\n },\n \"total_impressions\": {\n \"description\": \"Total number of times the marketing activity was displayed.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_orders\": {\n \"description\": \"Number of orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_revenue\": {\n \"description\": \"Revenue generated from orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"keyword\": {\n \"description\": \"Keyword used in the marketing activity (if applicable).\",\n \"values_sample\": [None],\n },\n \"_synced_at\": {\n \"description\": \"Timestamp indicating when the data was last synced.\",\n \"values_sample\": [\"2024-07-16T21:32:08.452+00:00\"],\n },\n },\n}, I am giving you complete DB and table info in details, user context is bit lengthy so go line by line then answer properly","role":"system"},{"content":"Compare the sales performance during peak hours vs. non-peak hours.","role":"user"},{"content":"WITH peak_hours AS (SELECT order_id, SUM(net_sales_before_tax) AS total_net_sales FROM order_values WHERE order_date < DATE_TRUNC('month', CURRENT_DATE) AND order_date >= DATE_TRUNC('month', ADD_MONTHS(CURRENT_DATE, -12)) AND order_hour BETWEEN 18 AND 23 GROUP BY order_id), non_peak_hours AS (SELECT order_id, SUM(net_sales_before_tax) AS total_net_sales FROM order_values WHERE order_date < DATE_TRUNC('month', CURRENT_DATE) AND order_date >= DATE_TRUNC('month', ADD_MONTHS(CURRENT_DATE, -12)) AND order_hour NOT BETWEEN 18 AND 23 GROUP BY order_id) SELECT 'peak_hours' AS time_period, SUM(total_net_sales) AS net_sales FROM peak_hours UNION ALL SELECT 'non_peak_hours' AS time_period, SUM(total_net_sales) AS net_sales FROM non_peak_hours;\",","role":"assistant"}]} +{"question":"What is the overall CTR for all campaigns in the last 3 months?","answer":"SELECT COALESCE(TRY_DIVIDE(SUM(total_clicks), SUM(total_impressions)), 0) AS overall_ctr FROM marketing_performance WHERE activity_date >= DATE_TRUNC('month', CURRENT_DATE - INTERVAL '3 month') AND activity_date < DATE_TRUNC('month', CURRENT_DATE);","llama-3-sqlcoder-8b":"SELECT SUM(t.total_clicks) \/ NULLIF(SUM(t.total_impressions), 0) AS overall_ctr FROM marketing_performance t WHERE t.activity_date >= (CURRENT_DATE - INTERVAL '3 months');","llama-3.1-8b":"SELECT AVG(total_clicks) \/ AVG(total_impressions) AS ctr FROM marketing_performance WHERE activity_month > DATE_SUB(CURRENT_DATE, INTERVAL 3 MONTH)","context":"TABLE_DESCRIPTIONS = {\n \"order_values\": \"This table contains order information aggregated across multiple sources for an e-commerce brand. The table is unique at an Order ID - SKU ID level. The table includes, but is not limited to, all pricing information (like gross sales, tax, net sales, shipping charge, duties, etc.), information related to the product (like SKU, product id\/title, price, etc.), order related information (timestamp of order), payment information and shipping information.\",\n \"marketing_performance\": \"This table contains detailed marketing performance data for an e-commerce brand, capturing data from various marketing activities and platforms. It provides a comprehensive overview of campaign performance, including spend, clicks, views, impressions, and attributed revenue.\",\n}\n\nCOLUMNS = {\n \"order_values\": {\n \"order_line_item_id\": {\n \"description\": \"Unique identifier for each line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"source\": {\"description\": \"Source of the order\", \"values_sample\": [\"shopify\"]},\n \"order_id\": {\n \"description\": \"Unique identifier for each order\",\n \"values_sample\": [\"shopify_5667598663969\"],\n },\n \"ordered_quantity\": {\n \"description\": \"Quantity of each item of a line item\",\n \"values_sample\": [1],\n },\n \"tax_percent\": {\n \"description\": \"Tax percentage applied to the order\",\n \"values_sample\": [0.17999949556658],\n },\n \"total_price_tax\": {\n \"description\": \"Total price including tax\",\n \"values_sample\": [152.389468594368],\n },\n \"gross_sales_price_before_tax\": {\n \"description\": \"Gross sales price before applying tax\",\n \"values_sample\": [846.610531405632],\n },\n \"total_discount_after_tax\": {\n \"description\": \"Total discount after applying tax\",\n \"values_sample\": [0],\n },\n \"total_discount_tax\": {\n \"description\": \"Total discount amount subject to tax\",\n \"values_sample\": [0],\n },\n \"total_discount_before_tax\": {\n \"description\": \"Total discount before applying tax\",\n \"values_sample\": [0],\n },\n \"total_returns_before_tax\": {\n \"description\": \"Total return\/refund amount before tax\",\n \"values_sample\": [846.610531405632],\n },\n \"net_sales_before_tax\": {\n \"description\": \"Net sales amount before applying tax\",\n \"values_sample\": [0],\n },\n \"item_shipping_charge\": {\n \"description\": \"Shipping charge for an item\",\n \"values_sample\": [0],\n },\n \"item_duties\": {\n \"description\": \"Duties charged for an item\",\n \"values_sample\": [0],\n },\n \"item_additional_feels\": {\n \"description\": \"Additional fees charged for an item\",\n \"values_sample\": [0],\n },\n \"total_tax\": {\"description\": \"Total tax amount\", \"values_sample\": [0]},\n \"total_sales_after_tax\": {\n \"description\": \"Total sales amount after applying tax\",\n \"values_sample\": [0],\n },\n \"sku_id\": {\n \"description\": \"Unique identifier for each stock keeping unit (SKU)\",\n \"values_sample\": [\"shopify_8848983261473_47478863036705\"],\n },\n \"sku_code\": {\n \"description\": \"Code assigned to each stock keeping unit (SKU)\",\n \"values_sample\": [\"BSL-D-SIP-0001\"],\n },\n \"product_category\": {\n \"description\": \"Category of the product\",\n \"values_sample\": [\"Insulated Sipper\"],\n },\n \"product_id\": {\n \"description\": \"Unique identifier for each product\",\n \"values_sample\": [\"shopify_8848983261473\"],\n },\n \"product_title\": {\n \"description\": \"Title of the product\",\n \"values_sample\": [\"Kids Sipper (430 ml)\"],\n },\n \"product_price\": {\n \"description\": \"Price of the product\",\n \"values_sample\": [999],\n },\n \"customer_id\": {\n \"description\": \"Unique identifier for each customer\",\n \"values_sample\": [\"shopify_7694075199777\"],\n },\n \"first_ordered_at\": {\n \"description\": \"Timestamp of the first order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_refund_line_item_id\": {\n \"description\": \"Unique identifier for each refunded line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"order_date_time\": {\n \"description\": \"Date and time of the order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_date\": {\n \"description\": \"Date of the order\",\n \"values_sample\": [\"2024-02-14\"],\n },\n \"order_year\": {\"description\": \"Year of the order\", \"values_sample\": [2024]},\n \"order_quarter\": {\n \"description\": \"Quarter of the year of the order\",\n \"values_sample\": [1],\n },\n \"order_month\": {\"description\": \"Month of the order\", \"values_sample\": [2]},\n \"order_day_of_month\": {\n \"description\": \"Day of the month of the order\",\n \"values_sample\": [14],\n },\n \"order_week\": {\n \"description\": \"Week of the year of the order\",\n \"values_sample\": [7],\n },\n \"order_day_of_week\": {\n \"description\": \"Day of the week of the order\",\n \"values_sample\": [4],\n },\n \"order_hour\": {\n \"description\": \"Hour of the day of the order\",\n \"values_sample\": [16],\n },\n \"order_minute\": {\n \"description\": \"Minute of the hour of the order\",\n \"values_sample\": [0],\n },\n \"order_time\": {\"description\": \"Time of the order\", \"values_sample\": [\"16:00\"]},\n \"cancellation_status\": {\n \"description\": \"Status of order cancellation\",\n \"values_sample\": [\"false\"],\n },\n \"refund_status\": {\n \"description\": \"Status of order refund\",\n \"values_sample\": [\"false\"],\n },\n \"order_status\": {\n \"description\": \"Status of the order\",\n \"values_sample\": [\"unknown\"],\n },\n \"payment_status\": {\n \"description\": \"Status of payment for the order\",\n \"values_sample\": [\"pending\"],\n },\n \"shipping_address_city\": {\n \"description\": \"City of the shipping address\",\n \"values_sample\": [\"Surat\"],\n },\n \"shipping_address_state\": {\n \"description\": \"State of the shipping address\",\n \"values_sample\": [\"Gujarat\"],\n },\n \"shipping_address_country\": {\n \"description\": \"Country of the shipping address\",\n \"values_sample\": [\"India\"],\n },\n }\n}\n \"marketing_performance\": {\n \"marketing_id\": {\n \"description\": \"Unique identifier for each marketing activity.\",\n \"values_sample\": [\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_304143034868101_310419640566194_productAdsamazon_ads_sponsored_products_548576666024459\",\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_405826215303183_448674135385556_productAdsamazon_ads_sponsored_products_511545631860472\",\n ],\n },\n \"activity_date_time\": {\n \"description\": \"Timestamp of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_date\": {\n \"description\": \"Date of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_year\": {\n \"description\": \"Year of the marketing activity.\",\n \"values_sample\": [\"2024\"],\n },\n \"activity_quarter\": {\n \"description\": \"Quarter of the year in which the marketing activity took place.\",\n \"values_sample\": [\"2\"],\n },\n \"activity_month\": {\n \"description\": \"Month of the year in which the marketing activity took place.\",\n \"values_sample\": [\"4\"],\n },\n \"activity_day_of_month\": {\n \"description\": \"Day of the month on which the marketing activity took place.\",\n \"values_sample\": [\"1\"],\n },\n \"activity_week\": {\n \"description\": \"Week of the year in which the marketing activity took place.\",\n \"values_sample\": [\"14\"],\n },\n \"activity_day_of_week\": {\n \"description\": \"Day of the week on which the marketing activity took place (1 for Monday, 7 for Sunday).\",\n \"values_sample\": [\"2\"],\n },\n \"activity_hour\": {\n \"description\": \"Hour of the day in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_minute\": {\n \"description\": \"Minute of the hour in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_time\": {\n \"description\": \"Formatted string representation of the marketing activity time.\",\n \"values_sample\": [\"00:00\"],\n },\n \"channel\": {\n \"description\": \"Marketing channel used for the activity (e.g., Google Ads, Facebook Ads, Email Marketing).\",\n \"values_sample\": [\"sponsored product\"],\n },\n \"vendor\": {\n \"description\": \"Vendor or platform responsible for the marketing activity (e.g., Google, Facebook, Mailchimp).\",\n \"values_sample\": [\"amazon\"],\n },\n \"ad_account_id\": {\n \"description\": \"Unique identifier for the ad account associated with the activity.\",\n \"values_sample\": [\"A5IVEQE4ZPVNJ\"],\n },\n \"ad_account_name\": {\n \"description\": \"Name of the ad account associated with the activity.\",\n \"values_sample\": [\"Famyo\"],\n },\n \"property_name\": {\n \"description\": \"Name of the property or website where the marketing activity was run.\",\n \"values_sample\": [\"amazon sponsored product\"],\n },\n \"network_type\": {\n \"description\": \"Type of advertising network used (e.g., Search, Display, Video).\",\n \"values_sample\": [\"amazon\"],\n },\n \"campaign_id\": {\n \"description\": \"Unique identifier for the marketing campaign.\",\n \"values_sample\": [\n \"304143034868101\",\n \"405826215303183\",\n ],\n },\n \"campaign_name\": {\n \"description\": \"Name of the marketing campaign.\",\n \"values_sample\": [\n \"Football Campaign with presets - B0CT662KJL - 15\/2\/2024 23:09:44\",\n \"Hvs_Tar_SP_Blankets_Genric_Mix\",\n ],\n },\n \"campaign_status\": {\n \"description\": \"Current status of the marketing campaign (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"PAUSED\", \"ENABLED\"],\n },\n \"adset_id\": {\n \"description\": \"Unique identifier for the ad set within the campaign.\",\n \"values_sample\": [\n \"310419640566194\",\n \"448674135385556\",\n ],\n },\n \"adset_name\": {\n \"description\": \"Name of the ad set within the campaign.\",\n \"values_sample\": [\n \"Ad group - 15\/2\/2024 23:09:44\",\n \"Glow Blankets C1\",\n ],\n },\n \"adset_status\": {\n \"description\": \"Current status of the ad set (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"ad_id\": {\n \"description\": \"Unique identifier for the individual ad within the ad set.\",\n \"values_sample\": [\n \"548576666024459\",\n \"511545631860472\",\n ],\n },\n \"ad_name\": {\n \"description\": \"Name of the individual ad.\",\n \"values_sample\": [\"B0CT662KJL\", \"B0CT6428LV\"],\n },\n \"ad_description\": {\n \"description\": \"Description of the individual ad.\",\n \"values_sample\": [\n \"FM_GIDB_Football\",\n \"FM_GIDB_Astronaut\",\n ],\n },\n \"ad_status\": {\n \"description\": \"Current status of the individual ad (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"total_spend\": {\n \"description\": \"Total amount spent on the marketing activity.\",\n \"values_sample\": [\"29.15\", \"110.15\"],\n },\n \"total_clicks\": {\n \"description\": \"Total number of clicks generated by the marketing activity.\",\n \"values_sample\": [\"3\", \"7\"],\n },\n \"total_views\": {\n \"description\": \"Total number of times the marketing activity was viewed.\",\n \"values_sample\": [\"306\", \"1404\"],\n },\n \"total_impressions\": {\n \"description\": \"Total number of times the marketing activity was displayed.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_orders\": {\n \"description\": \"Number of orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_revenue\": {\n \"description\": \"Revenue generated from orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"keyword\": {\n \"description\": \"Keyword used in the marketing activity (if applicable).\",\n \"values_sample\": [None],\n },\n \"_synced_at\": {\n \"description\": \"Timestamp indicating when the data was last synced.\",\n \"values_sample\": [\"2024-07-16T21:32:08.452+00:00\"],\n },\n },\n}","messages":[{"content":"You are an advanced AI trained to generate SQL queries based\n on a given context. Your task is to write an SQL query that accurately \n retrieves the requested data from the provided table schema. Do not answer with any explanations -- just the SQL query.\n Output only plain text. Do not output markdown. \n Please ensure that the SQL query matches the exact table name and column names\n specified in the TABLE_DESCRIPTIONS = {\n \"order_values\": \"This table contains order information aggregated across multiple sources for an e-commerce brand. The table is unique at an Order ID - SKU ID level. The table includes, but is not limited to, all pricing information (like gross sales, tax, net sales, shipping charge, duties, etc.), information related to the product (like SKU, product id\/title, price, etc.), order related information (timestamp of order), payment information and shipping information.\",\n \"marketing_performance\": \"This table contains detailed marketing performance data for an e-commerce brand, capturing data from various marketing activities and platforms. It provides a comprehensive overview of campaign performance, including spend, clicks, views, impressions, and attributed revenue.\",\n}\n\nCOLUMNS = {\n \"order_values\": {\n \"order_line_item_id\": {\n \"description\": \"Unique identifier for each line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"source\": {\"description\": \"Source of the order\", \"values_sample\": [\"shopify\"]},\n \"order_id\": {\n \"description\": \"Unique identifier for each order\",\n \"values_sample\": [\"shopify_5667598663969\"],\n },\n \"ordered_quantity\": {\n \"description\": \"Quantity of each item of a line item\",\n \"values_sample\": [1],\n },\n \"tax_percent\": {\n \"description\": \"Tax percentage applied to the order\",\n \"values_sample\": [0.17999949556658],\n },\n \"total_price_tax\": {\n \"description\": \"Total price including tax\",\n \"values_sample\": [152.389468594368],\n },\n \"gross_sales_price_before_tax\": {\n \"description\": \"Gross sales price before applying tax\",\n \"values_sample\": [846.610531405632],\n },\n \"total_discount_after_tax\": {\n \"description\": \"Total discount after applying tax\",\n \"values_sample\": [0],\n },\n \"total_discount_tax\": {\n \"description\": \"Total discount amount subject to tax\",\n \"values_sample\": [0],\n },\n \"total_discount_before_tax\": {\n \"description\": \"Total discount before applying tax\",\n \"values_sample\": [0],\n },\n \"total_returns_before_tax\": {\n \"description\": \"Total return\/refund amount before tax\",\n \"values_sample\": [846.610531405632],\n },\n \"net_sales_before_tax\": {\n \"description\": \"Net sales amount before applying tax\",\n \"values_sample\": [0],\n },\n \"item_shipping_charge\": {\n \"description\": \"Shipping charge for an item\",\n \"values_sample\": [0],\n },\n \"item_duties\": {\n \"description\": \"Duties charged for an item\",\n \"values_sample\": [0],\n },\n \"item_additional_feels\": {\n \"description\": \"Additional fees charged for an item\",\n \"values_sample\": [0],\n },\n \"total_tax\": {\"description\": \"Total tax amount\", \"values_sample\": [0]},\n \"total_sales_after_tax\": {\n \"description\": \"Total sales amount after applying tax\",\n \"values_sample\": [0],\n },\n \"sku_id\": {\n \"description\": \"Unique identifier for each stock keeping unit (SKU)\",\n \"values_sample\": [\"shopify_8848983261473_47478863036705\"],\n },\n \"sku_code\": {\n \"description\": \"Code assigned to each stock keeping unit (SKU)\",\n \"values_sample\": [\"BSL-D-SIP-0001\"],\n },\n \"product_category\": {\n \"description\": \"Category of the product\",\n \"values_sample\": [\"Insulated Sipper\"],\n },\n \"product_id\": {\n \"description\": \"Unique identifier for each product\",\n \"values_sample\": [\"shopify_8848983261473\"],\n },\n \"product_title\": {\n \"description\": \"Title of the product\",\n \"values_sample\": [\"Kids Sipper (430 ml)\"],\n },\n \"product_price\": {\n \"description\": \"Price of the product\",\n \"values_sample\": [999],\n },\n \"customer_id\": {\n \"description\": \"Unique identifier for each customer\",\n \"values_sample\": [\"shopify_7694075199777\"],\n },\n \"first_ordered_at\": {\n \"description\": \"Timestamp of the first order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_refund_line_item_id\": {\n \"description\": \"Unique identifier for each refunded line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"order_date_time\": {\n \"description\": \"Date and time of the order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_date\": {\n \"description\": \"Date of the order\",\n \"values_sample\": [\"2024-02-14\"],\n },\n \"order_year\": {\"description\": \"Year of the order\", \"values_sample\": [2024]},\n \"order_quarter\": {\n \"description\": \"Quarter of the year of the order\",\n \"values_sample\": [1],\n },\n \"order_month\": {\"description\": \"Month of the order\", \"values_sample\": [2]},\n \"order_day_of_month\": {\n \"description\": \"Day of the month of the order\",\n \"values_sample\": [14],\n },\n \"order_week\": {\n \"description\": \"Week of the year of the order\",\n \"values_sample\": [7],\n },\n \"order_day_of_week\": {\n \"description\": \"Day of the week of the order\",\n \"values_sample\": [4],\n },\n \"order_hour\": {\n \"description\": \"Hour of the day of the order\",\n \"values_sample\": [16],\n },\n \"order_minute\": {\n \"description\": \"Minute of the hour of the order\",\n \"values_sample\": [0],\n },\n \"order_time\": {\"description\": \"Time of the order\", \"values_sample\": [\"16:00\"]},\n \"cancellation_status\": {\n \"description\": \"Status of order cancellation\",\n \"values_sample\": [\"false\"],\n },\n \"refund_status\": {\n \"description\": \"Status of order refund\",\n \"values_sample\": [\"false\"],\n },\n \"order_status\": {\n \"description\": \"Status of the order\",\n \"values_sample\": [\"unknown\"],\n },\n \"payment_status\": {\n \"description\": \"Status of payment for the order\",\n \"values_sample\": [\"pending\"],\n },\n \"shipping_address_city\": {\n \"description\": \"City of the shipping address\",\n \"values_sample\": [\"Surat\"],\n },\n \"shipping_address_state\": {\n \"description\": \"State of the shipping address\",\n \"values_sample\": [\"Gujarat\"],\n },\n \"shipping_address_country\": {\n \"description\": \"Country of the shipping address\",\n \"values_sample\": [\"India\"],\n },\n }\n}\n \"marketing_performance\": {\n \"marketing_id\": {\n \"description\": \"Unique identifier for each marketing activity.\",\n \"values_sample\": [\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_304143034868101_310419640566194_productAdsamazon_ads_sponsored_products_548576666024459\",\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_405826215303183_448674135385556_productAdsamazon_ads_sponsored_products_511545631860472\",\n ],\n },\n \"activity_date_time\": {\n \"description\": \"Timestamp of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_date\": {\n \"description\": \"Date of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_year\": {\n \"description\": \"Year of the marketing activity.\",\n \"values_sample\": [\"2024\"],\n },\n \"activity_quarter\": {\n \"description\": \"Quarter of the year in which the marketing activity took place.\",\n \"values_sample\": [\"2\"],\n },\n \"activity_month\": {\n \"description\": \"Month of the year in which the marketing activity took place.\",\n \"values_sample\": [\"4\"],\n },\n \"activity_day_of_month\": {\n \"description\": \"Day of the month on which the marketing activity took place.\",\n \"values_sample\": [\"1\"],\n },\n \"activity_week\": {\n \"description\": \"Week of the year in which the marketing activity took place.\",\n \"values_sample\": [\"14\"],\n },\n \"activity_day_of_week\": {\n \"description\": \"Day of the week on which the marketing activity took place (1 for Monday, 7 for Sunday).\",\n \"values_sample\": [\"2\"],\n },\n \"activity_hour\": {\n \"description\": \"Hour of the day in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_minute\": {\n \"description\": \"Minute of the hour in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_time\": {\n \"description\": \"Formatted string representation of the marketing activity time.\",\n \"values_sample\": [\"00:00\"],\n },\n \"channel\": {\n \"description\": \"Marketing channel used for the activity (e.g., Google Ads, Facebook Ads, Email Marketing).\",\n \"values_sample\": [\"sponsored product\"],\n },\n \"vendor\": {\n \"description\": \"Vendor or platform responsible for the marketing activity (e.g., Google, Facebook, Mailchimp).\",\n \"values_sample\": [\"amazon\"],\n },\n \"ad_account_id\": {\n \"description\": \"Unique identifier for the ad account associated with the activity.\",\n \"values_sample\": [\"A5IVEQE4ZPVNJ\"],\n },\n \"ad_account_name\": {\n \"description\": \"Name of the ad account associated with the activity.\",\n \"values_sample\": [\"Famyo\"],\n },\n \"property_name\": {\n \"description\": \"Name of the property or website where the marketing activity was run.\",\n \"values_sample\": [\"amazon sponsored product\"],\n },\n \"network_type\": {\n \"description\": \"Type of advertising network used (e.g., Search, Display, Video).\",\n \"values_sample\": [\"amazon\"],\n },\n \"campaign_id\": {\n \"description\": \"Unique identifier for the marketing campaign.\",\n \"values_sample\": [\n \"304143034868101\",\n \"405826215303183\",\n ],\n },\n \"campaign_name\": {\n \"description\": \"Name of the marketing campaign.\",\n \"values_sample\": [\n \"Football Campaign with presets - B0CT662KJL - 15\/2\/2024 23:09:44\",\n \"Hvs_Tar_SP_Blankets_Genric_Mix\",\n ],\n },\n \"campaign_status\": {\n \"description\": \"Current status of the marketing campaign (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"PAUSED\", \"ENABLED\"],\n },\n \"adset_id\": {\n \"description\": \"Unique identifier for the ad set within the campaign.\",\n \"values_sample\": [\n \"310419640566194\",\n \"448674135385556\",\n ],\n },\n \"adset_name\": {\n \"description\": \"Name of the ad set within the campaign.\",\n \"values_sample\": [\n \"Ad group - 15\/2\/2024 23:09:44\",\n \"Glow Blankets C1\",\n ],\n },\n \"adset_status\": {\n \"description\": \"Current status of the ad set (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"ad_id\": {\n \"description\": \"Unique identifier for the individual ad within the ad set.\",\n \"values_sample\": [\n \"548576666024459\",\n \"511545631860472\",\n ],\n },\n \"ad_name\": {\n \"description\": \"Name of the individual ad.\",\n \"values_sample\": [\"B0CT662KJL\", \"B0CT6428LV\"],\n },\n \"ad_description\": {\n \"description\": \"Description of the individual ad.\",\n \"values_sample\": [\n \"FM_GIDB_Football\",\n \"FM_GIDB_Astronaut\",\n ],\n },\n \"ad_status\": {\n \"description\": \"Current status of the individual ad (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"total_spend\": {\n \"description\": \"Total amount spent on the marketing activity.\",\n \"values_sample\": [\"29.15\", \"110.15\"],\n },\n \"total_clicks\": {\n \"description\": \"Total number of clicks generated by the marketing activity.\",\n \"values_sample\": [\"3\", \"7\"],\n },\n \"total_views\": {\n \"description\": \"Total number of times the marketing activity was viewed.\",\n \"values_sample\": [\"306\", \"1404\"],\n },\n \"total_impressions\": {\n \"description\": \"Total number of times the marketing activity was displayed.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_orders\": {\n \"description\": \"Number of orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_revenue\": {\n \"description\": \"Revenue generated from orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"keyword\": {\n \"description\": \"Keyword used in the marketing activity (if applicable).\",\n \"values_sample\": [None],\n },\n \"_synced_at\": {\n \"description\": \"Timestamp indicating when the data was last synced.\",\n \"values_sample\": [\"2024-07-16T21:32:08.452+00:00\"],\n },\n },\n}, I am giving you complete DB and table info in details, user context is bit lengthy so go line by line then answer properly","role":"system"},{"content":"What is the overall CTR for all campaigns in the last 3 months?","role":"user"},{"content":"SELECT COALESCE(TRY_DIVIDE(SUM(total_clicks), SUM(total_impressions)), 0) AS overall_ctr FROM marketing_performance WHERE activity_date >= DATE_TRUNC('month', CURRENT_DATE - INTERVAL '3 month') AND activity_date < DATE_TRUNC('month', CURRENT_DATE);","role":"assistant"}]} +{"question":"Show me the trend of orders from Shopify for this year","answer":"SELECT CONCAT(order_year, '-', LPAD(order_month, 2, '0')) AS order_date, COUNT(DISTINCT order_id) AS order_count FROM order_values WHERE source='Shopify' AND order_year = YEAR(CURRENT_DATE) GROUP BY order_year, order_month ORDER BY order_year, order_month;","llama-3-sqlcoder-8b":"SELECT COUNT(*) AS total_orders, EXTRACT(MONTH FROM o.order_date) AS order_month, EXTRACT(YEAR FROM o.order_date) AS order_year FROM order_values o WHERE o.source ='shopify' AND EXTRACT(YEAR FROM o.order_date) = 2024 GROUP BY order_month, order_year ORDER BY order_year, order_month NULLS LAST;","llama-3.1-8b":"SELECT order_date FROM order_values WHERE source ='shopify' AND order_year = 2024","context":"TABLE_DESCRIPTIONS = {\n \"order_values\": \"This table contains order information aggregated across multiple sources for an e-commerce brand. The table is unique at an Order ID - SKU ID level. The table includes, but is not limited to, all pricing information (like gross sales, tax, net sales, shipping charge, duties, etc.), information related to the product (like SKU, product id\/title, price, etc.), order related information (timestamp of order), payment information and shipping information.\",\n \"marketing_performance\": \"This table contains detailed marketing performance data for an e-commerce brand, capturing data from various marketing activities and platforms. It provides a comprehensive overview of campaign performance, including spend, clicks, views, impressions, and attributed revenue.\",\n}\n\nCOLUMNS = {\n \"order_values\": {\n \"order_line_item_id\": {\n \"description\": \"Unique identifier for each line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"source\": {\"description\": \"Source of the order\", \"values_sample\": [\"shopify\"]},\n \"order_id\": {\n \"description\": \"Unique identifier for each order\",\n \"values_sample\": [\"shopify_5667598663969\"],\n },\n \"ordered_quantity\": {\n \"description\": \"Quantity of each item of a line item\",\n \"values_sample\": [1],\n },\n \"tax_percent\": {\n \"description\": \"Tax percentage applied to the order\",\n \"values_sample\": [0.17999949556658],\n },\n \"total_price_tax\": {\n \"description\": \"Total price including tax\",\n \"values_sample\": [152.389468594368],\n },\n \"gross_sales_price_before_tax\": {\n \"description\": \"Gross sales price before applying tax\",\n \"values_sample\": [846.610531405632],\n },\n \"total_discount_after_tax\": {\n \"description\": \"Total discount after applying tax\",\n \"values_sample\": [0],\n },\n \"total_discount_tax\": {\n \"description\": \"Total discount amount subject to tax\",\n \"values_sample\": [0],\n },\n \"total_discount_before_tax\": {\n \"description\": \"Total discount before applying tax\",\n \"values_sample\": [0],\n },\n \"total_returns_before_tax\": {\n \"description\": \"Total return\/refund amount before tax\",\n \"values_sample\": [846.610531405632],\n },\n \"net_sales_before_tax\": {\n \"description\": \"Net sales amount before applying tax\",\n \"values_sample\": [0],\n },\n \"item_shipping_charge\": {\n \"description\": \"Shipping charge for an item\",\n \"values_sample\": [0],\n },\n \"item_duties\": {\n \"description\": \"Duties charged for an item\",\n \"values_sample\": [0],\n },\n \"item_additional_feels\": {\n \"description\": \"Additional fees charged for an item\",\n \"values_sample\": [0],\n },\n \"total_tax\": {\"description\": \"Total tax amount\", \"values_sample\": [0]},\n \"total_sales_after_tax\": {\n \"description\": \"Total sales amount after applying tax\",\n \"values_sample\": [0],\n },\n \"sku_id\": {\n \"description\": \"Unique identifier for each stock keeping unit (SKU)\",\n \"values_sample\": [\"shopify_8848983261473_47478863036705\"],\n },\n \"sku_code\": {\n \"description\": \"Code assigned to each stock keeping unit (SKU)\",\n \"values_sample\": [\"BSL-D-SIP-0001\"],\n },\n \"product_category\": {\n \"description\": \"Category of the product\",\n \"values_sample\": [\"Insulated Sipper\"],\n },\n \"product_id\": {\n \"description\": \"Unique identifier for each product\",\n \"values_sample\": [\"shopify_8848983261473\"],\n },\n \"product_title\": {\n \"description\": \"Title of the product\",\n \"values_sample\": [\"Kids Sipper (430 ml)\"],\n },\n \"product_price\": {\n \"description\": \"Price of the product\",\n \"values_sample\": [999],\n },\n \"customer_id\": {\n \"description\": \"Unique identifier for each customer\",\n \"values_sample\": [\"shopify_7694075199777\"],\n },\n \"first_ordered_at\": {\n \"description\": \"Timestamp of the first order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_refund_line_item_id\": {\n \"description\": \"Unique identifier for each refunded line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"order_date_time\": {\n \"description\": \"Date and time of the order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_date\": {\n \"description\": \"Date of the order\",\n \"values_sample\": [\"2024-02-14\"],\n },\n \"order_year\": {\"description\": \"Year of the order\", \"values_sample\": [2024]},\n \"order_quarter\": {\n \"description\": \"Quarter of the year of the order\",\n \"values_sample\": [1],\n },\n \"order_month\": {\"description\": \"Month of the order\", \"values_sample\": [2]},\n \"order_day_of_month\": {\n \"description\": \"Day of the month of the order\",\n \"values_sample\": [14],\n },\n \"order_week\": {\n \"description\": \"Week of the year of the order\",\n \"values_sample\": [7],\n },\n \"order_day_of_week\": {\n \"description\": \"Day of the week of the order\",\n \"values_sample\": [4],\n },\n \"order_hour\": {\n \"description\": \"Hour of the day of the order\",\n \"values_sample\": [16],\n },\n \"order_minute\": {\n \"description\": \"Minute of the hour of the order\",\n \"values_sample\": [0],\n },\n \"order_time\": {\"description\": \"Time of the order\", \"values_sample\": [\"16:00\"]},\n \"cancellation_status\": {\n \"description\": \"Status of order cancellation\",\n \"values_sample\": [\"false\"],\n },\n \"refund_status\": {\n \"description\": \"Status of order refund\",\n \"values_sample\": [\"false\"],\n },\n \"order_status\": {\n \"description\": \"Status of the order\",\n \"values_sample\": [\"unknown\"],\n },\n \"payment_status\": {\n \"description\": \"Status of payment for the order\",\n \"values_sample\": [\"pending\"],\n },\n \"shipping_address_city\": {\n \"description\": \"City of the shipping address\",\n \"values_sample\": [\"Surat\"],\n },\n \"shipping_address_state\": {\n \"description\": \"State of the shipping address\",\n \"values_sample\": [\"Gujarat\"],\n },\n \"shipping_address_country\": {\n \"description\": \"Country of the shipping address\",\n \"values_sample\": [\"India\"],\n },\n }\n}\n \"marketing_performance\": {\n \"marketing_id\": {\n \"description\": \"Unique identifier for each marketing activity.\",\n \"values_sample\": [\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_304143034868101_310419640566194_productAdsamazon_ads_sponsored_products_548576666024459\",\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_405826215303183_448674135385556_productAdsamazon_ads_sponsored_products_511545631860472\",\n ],\n },\n \"activity_date_time\": {\n \"description\": \"Timestamp of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_date\": {\n \"description\": \"Date of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_year\": {\n \"description\": \"Year of the marketing activity.\",\n \"values_sample\": [\"2024\"],\n },\n \"activity_quarter\": {\n \"description\": \"Quarter of the year in which the marketing activity took place.\",\n \"values_sample\": [\"2\"],\n },\n \"activity_month\": {\n \"description\": \"Month of the year in which the marketing activity took place.\",\n \"values_sample\": [\"4\"],\n },\n \"activity_day_of_month\": {\n \"description\": \"Day of the month on which the marketing activity took place.\",\n \"values_sample\": [\"1\"],\n },\n \"activity_week\": {\n \"description\": \"Week of the year in which the marketing activity took place.\",\n \"values_sample\": [\"14\"],\n },\n \"activity_day_of_week\": {\n \"description\": \"Day of the week on which the marketing activity took place (1 for Monday, 7 for Sunday).\",\n \"values_sample\": [\"2\"],\n },\n \"activity_hour\": {\n \"description\": \"Hour of the day in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_minute\": {\n \"description\": \"Minute of the hour in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_time\": {\n \"description\": \"Formatted string representation of the marketing activity time.\",\n \"values_sample\": [\"00:00\"],\n },\n \"channel\": {\n \"description\": \"Marketing channel used for the activity (e.g., Google Ads, Facebook Ads, Email Marketing).\",\n \"values_sample\": [\"sponsored product\"],\n },\n \"vendor\": {\n \"description\": \"Vendor or platform responsible for the marketing activity (e.g., Google, Facebook, Mailchimp).\",\n \"values_sample\": [\"amazon\"],\n },\n \"ad_account_id\": {\n \"description\": \"Unique identifier for the ad account associated with the activity.\",\n \"values_sample\": [\"A5IVEQE4ZPVNJ\"],\n },\n \"ad_account_name\": {\n \"description\": \"Name of the ad account associated with the activity.\",\n \"values_sample\": [\"Famyo\"],\n },\n \"property_name\": {\n \"description\": \"Name of the property or website where the marketing activity was run.\",\n \"values_sample\": [\"amazon sponsored product\"],\n },\n \"network_type\": {\n \"description\": \"Type of advertising network used (e.g., Search, Display, Video).\",\n \"values_sample\": [\"amazon\"],\n },\n \"campaign_id\": {\n \"description\": \"Unique identifier for the marketing campaign.\",\n \"values_sample\": [\n \"304143034868101\",\n \"405826215303183\",\n ],\n },\n \"campaign_name\": {\n \"description\": \"Name of the marketing campaign.\",\n \"values_sample\": [\n \"Football Campaign with presets - B0CT662KJL - 15\/2\/2024 23:09:44\",\n \"Hvs_Tar_SP_Blankets_Genric_Mix\",\n ],\n },\n \"campaign_status\": {\n \"description\": \"Current status of the marketing campaign (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"PAUSED\", \"ENABLED\"],\n },\n \"adset_id\": {\n \"description\": \"Unique identifier for the ad set within the campaign.\",\n \"values_sample\": [\n \"310419640566194\",\n \"448674135385556\",\n ],\n },\n \"adset_name\": {\n \"description\": \"Name of the ad set within the campaign.\",\n \"values_sample\": [\n \"Ad group - 15\/2\/2024 23:09:44\",\n \"Glow Blankets C1\",\n ],\n },\n \"adset_status\": {\n \"description\": \"Current status of the ad set (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"ad_id\": {\n \"description\": \"Unique identifier for the individual ad within the ad set.\",\n \"values_sample\": [\n \"548576666024459\",\n \"511545631860472\",\n ],\n },\n \"ad_name\": {\n \"description\": \"Name of the individual ad.\",\n \"values_sample\": [\"B0CT662KJL\", \"B0CT6428LV\"],\n },\n \"ad_description\": {\n \"description\": \"Description of the individual ad.\",\n \"values_sample\": [\n \"FM_GIDB_Football\",\n \"FM_GIDB_Astronaut\",\n ],\n },\n \"ad_status\": {\n \"description\": \"Current status of the individual ad (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"total_spend\": {\n \"description\": \"Total amount spent on the marketing activity.\",\n \"values_sample\": [\"29.15\", \"110.15\"],\n },\n \"total_clicks\": {\n \"description\": \"Total number of clicks generated by the marketing activity.\",\n \"values_sample\": [\"3\", \"7\"],\n },\n \"total_views\": {\n \"description\": \"Total number of times the marketing activity was viewed.\",\n \"values_sample\": [\"306\", \"1404\"],\n },\n \"total_impressions\": {\n \"description\": \"Total number of times the marketing activity was displayed.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_orders\": {\n \"description\": \"Number of orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_revenue\": {\n \"description\": \"Revenue generated from orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"keyword\": {\n \"description\": \"Keyword used in the marketing activity (if applicable).\",\n \"values_sample\": [None],\n },\n \"_synced_at\": {\n \"description\": \"Timestamp indicating when the data was last synced.\",\n \"values_sample\": [\"2024-07-16T21:32:08.452+00:00\"],\n },\n },\n}","messages":[{"content":"You are an advanced AI trained to generate SQL queries based\n on a given context. Your task is to write an SQL query that accurately \n retrieves the requested data from the provided table schema. Do not answer with any explanations -- just the SQL query.\n Output only plain text. Do not output markdown. \n Please ensure that the SQL query matches the exact table name and column names\n specified in the TABLE_DESCRIPTIONS = {\n \"order_values\": \"This table contains order information aggregated across multiple sources for an e-commerce brand. The table is unique at an Order ID - SKU ID level. The table includes, but is not limited to, all pricing information (like gross sales, tax, net sales, shipping charge, duties, etc.), information related to the product (like SKU, product id\/title, price, etc.), order related information (timestamp of order), payment information and shipping information.\",\n \"marketing_performance\": \"This table contains detailed marketing performance data for an e-commerce brand, capturing data from various marketing activities and platforms. It provides a comprehensive overview of campaign performance, including spend, clicks, views, impressions, and attributed revenue.\",\n}\n\nCOLUMNS = {\n \"order_values\": {\n \"order_line_item_id\": {\n \"description\": \"Unique identifier for each line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"source\": {\"description\": \"Source of the order\", \"values_sample\": [\"shopify\"]},\n \"order_id\": {\n \"description\": \"Unique identifier for each order\",\n \"values_sample\": [\"shopify_5667598663969\"],\n },\n \"ordered_quantity\": {\n \"description\": \"Quantity of each item of a line item\",\n \"values_sample\": [1],\n },\n \"tax_percent\": {\n \"description\": \"Tax percentage applied to the order\",\n \"values_sample\": [0.17999949556658],\n },\n \"total_price_tax\": {\n \"description\": \"Total price including tax\",\n \"values_sample\": [152.389468594368],\n },\n \"gross_sales_price_before_tax\": {\n \"description\": \"Gross sales price before applying tax\",\n \"values_sample\": [846.610531405632],\n },\n \"total_discount_after_tax\": {\n \"description\": \"Total discount after applying tax\",\n \"values_sample\": [0],\n },\n \"total_discount_tax\": {\n \"description\": \"Total discount amount subject to tax\",\n \"values_sample\": [0],\n },\n \"total_discount_before_tax\": {\n \"description\": \"Total discount before applying tax\",\n \"values_sample\": [0],\n },\n \"total_returns_before_tax\": {\n \"description\": \"Total return\/refund amount before tax\",\n \"values_sample\": [846.610531405632],\n },\n \"net_sales_before_tax\": {\n \"description\": \"Net sales amount before applying tax\",\n \"values_sample\": [0],\n },\n \"item_shipping_charge\": {\n \"description\": \"Shipping charge for an item\",\n \"values_sample\": [0],\n },\n \"item_duties\": {\n \"description\": \"Duties charged for an item\",\n \"values_sample\": [0],\n },\n \"item_additional_feels\": {\n \"description\": \"Additional fees charged for an item\",\n \"values_sample\": [0],\n },\n \"total_tax\": {\"description\": \"Total tax amount\", \"values_sample\": [0]},\n \"total_sales_after_tax\": {\n \"description\": \"Total sales amount after applying tax\",\n \"values_sample\": [0],\n },\n \"sku_id\": {\n \"description\": \"Unique identifier for each stock keeping unit (SKU)\",\n \"values_sample\": [\"shopify_8848983261473_47478863036705\"],\n },\n \"sku_code\": {\n \"description\": \"Code assigned to each stock keeping unit (SKU)\",\n \"values_sample\": [\"BSL-D-SIP-0001\"],\n },\n \"product_category\": {\n \"description\": \"Category of the product\",\n \"values_sample\": [\"Insulated Sipper\"],\n },\n \"product_id\": {\n \"description\": \"Unique identifier for each product\",\n \"values_sample\": [\"shopify_8848983261473\"],\n },\n \"product_title\": {\n \"description\": \"Title of the product\",\n \"values_sample\": [\"Kids Sipper (430 ml)\"],\n },\n \"product_price\": {\n \"description\": \"Price of the product\",\n \"values_sample\": [999],\n },\n \"customer_id\": {\n \"description\": \"Unique identifier for each customer\",\n \"values_sample\": [\"shopify_7694075199777\"],\n },\n \"first_ordered_at\": {\n \"description\": \"Timestamp of the first order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_refund_line_item_id\": {\n \"description\": \"Unique identifier for each refunded line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"order_date_time\": {\n \"description\": \"Date and time of the order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_date\": {\n \"description\": \"Date of the order\",\n \"values_sample\": [\"2024-02-14\"],\n },\n \"order_year\": {\"description\": \"Year of the order\", \"values_sample\": [2024]},\n \"order_quarter\": {\n \"description\": \"Quarter of the year of the order\",\n \"values_sample\": [1],\n },\n \"order_month\": {\"description\": \"Month of the order\", \"values_sample\": [2]},\n \"order_day_of_month\": {\n \"description\": \"Day of the month of the order\",\n \"values_sample\": [14],\n },\n \"order_week\": {\n \"description\": \"Week of the year of the order\",\n \"values_sample\": [7],\n },\n \"order_day_of_week\": {\n \"description\": \"Day of the week of the order\",\n \"values_sample\": [4],\n },\n \"order_hour\": {\n \"description\": \"Hour of the day of the order\",\n \"values_sample\": [16],\n },\n \"order_minute\": {\n \"description\": \"Minute of the hour of the order\",\n \"values_sample\": [0],\n },\n \"order_time\": {\"description\": \"Time of the order\", \"values_sample\": [\"16:00\"]},\n \"cancellation_status\": {\n \"description\": \"Status of order cancellation\",\n \"values_sample\": [\"false\"],\n },\n \"refund_status\": {\n \"description\": \"Status of order refund\",\n \"values_sample\": [\"false\"],\n },\n \"order_status\": {\n \"description\": \"Status of the order\",\n \"values_sample\": [\"unknown\"],\n },\n \"payment_status\": {\n \"description\": \"Status of payment for the order\",\n \"values_sample\": [\"pending\"],\n },\n \"shipping_address_city\": {\n \"description\": \"City of the shipping address\",\n \"values_sample\": [\"Surat\"],\n },\n \"shipping_address_state\": {\n \"description\": \"State of the shipping address\",\n \"values_sample\": [\"Gujarat\"],\n },\n \"shipping_address_country\": {\n \"description\": \"Country of the shipping address\",\n \"values_sample\": [\"India\"],\n },\n }\n}\n \"marketing_performance\": {\n \"marketing_id\": {\n \"description\": \"Unique identifier for each marketing activity.\",\n \"values_sample\": [\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_304143034868101_310419640566194_productAdsamazon_ads_sponsored_products_548576666024459\",\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_405826215303183_448674135385556_productAdsamazon_ads_sponsored_products_511545631860472\",\n ],\n },\n \"activity_date_time\": {\n \"description\": \"Timestamp of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_date\": {\n \"description\": \"Date of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_year\": {\n \"description\": \"Year of the marketing activity.\",\n \"values_sample\": [\"2024\"],\n },\n \"activity_quarter\": {\n \"description\": \"Quarter of the year in which the marketing activity took place.\",\n \"values_sample\": [\"2\"],\n },\n \"activity_month\": {\n \"description\": \"Month of the year in which the marketing activity took place.\",\n \"values_sample\": [\"4\"],\n },\n \"activity_day_of_month\": {\n \"description\": \"Day of the month on which the marketing activity took place.\",\n \"values_sample\": [\"1\"],\n },\n \"activity_week\": {\n \"description\": \"Week of the year in which the marketing activity took place.\",\n \"values_sample\": [\"14\"],\n },\n \"activity_day_of_week\": {\n \"description\": \"Day of the week on which the marketing activity took place (1 for Monday, 7 for Sunday).\",\n \"values_sample\": [\"2\"],\n },\n \"activity_hour\": {\n \"description\": \"Hour of the day in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_minute\": {\n \"description\": \"Minute of the hour in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_time\": {\n \"description\": \"Formatted string representation of the marketing activity time.\",\n \"values_sample\": [\"00:00\"],\n },\n \"channel\": {\n \"description\": \"Marketing channel used for the activity (e.g., Google Ads, Facebook Ads, Email Marketing).\",\n \"values_sample\": [\"sponsored product\"],\n },\n \"vendor\": {\n \"description\": \"Vendor or platform responsible for the marketing activity (e.g., Google, Facebook, Mailchimp).\",\n \"values_sample\": [\"amazon\"],\n },\n \"ad_account_id\": {\n \"description\": \"Unique identifier for the ad account associated with the activity.\",\n \"values_sample\": [\"A5IVEQE4ZPVNJ\"],\n },\n \"ad_account_name\": {\n \"description\": \"Name of the ad account associated with the activity.\",\n \"values_sample\": [\"Famyo\"],\n },\n \"property_name\": {\n \"description\": \"Name of the property or website where the marketing activity was run.\",\n \"values_sample\": [\"amazon sponsored product\"],\n },\n \"network_type\": {\n \"description\": \"Type of advertising network used (e.g., Search, Display, Video).\",\n \"values_sample\": [\"amazon\"],\n },\n \"campaign_id\": {\n \"description\": \"Unique identifier for the marketing campaign.\",\n \"values_sample\": [\n \"304143034868101\",\n \"405826215303183\",\n ],\n },\n \"campaign_name\": {\n \"description\": \"Name of the marketing campaign.\",\n \"values_sample\": [\n \"Football Campaign with presets - B0CT662KJL - 15\/2\/2024 23:09:44\",\n \"Hvs_Tar_SP_Blankets_Genric_Mix\",\n ],\n },\n \"campaign_status\": {\n \"description\": \"Current status of the marketing campaign (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"PAUSED\", \"ENABLED\"],\n },\n \"adset_id\": {\n \"description\": \"Unique identifier for the ad set within the campaign.\",\n \"values_sample\": [\n \"310419640566194\",\n \"448674135385556\",\n ],\n },\n \"adset_name\": {\n \"description\": \"Name of the ad set within the campaign.\",\n \"values_sample\": [\n \"Ad group - 15\/2\/2024 23:09:44\",\n \"Glow Blankets C1\",\n ],\n },\n \"adset_status\": {\n \"description\": \"Current status of the ad set (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"ad_id\": {\n \"description\": \"Unique identifier for the individual ad within the ad set.\",\n \"values_sample\": [\n \"548576666024459\",\n \"511545631860472\",\n ],\n },\n \"ad_name\": {\n \"description\": \"Name of the individual ad.\",\n \"values_sample\": [\"B0CT662KJL\", \"B0CT6428LV\"],\n },\n \"ad_description\": {\n \"description\": \"Description of the individual ad.\",\n \"values_sample\": [\n \"FM_GIDB_Football\",\n \"FM_GIDB_Astronaut\",\n ],\n },\n \"ad_status\": {\n \"description\": \"Current status of the individual ad (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"total_spend\": {\n \"description\": \"Total amount spent on the marketing activity.\",\n \"values_sample\": [\"29.15\", \"110.15\"],\n },\n \"total_clicks\": {\n \"description\": \"Total number of clicks generated by the marketing activity.\",\n \"values_sample\": [\"3\", \"7\"],\n },\n \"total_views\": {\n \"description\": \"Total number of times the marketing activity was viewed.\",\n \"values_sample\": [\"306\", \"1404\"],\n },\n \"total_impressions\": {\n \"description\": \"Total number of times the marketing activity was displayed.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_orders\": {\n \"description\": \"Number of orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_revenue\": {\n \"description\": \"Revenue generated from orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"keyword\": {\n \"description\": \"Keyword used in the marketing activity (if applicable).\",\n \"values_sample\": [None],\n },\n \"_synced_at\": {\n \"description\": \"Timestamp indicating when the data was last synced.\",\n \"values_sample\": [\"2024-07-16T21:32:08.452+00:00\"],\n },\n },\n}, I am giving you complete DB and table info in details, user context is bit lengthy so go line by line then answer properly","role":"system"},{"content":"Show me the trend of orders from Shopify for this year","role":"user"},{"content":"SELECT CONCAT(order_year, '-', LPAD(order_month, 2, '0')) AS order_date, COUNT(DISTINCT order_id) AS order_count FROM order_values WHERE source='Shopify' AND order_year = YEAR(CURRENT_DATE) GROUP BY order_year, order_month ORDER BY order_year, order_month;","role":"assistant"}]} +{"question":"Which marketing channel generated the highest revenue last month?","answer":"SELECT channel, SUM(vendor_reported_revenue) AS total_revenue FROM marketing_performance WHERE activity_date >= DATE_TRUNC('month', CURRENT_DATE - INTERVAL '1 month') AND activity_date < DATE_TRUNC('month', CURRENT_DATE) GROUP BY channel ORDER BY total_revenue DESC LIMIT 1;","llama-3-sqlcoder-8b":"WITH channel_revenue AS (SELECT m.channel, SUM(m.total_spend) AS revenue FROM marketing_performance m WHERE m.activity_date >= (CURRENT_DATE - INTERVAL '1 month') GROUP BY m.channel) SELECT cr.channel, cr.revenue FROM channel_revenue cr ORDER BY cr.revenue DESC NULLS LAST LIMIT 1;","llama-3.1-8b":"SELECT T1.channel FROM marketing_performance AS T1 INNER JOIN ( SELECT channel, MAX(total_spend) AS max_spend FROM marketing_performance WHERE activity_month = 4 GROUP BY channel ) AS T2 ON T1.channel = T2.channel WHERE T1.total_spend = T2.max_spend","context":"TABLE_DESCRIPTIONS = {\n \"order_values\": \"This table contains order information aggregated across multiple sources for an e-commerce brand. The table is unique at an Order ID - SKU ID level. The table includes, but is not limited to, all pricing information (like gross sales, tax, net sales, shipping charge, duties, etc.), information related to the product (like SKU, product id\/title, price, etc.), order related information (timestamp of order), payment information and shipping information.\",\n \"marketing_performance\": \"This table contains detailed marketing performance data for an e-commerce brand, capturing data from various marketing activities and platforms. It provides a comprehensive overview of campaign performance, including spend, clicks, views, impressions, and attributed revenue.\",\n}\n\nCOLUMNS = {\n \"order_values\": {\n \"order_line_item_id\": {\n \"description\": \"Unique identifier for each line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"source\": {\"description\": \"Source of the order\", \"values_sample\": [\"shopify\"]},\n \"order_id\": {\n \"description\": \"Unique identifier for each order\",\n \"values_sample\": [\"shopify_5667598663969\"],\n },\n \"ordered_quantity\": {\n \"description\": \"Quantity of each item of a line item\",\n \"values_sample\": [1],\n },\n \"tax_percent\": {\n \"description\": \"Tax percentage applied to the order\",\n \"values_sample\": [0.17999949556658],\n },\n \"total_price_tax\": {\n \"description\": \"Total price including tax\",\n \"values_sample\": [152.389468594368],\n },\n \"gross_sales_price_before_tax\": {\n \"description\": \"Gross sales price before applying tax\",\n \"values_sample\": [846.610531405632],\n },\n \"total_discount_after_tax\": {\n \"description\": \"Total discount after applying tax\",\n \"values_sample\": [0],\n },\n \"total_discount_tax\": {\n \"description\": \"Total discount amount subject to tax\",\n \"values_sample\": [0],\n },\n \"total_discount_before_tax\": {\n \"description\": \"Total discount before applying tax\",\n \"values_sample\": [0],\n },\n \"total_returns_before_tax\": {\n \"description\": \"Total return\/refund amount before tax\",\n \"values_sample\": [846.610531405632],\n },\n \"net_sales_before_tax\": {\n \"description\": \"Net sales amount before applying tax\",\n \"values_sample\": [0],\n },\n \"item_shipping_charge\": {\n \"description\": \"Shipping charge for an item\",\n \"values_sample\": [0],\n },\n \"item_duties\": {\n \"description\": \"Duties charged for an item\",\n \"values_sample\": [0],\n },\n \"item_additional_feels\": {\n \"description\": \"Additional fees charged for an item\",\n \"values_sample\": [0],\n },\n \"total_tax\": {\"description\": \"Total tax amount\", \"values_sample\": [0]},\n \"total_sales_after_tax\": {\n \"description\": \"Total sales amount after applying tax\",\n \"values_sample\": [0],\n },\n \"sku_id\": {\n \"description\": \"Unique identifier for each stock keeping unit (SKU)\",\n \"values_sample\": [\"shopify_8848983261473_47478863036705\"],\n },\n \"sku_code\": {\n \"description\": \"Code assigned to each stock keeping unit (SKU)\",\n \"values_sample\": [\"BSL-D-SIP-0001\"],\n },\n \"product_category\": {\n \"description\": \"Category of the product\",\n \"values_sample\": [\"Insulated Sipper\"],\n },\n \"product_id\": {\n \"description\": \"Unique identifier for each product\",\n \"values_sample\": [\"shopify_8848983261473\"],\n },\n \"product_title\": {\n \"description\": \"Title of the product\",\n \"values_sample\": [\"Kids Sipper (430 ml)\"],\n },\n \"product_price\": {\n \"description\": \"Price of the product\",\n \"values_sample\": [999],\n },\n \"customer_id\": {\n \"description\": \"Unique identifier for each customer\",\n \"values_sample\": [\"shopify_7694075199777\"],\n },\n \"first_ordered_at\": {\n \"description\": \"Timestamp of the first order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_refund_line_item_id\": {\n \"description\": \"Unique identifier for each refunded line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"order_date_time\": {\n \"description\": \"Date and time of the order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_date\": {\n \"description\": \"Date of the order\",\n \"values_sample\": [\"2024-02-14\"],\n },\n \"order_year\": {\"description\": \"Year of the order\", \"values_sample\": [2024]},\n \"order_quarter\": {\n \"description\": \"Quarter of the year of the order\",\n \"values_sample\": [1],\n },\n \"order_month\": {\"description\": \"Month of the order\", \"values_sample\": [2]},\n \"order_day_of_month\": {\n \"description\": \"Day of the month of the order\",\n \"values_sample\": [14],\n },\n \"order_week\": {\n \"description\": \"Week of the year of the order\",\n \"values_sample\": [7],\n },\n \"order_day_of_week\": {\n \"description\": \"Day of the week of the order\",\n \"values_sample\": [4],\n },\n \"order_hour\": {\n \"description\": \"Hour of the day of the order\",\n \"values_sample\": [16],\n },\n \"order_minute\": {\n \"description\": \"Minute of the hour of the order\",\n \"values_sample\": [0],\n },\n \"order_time\": {\"description\": \"Time of the order\", \"values_sample\": [\"16:00\"]},\n \"cancellation_status\": {\n \"description\": \"Status of order cancellation\",\n \"values_sample\": [\"false\"],\n },\n \"refund_status\": {\n \"description\": \"Status of order refund\",\n \"values_sample\": [\"false\"],\n },\n \"order_status\": {\n \"description\": \"Status of the order\",\n \"values_sample\": [\"unknown\"],\n },\n \"payment_status\": {\n \"description\": \"Status of payment for the order\",\n \"values_sample\": [\"pending\"],\n },\n \"shipping_address_city\": {\n \"description\": \"City of the shipping address\",\n \"values_sample\": [\"Surat\"],\n },\n \"shipping_address_state\": {\n \"description\": \"State of the shipping address\",\n \"values_sample\": [\"Gujarat\"],\n },\n \"shipping_address_country\": {\n \"description\": \"Country of the shipping address\",\n \"values_sample\": [\"India\"],\n },\n }\n}\n \"marketing_performance\": {\n \"marketing_id\": {\n \"description\": \"Unique identifier for each marketing activity.\",\n \"values_sample\": [\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_304143034868101_310419640566194_productAdsamazon_ads_sponsored_products_548576666024459\",\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_405826215303183_448674135385556_productAdsamazon_ads_sponsored_products_511545631860472\",\n ],\n },\n \"activity_date_time\": {\n \"description\": \"Timestamp of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_date\": {\n \"description\": \"Date of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_year\": {\n \"description\": \"Year of the marketing activity.\",\n \"values_sample\": [\"2024\"],\n },\n \"activity_quarter\": {\n \"description\": \"Quarter of the year in which the marketing activity took place.\",\n \"values_sample\": [\"2\"],\n },\n \"activity_month\": {\n \"description\": \"Month of the year in which the marketing activity took place.\",\n \"values_sample\": [\"4\"],\n },\n \"activity_day_of_month\": {\n \"description\": \"Day of the month on which the marketing activity took place.\",\n \"values_sample\": [\"1\"],\n },\n \"activity_week\": {\n \"description\": \"Week of the year in which the marketing activity took place.\",\n \"values_sample\": [\"14\"],\n },\n \"activity_day_of_week\": {\n \"description\": \"Day of the week on which the marketing activity took place (1 for Monday, 7 for Sunday).\",\n \"values_sample\": [\"2\"],\n },\n \"activity_hour\": {\n \"description\": \"Hour of the day in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_minute\": {\n \"description\": \"Minute of the hour in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_time\": {\n \"description\": \"Formatted string representation of the marketing activity time.\",\n \"values_sample\": [\"00:00\"],\n },\n \"channel\": {\n \"description\": \"Marketing channel used for the activity (e.g., Google Ads, Facebook Ads, Email Marketing).\",\n \"values_sample\": [\"sponsored product\"],\n },\n \"vendor\": {\n \"description\": \"Vendor or platform responsible for the marketing activity (e.g., Google, Facebook, Mailchimp).\",\n \"values_sample\": [\"amazon\"],\n },\n \"ad_account_id\": {\n \"description\": \"Unique identifier for the ad account associated with the activity.\",\n \"values_sample\": [\"A5IVEQE4ZPVNJ\"],\n },\n \"ad_account_name\": {\n \"description\": \"Name of the ad account associated with the activity.\",\n \"values_sample\": [\"Famyo\"],\n },\n \"property_name\": {\n \"description\": \"Name of the property or website where the marketing activity was run.\",\n \"values_sample\": [\"amazon sponsored product\"],\n },\n \"network_type\": {\n \"description\": \"Type of advertising network used (e.g., Search, Display, Video).\",\n \"values_sample\": [\"amazon\"],\n },\n \"campaign_id\": {\n \"description\": \"Unique identifier for the marketing campaign.\",\n \"values_sample\": [\n \"304143034868101\",\n \"405826215303183\",\n ],\n },\n \"campaign_name\": {\n \"description\": \"Name of the marketing campaign.\",\n \"values_sample\": [\n \"Football Campaign with presets - B0CT662KJL - 15\/2\/2024 23:09:44\",\n \"Hvs_Tar_SP_Blankets_Genric_Mix\",\n ],\n },\n \"campaign_status\": {\n \"description\": \"Current status of the marketing campaign (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"PAUSED\", \"ENABLED\"],\n },\n \"adset_id\": {\n \"description\": \"Unique identifier for the ad set within the campaign.\",\n \"values_sample\": [\n \"310419640566194\",\n \"448674135385556\",\n ],\n },\n \"adset_name\": {\n \"description\": \"Name of the ad set within the campaign.\",\n \"values_sample\": [\n \"Ad group - 15\/2\/2024 23:09:44\",\n \"Glow Blankets C1\",\n ],\n },\n \"adset_status\": {\n \"description\": \"Current status of the ad set (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"ad_id\": {\n \"description\": \"Unique identifier for the individual ad within the ad set.\",\n \"values_sample\": [\n \"548576666024459\",\n \"511545631860472\",\n ],\n },\n \"ad_name\": {\n \"description\": \"Name of the individual ad.\",\n \"values_sample\": [\"B0CT662KJL\", \"B0CT6428LV\"],\n },\n \"ad_description\": {\n \"description\": \"Description of the individual ad.\",\n \"values_sample\": [\n \"FM_GIDB_Football\",\n \"FM_GIDB_Astronaut\",\n ],\n },\n \"ad_status\": {\n \"description\": \"Current status of the individual ad (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"total_spend\": {\n \"description\": \"Total amount spent on the marketing activity.\",\n \"values_sample\": [\"29.15\", \"110.15\"],\n },\n \"total_clicks\": {\n \"description\": \"Total number of clicks generated by the marketing activity.\",\n \"values_sample\": [\"3\", \"7\"],\n },\n \"total_views\": {\n \"description\": \"Total number of times the marketing activity was viewed.\",\n \"values_sample\": [\"306\", \"1404\"],\n },\n \"total_impressions\": {\n \"description\": \"Total number of times the marketing activity was displayed.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_orders\": {\n \"description\": \"Number of orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_revenue\": {\n \"description\": \"Revenue generated from orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"keyword\": {\n \"description\": \"Keyword used in the marketing activity (if applicable).\",\n \"values_sample\": [None],\n },\n \"_synced_at\": {\n \"description\": \"Timestamp indicating when the data was last synced.\",\n \"values_sample\": [\"2024-07-16T21:32:08.452+00:00\"],\n },\n },\n}","messages":[{"content":"You are an advanced AI trained to generate SQL queries based\n on a given context. Your task is to write an SQL query that accurately \n retrieves the requested data from the provided table schema. Do not answer with any explanations -- just the SQL query.\n Output only plain text. Do not output markdown. \n Please ensure that the SQL query matches the exact table name and column names\n specified in the TABLE_DESCRIPTIONS = {\n \"order_values\": \"This table contains order information aggregated across multiple sources for an e-commerce brand. The table is unique at an Order ID - SKU ID level. The table includes, but is not limited to, all pricing information (like gross sales, tax, net sales, shipping charge, duties, etc.), information related to the product (like SKU, product id\/title, price, etc.), order related information (timestamp of order), payment information and shipping information.\",\n \"marketing_performance\": \"This table contains detailed marketing performance data for an e-commerce brand, capturing data from various marketing activities and platforms. It provides a comprehensive overview of campaign performance, including spend, clicks, views, impressions, and attributed revenue.\",\n}\n\nCOLUMNS = {\n \"order_values\": {\n \"order_line_item_id\": {\n \"description\": \"Unique identifier for each line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"source\": {\"description\": \"Source of the order\", \"values_sample\": [\"shopify\"]},\n \"order_id\": {\n \"description\": \"Unique identifier for each order\",\n \"values_sample\": [\"shopify_5667598663969\"],\n },\n \"ordered_quantity\": {\n \"description\": \"Quantity of each item of a line item\",\n \"values_sample\": [1],\n },\n \"tax_percent\": {\n \"description\": \"Tax percentage applied to the order\",\n \"values_sample\": [0.17999949556658],\n },\n \"total_price_tax\": {\n \"description\": \"Total price including tax\",\n \"values_sample\": [152.389468594368],\n },\n \"gross_sales_price_before_tax\": {\n \"description\": \"Gross sales price before applying tax\",\n \"values_sample\": [846.610531405632],\n },\n \"total_discount_after_tax\": {\n \"description\": \"Total discount after applying tax\",\n \"values_sample\": [0],\n },\n \"total_discount_tax\": {\n \"description\": \"Total discount amount subject to tax\",\n \"values_sample\": [0],\n },\n \"total_discount_before_tax\": {\n \"description\": \"Total discount before applying tax\",\n \"values_sample\": [0],\n },\n \"total_returns_before_tax\": {\n \"description\": \"Total return\/refund amount before tax\",\n \"values_sample\": [846.610531405632],\n },\n \"net_sales_before_tax\": {\n \"description\": \"Net sales amount before applying tax\",\n \"values_sample\": [0],\n },\n \"item_shipping_charge\": {\n \"description\": \"Shipping charge for an item\",\n \"values_sample\": [0],\n },\n \"item_duties\": {\n \"description\": \"Duties charged for an item\",\n \"values_sample\": [0],\n },\n \"item_additional_feels\": {\n \"description\": \"Additional fees charged for an item\",\n \"values_sample\": [0],\n },\n \"total_tax\": {\"description\": \"Total tax amount\", \"values_sample\": [0]},\n \"total_sales_after_tax\": {\n \"description\": \"Total sales amount after applying tax\",\n \"values_sample\": [0],\n },\n \"sku_id\": {\n \"description\": \"Unique identifier for each stock keeping unit (SKU)\",\n \"values_sample\": [\"shopify_8848983261473_47478863036705\"],\n },\n \"sku_code\": {\n \"description\": \"Code assigned to each stock keeping unit (SKU)\",\n \"values_sample\": [\"BSL-D-SIP-0001\"],\n },\n \"product_category\": {\n \"description\": \"Category of the product\",\n \"values_sample\": [\"Insulated Sipper\"],\n },\n \"product_id\": {\n \"description\": \"Unique identifier for each product\",\n \"values_sample\": [\"shopify_8848983261473\"],\n },\n \"product_title\": {\n \"description\": \"Title of the product\",\n \"values_sample\": [\"Kids Sipper (430 ml)\"],\n },\n \"product_price\": {\n \"description\": \"Price of the product\",\n \"values_sample\": [999],\n },\n \"customer_id\": {\n \"description\": \"Unique identifier for each customer\",\n \"values_sample\": [\"shopify_7694075199777\"],\n },\n \"first_ordered_at\": {\n \"description\": \"Timestamp of the first order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_refund_line_item_id\": {\n \"description\": \"Unique identifier for each refunded line item in an order\",\n \"values_sample\": [\"shopify_5667598663969_14461737632033\"],\n },\n \"order_date_time\": {\n \"description\": \"Date and time of the order\",\n \"values_sample\": [\"2024-02-14 16:00:13.000000\"],\n },\n \"order_date\": {\n \"description\": \"Date of the order\",\n \"values_sample\": [\"2024-02-14\"],\n },\n \"order_year\": {\"description\": \"Year of the order\", \"values_sample\": [2024]},\n \"order_quarter\": {\n \"description\": \"Quarter of the year of the order\",\n \"values_sample\": [1],\n },\n \"order_month\": {\"description\": \"Month of the order\", \"values_sample\": [2]},\n \"order_day_of_month\": {\n \"description\": \"Day of the month of the order\",\n \"values_sample\": [14],\n },\n \"order_week\": {\n \"description\": \"Week of the year of the order\",\n \"values_sample\": [7],\n },\n \"order_day_of_week\": {\n \"description\": \"Day of the week of the order\",\n \"values_sample\": [4],\n },\n \"order_hour\": {\n \"description\": \"Hour of the day of the order\",\n \"values_sample\": [16],\n },\n \"order_minute\": {\n \"description\": \"Minute of the hour of the order\",\n \"values_sample\": [0],\n },\n \"order_time\": {\"description\": \"Time of the order\", \"values_sample\": [\"16:00\"]},\n \"cancellation_status\": {\n \"description\": \"Status of order cancellation\",\n \"values_sample\": [\"false\"],\n },\n \"refund_status\": {\n \"description\": \"Status of order refund\",\n \"values_sample\": [\"false\"],\n },\n \"order_status\": {\n \"description\": \"Status of the order\",\n \"values_sample\": [\"unknown\"],\n },\n \"payment_status\": {\n \"description\": \"Status of payment for the order\",\n \"values_sample\": [\"pending\"],\n },\n \"shipping_address_city\": {\n \"description\": \"City of the shipping address\",\n \"values_sample\": [\"Surat\"],\n },\n \"shipping_address_state\": {\n \"description\": \"State of the shipping address\",\n \"values_sample\": [\"Gujarat\"],\n },\n \"shipping_address_country\": {\n \"description\": \"Country of the shipping address\",\n \"values_sample\": [\"India\"],\n },\n }\n}\n \"marketing_performance\": {\n \"marketing_id\": {\n \"description\": \"Unique identifier for each marketing activity.\",\n \"values_sample\": [\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_304143034868101_310419640566194_productAdsamazon_ads_sponsored_products_548576666024459\",\n \"2024-04-01_amazon_sponsored_product_A5IVEQE4ZPVNJ_405826215303183_448674135385556_productAdsamazon_ads_sponsored_products_511545631860472\",\n ],\n },\n \"activity_date_time\": {\n \"description\": \"Timestamp of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_date\": {\n \"description\": \"Date of the marketing activity.\",\n \"values_sample\": [\n \"2024-04-01T00:00:00.000+00:00\",\n ],\n },\n \"activity_year\": {\n \"description\": \"Year of the marketing activity.\",\n \"values_sample\": [\"2024\"],\n },\n \"activity_quarter\": {\n \"description\": \"Quarter of the year in which the marketing activity took place.\",\n \"values_sample\": [\"2\"],\n },\n \"activity_month\": {\n \"description\": \"Month of the year in which the marketing activity took place.\",\n \"values_sample\": [\"4\"],\n },\n \"activity_day_of_month\": {\n \"description\": \"Day of the month on which the marketing activity took place.\",\n \"values_sample\": [\"1\"],\n },\n \"activity_week\": {\n \"description\": \"Week of the year in which the marketing activity took place.\",\n \"values_sample\": [\"14\"],\n },\n \"activity_day_of_week\": {\n \"description\": \"Day of the week on which the marketing activity took place (1 for Monday, 7 for Sunday).\",\n \"values_sample\": [\"2\"],\n },\n \"activity_hour\": {\n \"description\": \"Hour of the day in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_minute\": {\n \"description\": \"Minute of the hour in which the marketing activity took place.\",\n \"values_sample\": [\"0\"],\n },\n \"activity_time\": {\n \"description\": \"Formatted string representation of the marketing activity time.\",\n \"values_sample\": [\"00:00\"],\n },\n \"channel\": {\n \"description\": \"Marketing channel used for the activity (e.g., Google Ads, Facebook Ads, Email Marketing).\",\n \"values_sample\": [\"sponsored product\"],\n },\n \"vendor\": {\n \"description\": \"Vendor or platform responsible for the marketing activity (e.g., Google, Facebook, Mailchimp).\",\n \"values_sample\": [\"amazon\"],\n },\n \"ad_account_id\": {\n \"description\": \"Unique identifier for the ad account associated with the activity.\",\n \"values_sample\": [\"A5IVEQE4ZPVNJ\"],\n },\n \"ad_account_name\": {\n \"description\": \"Name of the ad account associated with the activity.\",\n \"values_sample\": [\"Famyo\"],\n },\n \"property_name\": {\n \"description\": \"Name of the property or website where the marketing activity was run.\",\n \"values_sample\": [\"amazon sponsored product\"],\n },\n \"network_type\": {\n \"description\": \"Type of advertising network used (e.g., Search, Display, Video).\",\n \"values_sample\": [\"amazon\"],\n },\n \"campaign_id\": {\n \"description\": \"Unique identifier for the marketing campaign.\",\n \"values_sample\": [\n \"304143034868101\",\n \"405826215303183\",\n ],\n },\n \"campaign_name\": {\n \"description\": \"Name of the marketing campaign.\",\n \"values_sample\": [\n \"Football Campaign with presets - B0CT662KJL - 15\/2\/2024 23:09:44\",\n \"Hvs_Tar_SP_Blankets_Genric_Mix\",\n ],\n },\n \"campaign_status\": {\n \"description\": \"Current status of the marketing campaign (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"PAUSED\", \"ENABLED\"],\n },\n \"adset_id\": {\n \"description\": \"Unique identifier for the ad set within the campaign.\",\n \"values_sample\": [\n \"310419640566194\",\n \"448674135385556\",\n ],\n },\n \"adset_name\": {\n \"description\": \"Name of the ad set within the campaign.\",\n \"values_sample\": [\n \"Ad group - 15\/2\/2024 23:09:44\",\n \"Glow Blankets C1\",\n ],\n },\n \"adset_status\": {\n \"description\": \"Current status of the ad set (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"ad_id\": {\n \"description\": \"Unique identifier for the individual ad within the ad set.\",\n \"values_sample\": [\n \"548576666024459\",\n \"511545631860472\",\n ],\n },\n \"ad_name\": {\n \"description\": \"Name of the individual ad.\",\n \"values_sample\": [\"B0CT662KJL\", \"B0CT6428LV\"],\n },\n \"ad_description\": {\n \"description\": \"Description of the individual ad.\",\n \"values_sample\": [\n \"FM_GIDB_Football\",\n \"FM_GIDB_Astronaut\",\n ],\n },\n \"ad_status\": {\n \"description\": \"Current status of the individual ad (e.g., Active, Paused, Archived).\",\n \"values_sample\": [\"ENABLED\"],\n },\n \"total_spend\": {\n \"description\": \"Total amount spent on the marketing activity.\",\n \"values_sample\": [\"29.15\", \"110.15\"],\n },\n \"total_clicks\": {\n \"description\": \"Total number of clicks generated by the marketing activity.\",\n \"values_sample\": [\"3\", \"7\"],\n },\n \"total_views\": {\n \"description\": \"Total number of times the marketing activity was viewed.\",\n \"values_sample\": [\"306\", \"1404\"],\n },\n \"total_impressions\": {\n \"description\": \"Total number of times the marketing activity was displayed.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_orders\": {\n \"description\": \"Number of orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"vendor_reported_revenue\": {\n \"description\": \"Revenue generated from orders attributed to the marketing activity as reported by the marketing vendor.\",\n \"values_sample\": [\"0.0\"],\n },\n \"keyword\": {\n \"description\": \"Keyword used in the marketing activity (if applicable).\",\n \"values_sample\": [None],\n },\n \"_synced_at\": {\n \"description\": \"Timestamp indicating when the data was last synced.\",\n \"values_sample\": [\"2024-07-16T21:32:08.452+00:00\"],\n },\n },\n}, I am giving you complete DB and table info in details, user context is bit lengthy so go line by line then answer properly","role":"system"},{"content":"Which marketing channel generated the highest revenue last month?","role":"user"},{"content":"SELECT channel, SUM(vendor_reported_revenue) AS total_revenue FROM marketing_performance WHERE activity_date >= DATE_TRUNC('month', CURRENT_DATE - INTERVAL '1 month') AND activity_date < DATE_TRUNC('month', CURRENT_DATE) GROUP BY channel ORDER BY total_revenue DESC LIMIT 1;","role":"assistant"}]}