My Code:
WITH custs AS
(
SELECT *
FROM customer_gt_90_dollars
INTERSECT
SELECT *
FROM customer_usa
)
SELECT
e.first_name || " " || e.last_name AS employee_name,
COUNT(c.customer_id) AS customers_usa_gt_90
FROM employee AS e
LEFT JOIN custs AS c ON c.support_rep_id = e.employee_id
WHERE e.title = 'Sales Support Agent'
GROUP BY e.employee_name
ORDER BY e.employee_name;
What I expected to happen:
I thought this would be correct, failing that I expected it to run.
What actually happened:
I get the error below
(sqlite3.OperationalError) no such column: e.employee_name
[SQL: WITH custs AS ( SELECT * FROM customer_gt_90_dollars INTERSECT SELECT * FROM customer_usa ) SELECT e.first_name || " " || e.last_name AS employee_name, COUNT(c.customer_id) AS customers_usa_gt_90 FROM employee AS e LEFT JOIN custs AS c ON c.support_rep_id = e.employee_id WHERE e.title = 'Sales Support Agent' GROUP BY e.employee_name ORDER BY e.employee_name;]
(Background on this error at: http://sqlalche.me/e/13/e3q8)
If I refresh the screen and copy and paste the answer it runs correctly.
If I comment out my code and paste the correct answer it seems to run, but there is no output.
If I comment out my code and paste the correct answer and submit the answer I get the following error:
Code
-- WITH custs AS
-- (
-- SELECT *
-- FROM customer_gt_90_dollars
-- INTERSECT
-- SELECT *
-- FROM customer_usa
-- )
-- SELECT
-- e.first_name || " " || e.last_name AS employee_name,
-- COUNT(c.customer_id) AS customers_usa_gt_90
-- FROM employee AS e
-- LEFT JOIN custs AS c ON c.support_rep_id = e.employee_id
-- WHERE e.title = 'Sales Support Agent'
-- GROUP BY e.employee_name
-- ORDER BY e.employee_name;
WITH customers_usa_gt_90 AS
(
SELECT * FROM customer_usa
INTERSECT
SELECT * FROM customer_gt_90_dollars
)
SELECT
e.first_name || " " || e.last_name employee_name,
COUNT(c.customer_id) customers_usa_gt_90
FROM employee e
LEFT JOIN customers_usa_gt_90 c ON c.support_rep_id = e.employee_id
WHERE e.title = 'Sales Support Agent'
GROUP BY 1 ORDER BY 1;
Result
The value for result doesn't look right.
One of your variables doesn't seem to have the correct value. Please re-check the instructions and your code.
This seems like a bug, but I thought it would be good to put other eyes on this before I report it.