%3 (target) stg_customer (target) stg_customer country customer_name market_segment phone_number region (source) stg_nation (source) stg_nation country_name (source) stg_nation:f0->(target) stg_customer:f0 (target) stg_supplier (target) stg_supplier country phone_number region supplier_name address (source) stg_nation:f0->(target) stg_supplier:f0 (source) stg_customer (source) stg_customer customer_name market_segment phone_number (source) stg_customer:f0->(target) stg_customer:f1 (source) stg_customer:f1->(target) stg_customer:f2 (source) stg_customer:f2->(target) stg_customer:f3 (source) stg_region (source) stg_region region_name (source) stg_region:f0->(target) stg_customer:f4 (source) stg_region:f0->(target) stg_supplier:f2 (target) stg_date (target) stg_date (target) stg_lineorder (target) stg_lineorder commit_date discount_percentage line_item_revenue line_item_total line_number order_date order_priority order_total quantity shipping_mode shipping_priority supply_cost tax_percentage (source) stg_lineitem (source) stg_lineitem commit_date discount_rate extended_price line_number quantity shipping_mode tax_rate (source) stg_lineitem:f0->(target) stg_lineorder:f0 (source) stg_lineitem:f1->(target) stg_lineorder:f1 (source) stg_lineitem:f2->(target) stg_lineorder:f2 (source) stg_lineitem:f2->(target) stg_lineorder:f3 (source) stg_lineitem:f3->(target) stg_lineorder:f4 (source) stg_lineitem:f4->(target) stg_lineorder:f8 (source) stg_lineitem:f5->(target) stg_lineorder:f9 (source) stg_lineitem:f6->(target) stg_lineorder:f12 (source) stg_order (source) stg_order order_date order_priority total_price shipping_priority (source) stg_order:f0->(target) stg_lineorder:f5 (source) stg_order:f1->(target) stg_lineorder:f6 (source) stg_order:f2->(target) stg_lineorder:f7 (source) stg_order:f3->(target) stg_lineorder:f10 (source) stg_partsupp (source) stg_partsupp supply_cost (source) stg_partsupp:f0->(target) stg_lineorder:f11 (target) stg_part (target) stg_part container_type part_name size_ type_and_material (source) stg_part (source) stg_part container name size type (source) stg_part:f0->(target) stg_part:f0 (source) stg_part:f1->(target) stg_part:f1 (source) stg_part:f2->(target) stg_part:f2 (source) stg_part:f3->(target) stg_part:f3 (source) stg_supplier (source) stg_supplier supplier_phone supplier_name supplier_address (source) stg_supplier:f0->(target) stg_supplier:f1 (source) stg_supplier:f1->(target) stg_supplier:f3 (source) stg_supplier:f2->(target) stg_supplier:f4
%3 (target) stg_customer (target) stg_customer country customer_name market_segment phone_number region (source) stg_nation (source) stg_nation country_name (source) stg_nation:f0->(target) stg_customer:f0 (source) stg_customer (source) stg_customer customer_name market_segment phone_number (source) stg_customer:f0->(target) stg_customer:f1 (source) stg_customer:f1->(target) stg_customer:f2 (source) stg_customer:f2->(target) stg_customer:f3 (source) stg_region (source) stg_region region_name (source) stg_region:f0->(target) stg_customer:f4
SELECT 
    n.country_name as country,
    c.customer_name,
    c.market_segment,
    c.phone_number,
    r.region_name as region
FROM 
    stg_customer c
JOIN 
    stg_nation n ON c.nation_id = n.nation_id
JOIN 
    stg_region r ON n.region_id = r.region_id
⚠️ SQL query is just for reference based on schema. To ensure correctness, data access is required.
%3 (target) stg_date (target) stg_date
⚠️ SQL query is just for reference based on schema. To ensure correctness, data access is required.
%3 (target) stg_lineorder (target) stg_lineorder commit_date discount_percentage line_item_revenue line_item_total line_number order_date order_priority order_total quantity shipping_mode shipping_priority supply_cost tax_percentage (source) stg_lineitem (source) stg_lineitem commit_date discount_rate extended_price line_number quantity shipping_mode tax_rate (source) stg_lineitem:f0->(target) stg_lineorder:f0 (source) stg_lineitem:f1->(target) stg_lineorder:f1 (source) stg_lineitem:f2->(target) stg_lineorder:f2 (source) stg_lineitem:f2->(target) stg_lineorder:f3 (source) stg_lineitem:f3->(target) stg_lineorder:f4 (source) stg_lineitem:f4->(target) stg_lineorder:f8 (source) stg_lineitem:f5->(target) stg_lineorder:f9 (source) stg_lineitem:f6->(target) stg_lineorder:f12 (source) stg_order (source) stg_order order_date order_priority total_price shipping_priority (source) stg_order:f0->(target) stg_lineorder:f5 (source) stg_order:f1->(target) stg_lineorder:f6 (source) stg_order:f2->(target) stg_lineorder:f7 (source) stg_order:f3->(target) stg_lineorder:f10 (source) stg_partsupp (source) stg_partsupp supply_cost (source) stg_partsupp:f0->(target) stg_lineorder:f11
SELECT 
    l.commit_date,
    l.discount_rate * 100 AS discount_percentage,
    l.extended_price AS line_item_revenue,
    l.extended_price AS line_item_total,
    l.line_number,
    o.order_date,
    CASE 
        WHEN o.order_priority = '1-URGENT' THEN 'Urgent'
        WHEN o.order_priority = '2-HIGH' THEN 'High'
        WHEN o.order_priority = '3-MEDIUM' THEN 'Medium'
        WHEN o.order_priority = '4-LOW' THEN 'Low'
        WHEN o.order_priority = '5-NOT URGENT' THEN 'Not Urgent'
        ELSE o.order_priority
    END AS order_priority,
    o.total_price AS order_total,
    l.quantity,
    CASE 
        WHEN l.shipping_mode = 'TRUCK' THEN 'TRUCK'
        WHEN l.shipping_mode = 'AIR' THEN 'AIR'
        WHEN l.shipping_mode = 'MAIL' THEN 'MAIL'
        WHEN l.shipping_mode = 'RAIL' THEN 'RAIL'
        ELSE 'OTHER'
    END AS shipping_mode,
    o.shipping_priority,
    ps.supply_cost,
    l.tax_rate * 100 AS tax_percentage
FROM 
    stg_lineitem l
JOIN 
    stg_order o ON l.order_id = o.order_id
JOIN 
    stg_partsupp ps ON l.part_id = ps.part_key AND l.supplier_id = ps.supplier_key
⚠️ SQL query is just for reference based on schema. To ensure correctness, data access is required.
%3 (target) stg_part (target) stg_part container_type part_name size_ type_and_material (source) stg_part (source) stg_part container name size type (source) stg_part:f0->(target) stg_part:f0 (source) stg_part:f1->(target) stg_part:f1 (source) stg_part:f2->(target) stg_part:f2 (source) stg_part:f3->(target) stg_part:f3
SELECT 
    container AS container_type,
    name AS part_name,
    size AS size_,
    type AS type_and_material
FROM 
    stg_part
⚠️ SQL query is just for reference based on schema. To ensure correctness, data access is required.
%3 (target) stg_supplier (target) stg_supplier country phone_number region supplier_name address (source) stg_nation (source) stg_nation country_name (source) stg_nation:f0->(target) stg_supplier:f0 (source) stg_supplier (source) stg_supplier supplier_phone supplier_name supplier_address (source) stg_supplier:f0->(target) stg_supplier:f1 (source) stg_supplier:f1->(target) stg_supplier:f3 (source) stg_supplier:f2->(target) stg_supplier:f4 (source) stg_region (source) stg_region region_name (source) stg_region:f0->(target) stg_supplier:f2
SELECT 
    n.country_name AS country,
    s.supplier_phone AS phone_number,
    r.region_name AS region,
    s.supplier_name AS supplier_name,
    s.supplier_address AS address
FROM 
    stg_supplier s
JOIN 
    stg_nation n ON s.nation_id = n.nation_id
JOIN 
    stg_region r ON n.region_id = r.region_id
⚠️ SQL query is just for reference based on schema. To ensure correctness, data access is required.