Skip to content

Chapter 6: Exploring Your Data

The Problem

You need to build a campaign targeting "customers who bought electronics last quarter." But you're not sure: What's the table called? What field indicates product category? How is "electronics" spelled in the data—"Electronics," "ELECTRONICS," or "electronics"?

Before you can target, you need to explore.

The Key Idea

Core concept

AI can investigate your data for you. Ask questions in plain English, and AI translates them into database exploration.

You don't need to know SQL. You don't need to know table names. You describe what you're looking for, and AI finds it.

Starting a Conversation

Launch Claude Code with TD skills:

bash
tdx claude

Then ask exploratory questions:

> "What databases do I have access to?"

AI runs tdx database list and shows you the results:

You have access to 12 databases:
- marketing (42 tables)
- analytics (28 tables)
- events (15 tables)
- raw_data (89 tables)
...

Finding Tables

Once you know the databases, drill down:

> "What tables are in the marketing database?"
The marketing database contains 42 tables:
- customers (core customer records)
- campaigns (campaign definitions)
- segments (segment membership)
- email_sends (email delivery logs)
...

Understanding Table Structure

Found a promising table? Ask what's in it:

> "What columns are in the customers table?"
The customers table has these columns:
- customer_id (string) - unique identifier
- email (string)
- first_name (string)
- signup_date (timestamp)
- country (string)
- lifetime_value (double)
...

Asking Business Questions

The real power is asking business questions, not technical ones:

> "Where can I find purchase data with product categories?"

AI searches across tables and returns:

Purchase data with categories is in the events.purchases table:
- customer_id: who made the purchase
- purchased_at: when
- product_id: what product
- category: product category (e.g., 'Electronics', 'Clothing')
- amount: purchase value

Checking Data Values

Before building a segment, verify the values exist:

> "What are the unique values in the category field of purchases?"
The category field has these values:
- Electronics (45,230 purchases)
- Clothing (38,102 purchases)
- Home & Garden (22,891 purchases)
- Books (18,443 purchases)
...

Now you know: it's "Electronics" with a capital E.

Sample Data

Sometimes you need to see actual records:

> "Show me 5 example rows from the purchases table"

AI writes and runs a query, showing you real data:

| customer_id | purchased_at        | category    | amount |
|-------------|---------------------|-------------|--------|
| C-10042     | 2024-12-15 14:22:00 | Electronics | 299.99 |
| C-88721     | 2024-12-15 14:18:00 | Clothing    | 45.00  |
...

Counting and Aggregating

Get a sense of scale:

> "How many customers purchased electronics last quarter?"
I found 12,847 unique customers who purchased from the
Electronics category between October 1 and December 31, 2024.

This tells you the approximate audience size before you build the segment.

Mental Model: AI as Your Data Analyst

Imagine you had a data analyst sitting next to you. You wouldn't say "write me a SQL query that joins the purchases table to customers on customer_id and filters where category equals 'Electronics' and purchased_at is between..."

You'd say: "How many people bought electronics last quarter?"

That's exactly how to work with AI. State what you want to know. Let AI figure out the technical details.

Exploration Workflow

A typical exploration session:

  1. Start broad: "What data do I have about customer purchases?"
  2. Narrow down: "Which table has product categories?"
  3. Check values: "What categories exist?"
  4. Verify scale: "How many customers bought electronics?"
  5. Sample data: "Show me example records"

By the end, you know exactly what to target and how to describe it.

Saving Explorations

If AI writes a useful query, you can save it:

> "Save that query as 'electronics_buyers_count.sql'"

This creates a file you can reference later or share with colleagues.

Pitfalls

"AI says the table doesn't exist."

Check the database name. You might be looking in the wrong database:

> "Search for a table containing purchase data across all databases"

"The data looks different than expected."

Data pipelines vary. Ask AI to investigate:

> "Why are there null values in the category field?"

"I'm not sure if my question is too vague."

Start vague, then refine. AI will ask clarifying questions if needed, or you can iterate:

> "Actually, I meant electronics purchases over $100"

What You've Learned

  • AI explores data on your behalf
  • Ask business questions, not technical ones
  • Verify field values before building segments
  • Check audience sizes before committing
  • Iterate from broad to specific

Next Step

You can explore. Chapter 7 goes deeper—having AI write SQL queries for complex questions that go beyond exploration.


You've learned to explore. Next, you'll learn to query.