Use CasesAISQLdashboards

How to Build a Customer 360 View from Your Database Without SQL

Every team wants a complete picture of their customers. Sales wants to know deal history and last contact date. Support wants to see open tickets and how lon...

Priya Sharma· Product LeadApril 8, 20268 min read

Every team wants a complete picture of their customers. Sales wants to know deal history and last contact date. Support wants to see open tickets and how long someone has been a customer. Product wants to understand which features they've used and whether they're hitting limits.

The data to answer all of those questions almost always lives in your database. The problem is accessing it.

A "Customer 360" a single unified view of everything you know about a customer sounds like a big data infrastructure project. In practice, most of the raw ingredients are already in tables you have right now. What's missing is a fast way to combine and query them without writing complex SQL every time someone has a question.

This guide walks through what a Customer 360 view actually contains, how the data is typically structured in a database, and how to pull it together in a way that's useful to non-technical team members.

What a Customer 360 View Actually Contains

The term gets used loosely, but a practical Customer 360 answers these questions about any given customer:

  • Identity: Who are they? Name, email, company, location.
  • Acquisition: When did they sign up? What channel or campaign brought them?
  • Product usage: What features have they used? How often? When did they last log in?
  • Commercial status: What plan are they on? What's their MRR? Do they have outstanding invoices?
  • Support history: How many tickets have they opened? What was the last issue? Was it resolved?
  • Risk signals: Has their usage declined? Are they close to churning based on historical patterns?
  • Each of those categories maps to one or more tables in a typical SaaS database. Identity is in users or customers. Usage is in events or sessions. Commercial data is in subscriptions and invoices. Support is in tickets. The data exists it just sits in separate places.

    The Database Structure Behind a Customer 360

    Before querying anything, it helps to understand the schema. Here's a realistic structure for a mid-stage SaaS product:

     Core identity
    CREATE TABLE users (
      id UUID PRIMARY KEY,
      email TEXT UNIQUE NOT NULL,
      name TEXT,
      company TEXT,
      plan TEXT,
      created_at TIMESTAMP,
      last_seen_at TIMESTAMP
    );
    
     Subscription and billing
    CREATE TABLE subscriptions (
      id UUID PRIMARY KEY,
      user_id UUID REFERENCES users(id),
      plan_name TEXT,
      mrr DECIMAL,
      status TEXT,, 'active', 'churned', 'trial'
      started_at TIMESTAMP,
      cancelled_at TIMESTAMP
    );
    
     Product usage events
    CREATE TABLE events (
      id UUID PRIMARY KEY,
      user_id UUID REFERENCES users(id),
      event_name TEXT,
      properties JSONB,
      occurred_at TIMESTAMP
    );
    
     Support tickets
    CREATE TABLE tickets (
      id UUID PRIMARY KEY,
      user_id UUID REFERENCES users(id),
      subject TEXT,
      status TEXT,
      created_at TIMESTAMP,
      resolved_at TIMESTAMP
    );

    This is a simplified version of what most SaaS databases look like. Four tables, all linked to users.id. A Customer 360 query combines all four.

    Querying the Customer 360

    Here's a SQL query that pulls a meaningful snapshot for a single customer:

    SELECT
      u.name,
      u.email,
      u.company,
      u.plan,
      u.created_at as signup_date,
      u.last_seen_at,
      s.plan_name,
      s.mrr,
      s.status as subscription_status,
      COUNT(DISTINCT e.id) as total_events_30d,
      COUNT(DISTINCT t.id) as total_tickets,
      COUNT(DISTINCT CASE WHEN t.status = 'open' THEN t.id END) as open_tickets
    FROM users u
    LEFT JOIN subscriptions s ON u.id = s.user_id AND s.status = 'active'
    LEFT JOIN events e ON u.id = e.user_id AND e.occurred_at >= NOW() - INTERVAL '30 days'
    LEFT JOIN tickets t ON u.id = t.user_id
    WHERE u.email = 'customer@example.com'
    GROUP BY u.id, u.name, u.email, u.company, u.plan, u.created_at,
             u.last_seen_at, s.plan_name, s.mrr, s.status;

    This query returns one row with everything you need to understand that customer's current state. But writing it correctly and adapting it for different questions requires SQL knowledge most non-technical team members don't have.

    Turning the Customer 360 Into a Live Dashboard

    A query is useful once. A dashboard is useful every day.

    The real value of a Customer 360 comes when your support team can look up any customer in 10 seconds, or when your sales team can see which trial users are most active without filing a data request.

    The typical path to building this involves:

  • Writing the queries (SQL knowledge required)
  • Setting up a BI tool (Tableau, Metabase, Mode, etc.)
  • Pre-building every report and metric a team might want
  • Updating it when the schema changes
  • That process works, but it puts all the maintenance on whoever built the reports. When someone wants to add "number of API calls in the last 7 days" to the view, they need to go back to the engineer who built it.

    A different approach is using AI to query the database on demand. Instead of pre-building every possible view, team members ask questions directly: "Show me everything about customer@example.com" or "Which customers on the Pro plan haven't logged in for 30 days?"

    AI for Database connects directly to your database and translates those questions into SQL. Your support team can pull up a customer profile without knowing what table the data is in, or how to write a JOIN. Your sales team can ask "Which trial users have used the API more than 50 times this week?" and get an immediate answer.

    Building a Proactive Customer Health Score

    A static Customer 360 tells you where a customer is today. A health score tells you where they're headed.

    Health scores combine multiple signals into a single number typically 0-100 that predicts retention or churn risk. Common inputs:

  • Recency: Days since last login (lower is better)
  • Frequency: Number of logins or events in the last 30 days
  • Breadth: How many features has the customer used?
  • Depth: How much of their plan's capacity are they using?
  • Support burden: Number of open tickets (higher usually signals risk)
  • Here's a simplified health score query:

    WITH usage AS (
      SELECT
        user_id,
        COUNT(*) as events_30d,
        COUNT(DISTINCT event_name) as distinct_features_used,
        MAX(occurred_at) as last_event
      FROM events
      WHERE occurred_at >= NOW() - INTERVAL '30 days'
      GROUP BY user_id
    ),
    tickets AS (
      SELECT user_id, COUNT(*) as open_tickets
      FROM tickets
      WHERE status = 'open'
      GROUP BY user_id
    )
    SELECT
      u.name,
      u.email,
      COALESCE(usage.events_30d, 0) as events_30d,
      COALESCE(usage.distinct_features_used, 0) as features_used,
      EXTRACT(DAY FROM NOW() - COALESCE(usage.last_event, u.created_at)) as days_since_active,
      COALESCE(tickets.open_tickets, 0) as open_tickets,
     , Simple health score: high events + diverse features - inactivity - tickets
      LEAST(100, GREATEST(0,
        (COALESCE(usage.events_30d, 0) * 2) +
        (COALESCE(usage.distinct_features_used, 0) * 5) -
        (EXTRACT(DAY FROM NOW() - COALESCE(usage.last_event, u.created_at)) * 3) -
        (COALESCE(tickets.open_tickets, 0) * 10)
      )) as health_score
    FROM users u
    LEFT JOIN subscriptions s ON u.id = s.user_id AND s.status = 'active'
    LEFT JOIN usage ON u.id = usage.user_id
    LEFT JOIN tickets ON u.id = tickets.user_id
    WHERE s.status = 'active'
    ORDER BY health_score ASC;

    This surfaces your most at-risk customers at the top. Run it daily, and you have an early warning system without any external tool.

    Setting Up Automated Alerts for Customer Health Changes

    A health score dashboard is useful for on-demand lookups. But by the time you look at the dashboard, some customers may already be three weeks into a decline spiral.

    Action workflows let you define conditions and trigger alerts automatically. With AI for Database, you can set up a workflow like: "When a customer's event count drops below 5 for the week and they were previously at 20+, send a Slack alert to the Customer Success channel with their name and email."

    This kind of alert based on a change in database activity, not just a threshold is what separates proactive retention from reactive firefighting. You find out about the at-risk customer when there's still time to act, not when they cancel.

    The technical implementation without purpose-built tooling is complicated: you'd need a stored procedure or an external cron job, logic to track previous values, a way to send the Slack message, and ongoing maintenance. AI for Database handles all of this through a simple workflow interface, no stored procedures required.

    What Customer 360 Looks Like in Practice

    Here's how different teams actually use it:

    Customer success managers pull up an account before a renewal call. They check last login, feature usage, and open tickets. If usage is down, they have a conversation anchor.

    Sales reps look at trial accounts daily. Which trials are engaged? Who used a key feature that correlates with conversion? They reach out to the right people at the right time instead of blasting everyone.

    Support agents see a customer's full history when a ticket comes in. They know if this person is a long-term customer on an enterprise plan, or a free-tier user on their third ticket this week. The response calibrates accordingly.

    Product managers identify power users the customers who use the most features most often. They become the first call for user research and beta testing.

    None of this requires a data warehouse, a BI team, or a custom internal tool. It requires a database with the right tables and a way to query it that doesn't involve filing a request to an engineer.

    Ready to try AI for Database?

    Query your database in plain English. No SQL required. Start free today.