text
stringlengths
190
342
<s>[INST] Write a SQL code to retrieve the total number of orders placed in each ISO week. [/INST] SELECT order_isoweek, COUNT(*) AS total_orders FROM order_transaction.transaction_detail_deprecated GROUP BY order_isoweek; </s>
<s>[INST] Write a SQL code to find the total revenue generated by each merchant. [/INST] SELECT merchant_id, SUM(order_total_amount) AS total_revenue FROM order_transaction.transaction_detail_deprecated GROUP BY merchant_id; </s>
<s>[INST] Write a SQL code to identify the number of unique shop locations (latitude and longitude pairs) from where orders have been placed. [/INST] SELECT DISTINCT order_shop_lat, order_shop_lng FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to calculate the average special discount applied to orders. [/INST] SELECT DISTINCT order_shop_lat, order_shop_lng FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to calculate the average special discount applied to orders. [/INST] SELECT AVG(order_special_discount) AS average_special_discount FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to determine the average longitude value of delivery locations for all orders. [/INST] SELECT AVG(order_delivery_lng) AS average_delivery_longitude FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to count the number of orders placed for each delivery mode (e.g., standard, express, etc.). [/INST] SELECT order_delivery_mode, COUNT(*) AS total_orders FROM order_transaction.transaction_detail_deprecated GROUP BY order_delivery_mode; </s>
<s>[INST] Write a SQL code to find the total subsidized amount applied to orders. [/INST] SELECT SUM(order_delivery_subsidized_cfg_amt) AS total_subsidized_amount FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to find the average estimated delivery amount for all orders. [/INST] SELECT AVG(order_delivery_estimate_amt) AS average_delivery_estimate FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to determine the total number of orders delivered to each unique English subdistrict. [/INST] SELECT order_delivery_subdistrict_en, COUNT(*) AS total_orders FROM order_transaction.transaction_detail_deprecated GROUP BY order_delivery_subdistrict_en; </s>
<s>[INST] Write a SQL code to find the total number of orders delivered to each unique Thai subdistrict. [/INST] SELECT order_delivery_subdistrict_th, COUNT(*) AS total_orders FROM order_transaction.transaction_detail_deprecated GROUP BY order_delivery_subdistrict_th; </s>
<s>[INST] Write a SQL code to calculate the average order_total_amount for each delivery district in Thai (Thailand). [/INST] SELECT order_delivery_district_th, AVG(order_total_amount) AS average_order_total_amount FROM order_transaction.transaction_detail_deprecated GROUP BY order_delivery_district_th; </s>
<s>[INST] Write a SQL code to retrieve the total number of orders placed in each province in Thai (Thailand). [/INST] SELECT order_delivery_province_th, COUNT(*) AS total_orders FROM order_transaction.transaction_detail_deprecated GROUP BY order_delivery_province_th; </s>
<s>[INST] Write a SQL code to find the total revenue generated from orders before any discounts or subsidies were applied. [/INST] SELECT SUM(order_delivery_original_amt) AS total_revenue FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to identify the number of unique delivery districts in English. [/INST] SELECT COUNT(DISTINCT order_delivery_district_en) AS unique_delivery_districts FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to count the number of orders placed at each unique shop address. [/INST] SELECT order_shop_address, COUNT(*) AS total_orders FROM order_transaction.transaction_detail_deprecated GROUP BY order_shop_address; </s>
<s>[INST] Write a SQL code to find the earliest and latest date of the week for all orders. [/INST] SELECT MIN(order_lastdateofweek) AS earliest_week, MAX(order_lastdateofweek) AS latest_week FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to determine the most frequently used saved address ID for orders. [/INST] SELECT order_saved_addr_id, COUNT(*) AS order_count FROM order_transaction.transaction_detail_deprecated GROUP BY order_saved_addr_id ORDER BY order_count DESC LIMIT 1; </s>
<s>[INST] Write a SQL code to find the total number of orders that used a promo code. [/INST] SELECT COUNT(*) AS total_orders_with_promo_code FROM order_transaction.transaction_detail_deprecated WHERE order_promo_code IS NOT NULL; </s>
<s>[INST] Write a SQL code to count the number of orders for each unique current state (e.g., processing, delivered, canceled). [/INST] SELECT order_current_state, COUNT(*) AS total_orders FROM order_transaction.transaction_detail_deprecated GROUP BY order_current_state; </s>
<s>[INST] Write a SQL code to identify the most common current status for all orders. [/INST] SELECT order_current_status, COUNT(*) AS order_count FROM order_transaction.transaction_detail_deprecated GROUP BY order_current_status ORDER BY order_count DESC LIMIT 1; </s>
<s>[INST] Write a SQL code to find the average time taken to complete an order (from placing the order to delivery) for all orders. [/INST] SELECT AVG(order_time) AS average_order_completion_time FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to determine the total revenue generated from all orders. [/INST] SELECT SUM(order_amount) AS total_revenue FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to count the number of orders for each unique delivery description. [/INST] SELECT order_delivery_desc, COUNT(*) AS total_orders FROM order_transaction.transaction_detail_deprecated GROUP BY order_delivery_desc; </s>
<s>[INST] Write a SQL code to find the total number of orders delivered to each province in English. [/INST] SELECT order_delivery_province_en, COUNT(*) AS total_orders FROM order_transaction.transaction_detail_deprecated GROUP BY order_delivery_province_en; </s>
<s>[INST] Write a SQL code to calculate the average subsidy amount applied to orders. [/INST] SELECT AVG(order_delivery_subsidy) AS average_subsidy_amount FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to retrieve the total number of orders placed in each month. [/INST] SELECT order_month, COUNT(*) AS total_orders FROM order_transaction.transaction_detail_deprecated GROUP BY order_month; </s>
<s>[INST] Write a SQL code to identify the number of orders for each unique order status (e.g., confirmed, pending, completed). [/INST] SELECT order_status, COUNT(*) AS total_orders FROM order_transaction.transaction_detail_deprecated GROUP BY order_status; </s>
<s>[INST] Write a SQL code to find the average latitude value of delivery locations for all orders. [/INST] SELECT AVG(order_delivery_lat) AS average_delivery_latitude FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to count the number of orders delivered to each unique delivery name. [/INST] SELECT order_delivery_name, COUNT(*) AS total_orders FROM order_transaction.transaction_detail_deprecated GROUP BY order_delivery_name; </s>
<s>[INST] Write a SQL code to determine the number of orders handled by each unique driver. [/INST] SELECT order_driver_id, COUNT(*) AS total_orders_handled FROM order_transaction.transaction_detail_deprecated GROUP BY order_driver_id; </s>
<s>[INST] Write a SQL code to find the total number of orders placed in each year. [/INST] SELECT order_year, COUNT(*) AS total_orders FROM order_transaction.transaction_detail_deprecated GROUP BY order_year; </s>
<s>[INST] Write a SQL code to calculate the average total distance covered in all orders. [/INST] SELECT AVG(order_totaldistance) AS average_total_distance FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to find the total amount of subsidy provided by merchants for all orders. [/INST] SELECT SUM(order_merchant_subsidy_amt) AS total_merchant_subsidy_amount FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to calculate the average Merchant Discount Rate (MDR) cost incurred by merchants for all orders. [/INST] SELECT AVG(order_merchant_cost_mdr) AS average_merchant_mdr_cost FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to determine the total Direct Delivery (DD) cost incurred by merchants for all orders. [/INST] SELECT SUM(order_merchant_cost_dd) AS total_direct_delivery_cost FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to find the average Delivery Service (DS) cost incurred by merchants for all orders. [/INST] SELECT AVG(order_merchant_cost_ds) AS average_delivery_service_cost FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to calculate the total Last-mile Service (LS) cost incurred by merchants for all orders. [/INST] SELECT SUM(order_merchant_cost_ls) AS total_last_mile_service_cost FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to find the total Delivery Service (DS) cost incurred by merchants for all orders. [/INST] SELECT SUM(order_dd_discount) AS total_delivery_service_cost FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to calculate the total Last-mile Service (LS) cost incurred by merchants for all orders. [/INST] SELECT SUM(order_dd_discount_exclude_vat) AS total_last_mile_service_cost FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to determine the total discount amount applied to Direct Delivery (DD) orders. [/INST] SELECT SUM(order_firstdateofweek) AS total_discount_amount_dd_orders FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to find the total discount amount applied to DD orders, excluding VAT. [/INST] SELECT SUM(order_update_date) AS total_discount_amount_dd_orders_excluding_vat FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to identify the earliest date of the week for all orders. [/INST] SELECT MIN(order_discount_amount) AS earliest_date_of_week FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to find the latest update date for orders. [/INST] SELECT MAX(order_dd_discount_food) AS latest_update_date FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to count the number of orders with non-null note entries. [/INST] SELECT COUNT(*) AS total_orders_with_notes FROM order_transaction.transaction_detail_deprecated WHERE order_datetime IS NOT NULL; </s>
<s>[INST] Write a SQL code to calculate the total discount amount applied to all orders. [/INST] SELECT SUM(order_date) AS total_discount_amount_all_orders FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to find the total discount amount applied to Direct Delivery (DD) food orders. [/INST] SELECT SUM(order_datename) AS total_discount_amount_dd_food_orders FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to determine the number of orders handled by each unique rider. [/INST] SELECT rider_riderid, COUNT(*) AS total_orders_handled FROM order_transaction.transaction_detail_deprecated GROUP BY rider_riderid; </s>
<s>[INST] Write a SQL code to find the average net payment received by riders. [/INST] SELECT AVG(rider_netprice) AS average_net_payment_received FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to count the number of orders placed at each unique shop address detail. [/INST] SELECT shop_address_detail, COUNT(*) AS total_orders FROM order_transaction.transaction_detail_deprecated GROUP BY shop_address_detail; </s>
<s>[INST] Write a SQL code to find the average distance traveled by riders to reach the merchant's location. [/INST] SELECT AVG(rider_distancetomerchant) AS average_distance_to_merchant FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to count the number of times a rider was not found during delivery attempts. [/INST] SELECT COUNT(*) AS total_rider_not_found_attempts FROM order_transaction.transaction_detail_deprecated WHERE rider_ridernotfoundtime IS NOT NULL; </s>
<s>[INST] Write a SQL code to calculate the average time taken by riders to deliver food orders. [/INST] SELECT AVG(rider_fooddeliveredtime) AS average_food_delivery_time FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to find the average time taken by riders to arrive at the merchant's location. [/INST] SELECT AVG(rider_arrivedatmerchanttime) AS average_time_to_merchant FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to identify the earliest rider creation date in the database. [/INST] SELECT MIN(rider_creationdatetime) AS earliest_rider_creation_date FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to determine the total discount amount provided to riders. [/INST] SELECT SUM(rider_discount) AS total_discount_amount_to_riders FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to calculate the average time taken by riders to accept job assignments. [/INST] SELECT AVG(rider_jobacceptedtime) AS average_time_to_accept_job FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to find the average net payment received by riders after deductions. [/INST] SELECT AVG(rider_netpaymentprice) AS average_net_payment_received_after_deductions FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to count the number of times riders called merchants during deliveries. [/INST] SELECT COUNT(*) AS total_merchant_calls FROM order_transaction.transaction_detail_deprecated WHERE rider_calledmerchanttime IS NOT NULL; </s>
<s>[INST] Write a SQL code to count the number of unique driver IDs present in the database. [/INST] SELECT COUNT(DISTINCT rider_driverid) AS total_unique_driver_ids FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to determine the average time taken by riders to pick up meals for delivery. [/INST] SELECT AVG(rider_mealpickeduptime) AS average_time_to_pickup_meals FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to find the total tax amount deducted from rider payments. [/INST] SELECT SUM(rider_taxamount) AS total_tax_amount_deducted FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to identify the earliest and latest order date and time in the database. [/INST] SELECT MIN(order_datetime) AS earliest_order_datetime, MAX(order_datetime) AS latest_order_datetime FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to count the number of orders placed on each unique date. [/INST] SELECT order_date, COUNT(*) AS total_orders FROM order_transaction.transaction_detail_deprecated GROUP BY order_date; </s>
<s>[INST] Write a SQL code to find the total number of orders placed in each unique date name (e.g., Monday, Tuesday). [/INST] SELECT order_datename, COUNT(*) AS total_orders FROM order_transaction.transaction_detail_deprecated GROUP BY order_datename; </s>
<s>[INST] Write a SQL code to calculate the total amount earned from all orders. [/INST] SELECT SUM(order_total_amount) AS total_earnings FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to determine the most common day of the week for order placements. [/INST] SELECT order_day_of_week, COUNT(*) AS total_orders FROM order_transaction.transaction_detail_deprecated GROUP BY order_day_of_week ORDER BY total_orders DESC LIMIT 1; </s>
<s>[INST] Write a SQL code to count the number of orders placed in each unique month name. [/INST] SELECT order_monthname, COUNT(*) AS total_orders FROM order_transaction.transaction_detail_deprecated GROUP BY order_monthname; </s>
<s>[INST] Write a SQL code to calculate the total price of orders without any discounts or promotions. [/INST] SELECT SUM(order_normalprice) AS total_price_without_discounts FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to find the total number of orders placed in each year week (year and week combination). [/INST] SELECT order_yearweek, COUNT(*) AS total_orders FROM order_transaction.transaction_detail_deprecated GROUP BY order_yearweek; </s>
<s>[INST] Write a SQL code to find the average quantity of items ordered in each order. [/INST] SELECT AVG(order_item_quantity) AS average_item_quantity FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to determine the average time taken by riders to arrive at the customer's location during deliveries. [/INST] SELECT AVG(rider_arrivedatcustlocationtime) AS average_time_to_customer_location FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to count the total number of unique orders in the database. [/INST] SELECT COUNT(DISTINCT order_id) AS total_unique_orders FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to find the total logistic discount amount applied to all orders. [/INST] SELECT SUM(order_logistic_discount_amt) AS total_logistic_discount_amount FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to calculate the total VAT amount for all orders. [/INST] SELECT SUM(order_vat_amount) AS total_vat_amount FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to count the number of orders for each unique payment type (e.g., cash, credit card, etc.). [/INST] SELECT order_payment_type, COUNT(*) AS total_orders FROM order_transaction.transaction_detail_deprecated GROUP BY order_payment_type; </s>
<s>[INST] Write a SQL code to find the total number of orders eligible for loyalty/reward points. [/INST] SELECT SUM(order_point_eligibility) AS total_eligible_orders FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to identify the number of orders for each unique payment channel (e.g., online, in-person, etc.). [/INST] SELECT order_payment_channel, COUNT(*) AS total_orders FROM order_transaction.transaction_detail_deprecated GROUP BY order_payment_channel; </s>
<s>[INST] Write a SQL code to determine the number of orders made using each unique card mask (last four digits of the card number). [/INST] SELECT order_card_mask, COUNT(*) AS total_orders FROM order_transaction.transaction_detail_deprecated GROUP BY order_card_mask; </s>
<s>[INST] Write a SQL code to count the number of orders placed with each unique card type (e.g., Visa, Mastercard, etc.). [/INST] SELECT order_card_type, COUNT(*) AS total_orders FROM order_transaction.transaction_detail_deprecated GROUP BY order_card_type; </s>
<s>[INST] Write a SQL code to identify the number of orders for each unique payment reference. [/INST] SELECT order_payment_ref, COUNT(*) AS total_orders FROM order_transaction.transaction_detail_deprecated GROUP BY order_payment_ref; </s>
<s>[INST] Write a SQL code to count the number of orders for each unique payment method ID. [/INST] SELECT order_payment_method_id, COUNT(*) AS total_orders FROM order_transaction.transaction_detail_deprecated GROUP BY order_payment_method_id; </s>
<s>[INST] Write a SQL code to find the total number of orders for each unique OTI card reference. [/INST] SELECT order_oti_card_ref, COUNT(*) AS total_orders FROM order_transaction.transaction_detail_deprecated GROUP BY order_oti_card_ref; </s>
<s>[INST] Write a SQL code to count the number of orders for each unique merchant order reference. [/INST] SELECT order_merchant_order_ref, COUNT(*) AS total_orders FROM order_transaction.transaction_detail_deprecated GROUP BY order_merchant_order_ref; </s>
<s>[INST] Write a SQL code to determine the total number of users for each unique card bank. [/INST] SELECT user_card_bank, COUNT(*) AS total_users FROM order_transaction.transaction_detail_deprecated GROUP BY user_card_bank; </s>
<s>[INST] Write a SQL code to find the average version number accepted by users for terms and conditions. [/INST] SELECT AVG(user_tc_accept_version) AS average_tc_accept_version FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to identify the earliest and latest user update dates in the database. [/INST] SELECT MIN(user_update_date) AS earliest_user_update_date, MAX(user_update_date) AS latest_user_update_date FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to count the total number of unique users in the database. [/INST] SELECT COUNT(DISTINCT user_id) AS total_unique_users FROM order_transaction.transaction_detail_deprecated; </s>
<s>[INST] Write a SQL code to find the total number of user registrations on each unique registration date. [/INST] SELECT user_register_date, COUNT(*) AS total_user_registrations FROM order_transaction.transaction_detail_deprecated GROUP BY user_register_date; </s>
<s>[INST] Write a SQL code to determine the total number of users who accepted the terms and conditions on each unique acceptance date. [/INST] SELECT user_tc_accept_date, COUNT(*) AS total_users_accepted_tc FROM order_transaction.transaction_detail_deprecated GROUP BY user_tc_accept_date; </s>
<s>[INST] Write a SQL code to count the number of users for each unique user status [/INST] SELECT user_user_status, COUNT(*) AS total_users_per_status FROM order_transaction.transaction_detail_deprecated GROUP BY user_user_status; </s>
<s>[INST] Write a SQL code to determine the total number of users for each unique channel (e.g., web, mobile, etc.). [/INST] SELECT user_channel, COUNT(*) AS total_users_per_channel FROM order_transaction.transaction_detail_deprecated GROUP BY user_channel; </s>
<s>[INST] Write a SQL code to count the number of users for each unique gender (e.g., male, female, non-binary). [/INST] SELECT user_gender, COUNT(*) AS total_users_per_gender FROM order_transaction.transaction_detail_deprecated GROUP BY user_gender; </s>
<s>[INST] Write a SQL code to identify the number of users for each unique CRD card reference. [/INST] SELECT user_crd_card_ref, COUNT(*) AS total_users_per_crd_card_ref FROM order_transaction.transaction_detail_deprecated GROUP BY user_crd_card_ref; </s>
<s>[INST] Write a SQL code to find the total number of users for each unique card professional ID. [/INST] SELECT user_card_prof_id, COUNT(*) AS total_users_per_card_prof_id FROM order_transaction.transaction_detail_deprecated GROUP BY user_card_prof_id; </s>
<s>[INST] Write a SQL code to count the number of shops for each unique name quality control status. [/INST] SELECT shop_name_qc_status, COUNT(*) AS total_shops_per_name_qc_status FROM order_transaction.transaction_detail_deprecated GROUP BY shop_name_qc_status; </s>
<s>[INST] Write a SQL code to determine the total number of shops for each unique nation food category quality control status. [/INST] SELECT shop_nation_food_category_qc_status, COUNT(*) AS total_shops_per_nation_food_category_qc_status FROM order_transaction.transaction_detail_deprecated GROUP BY shop_nation_food_category_qc_status; </s>
<s>[INST] Write a SQL code to find the total number of shops for each unique description quality control status. [/INST] SELECT shop_description_qc_status, COUNT(*) AS total_shops_per_description_qc_status FROM order_transaction.transaction_detail_deprecated GROUP BY shop_description_qc_status; </s>
<s>[INST] Write a SQL code to count the number of shops in each unique district (in English). [/INST] SELECT shop_district_en, COUNT(*) AS total_shops_per_district_en FROM order_transaction.transaction_detail_deprecated GROUP BY shop_district_en; </s>
<s>[INST] Write a SQL code to identify the number of shops for each unique location quality control status. [/INST] SELECT shop_location_qc_status, COUNT(*) AS total_shops_per_location_qc_status FROM order_transaction.transaction_detail_deprecated GROUP BY shop_location_qc_status; </s>