[ { "prompt": "In SAP Hana provide the SQL statement to create a custom billing document line item table based on common fields of the SAP S/4 CDS View I_BillingDocumentItemCube", "completion": "CREATE TABLE ZSDBILLGDOCITM (\n \"BILLINGDOCUMENT\" NVARCHAR(000010),\n \"BILLINGDOCUMENTITEM\" NVARCHAR(000006),\n \"SOLDTOPARTY\" NVARCHAR(000010),\n \"SOLDTOPARTYNAME\" NVARCHAR(000080),\n \"SALESEMPLOYEE\" NVARCHAR(000008),\n \"SALESEMPLOYEENAME\" NVARCHAR(000080),\n \"COUNTRY\" NVARCHAR(000003),\n \"REGION\" NVARCHAR(000003),\n \"SALESORGANIZATION\" NVARCHAR(000004),\n \"DISTRIBUTIONCHANNEL\" NVARCHAR(000002),\n \"DIVISION\" NVARCHAR(000002),\n \"PRODUCT\" NVARCHAR(000040),\n \"PLANT\" NVARCHAR(000004),\n \"PLANTNAME\" NVARCHAR(000030),\n \"BILLINGQUANTITY\" DECIMAL(000013,000003),\n \"BILLINGQUANTITYUNIT\" NVARCHAR(000003),\n \"TRANSACTIONCURRENCY\" NVARCHAR(000005),\n \"ITEMNETAMOUNTOFBILLINGDOC\" DECIMAL(000015,000002),\n \"COMPANYCODE\" NVARCHAR(000004),\n \"COMPANYCODENAME\" NVARCHAR(000025),\n \"FISCALYEAR\" NVARCHAR(000004),\n \"ACCOUNTINGDOCUMENT\" NVARCHAR(000010),\n \"FISCALPERIOD\" NVARCHAR(000003)\n) ;" }, { "prompt": "In SAP Hana SQL create an insert statement to populate the custom table ZSDBILLGDOCITM (based on I_BillingDocumentItemCube) with fictitious data", "completion": "INSERT INTO ZSDBILLGDOCITM (\n \"BILLINGDOCUMENT\",\n \"BILLINGDOCUMENTITEM\",\n \"SALESORGANIZATION\",\n \"SOLDTOPARTY\",\n \"SOLDTOPARTYNAME\",\n \"SALESEMPLOYEE\",\n \"SALESEMPLOYEENAME\",\n \"COUNTRY\",\n \"REGION\",\n \"DISTRIBUTIONCHANNEL\",\n \"DIVISION\",\n \"PRODUCT\",\n \"PLANT\",\n \"PLANTNAME\",\n \"BILLINGQUANTITY\",\n \"BILLINGQUANTITYUNIT\",\n \"TRANSACTIONCURRENCY\",\n \"ITEMNETAMOUNTOFBILLINGDOC\",\n \"COMPANYCODE\",\n \"COMPANYCODENAME\",\n \"FISCALYEAR\",\n \"ACCOUNTINGDOCUMENT\",\n \"FISCALPERIOD\"\n)\nWITH sales_orgs AS (\n SELECT 'US01' AS sales_org, 'USD' AS currency, 'US' AS country , 0.35 as org_weight FROM DUMMY\n UNION ALL\n SELECT 'US02' AS sales_org, 'USD' AS currency, 'US' AS country, 0.10 as org_weight FROM DUMMY\n UNION ALL\n SELECT 'UK01' AS sales_org, 'GBP' AS currency, 'UK' AS country, 0.25 as org_weight FROM DUMMY\n UNION ALL\n SELECT 'AU01' AS sales_org, 'AUD' AS currency, 'AU' AS country, 0.30 as org_weight FROM DUMMY\n),\nproducts AS (\n SELECT 'Apple' AS product FROM DUMMY UNION ALL\n SELECT 'Banana' AS product FROM DUMMY UNION ALL\n SELECT 'Orange' AS product FROM DUMMY UNION ALL\n SELECT 'Mango' AS product FROM DUMMY UNION ALL\n SELECT 'Grapes' AS product FROM DUMMY\n),\nemployees AS (\n SELECT '00001' AS employee_id, 'Hamlet' AS employee_name FROM DUMMY UNION ALL\n SELECT '00002' AS employee_id, 'Romeo' AS employee_name FROM DUMMY UNION ALL\n SELECT '00003' AS employee_id, 'Juliet' AS employee_name FROM DUMMY UNION ALL\n SELECT '00004' AS employee_id, 'Othello' AS employee_name FROM DUMMY UNION ALL\n SELECT '00005' AS employee_id, 'Macbeth' AS employee_name FROM DUMMY UNION ALL\n SELECT '00006' AS employee_id, 'Desdemona' AS employee_name FROM DUMMY UNION ALL\n SELECT '00007' AS employee_id, 'Cordelia' AS employee_name FROM DUMMY UNION ALL\n SELECT '00008' AS employee_id, 'Prospero' AS employee_name FROM DUMMY UNION ALL\n SELECT '00009' AS employee_id, 'Viola' AS employee_name FROM DUMMY UNION ALL\n SELECT '00010' AS employee_id, 'Titania' AS employee_name FROM DUMMY\n),\nsold_to_parties AS (\n SELECT '8000' AS sold_to_party, 'Fruitopia Inc.' AS sold_to_party_name FROM DUMMY UNION ALL\n SELECT '8001' AS sold_to_party, 'Tropical Treats Ltd.' AS sold_to_party_name FROM DUMMY UNION ALL\n SELECT '8002' AS sold_to_party, 'Apple Haven Corp.' AS sold_to_party_name FROM DUMMY UNION ALL\n SELECT '8003' AS sold_to_party, 'Citrus Delights Co.' AS sold_to_party_name FROM DUMMY UNION ALL\n SELECT '8004' AS sold_to_party, 'Exotic Fruits Ltd.' AS sold_to_party_name FROM DUMMY UNION ALL\n SELECT '8005' AS sold_to_party, 'Juicy Orchard Company' AS sold_to_party_name FROM DUMMY UNION ALL\n SELECT '8006' AS sold_to_party, 'Berry Bliss Enterprises' AS sold_to_party_name FROM DUMMY UNION ALL\n SELECT '8007' AS sold_to_party, 'Mango Magic Corp.' AS sold_to_party_name FROM DUMMY UNION ALL\n SELECT '8008' AS sold_to_party, 'Tempting Fruit Co.' AS sold_to_party_name FROM DUMMY UNION ALL\n SELECT '8009' AS sold_to_party, 'Paradise Fruit Ltd.' AS sold_to_party_name FROM DUMMY\n),\nrandom_values AS (\n SELECT\n LPAD(CAST(FLOOR(RAND() * 1000000) + 10000000 AS VARCHAR(10)), 10, '0') AS billing_doc,\n LPAD(CAST(FLOOR(RAND() * 10) + 1 AS VARCHAR(6)), 6, '0') AS billing_doc_item,\n sales_org,\n country,\n sold_to_parties.sold_to_party AS sold_to_party,\n sold_to_parties.sold_to_party_name AS sold_to_party_name,\n employees.employee_id AS sales_employee,\n employees.employee_name AS sales_employee_name,\n CASE LEFT(sales_org, 2)\n WHEN 'US' THEN 'NA'\n WHEN 'UK' THEN 'EU'\n WHEN 'AU' THEN 'AP'\n ELSE ''\n END AS region,\n sales_org AS sales_organization,\n LPAD(CAST(FLOOR(RAND() * 100) AS VARCHAR(2)), 2, '0') AS distribution_channel,\n LPAD(CAST(FLOOR(RAND() * 100) AS VARCHAR(2)), 2, '0') AS division,\n product AS product,\n 'PL' || LPAD(CAST(FLOOR(RAND() * 100) AS VARCHAR(2)), 2, '0') AS plant,\n 'PlantName' || CAST(FLOOR(RAND() * 1000000) AS NVARCHAR(6)) AS plant_name,\n LPAD(CAST(FLOOR(RAND() * 1000000) / 1000 AS DECIMAL(13, 3)), 13, '0') AS billing_quantity,\n 'KG' AS billing_quantity_unit,\n sales_orgs.currency AS transaction_currency,\n LPAD(CAST(FLOOR(RAND() * 1010000) / 100 AS DECIMAL(15, 2)), 15, '0') AS item_net_amount,\n sales_org AS company_code,\n 'CompanyCodeName' || CAST(FLOOR(RAND() * 1000000) AS NVARCHAR(6)) AS company_code_name,\n '2023' AS fiscal_year,\n LPAD(CAST(FLOOR(RAND() * 101) + 20000000 AS VARCHAR(10)), 10, '0') AS accounting_document,\n LPAD(CAST(FLOOR(RAND() * 6) + 1 AS VARCHAR(3)), 3, '0') AS fiscal_period,\n sales_orgs.org_weight as org_weight,\n RAND() as org_random\n FROM sales_orgs, products, employees, sold_to_parties\n)\n\nSELECT\n billing_doc,\n billing_doc_item,\n sales_org,\n sold_to_party,\n sold_to_party_name,\n sales_employee,\n sales_employee_name,\n country,\n region,\n distribution_channel,\n division,\n product,\n plant,\n plant_name,\n billing_quantity,\n billing_quantity_unit,\n transaction_currency,\n item_net_amount,\n company_code,\n company_code_name,\n fiscal_year,\n accounting_document,\n fiscal_period\nFROM random_values \nWHERE org_random <= org_weight;" }, { "prompt": "Provide technical details of the billing data table.", "completion": "The billing data table 'zsdbillgdocitm' contains the following columns:\n\n- billingdocument: NVARCHAR\n- billingdocumentitem: NVARCHAR\n- soldtoparty: NVARCHAR\n- soldtopartyname: NVARCHAR\n- salesemployee: NVARCHAR\n- salesemployeename: NVARCHAR\n- country: NVARCHAR\n- region: NVARCHAR\n- salesorganization: NVARCHAR\n- distributionchannel: NVARCHAR\n- division: NVARCHAR\n- product: NVARCHAR\n- plant: NVARCHAR\n- plantname: NVARCHAR\n- billingquantity: DECIMAL(13, 3)\n- billingquantityunit: NVARCHAR\n- transactioncurrency: NVARCHAR\n- itemnetamountofbillingdoc: DECIMAL(15, 2)\n- companycode: NVARCHAR\n- companycodename: NVARCHAR\n- fiscalyear: NVARCHAR\n- accountingdocument: NVARCHAR\n- fiscalperiod: NVARCHAR" }, { "prompt": "What is the field name and data type of the billing document in the billing table?", "completion": "In the zsdbillgdocitm table, the field name is billingdocument and it has the data type NVARCHAR." }, { "prompt": "Tell me the field name and data type of the billing document item in the billing table.", "completion": "The billing document item in the zsdbillgdocitm table is represented by the field name billingdocumentitem with the data type NVARCHAR." }, { "prompt": "From the billing table, what is the field name and data type of the customer code (soldtoparty)?", "completion": "In the zsdbillgdocitm table, the field soldtoparty is used as the customer code. It is of type NVARCHAR." }, { "prompt": "Can you provide me the field name and data type of the customer name (soldtopartyname) in the billing table?", "completion": "Certainly! In the zsdbillgdocitm table, the customer name field is represented by soldtopartyname and it is of type NVARCHAR." }, { "prompt": "From the billing table, what is the field name and data type of the sales employee?", "completion": "The sales employee field in the zsdbillgdocitm table is denoted by the field name salesemployee with the data type NVARCHAR." }, { "prompt": "What is the field name and data type of the sales employee name in the billing table?", "completion": "The field sales employee name in the zsdbillgdocitm table corresponds to the field name salesemployeename and it has the data type NVARCHAR." }, { "prompt": "Please provide the field name and data type of the country field in the billing table.", "completion": "The country field in the zsdbillgdocitm table is represented by the field name country and it has the data type NVARCHAR." }, { "prompt": "Tell me the field name and data type of the region field in the billing table.", "completion": "Certainly! The region field in the zsdbillgdocitm table is identified by the field name region and it has the data type NVARCHAR." }, { "prompt": "From the billing table, what is the field name and data type of the sales organization?", "completion": "In the zsdbillgdocitm table, the field sales organization is denoted by the field name salesorganization with the data type NVARCHAR." }, { "prompt": "What is the field name and data type of the distribution channel in the billing table?", "completion": "The field name for the distribution channel in the zsdbillgdocitm table is distributionchannel, and it has the data type NVARCHAR." }, { "prompt": "From the billing table, what is the field name and data type of the division?", "completion": "In the zsdbillgdocitm table, the field division is represented by the field name division and it has the data type NVARCHAR." }, { "prompt": "What is the field name and data type of the product (material) in the billing table?", "completion": "From the zsdbillgdocitm table, the field name for the product (material) is product, and it has the data type NVARCHAR." }, { "prompt": "Please provide the field name and data type of the plant field in the billing table.", "completion": "Certainly! The field name for the plant in the zsdbillgdocitm table is plant, and it has the data type NVARCHAR." }, { "prompt": "From the billing table, what is the field name and data type of the plant name?", "completion": "In the zsdbillgdocitm table, the field plant name is represented by the field name plantname with the data type NVARCHAR." }, { "prompt": "What is the total quantity and amount sold for each billing document in the billing data?", "completion": "SELECT billingdocument, billingquantityunit, SUM(billingquantity) AS sum_billingquantity, transactioncurrency, SUM(itemnetamountofbillingdoc) AS sum_itemnetamountofbillingdoc FROM zsdbillgdocitm GROUP BY billingdocument, billingquantityunit, transactioncurrency" }, { "prompt": "Provide the total quantity and amount sold for each billing document item in the billing dataset.", "completion": "SELECT billingdocumentitem, billingquantityunit, SUM(billingquantity) AS sum_billingquantity, transactioncurrency, SUM(itemnetamountofbillingdoc) AS sum_itemnetamountofbillingdoc FROM zsdbillgdocitm GROUP BY billingdocumentitem, billingquantityunit, transactioncurrency" }, { "prompt": "What is the total quantity and amount sold for each Sold-to party in the billing information?", "completion": "SELECT soldtoparty, billingquantityunit, SUM(billingquantity) AS sum_billingquantity, transactioncurrency, SUM(itemnetamountofbillingdoc) AS sum_itemnetamountofbillingdoc FROM zsdbillgdocitm GROUP BY soldtoparty, billingquantityunit, transactioncurrency" }, { "prompt": "Provide the total quantity and amount sold for each Sold-to party name in the billing data.", "completion": "SELECT soldtopartyname, billingquantityunit, SUM(billingquantity) AS sum_billingquantity, transactioncurrency, SUM(itemnetamountofbillingdoc) AS sum_itemnetamountofbillingdoc FROM zsdbillgdocitm GROUP BY soldtopartyname, billingquantityunit, transactioncurrency" }, { "prompt": "What is the total quantity and amount sold for each Sales employee in the billing dataset?", "completion": "SELECT salesemployee, billingquantityunit, SUM(billingquantity) AS sum_billingquantity, transactioncurrency, SUM(itemnetamountofbillingdoc) AS sum_itemnetamountofbillingdoc FROM zsdbillgdocitm GROUP BY salesemployee, billingquantityunit, transactioncurrency" }, { "prompt": "Provide the total quantity and amount sold for each Sales employee name in the billing information.", "completion": "SELECT salesemployeename, billingquantityunit, SUM(billingquantity) AS sum_billingquantity, transactioncurrency, SUM(itemnetamountofbillingdoc) AS sum_itemnetamountofbillingdoc FROM zsdbillgdocitm GROUP BY salesemployeename, billingquantityunit, transactioncurrency" }, { "prompt": "What is the total quantity and amount sold for each country in the billing data?", "completion": "SELECT country, billingquantityunit, SUM(billingquantity) AS sum_billingquantity, transactioncurrency, SUM(itemnetamountofbillingdoc) AS sum_itemnetamountofbillingdoc FROM zsdbillgdocitm GROUP BY country, billingquantityunit, transactioncurrency" }, { "prompt": "Provide the total quantity and amount sold for each region in the billing dataset.", "completion": "SELECT region, billingquantityunit, SUM(billingquantity) AS sum_billingquantity, transactioncurrency, SUM(itemnetamountofbillingdoc) AS sum_itemnetamountofbillingdoc FROM zsdbillgdocitm GROUP BY region, billingquantityunit, transactioncurrency" }, { "prompt": "What is the total quantity and amount sold for each sales organization in the billing information?", "completion": "SELECT salesorganization, billingquantityunit, SUM(billingquantity) AS sum_billingquantity, transactioncurrency, SUM(itemnetamountofbillingdoc) AS sum_itemnetamountofbillingdoc FROM zsdbillgdocitm GROUP BY salesorganization, billingquantityunit, transactioncurrency" }, { "prompt": "Provide the total quantity and amount sold for each distribution channel in the billing data.", "completion": "SELECT distributionchannel, billingquantityunit, SUM(billingquantity) AS sum_billingquantity, transactioncurrency, SUM(itemnetamountofbillingdoc) AS sum_itemnetamountofbillingdoc FROM zsdbillgdocitm GROUP BY distributionchannel, billingquantityunit, transactioncurrency" }, { "prompt": "What is the total quantity and amount sold for each division in the billing dataset?", "completion": "SELECT division, billingquantityunit, SUM(billingquantity) AS sum_billingquantity, transactioncurrency, SUM(itemnetamountofbillingdoc) AS sum_itemnetamountofbillingdoc FROM zsdbillgdocitm GROUP BY division, billingquantityunit, transactioncurrency" }, { "prompt": "Provide the total quantity and amount sold for each product (material) in the billing information.", "completion": "SELECT product, billingquantityunit, SUM(billingquantity) AS sum_billingquantity, transactioncurrency, SUM(itemnetamountofbillingdoc) AS sum_itemnetamountofbillingdoc FROM zsdbillgdocitm GROUP BY product, billingquantityunit, transactioncurrency" }, { "prompt": "What is the total quantity and amount sold for each plant in the billing data?", "completion": "SELECT plant, billingquantityunit, SUM(billingquantity) AS sum_billingquantity, transactioncurrency, SUM(itemnetamountofbillingdoc) AS sum_itemnetamountofbillingdoc FROM zsdbillgdocitm GROUP BY plant, billingquantityunit, transactioncurrency" }, { "prompt": "Provide the total quantity and amount sold for each plant name in the billing dataset.", "completion": "SELECT plantname, billingquantityunit, SUM(billingquantity) AS sum_billingquantity, transactioncurrency, SUM(itemnetamountofbillingdoc) AS sum_itemnetamountofbillingdoc FROM zsdbillgdocitm GROUP BY plantname, billingquantityunit, transactioncurrency" }, { "prompt": "What is the total quantity and amount sold for each company code in the billing information?", "completion": "SELECT companycode, billingquantityunit, SUM(billingquantity) AS sum_billingquantity, transactioncurrency, SUM(itemnetamountofbillingdoc) AS sum_itemnetamountofbillingdoc FROM zsdbillgdocitm GROUP BY companycode, billingquantity, transactioncurrency" }, { "prompt": "Provide the total quantity and amount sold for each company code name in the billing data.", "completion": "SELECT companycodename, billingquantityunit, SUM(billingquantity) AS sum_billingquantity, transactioncurrency, SUM(itemnetamountofbillingdoc) AS sum_itemnetamountofbillingdoc FROM zsdbillgdocitm GROUP BY companycodename, billingquantityunit, transactioncurrency" }, { "prompt": "What is the total quantity and amount sold for each fiscal year in the billing dataset?", "completion": "SELECT fiscalyear, billingquantityunit, SUM(billingquantity) AS sum_billingquantity, transactioncurrency, SUM(itemnetamountofbillingdoc) AS sum_itemnetamountofbillingdoc FROM zsdbillgdocitm GROUP BY fiscalyear, billingquantityunit, transactioncurrency" }, { "prompt": "Provide the total quantity and amount sold for each accounting document in the billing information.", "completion": "SELECT accountingdocument, billingquantityunit, SUM(billingquantity) AS sum_billingquantity, transactioncurrency, SUM(itemnetamountofbillingdoc) AS sum_itemnetamountofbillingdoc FROM zsdbillgdocitm GROUP BY accountingdocument, billingquantityunit, transactioncurrency" }, { "prompt": "What is the total quantity and amount sold for each fiscal period in the billing data?", "completion": "SELECT fiscalperiod, billingquantityunit, SUM(billingquantity) AS sum_billingquantity, transactioncurrency, SUM(itemnetamountofbillingdoc) AS sum_itemnetamountofbillingdoc FROM zsdbillgdocitm GROUP BY fiscalperiod, billingquantityunit, transactioncurrency" }, { "prompt": "What is the total quantity sold by Billing document?", "completion": "SELECT billingdocument, billingquantityunit, SUM(billingquantity) AS total_quantity_sold FROM zsdbillgdocitm GROUP BY billingdocument, billingquantity" }, { "prompt": "What is the total amount sold by Billing document item?", "completion": "SELECT billingdocumentitem, transactioncurrency, SUM(itemnetamountofbillingdoc) AS total_amount_sold FROM zsdbillgdocitm GROUP BY billingdocumentitem, transactioncurrency" }, { "prompt": "What is the total quantity and amount sold by Sold-to party?", "completion": "SELECT soldtoparty, billingquantityunit, transactioncurrency, SUM(billingquantity) AS total_quantity_sold, SUM(itemnetamountofbillingdoc) AS total_amount_sold FROM zsdbillgdocitm GROUP BY soldtoparty, billingquantityunit,transactioncurrency" }, { "prompt": "What is the total quantity sold by Sales employee?", "completion": "SELECT salesemployee, billingquantityunit, SUM(billingquantity) AS total_quantity_sold FROM zsdbillgdocitm GROUP BY salesemployee, billingquantity" }, { "prompt": "What is the total amount sold by Sales employee name?", "completion": "SELECT salesemployeename, transactioncurrency, SUM(itemnetamountofbillingdoc) AS total_amount_sold FROM zsdbillgdocitm GROUP BY salesemployeename, transactioncurrency" }, { "prompt": "What is the total quantity and amount sold by Country?", "completion": "SELECT country, billingquantityunit, SUM(billingquantity) AS total_quantity_sold,transactioncurrency, SUM(itemnetamountofbillingdoc) AS total_amount_sold FROM zsdbillgdocitm GROUP BY country, billingquantityunit, transactioncurrency" }, { "prompt": "What is the total quantity sold by Region?", "completion": "SELECT region, billingquantityunit, SUM(billingquantity) AS total_quantity_sold FROM zsdbillgdocitm GROUP BY region, billingquantity" }, { "prompt": "What is the total amount sold by Sales organization?", "completion": "SELECT salesorganization, transactioncurrency, SUM(itemnetamountofbillingdoc) AS total_amount_sold FROM zsdbillgdocitm GROUP BY salesorganization, transactioncurrency" }, { "prompt": "What is the total quantity and amount sold by Distribution channel?", "completion": "SELECT distributionchannel, billingquantityunit, SUM(billingquantity) AS total_quantity_sold, transactioncurrency, SUM(itemnetamountofbillingdoc) AS total_amount_sold FROM zsdbillgdocitm GROUP BY distributionchannel, billingquantityunit, transactioncurrency" }, { "prompt": "What is the total quantity sold by Division?", "completion": "SELECT division, billingquantityunit, SUM(billingquantity) AS total_quantity_sold FROM zsdbillgdocitm GROUP BY division, billingquantity" }, { "prompt": "What is the total amount sold by Product?", "completion": "SELECT product, transactioncurrency, SUM(itemnetamountofbillingdoc) AS total_amount_sold FROM zsdbillgdocitm GROUP BY product, transactioncurrency" }, { "prompt": "What is the total quantity and amount sold by Plant?", "completion": "SELECT plant, billingquantityunit, transactioncurrency, SUM(billingquantity) AS total_quantity_sold, SUM(itemnetamountofbillingdoc) AS total_amount_sold FROM zsdbillgdocitm GROUP BY plant, billingquantity, transactioncurrency" }, { "prompt": "What is the total quantity sold by Plant name?", "completion": "SELECT plantname, billingquantityunit, SUM(billingquantity) AS total_quantity_sold FROM zsdbillgdocitm GROUP BY plantname, billingquantity" }, { "prompt": "What is the total amount sold by Company code?", "completion": "SELECT companycode, transactioncurrency, SUM(itemnetamountofbillingdoc) AS total_amount_sold FROM zsdbillgdocitm GROUP BY companycode, transactioncurrency" }, { "prompt": "What is the total quantity and amount sold by Company code name?", "completion": "SELECT companycodename, billingquantity, transactioncurrency, SUM(billingquantity) AS total_quantity_sold, SUM(itemnetamountofbillingdoc) AS total_amount_sold FROM zsdbillgdocitm GROUP BY companycodename, billingquantity, transactioncurrency" }, { "prompt": "What is the total quantity sold by Fiscal year?", "completion": "SELECT fiscalyear, billingquantity, SUM(billingquantity) AS total_quantity_sold FROM zsdbillgdocitm GROUP BY fiscalyear, billingquantity" }, { "prompt": "What is the total amount sold by Accounting document?", "completion": "SELECT accountingdocument, transactioncurrency, SUM(itemnetamountofbillingdoc) AS total_amount_sold FROM zsdbillgdocitm GROUP BY accountingdocument, transactioncurrency" }, { "prompt": "What is the total quantity and amount sold by Fiscal period?", "completion": "SELECT fiscalperiod, billingquantity, transactioncurrency, SUM(billingquantity) AS total_quantity_sold, SUM(itemnetamountofbillingdoc) AS total_amount_sold FROM zsdbillgdocitm GROUP BY fiscalperiod, billingquantity, transactioncurrency" }, { "prompt": "What is the total quantity and amount sold for each billing document in the billing data this year?", "completion": "SELECT billingdocument, SUM(billingquantity), SUM(itemnetamountofbillingdoc) FROM zsdbillgdocitm WHERE fiscalyear = YEAR(CURRENT_DATE) GROUP BY billingdocument limit 10;" }, { "prompt": "Provide the total quantity and amount sold for each billing document item in the billing dataset for the United States.", "completion": "SELECT billingdocumentitem, SUM(billingquantity), SUM(itemnetamountofbillingdoc) FROM zsdbillgdocitm WHERE country = 'US' GROUP BY billingdocumentitem limit 10;" }, { "prompt": "What is the total quantity and amount sold for each Sold-to party in the billing information in the first quarter?", "completion": "SELECT soldtoparty, SUM(billingquantity), SUM(itemnetamountofbillingdoc) FROM zsdbillgdocitm WHERE fiscalperiod IN ('001', '002', '003') and fiscalyear = YEAR(CURRENT_DATE) GROUP BY soldtoparty limit 10;" }, { "prompt": "Provide the total quantity and amount sold for each Sold-to party name in the billing data for the European region.", "completion": "SELECT soldtopartyname, SUM(billingquantity), SUM(itemnetamountofbillingdoc) FROM zsdbillgdocitm WHERE region = 'EU' GROUP BY soldtopartyname limit 10;" }, { "prompt": "What is the total quantity and amount sold for each Sales employee in the billing dataset for the current month?", "completion": "SELECT salesemployee, SUM(billingquantity), SUM(itemnetamountofbillingdoc) FROM zsdbillgdocitm WHERE fiscalperiod = MONTH(CURRENT_DATE) and fiscalyear = YEAR(CURRENT_DATE) GROUP BY salesemployee limit 10;" }, { "prompt": "Provide the total quantity and amount sold for each Sales employee name in the billing information in 2023.", "completion": "SELECT salesemployeename, SUM(billingquantity), SUM(itemnetamountofbillingdoc) FROM zsdbillgdocitm WHERE fiscalyear = '2023' GROUP BY salesemployeename limit 10;" }, { "prompt": "What is the total quantity and amount sold for each country in the billing data in the first half of the year?", "completion": "SELECT country, SUM(billingquantity), SUM(itemnetamountofbillingdoc) FROM zsdbillgdocitm WHERE fiscalperiod <= '006' and fiscalyear = YEAR(CURRENT_DATE) GROUP BY country limit 10;" }, { "prompt": "Provide the total quantity and amount sold for each region in the billing dataset for the Asia-Pacific region.", "completion": "SELECT region, SUM(billingquantity), SUM(itemnetamountofbillingdoc) FROM zsdbillgdocitm WHERE region = 'AP' GROUP BY region limit 10;" }, { "prompt": "What is the total quantity and amount sold for each sales organization in the billing information for the current fiscal year?", "completion": "SELECT salesorganization, SUM(billingquantity), SUM(itemnetamountofbillingdoc) FROM zsdbillgdocitm WHERE fiscalyear = '2023' GROUP BY salesorganization limit 10;" }, { "prompt": "Provide the total quantity and amount sold for each distribution channel in the billing data for the 03 channel.", "completion": "SELECT distributionchannel, SUM(billingquantity), SUM(itemnetamountofbillingdoc) FROM zsdbillgdocitm WHERE distributionchannel = '03' GROUP BY distributionchannel limit 10;" }, { "prompt": "What is the total quantity and amount sold for each division in the billing dataset for the North America region?", "completion": "SELECT division, SUM(billingquantity), SUM(itemnetamountofbillingdoc) FROM zsdbillgdocitm WHERE region = 'NA' GROUP BY division limit 10;" }, { "prompt": "Provide the total quantity and amount sold for each product (material) in the billing information for the top-selling products Oranges and Apples.", "completion": "SELECT product, SUM(billingquantity), SUM(itemnetamountofbillingdoc) FROM zsdbillgdocitm WHERE product IN ('Orange', 'Apple') GROUP BY product limit 10;" }, { "prompt": "What is the total quantity and amount sold for each plant in the billing data in the first quarter?", "completion": "SELECT plant, SUM(billingquantity), SUM(itemnetamountofbillingdoc) FROM zsdbillgdocitm WHERE fiscalperiod <= '003' and fiscalyear = YEAR(CURRENT_DATE) GROUP BY plant limit 10;" }, { "prompt": "Provide the total quantity and amount sold for each plant name in the billing dataset for the 105 plants .", "completion": "SELECT plantname, SUM(billingquantity), SUM(itemnetamountofbillingdoc) FROM zsdbillgdocitm WHERE plantname LIKE '%105%' GROUP BY plantname limit 10;" }, { "prompt": "What is the total quantity and amount sold for each company code in the billing information in the current fiscal period?", "completion": "SELECT companycode, SUM(billingquantity), SUM(itemnetamountofbillingdoc) FROM zsdbillgdocitm WHERE fiscalperiod = MONTH(CURRENT_DATE) and fiscalyear = YEAR(CURRENT_DATE) GROUP BY companycode limit 10;" }, { "prompt": "Provide the total quantity and amount sold for each company code name in the billing data for the United Kindom market.", "completion": "SELECT companycodename, SUM(billingquantity), SUM(itemnetamountofbillingdoc) FROM zsdbillgdocitm WHERE country = 'UK' GROUP BY companycodename limit 10;" }, { "prompt": "What is the total quantity and amount sold for each fiscal year in the billing dataset for the past five years?", "completion": "SELECT fiscalyear, SUM(billingquantity), SUM(itemnetamountofbillingdoc) FROM zsdbillgdocitm WHERE fiscalyear BETWEEN YEAR(CURRENT_DATE) - 5 AND YEAR(CURRENT_DATE) GROUP BY fiscalyear limit 10;" }, { "prompt": "Provide the total quantity and amount sold for each accounting document in the billing information for May.", "completion": "SELECT accountingdocument, SUM(billingquantity), SUM(itemnetamountofbillingdoc) FROM zsdbillgdocitm WHERE fiscalperiod = '005' AND YEAR(CURRENT_DATE) GROUP BY accountingdocument limit 10;" }, { "prompt": "What is the total quantity and amount sold for each fiscal period in the billing data in the last quarter?", "completion": "SELECT fiscalperiod, SUM(billingquantity), SUM(itemnetamountofbillingdoc) FROM zsdbillgdocitm WHERE (\n (MONTH(CURRENT_DATE) BETWEEN 1 AND 3 AND fiscalperiod BETWEEN '009' AND '012' AND fiscalyear = YEAR(CURRENT_DATE) - 1) -- January to March (Q4 Previous year)\n OR\n (MONTH(CURRENT_DATE) BETWEEN 4 AND 6 AND fiscalperiod BETWEEN '001' AND '003' AND fiscalyear = YEAR(CURRENT_DATE)) -- April to June (Q1)\n OR\n (MONTH(CURRENT_DATE) BETWEEN 7 AND 9 AND fiscalperiod BETWEEN '004' AND '006' AND fiscalyear = YEAR(CURRENT_DATE)) -- July to September (Q2)\n OR\n (MONTH(CURRENT_DATE) NOT BETWEEN 1 AND 9 AND fiscalperiod BETWEEN '007' AND '009' AND fiscalyear = YEAR(CURRENT_DATE)) -- October to December (Q3)\n ) GROUP BY fiscalperiod limit 10;" }, { "prompt": "What is the total quantity sold by Billing document for 2023?", "completion": "SELECT billingdocument, SUM(billingquantity) FROM zsdbillgdocitm WHERE fiscalyear = '2023' GROUP BY billingdocument limit 10;" }, { "prompt": "What is the total amount sold by Billing document item in the European region?", "completion": "SELECT billingdocumentitem, SUM(itemnetamountofbillingdoc) FROM zsdbillgdocitm WHERE region = 'EU' GROUP BY billingdocumentitem limit 10;" }, { "prompt": "What is the total quantity and amount sold for each Sold-to party in the last quarter?", "completion": "SELECT soldtoparty, SUM(billingquantity), SUM(itemnetamountofbillingdoc) FROM zsdbillgdocitm WHERE\n (\n (MONTH(CURRENT_DATE) BETWEEN 1 AND 3 AND fiscalperiod BETWEEN '009' AND '012' AND fiscalyear = YEAR(CURRENT_DATE) - 1) -- January to March (Q4 Previous year)\n OR\n (MONTH(CURRENT_DATE) BETWEEN 4 AND 6 AND fiscalperiod BETWEEN '001' AND '003' AND fiscalyear = YEAR(CURRENT_DATE)) -- April to June (Q1)\n OR\n (MONTH(CURRENT_DATE) BETWEEN 7 AND 9 AND fiscalperiod BETWEEN '004' AND '006' AND fiscalyear = YEAR(CURRENT_DATE)) -- July to September (Q2)\n OR\n (MONTH(CURRENT_DATE) NOT BETWEEN 1 AND 9 AND fiscalperiod BETWEEN '007' AND '009' AND fiscalyear = YEAR(CURRENT_DATE)) -- October to December (Q3)\n ) GROUP BY soldtoparty limit 10;" }, { "prompt": "What is the total quantity sold by Sales employee for the current month in US Dollar transactions?", "completion": "SELECT salesemployee, SUM(billingquantity) FROM zsdbillgdocitm WHERE fiscalperiod = MONTH(CURRENT_DATE) AND fiscalyear = YEAR(CURRENT_DATE) AND transactioncurrency = 'USD' GROUP BY salesemployee limit 10;" }, { "prompt": "What is the total amount sold by Sales employee name in 2022 where the transactions were in US Dollars?", "completion": "SELECT salesemployeename, SUM(itemnetamountofbillingdoc) FROM zsdbillgdocitm WHERE fiscalyear = '2022' AND transactioncurrency = 'USD' GROUP BY salesemployeename limit 10;" }, { "prompt": "What is the total quantity and amount sold for each country in the second half of the year in USD?", "completion": "SELECT country, SUM(billingquantity), SUM(itemnetamountofbillingdoc) FROM zsdbillgdocitm WHERE fiscalperiod >= '007' AND fiscalyear = YEAR(CURRENT_DATE) AND transactioncurrency = 'USD' GROUP BY country limit 10;" }, { "prompt": "What is the total quantity sold by region for the Asia-Pacific region in USD?", "completion": "SELECT region, SUM(billingquantity) FROM zsdbillgdocitm WHERE region = 'AP' AND transactioncurrency = 'USD' GROUP BY region limit 10;" }, { "prompt": "What is the total amount sold by sales organization for the current fiscal year in USD?", "completion": "SELECT salesorganization, SUM(itemnetamountofbillingdoc) FROM zsdbillgdocitm WHERE fiscalyear = YEAR(CURRENT_DATE) AND transactioncurrency = 'USD' GROUP BY salesorganization limit 10;" }, { "prompt": "What is the total quantity and amount sold for each distribution channel in USD?", "completion": "SELECT distributionchannel, SUM(billingquantity), SUM(itemnetamountofbillingdoc) FROM zsdbillgdocitm WHERE transactioncurrency = 'USD' GROUP BY distributionchannel limit 10;" }, { "prompt": "What is the total quantity sold by division for the North America region in USD?", "completion": "SELECT division, SUM(billingquantity) FROM zsdbillgdocitm WHERE region = 'NA' AND transactioncurrency = 'USD' GROUP BY division limit 10;" }, { "prompt": "What is the total amount sold by product (material) for top 5 best selling products in USD?", "completion": "SELECT product, SUM(itemnetamountofbillingdoc) as sum_itemnetamountofbillingdoc FROM zsdbillgdocitm WHERE transactioncurrency = 'USD' GROUP BY product ORDER BY sum_itemnetamountofbillingdoc DESC limit 5;" }, { "prompt": "What is the total quantity and amount sold for each plant in the first quarter in USD?", "completion": "SELECT plant, SUM(billingquantity), SUM(itemnetamountofbillingdoc) FROM zsdbillgdocitm WHERE fiscalperiod <= '003' AND fiscalyear = YEAR(CURRENT_DATE) AND transactioncurrency = 'USD' GROUP BY plant limit 10;" }, { "prompt": "What is the total quantity sold by plant name for the 488 plants in USD?", "completion": "SELECT plantname, SUM(billingquantity) FROM zsdbillgdocitm WHERE plantname LIKE '%488%' AND transactioncurrency = 'USD' GROUP BY plantname limit 10;" }, { "prompt": "What is the total amount sold by company code for the current fiscal period in USD?", "completion": "SELECT companycode, SUM(itemnetamountofbillingdoc) FROM zsdbillgdocitm WHERE fiscalperiod = MONTH(CURRENT_DATE) AND fiscalyear = YEAR(CURRENT_DATE) AND transactioncurrency = 'USD' GROUP BY companycode limit 10;" }, { "prompt": "What is the total quantity and amount sold for each company code name in the European market in EUR?", "completion": "SELECT companycodename, SUM(billingquantity), SUM(itemnetamountofbillingdoc) FROM zsdbillgdocitm WHERE region = 'EU' AND transactioncurrency = 'EUR' GROUP BY companycodename limit 10;" }, { "prompt": "What is the total quantity and amount sold for each fiscal year between 2018 and 2022 in USD?", "completion": "SELECT fiscalyear, SUM(billingquantity), SUM(itemnetamountofbillingdoc) FROM zsdbillgdocitm WHERE fiscalyear BETWEEN '2018' AND '2022' AND transactioncurrency = 'USD' GROUP BY fiscalyear limit 10;" }, { "prompt": "What is the total quantity sold by accounting document for the current month in USD?", "completion": "SELECT accountingdocument, SUM(billingquantity) FROM zsdbillgdocitm WHERE MONTH(CURRENT_DATE) AND fiscalyear = YEAR(CURRENT_DATE) AND transactioncurrency = 'USD' GROUP BY accountingdocument limit 10;" }, { "prompt": "What is the total quantity and amount sold for each fiscal period in the last quarter in USD?", "completion": "SELECT fiscalperiod, SUM(billingquantity), SUM(itemnetamountofbillingdoc) FROM zsdbillgdocitm WHERE (\n (MONTH(CURRENT_DATE) BETWEEN 1 AND 3 AND fiscalperiod BETWEEN '009' AND '012' AND fiscalyear = YEAR(CURRENT_DATE) - 1) -- January to March (Q4 Previous year)\n OR\n (MONTH(CURRENT_DATE) BETWEEN 4 AND 6 AND fiscalperiod BETWEEN '001' AND '003' AND fiscalyear = YEAR(CURRENT_DATE)) -- April to June (Q1)\n OR\n (MONTH(CURRENT_DATE) BETWEEN 7 AND 9 AND fiscalperiod BETWEEN '004' AND '006' AND fiscalyear = YEAR(CURRENT_DATE)) -- July to September (Q2)\n OR\n (MONTH(CURRENT_DATE) NOT BETWEEN 1 AND 9 AND fiscalperiod BETWEEN '007' AND '009' AND fiscalyear = YEAR(CURRENT_DATE)) -- October to December (Q3)\n ) AND transactioncurrency = 'USD' GROUP BY fiscalperiod limit 10;" } ]