FROM and SHOW
Every ShopifyQL query needs FROM, which chooses the table or tables to query. You can use SHOW to choose which metrics and dimensions to return from the table.
The table you choose in FROM determines the metrics and dimensions available to SHOW, WHERE, GROUP BY, TIMESERIES, and other clauses. Browse the schema reference to find each table's metrics and dimensions.
If a query doesn't include SHOW, then it must include VISUALIZE to select the metric it renders.
If a query doesn't include SHOW, then it must include VISUALIZE to select the metric it renders.
Anchor to FROMFROM
Use FROM to choose the table or tables that a query runs against. A complete query includes one FROM clause.
A table's schema can include dimensions from related records, so a single-table query can group and filter by those related attributes without combining tables. The selected table also determines which related records are available to MATCHES filters.
Browse the schema reference to find each table's metrics and dimensions.
Anchor to TablesTables
Tables such as sales or customers can appear in FROM. Each table has a versioned schema that defines its metrics and dimensions. Select one table, or combine several in a multi-fact query when their schemas support it.
- Anchor to campaign_productscampaign_
productscampaign_ products Product quantities and average order quantities for orders attributed to marketing campaigns. Learn more
- Anchor to campaign_salescampaign_
salescampaign_ sales Campaign-attributed orders, sales, and average order value across first-click, last-click, last non-direct click, and linear attribution models. Learn more
- Anchor to campaign_sessionscampaign_
sessionscampaign_ sessions Campaign-attributed online store visits, including page views, cart additions, checkout progress, and conversion rates. Learn more
- Anchor to chargebackschargebackschargebacks
Payment disputes, including chargeback counts, amounts, rates, reasons, reported fraud, and Rapid Dispute Resolution status. Learn more
- Anchor to collective_product_engagementscollective_
product_ engagementscollective_ product_ engagements Engagement data for products sourced through Shopify Collective, including impressions and clicks per product per day
- Anchor to customerscustomerscustomers
Customer records, including first-purchase timing, new customer counts, lifetime spend, order count, average spend per order, and days since last order. Learn more
- Anchor to discountsdiscountsdiscounts
Discounted order counts and discount amounts across product, order, shipping, and app-applied discounts. Learn more
- Anchor to feesfeesfees
Shopify Payments processing, foreign exchange, and Managed Markets fee amounts and averages. Learn more
- Anchor to fulfillmentsfulfillmentsfulfillments
Fulfillment speed and volume from order placement through fulfillment, shipping handoff, and delivery. Learn more
- Anchor to gift_cardsgift_
cardsgift_ cards Gift card issuance, sales, adjustments, disablement, and starting and ending balances over time. Learn more
- Anchor to global_searchesglobal_
searchesglobal_ searches Global catalog search requests by product, product variant, store, and time. Learn more
- Anchor to inventoryinventoryinventory
Inventory item history by stock levels, units sold, days in stock or out of stock, sell-through rate, days remaining, and inventory value over time. Learn more
- Anchor to inventory_adjustment_historyinventory_
adjustment_ historyinventory_ adjustment_ history Inventory quantity changes and adjustment counts by reason, state, app, staff member, and reference document. Learn more
- Anchor to inventory_by_locationinventory_
by_ locationinventory_ by_ location Inventory stock levels, net unit changes, days in stock or out of stock, days remaining, and value by location over time. Learn more
- Anchor to inventory_shipmentsinventory_
shipmentsinventory_ shipments Shipped, received, accepted, and rejected quantities by carrier, tracking, status, and origin and destination. Learn more
- Anchor to inventory_transfersinventory_
transfersinventory_ transfers Inventory transfer quantities and counts by item, origin, destination, app, and staff member. Learn more
- Anchor to low_engagement_product_recommendationslow_
engagement_ product_ recommendationslow_ engagement_ product_ recommendations Low-engagement product recommendations and their click-rate gap from the store's 30-day average. Learn more
- Anchor to marketing_engagementsmarketing_
engagementsmarketing_ engagements Engagement, spend, order, and sales metrics reported by marketing channels for marketing events. Learn more
- Anchor to payment_attemptspayment_
attemptspayment_ attempts Payment attempt volume, failures, and authorization rates by payment method, amount, card details, and retry pattern. Learn more
- Anchor to paymentspaymentspayments
Payment transaction amounts, refunds, gift card redemptions, payment methods, gateways, and transaction status by order and customer. Learn more
- Anchor to payoutspayoutspayouts
Payout amounts from payment transactions by payout currency and date. Learn more
- Anchor to product_recommendation_conversionsproduct_
recommendation_ conversionsproduct_ recommendation_ conversions Click, cart-addition, and purchase conversion metrics for online store product recommendations. Learn more
- Anchor to profitabilityprofitabilityprofitability
Per-order profitability before returns, including revenue, cost of goods sold, shipping costs, duties, import taxes, sales taxes, and fulfillment costs. Learn more
- Anchor to returnsreturnsreturns
Returned item quantities by return status, reason, refund, return app, staff member, and line item. Learn more
- Anchor to salessalessales
Core sales metrics across channels, including revenue, orders, discounts, taxes, shipping, sales reversals, and customer type. Learn more
- Anchor to sales_taxessales_
taxessales_ taxes Tax amounts applied to sales and returns by tax name, rate, location, sales channel, product, and order. Learn more
- Anchor to search_conversionssearch_
conversionssearch_ conversions Click, cart-addition, and purchase conversion metrics for online store search sessions. Learn more
- Anchor to search_queriessearch_
queriessearch_ queries Online store search query volume and result-click counts by query and click status. Learn more
- Anchor to searchessearchessearches
Online store search query volume by query, intent, content type, and whether results were returned. Learn more
- Anchor to sessionssessionssessions
Online store visits, page views, traffic sources, devices, visitor locations, cart additions, checkout progress, and conversion rates. Learn more
- Anchor to shipping_labelsshipping_
labelsshipping_ labels Shipping label counts and costs by carrier, service, origin, destination, package, and order. Learn more
- Anchor to shop_campaign_insightsshop_
campaign_ insightsshop_ campaign_ insights Sales, customers, ad spend, customer acquisition cost, and return on ad spend from Shop Campaigns. Learn more
- Anchor to shop_post_purchase_offersshop_
post_ purchase_ offersshop_ post_ purchase_ offers Counts of customers who receive Shop post-purchase offers by discount code and time. Learn more
- Anchor to shop_product_impressionsshop_
product_ impressionsshop_ product_ impressions Product impression counts in the Shop channel by product and time. Learn more
- Anchor to shopify_formsshopify_
formsshopify_ forms Views, submissions, and conversion rates for Shopify Forms by form, page type, and product. Learn more
- Anchor to shopify_tax_ca_countryshopify_
tax_ ca_ countryshopify_ tax_ ca_ country Taxes on Canadian sales transactions broken down by tax type (GST/HST, PST, QST, RST, VPT) and destination province, to help merchants file federal and provincial returns with the right authorities
- Anchor to shopify_tax_ca_transactionsshopify_
tax_ ca_ transactionsshopify_ tax_ ca_ transactions Individual Canadian sales tax transactions, including tax type (GST/HST, PST, QST, RST, VPT), to provide detailed records for tax preparation and audit defense
- Anchor to store_credit_summariesstore_
credit_ summariesstore_ credit_ summaries Store credit starting balance, ending balance, and net change by date and currency. Learn more
- Anchor to store_credit_transactionsstore_
credit_ transactionsstore_ credit_ transactions Credited, debited, and expired store credit by event, source, customer, company, order, currency, and expiration date. Learn more
- Anchor to subscriptionssubscriptionssubscriptions
Subscription counts for active, added, and canceled subscriptions over time. Learn more
- Anchor to web_performanceweb_
performanceweb_ performance Online store page load, responsiveness, and visual stability metrics by page, device, browser, and storefront. Learn more
Anchor to Multi-fact queriesMulti-fact queries
Query several tables in one request by listing them as comma-separated tables in FROM, such as FROM sales, sessions. ShopifyQL joins the tables on the dimensions they share, so a query can return metrics from each table in the same result rows. Use a multi-fact query only when the selected schemas support being combined.
Group by the dimensions that the tables share: every GROUP BY field must exist with the same name in each selected schema.
Anchor to Organization queriesOrganization queries
Use FROM ORGANIZATION to query a table across the stores in an organization for multi-store reporting. Filtering on shop_id also requires FROM ORGANIZATION.
FROM ORGANIZATION requires organization analytics access and a table that supports multi-store reporting.
FROM ORGANIZATION requires organization analytics access and a table that supports multi-store reporting.
Anchor to SHOWSHOW
Use SHOW to choose which metrics, dimensions, and expressions a query returns from the table or tables chosen in FROM.
ShopifyQL returns result columns in the same order that you list them. When a metric, dimension, or expression uses AS, the returned column uses that alias in the same position.
Anchor to ExpressionsExpressions
An expression calculates a returned value instead of returning a metric or dimension directly. Use mathematical operators to combine numeric fields or literals from the selected table or tables. Add AS to give an expression a readable returned column name.
- Anchor to additionadditionaddition++
Adds two numeric values.
- Anchor to subtractionsubtractionsubtraction--
Subtracts one numeric value from another.
- Anchor to multiplicationmultiplicationmultiplication**
Multiplies two numeric values.
- Anchor to divisiondivisiondivision//
Divides one numeric value by another.