Sql
SQL examples
Start with a small sample table. Choose the recipe for the filter, calculation or write you need, then check its limits before using it on production data.
For your first query, follow Read the columns you need from its table definition through its response. The filtering and join examples reuse its customers and the three-order sample. Advanced calculation examples use a separate numeric-ID dataset linked on those pages.
- Start with sample rowsCreate and load the table named by the recipe.
- Choose a questionSelect fields, filter rows, join tables or calculate a result.
- Run its SQLKeep parameters separate from the query where supported.
- Verify the outputCheck fields, row counts and changes before adapting the query.
Read and change rows
- Read the columns you need — Select customer IDs and email addresses.
- Find rows with an exact value — Find customers whose region is IN.
- Match any value in a list — Find orders with either of two statuses.
- Find values within a range — Find orders whose amount is between two limits.
- Combine matching records — Join each order to its customer.
- Keep records without a match — List every customer, including customers who have no orders.
- Summarize rows by status — Group orders by status and calculate counts and amounts.
- Sort and page through rows — Use ORDER BY to choose the order, LIMIT to choose the page size, and OFFSET to skip earlier rows.
- Calculate across related rows — Window functions add a ranking or running calculation while keeping each original row.
- Filter with another query’s results — Find orders belonging to customers in a selected region.
- Update one row by primary key — Change one known row through SQL.
- Remove rows deliberately — Check the rows selected by a filter before deleting them.
- Follow a hierarchy — Expand an organization chart from one employee.
- Use everyday SQL patterns — Choose a recipe for a named subquery, bound values, time buckets, conditional values or catalog lookup.
Before adapting a recipe
Use a test database, load the named sample data, and check the expected result. Read each page’s limits before changing the query. See connection and SDK notes.