Execute the SQL statement. SELECT count(*) as "Total Customers" FROM customers; SELECT count(distinct category_name) as "Number of Product Categories" FROM product_categories; SELECT count(*) as "Number of Shipping Addresses from Ontario" FROM shipping_details WHERE province_code = "ON"; SELECT payment_type, count(*) as "Number of Payments" FROM payments JOIN payment_info ON payments.payment_id = payment_info.payment_id GROUP BY payment_type; SELECT count(*) as "Number of Invoices in 2013" FROM invoices WHERE invoice_date BETWEEN '2013-01-01' AND '2013-12-31'; SELECT province_code, count(*) as "Number of Customers" FROM customers JOIN shipping_details ON customers.customer_id = shipping_details.customer_id GROUP BY province_code ORDER BY count(*) DESC; SELECT MIN(invoice_total) as "Lowest Invoice Total", MAX(invoice_total) as "Highest Invoice Total", AVG(invoice_total) as "Average Invoice Total" FROM invoices; SELECT customers.first_name, customers.last_name, UPPER(customers.email) as "Email Address", customer_product.ordered_amount FROM customers JOIN customer_product ON customers.customer_id = customer_product.customer_id WHERE customer_product.ordered_amount >= 5 ORDER BY customer_product.ordered_amount; SELECT customers.first_name, customers.last_name, UPPER(customers.email) as "Email Address", customer_product.ordered_amount FROM customers JOIN customer_product ON customers.customer_id = customer_product.customer_id WHERE customer_product.ordered_amount >= 5 ORDER BY customer_product.ordered_amount; SELECT customers.* FROM customers JOIN shipping_details ON customers.customer_id = shipping_details.customer_id WHERE shipping_details.province_code = "NS";
Execute the SQL statement.
SELECT count(*) as "Total Customers"
FROM customers;
SELECT count(distinct category_name) as "Number of Product Categories"
FROM product_categories;
SELECT count(*) as "Number of Shipping Addresses from Ontario"
FROM shipping_details
WHERE province_code = "ON";
SELECT payment_type, count(*) as "Number of Payments"
FROM payments
JOIN payment_info ON payments.payment_id = payment_info.payment_id
GROUP BY payment_type;
SELECT count(*) as "Number of Invoices in 2013"
FROM invoices
WHERE invoice_date BETWEEN '2013-01-01' AND '2013-12-31';
SELECT province_code, count(*) as "Number of Customers"
FROM customers
JOIN shipping_details ON customers.customer_id = shipping_details.customer_id
GROUP BY province_code
ORDER BY count(*) DESC;
SELECT MIN(invoice_total) as "Lowest Invoice Total", MAX(invoice_total) as "Highest Invoice Total", AVG(invoice_total) as "Average Invoice Total"
FROM invoices;
SELECT customers.first_name, customers.last_name, UPPER(customers.email) as "Email Address", customer_product.ordered_amount
FROM customers
JOIN customer_product ON customers.customer_id = customer_product.customer_id
WHERE customer_product.ordered_amount >= 5
ORDER BY customer_product.ordered_amount;
SELECT customers.first_name, customers.last_name, UPPER(customers.email) as "Email Address", customer_product.ordered_amount
FROM customers
JOIN customer_product ON customers.customer_id = customer_product.customer_id
WHERE customer_product.ordered_amount >= 5
ORDER BY customer_product.ordered_amount;
SELECT customers.*
FROM customers
JOIN shipping_details ON customers.customer_id = shipping_details.customer_id
WHERE shipping_details.province_code = "NS";
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 8 images