Skip to content

About

Practice Teradata SQL: primary indexes, `COLLECT STATISTICS`, `QUALIFY`, and window functions.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Arya Fatthurahman

Teradata Lab

Practice Teradata SQL: primary indexes, COLLECT STATISTICS, QUALIFY, and window functions.

Database: Teradata Category: Enterprise data warehouse Runs in Cloud License: MIT

What this lab is

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.

Quickstart

  1. Request access to Teradata ClearScape Analytics Experience (free) or start a Teradata Express VM.
  2. Open Teradata Studio or the SQL editor provided by the environment.
  3. Run examples/01_setup.sql to create the tables.
  4. Run examples/02_queries.sql to seed and query the data.
  5. Collect statistics and compare the query plan before and after.

Connection details

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

Examples

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.

Exercises

  1. Add a secondary index on orders.ordered_at and compare the plan for a date-range query.
  2. Use COLLECT STATISTICS on the join column and inspect the optimizer plan.
  3. Create a MULTISET table vs. a SET table and insert a duplicate row into each.
  4. Use QUALIFY to find the top two orders per customer.

Notes and limits

  • 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.

Run it from anywhere

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.

References


Part of the database-labs collection: 26 database engines, one index.

License

MIT (c) 2026 Arya Fatthurahman. See LICENSE.

About

Practice Teradata SQL: primary indexes, `COLLECT STATISTICS`, `QUALIFY`, and window functions.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors