Final answer:
To display the customer ID and total number of orders placed, you can use the COUNT() function and GROUP BY clause. To display each customer ID and name who has bought computer desks, you can use JOIN statements and the WHERE clause. To display customer ID, name, and order ID for all customers, including those without orders, use the LEFT JOIN statement.
Step-by-step explanation:
To display the customer ID and total number of orders placed for those customers who placed more than one order, you can use the following SQL query:
SELECT customer_id, COUNT(order_id) AS total_orders FROM orders GROUP BY customer_id HAVING COUNT(order_id) > 1;
To display each customer ID and name who has bought computer desks and the total number of units bought by each customer, you can use the following SQL query:
SELECT c.customer_id, c.customer_name, SUM(od.quantity) AS total_units_bought FROM customers c JOIN orders o ON c.customer_id = o.customer_id JOIN order_details od ON o.order_id = od.order_id JOIN products p ON od.product_id = p.product_id WHERE p.product_name = 'computer desks' GROUP BY c.customer_id, c.customer_name;
To display the customer ID, name, and order ID for all customer orders, including those customers who do not have any orders, you can use the following SQL query:
SELECT c.customer_id, c.customer_name, o.order_id FROM customers c LEFT JOIN orders o ON c.customer_id = o.customer_id;