Practice Teradata SQL: primary indexes, COLLECT STATISTICS, QUALIFY, and window functions.
Teradata is a shared-nothing enterprise data warehouse with a distinctive physical design model: primary indexes, secondary indexes, and statistics drive the optimizer. This lab is cloud/VM-based because Teradata does not publish a freely redistributable local image. It focuses on the SQL patterns that differ from PostgreSQL and MySQL.
- Request access to Teradata ClearScape Analytics Experience (free) or start a Teradata Express VM.
- Open Teradata Studio or the SQL editor provided by the environment.
- Run
examples/01_setup.sqlto create the tables. - Run
examples/02_queries.sqlto seed and query the data. - Collect statistics and compare the query plan before and after.
| Field | Value |
|---|---|
| Environment | Teradata ClearScape Analytics Experience or Teradata Express VM |
| Host | <host> |
| Port | 1025 (default) |
| Database | lab |
| JDBC URL | jdbc:teradata://<host>/DATABASE=lab |
| CLI | bteq or Teradata Studio |
| File | What it shows |
|---|---|
examples/01_setup.sql |
Primary index, secondary index, and statistics. |
examples/02_queries.sql |
Seed data, QUALIFY, and a window function. |
- Add a secondary index on
orders.ordered_atand compare the plan for a date-range query. - Use
COLLECT STATISTICSon the join column and inspect the optimizer plan. - Create a
MULTISETtable vs. aSETtable and insert a duplicate row into each. - Use
QUALIFYto find the top two orders per customer.
- Teradata does not provide a freely redistributable Docker image for this lab. Use the free ClearScape environment or a licensed VM.
- The default port varies by environment; 1025 is common for Teradata Express.
- Primary index choice affects data distribution. The examples are deliberately small.
- Never commit environment credentials to the repository.
This lab already runs in the provider's cloud. To use it from another country safely:
- Keep the account behind MFA and restrict network access to your IP or VPN where the provider allows it.
- Use a dedicated lab user with the minimum privileges; never reuse personal credentials.
- Store tokens and passwords in a secret manager or environment variables, never in the repository.
- Stop or delete the warehouse, cluster, or VM when you finish to control cost.
The shared checklist and provider map are in REMOTE-ACCESS.md.
Part of the database-labs collection: 26 database engines, one index.
MIT (c) 2026 Arya Fatthurahman. See LICENSE.