SELECT customerName, state, country FROM customers ORDER BY (CASE WHEN state IS NULL THEN country ELSE state END);
SELECT SUM(CASE WHEN status = 'Shipped' THEN 1 ELSE 0 END) AS 'Shipped', SUM(CASE WHEN status = 'On Hold' THEN 1 ELSE 0 END) AS 'On Hold', SUM(CASE WHEN status = 'In Process' THEN 1 ELSE 0 END) AS 'In Process', SUM(CASE WHEN status = 'Resolved' THEN 1 ELSE 0 END) AS 'Resolved', SUM(CASE WHEN status = 'Cancelled' THEN 1 ELSE 0 END) AS 'Cancelled', SUM(CASE WHEN status = 'Disputed' THEN 1 ELSE 0 END) AS 'Disputed', COUNT(*) AS Total FROM orders;