SQL ETL Example: Aggregating Customer Revenue
Extract data from orders table, transform by calculating total revenue per customer, load into customer_revenue table using SQL.
Let's walk through another SQL-based ETL example. This time, we'll deal with a slightly more complex scenario where we have to aggregate data and calculate new metrics before loading it into a target table. Scenario: You have an orders table containing information about customer orders. You want to extract this data, transform it by calculating the total revenue per customer, and then load the results into a customer_revenue table. Source Table: orders CREATE TABLE orders ( order_id INT PRIMARY KEY, customer_id INT, order_date DATE, amount DECIMAL(10, 2) );...