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.
⚠️ SQL query is just for reference based on schema. To ensure correctness, data access is required.
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.
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.
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.