Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

chasm-trap-example

Setting up

Please first run the SQL in the fan trap example

Add another customer with a target

INSERT INTO customers (customer_name)
VALUES ('Acorn Industries');

Run the query

This time we want a list of all customers and their targets, whether or not they have one set up.

SELECT
    c.customer_name,
    SUM(st.target_amount) AS sales_target_total
FROM customers AS c
JOIN sales_targets AS st
    ON st.customer_id = c.customer_id
GROUP BY c.customer_id, c.customer_name;
  customer_name  | sales_target_total 
-----------------+--------------------
 Acme Industries |             250.00

How do we get Acorn to show?