Complete QueryfulQL queries for common questions about your store.
Complete queries to paste into the query editor and adjust. Each answers a real question. See Datasets for every metric, dimension and filter.
Best-selling products last month
Your top products by net sales, with the items sold behind them.
FROM sales SHOW net_sales, net_items_sold GROUP BY product_title DURING last_month ORDER BY net_sales DESC LIMIT 20
Sales by channel, month on month
Each sales channel’s net sales last month, with the change against the month before.
FROM sales SHOW net_sales, orders GROUP BY sales_channel DURING last_month COMPARE TO previous_period ORDER BY net_sales DESC WITH PERCENT_CHANGE
This year against last, by week
Net sales week by week this year, drawn against the same weeks last year.
FROM sales SHOW net_sales TIMESERIES week DURING this_year COMPARE TO previous_year_match_day_of_week VISUALIZE net_sales TYPE line
Gross profit by vendor
What each vendor earned you after cost of goods, for products with a cost recorded.
FROM sales SHOW net_sales, cost_of_goods_sold, gross_profit, gross_margin GROUP BY product_vendor DURING last_quarter ORDER BY gross_profit DESC
New and returning customers
How much of each month’s sales came from first-time customers.
FROM sales SHOW net_sales, orders GROUP BY new_or_returning_customer TIMESERIES month DURING this_year VISUALIZE net_sales TYPE stacked_bar
Sales by the customer’s country
Where your buyers are, using the country on the customer behind each order.
FROM sales SHOW net_sales, orders GROUP BY order.customer.country DURING this_year ORDER BY net_sales DESC
Top three products for each vendor
The best sellers within each vendor, with everything else in an “Other” row.
FROM sales SHOW net_sales GROUP BY product_vendor, TOP 3 product_title DURING this_year WITH GROUP_TOTALS
Discount codes and what they brought in
Each discount code’s orders and sales, from the sales and discounts datasets together.
FROM sales, discounts SHOW applied_discounts, discounted_orders, net_sales GROUP BY discount_name DURING last_month ORDER BY net_sales DESC
Most-returned products and why
The products returned most this year, by return reason.
FROM returns SHOW returned_quantity, returned_value GROUP BY product_title, return_line_item_reason DURING this_year ORDER BY returned_quantity DESC LIMIT 25
Stock about to run out
Products by how many days their stock will last at last month’s rate of sale, soonest to sell out first.
FROM inventory SHOW ending_inventory_units, inventory_units_sold_per_day, days_of_inventory_remaining GROUP BY product_title, product_variant_title DURING last_month ORDER BY days_of_inventory_remaining ASC LIMIT 50
Best customers by lifetime spend
Customers with more than one order, by what they’ve spent with you.
FROM customers SHOW total_amount_spent, total_number_of_orders WHERE customer_number_of_orders > 1 GROUP BY customer_id, customer_country ORDER BY total_amount_spent DESC LIMIT 50
Conversion rate by device
How many online store sessions turned into orders, on mobile, desktop and tablet.
FROM sessions SHOW sessions, conversion_rate, added_to_cart_rate WHERE human_or_bot_session = 'human' GROUP BY session_device_type DURING last_month
Payouts this quarter
Each Shopify Payments payout, with the fees taken from it.
FROM payouts SHOW payout_amount, payout_fees TIMESERIES week DURING this_quarter WITH TOTALS
Abandoned checkouts recovered
How many abandoned checkouts came back and bought, week by week.
FROM abandoned_checkouts SHOW abandoned_checkouts, recovered_checkouts, checkout_recovery_rate TIMESERIES week DURING last_quarter
Fulfilment speed by location
The median time from order to shipping at each location.
FROM fulfillments SHOW orders_fulfilled, median_hours_order_to_shipping, on_time_delivery_rate GROUP BY inventory_location_name DURING last_month
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Queryful","colors":{"primary":"#84C11F","light":"#BBE379","dark":"#567D14"},"logo":{"light":"https://mintcdn.com/queryful/bWGj3e7V6oJUxtc5/logo/docs-logo-light.png?fit=max\u0026auto=format\u0026n=bWGj3e7V6oJUxtc5\u0026q=85\u0026s=a034b7abc6501fb900c0eb690369a0df","dark":"https://mintcdn.com/queryful/bWGj3e7V6oJUxtc5/logo/docs-logo-dark.png?fit=max\u0026auto=format\u0026n=bWGj3e7V6oJUxtc5\u0026q=85\u0026s=485cd150a2e0b8ff662f194b4563cd57"},"favicon":"https://mintcdn.com/queryful/bWGj3e7V6oJUxtc5/favicon.svg?fit=max\u0026auto=format\u0026n=bWGj3e7V6oJUxtc5\u0026q=85\u0026s=d8c4ee7435f964f8cebbd5944fb3bc0e","navbar":{"links":[{"href":"/support","label":"Support"}]},"footer":{"links":[{"header":"Help","items":[{"label":"Contact Support","href":"/support"}]},{"header":"Policies","items":[{"label":"Privacy Policy","href":"/policies/privacy-policy"},{"label":"Terms of Service","href":"/policies/terms-of-service"},{"label":"Data Processing Agreement","href":"/policies/data-processing-agreement"},{"label":"Security Incident Response","href":"/policies/security-incident-response"}]}]},"search":{"prompt":"Search Queryful documentation"},"seo":{},"fonts":{"heading":{"family":"JetBrains Mono"},"body":{"family":"Inter"}},"contextual":{"options":["copy","view","chatgpt","claude"],"display":"header"},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"queryful","hasAudioNarration":false,"actualSubdomain":"queryful","customDomains":["docs.queryful.app"],"gitSource":{"type":"github","owner":"ljsstudios","repo":"queryful","deployBranch":"main","contentDirectory":"documentation","isPrivate":true,"mountPath":"","label":"","_id":"6b09a01ef611578228526bfb"},"entitlements":{},"buildId":"6b09a3512af8fdfe8728188b","clientVersion":"0.0.4340","searchFilterCounts":[{"language":"default","tag":"QueryfulQL","count":85},{"language":"default","tag":"Datasets","count":59},{"language":"default","tag":"User Guide","count":24},{"language":"default","tag":"Syntax","count":13},{"language":"default","tag":"Sales","count":11},{"language":"default","tag":"Finance and payments","count":11},{"language":"default","tag":"Linked records","count":11},{"language":"default","tag":"Online store","count":10},{"language":"default","tag":"Schedules","count":9},{"language":"default","tag":"Reports","count":7}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"site-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"treatment","enabled":true,"payload":{"type":"string","value":"treatment"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"wildcard-email-auth","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[],"googleFontsInlined":true},"customCss":[]}
{"page":{"pagePath":"queryfulql/examples","slug":"/queryfulql/examples","pageMetadata":{"title":"Examples","description":"Complete QueryfulQL queries for common questions about your store.","href":"/queryfulql/examples"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Complete QueryfulQL queries for common questions about your store.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,p:`p`,pre:`pre`,span:`span`,..._provideComponents(),...props.components},{CodeBlock,Heading}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`Complete queries to paste into the `,_jsx(_components.a,{href:`/user-guide/reports/query-editor`,children:`query editor`}),` and adjust. Each answers a real question. See `,_jsx(_components.a,{href:`/queryfulql/datasets/overview`,children:`Datasets`}),` for every metric, dimension and filter.`]}),`\n`,_jsx(Heading,{level:`2`,id:`best-selling-products-last-month`,children:`Best-selling products last month`}),`\n`,_jsx(_components.p,{children:`Your top products by net sales, with the items sold behind them.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`6`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sales`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SHOW net_sales, net_items_sold`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` GROUP BY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` product_title`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` DURING last_month`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` ORDER BY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` net_sales `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`DESC`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` LIMIT`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 20`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`sales-by-channel-month-on-month`,children:`Sales by channel, month on month`}),`\n`,_jsx(_components.p,{children:`Each sales channel’s net sales last month, with the change against the month before.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sales`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SHOW net_sales, orders`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` GROUP BY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sales_channel`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` DURING last_month`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` COMPARE `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`TO`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` previous_period`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` ORDER BY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` net_sales `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`DESC`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` WITH`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` PERCENT_CHANGE`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`this-year-against-last-by-week`,children:`This year against last, by week`}),`\n`,_jsx(_components.p,{children:`Net sales week by week this year, drawn against the same weeks last year.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`6`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sales`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SHOW net_sales`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` TIMESERIES `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`week`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` DURING this_year`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` COMPARE `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`TO`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` previous_year_match_day_of_week`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` VISUALIZE net_sales `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`TYPE`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` line`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`gross-profit-by-vendor`,children:`Gross profit by vendor`}),`\n`,_jsx(_components.p,{children:`What each vendor earned you after cost of goods, for products with a cost recorded.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`5`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sales`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SHOW net_sales, cost_of_goods_sold, gross_profit, gross_margin`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` GROUP BY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` product_vendor`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` DURING last_quarter`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` ORDER BY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` gross_profit `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`DESC`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`new-and-returning-customers`,children:`New and returning customers`}),`\n`,_jsx(_components.p,{children:`How much of each month’s sales came from first-time customers.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`6`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sales`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SHOW net_sales, orders`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` GROUP BY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` new_or_returning_customer`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` TIMESERIES `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`month`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` DURING this_year`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` VISUALIZE net_sales `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`TYPE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` stacked_bar`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`sales-by-the-customer’s-country`,children:`Sales by the customer’s country`}),`\n`,_jsx(_components.p,{children:`Where your buyers are, using the country on the customer behind each order.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`5`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sales`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SHOW net_sales, orders`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` GROUP BY`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` order`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`customer`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.country`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` DURING this_year`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` ORDER BY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` net_sales `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`DESC`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`top-three-products-for-each-vendor`,children:`Top three products for each vendor`}),`\n`,_jsx(_components.p,{children:`The best sellers within each vendor, with everything else in an “Other” row.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`5`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sales`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SHOW net_sales`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` GROUP BY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` product_vendor, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`TOP`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 3`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` product_title`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` DURING this_year`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` WITH`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` GROUP_TOTALS`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`discount-codes-and-what-they-brought-in`,children:`Discount codes and what they brought in`}),`\n`,_jsx(_components.p,{children:`Each discount code’s orders and sales, from the sales and discounts datasets together.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`5`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sales, discounts`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SHOW applied_discounts, discounted_orders, net_sales`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` GROUP BY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` discount_name`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` DURING last_month`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` ORDER BY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` net_sales `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`DESC`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`most-returned-products-and-why`,children:`Most-returned products and why`}),`\n`,_jsx(_components.p,{children:`The products returned most this year, by return reason.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`6`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` returns`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SHOW returned_quantity, returned_value`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` GROUP BY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` product_title, return_line_item_reason`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` DURING this_year`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` ORDER BY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` returned_quantity `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`DESC`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` LIMIT`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 25`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`stock-about-to-run-out`,children:`Stock about to run out`}),`\n`,_jsx(_components.p,{children:`Products by how many days their stock will last at last month’s rate of sale, soonest to sell out first.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`6`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` inventory`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SHOW ending_inventory_units, inventory_units_sold_per_day, days_of_inventory_remaining`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` GROUP BY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` product_title, product_variant_title`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` DURING last_month`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` ORDER BY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` days_of_inventory_remaining `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`ASC`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` LIMIT`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 50`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`best-customers-by-lifetime-spend`,children:`Best customers by lifetime spend`}),`\n`,_jsx(_components.p,{children:`Customers with more than one order, by what they’ve spent with you.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`6`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` customers`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SHOW total_amount_spent, total_number_of_orders`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` WHERE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` customer_number_of_orders `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` GROUP BY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` customer_id, customer_country`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` ORDER BY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` total_amount_spent `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`DESC`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` LIMIT`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 50`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`conversion-rate-by-device`,children:`Conversion rate by device`}),`\n`,_jsx(_components.p,{children:`How many online store sessions turned into orders, on mobile, desktop and tablet.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`5`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` sessions`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SHOW `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`sessions`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, conversion_rate, added_to_cart_rate`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` WHERE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` human_or_bot_session `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'human'`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` GROUP BY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` session_device_type`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` DURING last_month`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`payouts-this-quarter`,children:`Payouts this quarter`}),`\n`,_jsx(_components.p,{children:`Each Shopify Payments payout, with the fees taken from it.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`5`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` payouts`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SHOW payout_amount, payout_fees`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` TIMESERIES `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`week`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` DURING this_quarter`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` WITH`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` TOTALS`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`abandoned-checkouts-recovered`,children:`Abandoned checkouts recovered`}),`\n`,_jsx(_components.p,{children:`How many abandoned checkouts came back and bought, week by week.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` abandoned_checkouts`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SHOW abandoned_checkouts, recovered_checkouts, checkout_recovery_rate`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` TIMESERIES `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`week`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` DURING last_quarter`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`fulfilment-speed-by-location`,children:`Fulfilment speed by location`}),`\n`,_jsx(_components.p,{children:`The median time from order to shipping at each location.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` fulfillments`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SHOW orders_fulfilled, median_hours_order_to_shipping, on_time_delivery_rate`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` GROUP BY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` inventory_location_name`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` DURING last_month`})}),`\n`]})})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Examples","description":"Complete QueryfulQL queries for common questions about your store.","href":"/queryfulql/examples"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Best-selling products last month","slug":"best-selling-products-last-month","depth":2,"children":[]},{"title":"Sales by channel, month on month","slug":"sales-by-channel-month-on-month","depth":2,"children":[]},{"title":"This year against last, by week","slug":"this-year-against-last-by-week","depth":2,"children":[]},{"title":"Gross profit by vendor","slug":"gross-profit-by-vendor","depth":2,"children":[]},{"title":"New and returning customers","slug":"new-and-returning-customers","depth":2,"children":[]},{"title":"Sales by the customer’s country","slug":"sales-by-the-customer’s-country","depth":2,"children":[]},{"title":"Top three products for each vendor","slug":"top-three-products-for-each-vendor","depth":2,"children":[]},{"title":"Discount codes and what they brought in","slug":"discount-codes-and-what-they-brought-in","depth":2,"children":[]},{"title":"Most-returned products and why","slug":"most-returned-products-and-why","depth":2,"children":[]},{"title":"Stock about to run out","slug":"stock-about-to-run-out","depth":2,"children":[]},{"title":"Best customers by lifetime spend","slug":"best-customers-by-lifetime-spend","depth":2,"children":[]},{"title":"Conversion rate by device","slug":"conversion-rate-by-device","depth":2,"children":[]},{"title":"Payouts this quarter","slug":"payouts-this-quarter","depth":2,"children":[]},{"title":"Abandoned checkouts recovered","slug":"abandoned-checkouts-recovered","depth":2,"children":[]},{"title":"Fulfilment speed by location","slug":"fulfilment-speed-by-location","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"queryful","siteName":"Queryful","title":"Examples - Queryful","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-11-27T15:31:44.641Z","originalFileLocation":"queryfulql/examples.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Complete QueryfulQL queries for common questions about your store.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Queryful\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/queryful/HuIJlyPoWOxh8H5k/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/queryful/HuIJlyPoWOxh8H5k/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/queryful/HuIJlyPoWOxh8H5k/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/queryful/HuIJlyPoWOxh8H5k/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/queryful/HuIJlyPoWOxh8H5k/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/queryful/HuIJlyPoWOxh8H5k/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/queryful/HuIJlyPoWOxh8H5k/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/queryful/HuIJlyPoWOxh8H5k/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/queryful/HuIJlyPoWOxh8H5k/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Examples - Queryful\">\u003cmeta data-mint-head property=\"og:description\" content=\"Complete QueryfulQL queries for common questions about your store.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Queryful\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.queryful.app/queryfulql/examples\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://queryful.mintlify.site/_mintlify/api/og/v2?division=Examples\u0026amp;title=Examples\u0026amp;description=Complete+QueryfulQL+queries+for+common+questions+about+your+store.\u0026amp;theme=bb89f7701192a91b2956be50\u0026amp;signature=790b79d58ca5de7076d1a175d66ae47157831a97188c67a154c7926d7427f8b7\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Examples - Queryful\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Complete QueryfulQL queries for common questions about your store.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://queryful.mintlify.site/_mintlify/api/og/v2?division=Examples\u0026amp;title=Examples\u0026amp;description=Complete+QueryfulQL+queries+for+common+questions+about+your+store.\u0026amp;theme=bb89f7701192a91b2956be50\u0026amp;signature=790b79d58ca5de7076d1a175d66ae47157831a97188c67a154c7926d7427f8b7\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/queryful/HuIJlyPoWOxh8H5k/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Queryful\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#84C11F\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.queryful.app/queryfulql/examples\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/queryfulql/examples.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.queryful.app/#organization\",\"name\":\"Queryful\",\"url\":\"https://docs.queryful.app\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/queryful/bWGj3e7V6oJUxtc5/logo/docs-logo-light.png?fit=max\u0026auto=format\u0026n=bWGj3e7V6oJUxtc5\u0026q=85\u0026s=a034b7abc6501fb900c0eb690369a0df\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.queryful.app#website\",\"name\":\"Queryful\",\"url\":\"https://docs.queryful.app\",\"publisher\":{\"@id\":\"https://docs.queryful.app/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.queryful.app/queryfulql/examples#webpage\",\"url\":\"https://docs.queryful.app/queryfulql/examples\",\"name\":\"Examples\",\"description\":\"Complete QueryfulQL queries for common questions about your store.\",\"dateModified\":\"2026-11-27T15:31:44.641Z\",\"isPartOf\":{\"@id\":\"https://docs.queryful.app#website\"},\"breadcrumb\":{\"@id\":\"https://docs.queryful.app/queryfulql/examples#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.queryful.app/queryfulql/examples#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Queryful\",\"item\":\"https://docs.queryful.app\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Examples\",\"item\":\"https://docs.queryful.app/queryfulql/examples\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.queryful.app/queryfulql/examples#article\",\"headline\":\"Examples\",\"name\":\"Examples\",\"description\":\"Complete QueryfulQL queries for common questions about your store.\",\"url\":\"https://docs.queryful.app/queryfulql/examples\",\"mainEntityOfPage\":{\"@id\":\"https://docs.queryful.app/queryfulql/examples#webpage\"},\"dateModified\":\"2026-11-27T15:31:44.641Z\",\"publisher\":{\"@id\":\"https://docs.queryful.app/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.queryful.app#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Queryful\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Queryful\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/queryfulql/examples.md","siteName":"Queryful","nav":{"global":null,"tabs":[{"tab":"User Guide","pages":[{"title":"User Guide","href":"/user-guide/getting-started"}]},{"tab":"QueryfulQL","groups":[{"group":"Introduction","icon":"book-open","pages":[{"title":"QueryfulQL","href":"/queryfulql/overview"}]},{"group":"Syntax","icon":"code","pages":[{"title":"Overview","href":"/queryfulql/syntax/overview"},{"title":"FROM and SHOW","href":"/queryfulql/syntax/from-and-show"},{"title":"WHERE","href":"/queryfulql/syntax/where"},{"title":"GROUP BY","href":"/queryfulql/syntax/group-by"},{"title":"TIMESERIES","href":"/queryfulql/syntax/timeseries"},{"title":"SINCE, UNTIL and DURING","href":"/queryfulql/syntax/since-until-during"},{"title":"COMPARE TO","href":"/queryfulql/syntax/compare-to"},{"title":"HAVING","href":"/queryfulql/syntax/having"},{"title":"ORDER BY","href":"/queryfulql/syntax/order-by"},{"title":"LIMIT","href":"/queryfulql/syntax/limit"},{"title":"WITH","href":"/queryfulql/syntax/with"},{"title":"VISUALIZE","href":"/queryfulql/syntax/visualize"},{"title":"Linked records","href":"/queryfulql/syntax/linked-records"}]},{"group":"Datasets","icon":"database","pages":[{"title":"Overview","href":"/queryfulql/datasets/overview"},{"group":"Sales","pages":[{"title":"Sales","href":"/queryfulql/datasets/sales"},{"title":"Orders","href":"/queryfulql/datasets/orders"},{"title":"Order line items","href":"/queryfulql/datasets/order_lines"},{"title":"Returns","href":"/queryfulql/datasets/returns"},{"title":"Refunds","href":"/queryfulql/datasets/refunds"},{"title":"Restocks","href":"/queryfulql/datasets/refund_lines"},{"title":"Write-offs","href":"/queryfulql/datasets/sale_write_offs"},{"title":"Sales taxes","href":"/queryfulql/datasets/sales_taxes"},{"title":"Agentic sales","href":"/queryfulql/datasets/agentic_sales"},{"title":"Products bought together","href":"/queryfulql/datasets/product_pairs"},{"title":"Profitability","href":"/queryfulql/datasets/profitability"}]},{"group":"Discounts and checkouts","pages":[{"title":"Discounts","href":"/queryfulql/datasets/discounts"},{"title":"Discount catalogue","href":"/queryfulql/datasets/discount_catalog"},{"title":"Abandoned checkouts","href":"/queryfulql/datasets/abandoned_checkouts"},{"title":"Draft orders","href":"/queryfulql/datasets/draft_orders"}]},{"group":"Customers","pages":[{"title":"Customers","href":"/queryfulql/datasets/customers"},{"title":"Customer addresses","href":"/queryfulql/datasets/customer_addresses"},{"title":"Customer segments","href":"/queryfulql/datasets/segments"},{"title":"Companies","href":"/queryfulql/datasets/companies"},{"title":"Customer journey visits","href":"/queryfulql/datasets/journey_visits"}]},{"group":"Products and subscriptions","pages":[{"title":"Products","href":"/queryfulql/datasets/products"},{"title":"Price lists","href":"/queryfulql/datasets/price_lists"},{"title":"Selling plans","href":"/queryfulql/datasets/subscription_plans"},{"title":"Subscriptions","href":"/queryfulql/datasets/subscriptions"}]},{"group":"Inventory","pages":[{"title":"Inventory","href":"/queryfulql/datasets/inventory"},{"title":"Inventory adjustments","href":"/queryfulql/datasets/inventory_adjustment_history"},{"title":"Inventory transfers","href":"/queryfulql/datasets/inventory_transfers"},{"title":"Inventory shipments","href":"/queryfulql/datasets/inventory_shipments"},{"title":"Received items","href":"/queryfulql/datasets/inventory_shipment_received_items"},{"title":"Purchase orders","href":"/queryfulql/datasets/inventory_purchase_orders"}]},{"group":"Fulfillment and shipping","pages":[{"title":"Fulfillments","href":"/queryfulql/datasets/fulfillments"},{"title":"Fulfillment backlog","href":"/queryfulql/datasets/fulfillment_orders"},{"title":"Shipping labels","href":"/queryfulql/datasets/shipping_labels"},{"title":"Shipping methods","href":"/queryfulql/datasets/shipping_methods"}]},{"group":"Finance and payments","pages":[{"title":"Payments","href":"/queryfulql/datasets/payments"},{"title":"Payment attempts","href":"/queryfulql/datasets/payment_attempts"},{"title":"Payouts","href":"/queryfulql/datasets/payouts"},{"title":"Payout transactions","href":"/queryfulql/datasets/balance_transactions"},{"title":"Payments balance","href":"/queryfulql/datasets/payments_balance"},{"title":"Disputes","href":"/queryfulql/datasets/disputes"},{"title":"Chargebacks","href":"/queryfulql/datasets/chargebacks"},{"title":"Receivables","href":"/queryfulql/datasets/receivables"},{"title":"Gift cards","href":"/queryfulql/datasets/gift_cards"},{"title":"Store credit transactions","href":"/queryfulql/datasets/store_credit_transactions"},{"title":"Store credit balance","href":"/queryfulql/datasets/store_credit_summaries"}]},{"group":"Online store","pages":[{"title":"Sessions","href":"/queryfulql/datasets/sessions"},{"title":"Referrers","href":"/queryfulql/datasets/session_referrers"},{"title":"UTM sessions","href":"/queryfulql/datasets/utm_sessions"},{"title":"Product page visits","href":"/queryfulql/datasets/product_sessions"},{"title":"Searches","href":"/queryfulql/datasets/searches"},{"title":"Search queries","href":"/queryfulql/datasets/search_queries"},{"title":"Search conversions","href":"/queryfulql/datasets/search_conversions"},{"title":"Product recommendations","href":"/queryfulql/datasets/product_recommendations"},{"title":"Recommendation conversions","href":"/queryfulql/datasets/product_recommendation_conversions"},{"title":"Web performance","href":"/queryfulql/datasets/web_performance"}]},{"group":"Marketing","pages":[{"title":"Marketing attribution","href":"/queryfulql/datasets/marketing_attribution"},{"title":"Marketing spend","href":"/queryfulql/datasets/marketing_spend"},{"title":"Marketing performance","href":"/queryfulql/datasets/marketing_performance"}]}]},{"group":"Linked records","icon":"link","pages":[{"title":"Linked records","href":"/queryfulql/records/overview"},{"title":"Product","href":"/queryfulql/records/product"},{"title":"Variant","href":"/queryfulql/records/variant"},{"title":"Order","href":"/queryfulql/records/order"},{"title":"Customer","href":"/queryfulql/records/customer"},{"title":"Company","href":"/queryfulql/records/company"},{"title":"Company location","href":"/queryfulql/records/company_location"},{"title":"Location","href":"/queryfulql/records/location"},{"title":"Draft order","href":"/queryfulql/records/draft_order"},{"title":"Market","href":"/queryfulql/records/market"},{"title":"Store","description":"The store fields any report that reaches a store can use","href":"/queryfulql/records/shop"}]},{"group":"Examples","icon":"lightbulb","pages":[{"title":"Examples","href":"/queryfulql/examples"}]}]},{"tab":"Changelog","pages":[{"title":"Changelog","href":"/changelog"}]},{"tab":"Policies","pages":[{"title":"Policies","href":"/policies/privacy-policy"}]}]},"basePath":"","title":"Examples - Queryful","deploymentId":"dpl_EtLmMeZHkKGqAjV1DiX4ZXCriDj3","buildId":"dpl_EtLmMeZHkKGqAjV1DiX4ZXCriDj3","dynamics":[],"chunks":[]}