Fine-tuning is used to convert SQL language into natural language, making it easier for users to understand the business meaning of SQL queries. This fine-tuned model is based on the unsloth framework AND uses the DeepSeek-R1-Distill-Llama-8B pre-trained model under unsloth.
This is a complex customer analysis query used to test the understanding of the model
1SELECT
2 pc.category_name,
3 p.product_name,
4 COUNT(DISTINCT o.customer_id) AS unique_customers,
5 COUNT(oi.order_id) AS total_sales,
6 SUM(oi.quantity) AS total_quantity_sold,
7 ROUND(AVG(oi.unit_price), 2) AS avg_selling_price,
8 SUM(oi.quantity * oi.unit_price) AS total_revenue,
9 ROUND(SUM(oi.quantity * oi.unit_price) / COUNT(DISTINCT o.customer_id), 2) AS revenue_per_customer,
10 MAX(o.order_date) AS last_sale_date,
11 MIN(o.order_date) AS first_sale_date
12FROM product_categories pc
13JOIN products p ON pc.category_id = p.category_id
14JOIN order_items oi ON p.product_id = oi.product_id
15JOIN orders o ON oi.order_id = o.order_id
16WHERE
17 o.order_date >= '2024-01-01'
18 AND o.order_status = 'completed'
19GROUP BY
20 pc.category_name,
21 p.product_name
22HAVING
23 total_revenue > 10000
24ORDER BY
25 total_revenue DESC,
26 unique_customers DESC
27LIMIT 15;
CREATE TABLE product_categories (category_name VARCHAR, product_name VARCHAR, customer_id INT, order_id INT, order_date DATETIME, status VARCHAR)
FROM product_categories
JOIN products
JOIN order_items
JOIN orders
WHERE order_date >= '2024-01-01' AND order_status = 'completed'
GROUP BY category_name, product_name
HAVING total_revenue > 10000
This query analyzes the relationship between product categories and customer orders to identify categories and products with the highest revenue in completed orders since 2024. It can help a business understand which products are generating significant revenue and which products are performing well in the category to inform inventory planning and pricing strategies.
Below is the business use case for the query:
Use Case:
This query analyzes the relationship between product categories and customer orders to identify categories and products with the highest revenue in completed orders since 2024. It can help a business understand which products are generating significant revenue in the category and which products are performing well in the category to inform inventory planning and pricing strategies.<|end▁of▁sentence|>
Model Download
Usage
If you are unsure how to use GGUF files, refer to one of
TheBloke's READMEs for more details, including on how to concatenate multi-part files.
Uploaded model
- Developed by: datalabs-ai
- License: apache-2.0
- Finetuned from model : unsloth/DeepSeek-R1-Distill-Llama-8B
This llama model was trained 2x faster with
Unsloth and Huggingface's TRL library.