Samples to Understand the NLP to SQL Conversion
Sample 1: NLP to SQL
Natural Language Query: “Show me all customers who made a purchase last week.”
Converted SQL Query:
SELECT customer_id, customer_name
FROM customers
WHERE purchase_date > CURRENT_DATE - INTERVAL '7' DAY;
Sample 2: NLP to SQL
Natural Language Query: “Get the total sales for each product category in the last month.”
Converted SQL Query:
SELECT category_id, SUM(sales_amount) AS total_sales
FROM sales
WHERE sales_date > CURRENT_DATE - INTERVAL '30' DAY
GROUP BY category_id;
Sample 3: NLP to SQL
Natural Language Query: “List all employees who joined after January 1, 2020.”
Converted SQL Query:
SELECT employee_id, employee_name
FROM employees
WHERE hire_date > '2020-01-01';