Compare 2 SQL Datasets
This workflow automates the execution of two SQL queries to obtain customer order data from 2003 to 2005. It compares the data based on customer ID and year fields, allowing for a quick identification of trends in order quantity and amount. It addresses the cumbersome and inefficient issues of manual data comparison, making it suitable for financial analysts, sales teams, and any professionals who need to compare order data from different time periods, significantly improving the efficiency and accuracy of data analysis.

Workflow Name
Compare 2 SQL Datasets
Key Features and Highlights
This workflow automates the execution of two SQL queries to retrieve customer order data from different time periods (2003-2004 and 2004-2005). It compares the two datasets based on customer ID and year fields, enabling users to quickly identify trends in order quantities or amounts. Utilizing n8n’s “Compare Datasets” node, the workflow supports multi-condition data matching and multiple matching results, enhancing the accuracy and flexibility of data analysis.
Core Problem Addressed
Comparing customer order data across different years or time periods is a common and critical task in business data analysis. Manual comparison is time-consuming and prone to errors. This workflow automates SQL query execution and data comparison, solving the inefficiencies and complexities of cross-period data comparison, and helps users rapidly detect changes in customer orders.
Application Scenarios
- Financial analysts or business analysts comparing customer order data across different periods
- Sales teams evaluating changes in customer purchasing behavior
- Data teams analyzing historical order data trends
- Any scenario requiring automated comparison of database data across different time frames
Main Process Steps
- Manually trigger the workflow: Start the entire process via the “Execute Workflow” button
- Execute the first SQL query: Retrieve total order amounts and quantities for customers in 2003 and 2004
- Execute the second SQL query: Retrieve total order amounts and quantities for customers in 2004 and 2005
- Adjust data fields: Configure or modify the order quantity field in the second query’s results
- Compare datasets: Perform multi-condition matching based on customer ID and year to find all matching records
- Output comparison results: Provide data for subsequent analysis or processing
Involved Systems or Services
- MySQL database (connected via “db4free MySQL”)
- Core n8n workflow automation nodes: Manual Trigger, MySQL Query, Set, Compare Datasets
Target Users and Value
This workflow is suitable for data analysts, finance personnel, sales managers, and any professionals needing to compare customer orders or transaction data across time periods. By automating data retrieval and comparison, it significantly improves analysis efficiency, reduces human errors, and delivers precise data support for business decision-making.