SQL // foundationPRODUCTION

ORDER BY Is Not a Storage Contract

Use ordering to choose rows, not to pretend a Data Extension stays sorted.

Context Pack →Open Workspace →
Trust & provenancePRODUCTION
Evidence tierPRODUCTIONOfficial sources1Other sources0Last verified2026-10-05

Evidence tier describes my hands-on relationship with the content. Official sources describe platform contracts/documentation. Production observations should not automatically be treated as official limits.

A Data Extension is a relational table, not an ordered list. ORDER BY is useful when paired with TOP or window functions to select which rows win, but downstream consumers should never rely on physical row order.

EvidencePRODUCTION
Difficultyfoundation
Verified2026-10-05
Operating rules
01

Use TOP + ORDER BY when selecting a limited ordered set.

02

Use ROW_NUMBER when selecting winners per group.

03

Do not depend on insertion order inside the target DE.

04

If presentation order matters, sort where the data is consumed.

Top N

SFMC follows SQL Server-style syntax rather than MySQL LIMIT.

SELECT TOP 100
  SubscriberKey,
  ModifiedDate
FROM [Source_DE]
ORDER BY ModifiedDate DESC

Why SELECT * is a bad companion

Salesforce’s SQL reference notes that queries combining a JOIN with SELECT * are not permitted, and explicit columns are a safer durable contract anyway.

Related snippets
Sources / verification