MySQL integration

Query MySQL in plain English, without writing SQL.

InsightLab connects to your MySQL database so anyone on the team can ask a business question and get a table or chart back. Follow up in the same conversation, and save the charts worth keeping to a dashboard.

Example questions

Store questions, and the MySQL queries behind them.

MySQL sits behind a great many web applications and online stores, so the questions asked of it tend to be about orders, products and customers. Here is what three of them look like in MySQL’s dialect.

Illustrative examples. The SQL below was written by hand against a sample schema (orders, order_items and products) to show the MySQL dialect. It is not output captured from InsightLab, and your own tables and columns will differ.

  1. “How many orders did we take each month this year, and what were they worth?”

    DATE_FORMAT turns each order date into a year-and-month label for grouping, and MAKEDATE builds the first day of the current year. MySQL lets GROUP BY refer to the column alias.

    Illustrative MySQL SQL on a sample schema
    SELECT DATE_FORMAT(created_at, '%Y-%m') AS month,
           COUNT(*)                         AS orders,
           SUM(total)                       AS revenue
    FROM orders
    WHERE status = 'completed'
      AND created_at >= MAKEDATE(YEAR(CURDATE()), 1)
    GROUP BY month
    ORDER BY month;
  2. “Which five product categories sold the most units in the last 30 days?”

    Two joins connect each line item to its order and its product. INTERVAL 30 DAY is MySQL’s date arithmetic, and LIMIT keeps the top five.

    Illustrative MySQL SQL on a sample schema
    SELECT p.category,
           SUM(oi.quantity)                 AS units_sold,
           SUM(oi.quantity * oi.unit_price) AS revenue
    FROM order_items oi
    JOIN orders o   ON o.id = oi.order_id
    JOIN products p ON p.id = oi.product_id
    WHERE o.status = 'completed'
      AND o.created_at >= CURDATE() - INTERVAL 30 DAY
    GROUP BY p.category
    ORDER BY units_sold DESC
    LIMIT 5;
  3. “What share of orders were canceled each week over the last eight weeks?”

    MySQL has no FILTER clause. A comparison evaluates to 1 or 0, so SUM(status = 'canceled') counts the matching rows. YEARWEEK with mode 3 numbers weeks the ISO way. WEEKDAY counts the days since Monday, so the window opens on the Monday seven weeks before this week’s: eight weeks, the current one included.

    Illustrative MySQL SQL on a sample schema
    SELECT YEARWEEK(created_at, 3)  AS iso_week,
           COUNT(*)                 AS orders,
           SUM(status = 'canceled') AS canceled,
           ROUND(100 * SUM(status = 'canceled') / COUNT(*), 1) AS canceled_pct
    FROM orders
    WHERE created_at >= CURDATE() - INTERVAL (WEEKDAY(CURDATE()) + 49) DAY
    GROUP BY iso_week
    ORDER BY iso_week;
About MySQL

What’s distinctive about asking questions of MySQL.

MySQL is one of the most widely used open-source databases, and a common choice behind web applications, content systems and e-commerce platforms. For many small and medium businesses, a MySQL database is where orders, customers and products actually live.

A database like that is written for the software, not for analysis. Statuses are often stored as short codes or numbers, amounts may be held in cents, and one idea, a “completed order” for example, can depend on two or three columns. In InsightLab you can define internal terms and add reviewed question-and-SQL examples so that queries follow your team’s definitions.

The dialect has habits of its own. In MySQL the words database and schema mean the same thing, month grouping is usually done with DATE_FORMAT, and conditional counts are written as a SUM over a comparison or a CASE expression.

Beyond one query

Make the answers part of the routine.

The same questions come back every week. These three features are for the ones worth keeping.

Teach it your business language

Define internal terms and add reviewed question-and-SQL examples, so InsightLab can use your team’s definitions when it builds queries.

Keep the charts you need again

Save charts from conversations to dashboards, and refresh the underlying queries when you need updated numbers.

Ask from the tools you already use

Add the InsightLab assistant to an internal portal or web application, so teams can ask questions where they already work.

FAQ

Questions about InsightLab and MySQL.

Can non-technical staff query MySQL with InsightLab?

Yes. They ask a business question in plain language. InsightLab builds the database query and returns the result as a table or chart, so nobody has to write SQL.

How does InsightLab handle status codes and company terms in our MySQL tables?

You can define internal terms and add reviewed question-and-SQL examples. InsightLab uses your team’s definitions when it builds queries, so that is the place to record what a term such as “completed order” means in your data.

Can we build a recurring sales report from MySQL data?

Yes. Save charts from a conversation to a dashboard, then refresh the underlying queries when you need updated numbers.

Who can see what once MySQL is connected?

Admins assign workspace roles and configure row- and column-level rules for database queries, so a query only returns the records and fields a person is allowed to see. Recorded activity can be reviewed in the admin console.

See it answer your team’s questions.

Tell us what your team wants to answer and which sources you use. We’ll walk through the product with you.

Request a demo