Overview
In this guide, you’ll learn how to use the Oxla database with eCommerce datasets through various sample queries. These datasets include information about sales transactions, such as customer details, supplier data, and order details. You’ll explore how to analyze data by joining related tables and running queries to support informed decision-making for your business. Data Source: https://github.com/apache/doris/tree/master/tools/ssb-tools .Prerequisite 
Ensure you’ve created the Data Storage with the appropriate demo dataset, the Cluster is running, and you’re connected to it using the PostgreSQL client. For more details, refer to the Quickstart - Oxla SaaS page.
Ensure you’ve created the Data Storage with the appropriate demo dataset, the Cluster is running, and you’re connected to it using the PostgreSQL client. For more details, refer to the Quickstart - Oxla SaaS page.
Datasets Structure
Let’s explore the tables and their structures to understand better and fully utilize the eCommerce dataset.customer Table
customer Table
| Attribute Name | Type | 
|---|---|
| c_custkey | Integer | 
| c_name | Text | 
| c_address | Text | 
| c_city | Text | 
| c_nation | Text | 
| c_region | Text | 
| c_phone | Text | 
| c_mktsegment | Text | 
lineorder Table
lineorder Table
| Attribute Name | Type | 
|---|---|
| lo_orderkey | Integer | 
| lo_linenumber | Integer | 
| lo_custkey | Integer | 
| lo_partkey | Integer | 
| lo_suppkey | Integer | 
| lo_orderdate | Date | 
| lo_orderpriority | Text | 
| lo_shippriority | Integer | 
| lo_quantity | Integer | 
| lo_extendedprice | Integer | 
| lo_ordtotalprice | Integer | 
| lo_discount | Integer | 
| lo_revenue | Integer | 
| lo_supplycost | Integer | 
| lo_tax | Integer | 
| lo_commitdate | Date | 
| lo_shipmode | Text | 
supplier Table
supplier Table
| Attribute Name | Type | 
|---|---|
| s_suppkey | Integer | 
| s_name | Text | 
| s_address | Text | 
| s_city | Text | 
| s_nation | Text | 
| s_region | Text | 
| s_phone | Text | 
part Table
part Table
| Attribute Name | Type | 
|---|---|
| p_partkey | Integer | 
| p_name | Text | 
| p_mfgr | Text | 
| p_category | Text | 
| p_brand | Text | 
| p_color | Text | 
| p_type | Text | 
| p_size | Integer | 
| p_container | Text | 
Sample Queries
Sample 1: Find Customers with the Most Total Order
This example calculates the total order quantity for each customer by joining thecustomer and lineorder tables.
Sample 2: Average Order Quantity and Revenue per Customer
In this example, we aim to retrieve the average order quantity and revenue per customer. We will use theLIMIT clause to find the top 5 customers based on their revenue.