# Practical habits for reliable SQL work

A small reproducible query is easier to review than a large script with hidden assumptions. Keep the table definition, a few synthetic rows and the expected output together when learning a feature or diagnosing a problem. State the connection mode and selected database.

Use explicit destination columns for inserts and explicit join keys. Give result columns meaningful names, and add `ORDER BY` when output order matters. A query that happens to return a stable order today does not establish an ordering contract.

Before changing data, preview the exact predicate and decide whether several statements must commit together. Native sessions retain transactions; HTTP transaction steps must be in one request. Make repeated-request behavior deliberate through keys and appropriate conflict handling.

For performance, compare equivalent results before comparing times. Keep query IDs with observations so history, counters and errors can be correlated. Inspect the selected plan rather than guessing whether an index was used.

When sharing an example, remove credentials and private values. Prefer documented public behavior over folklore or syntax borrowed from another product.

See [SQL statements](https://coordinatordb.com/docs/reference/statements), [transactions](https://coordinatordb.com/docs/concepts/features/operations/insert/transactions), [result comparisons](https://coordinatordb.com/docs/resources/support-center/knowledge-base/queries-sql/compare-resultsets) and [query measurements](https://coordinatordb.com/docs/guides/clickhouse/performance-and-monitoring/isolate-query-bottlenecks).
