DebopamC's picture
Upload 16 files
aaaffa8 verified
These questions are generated by ChatGpt 4o. Copy and paste the questions in the ChatBox - run it - get the results - compare the results yourself.
> You can also upload your own files, to get your schemas. You can then use these schemas to cross check your Answer by ChatGpt 4os with any bigger LLM models. You can cross-check directly with our - Manual SQL Executer😊.
- Ask Questions
- Run Queries: automatic + manual
- Download Results
### Easy Questions
1.
**Question:**
```
Retrieve all customer IDs and their corresponding cities from the `customers` table.
```
**Fine-Tuned Model Results:**
βœ… **Pass**
**Answer by ChatGpt 4o:**
```sql
SELECT customer_id, customer_city FROM customers;
```
---
2.
**Question:**
```
List all products along with their category names from the `products` table.
```
**Fine-Tuned Model Results:**
βœ… **Pass**
**Answer by ChatGpt 4o:**
```sql
SELECT product_id, product_category_name FROM products;
```
---
3.
**Question:**
```
Fetch the order IDs and their purchase timestamps from the `orders` table.
```
**Fine-Tuned Model Results:**
βœ… **Pass**
**Answer by ChatGpt 4o:**
```sql
SELECT order_id, order_purchase_timestamp FROM orders;
```
---
4.
**Question:**
```
Display the distinct payment types available in the `payments` table.
```
**Fine-Tuned Model Results:**
βœ… **Pass**
**Answer by ChatGpt 4o:**
```sql
SELECT DISTINCT payment_type FROM payments;
```
---
5.
**Question:**
```
Find the total number of rows in the `customers` table.
```
**Fine-Tuned Model Results:**
βœ… **Pass**
**Answer by ChatGpt 4o:**
```sql
SELECT COUNT(*) AS total_customers FROM customers;
```
---
### Medium Questions
1.
**Question:**
```
Retrieve the total payment value for each order from the `payments` table, grouped by `order_id`.
```
**Fine-Tuned Model Results:**
βœ… **Pass**
**Answer by ChatGpt 4o:**
```sql
SELECT order_id, SUM(payment_value) AS total_payment
FROM payments
GROUP BY order_id;
```
---
2.
**Question:**
```
Find all orders where the total shipping charges (sum of `shipping_charges`) exceed 100.
```
**Fine-Tuned Model Results:**
❌ **Fail**
**Answer by ChatGpt 4o:**
```sql
SELECT order_id
FROM order_items
GROUP BY order_id
HAVING SUM(shipping_charges) > 100;
```
**Issue:** Missing validation for null or non-existent data.
---
3.
**Question:**
```
List the names of cities and the number of customers in each city, sorted in descending order of the number of customers.
```
**Fine-Tuned Model Results:**
βœ… **Pass**
**Answer by ChatGpt 4o:**
```sql
SELECT customer_city, COUNT(*) AS customer_count
FROM customers
GROUP BY customer_city
ORDER BY customer_count DESC;
```
---
### Hard Questions
1.
**Question:**
```
Select the most recent 1000 orders, their corresponding product details, customer details, and when they were purchased.
```
**Fine-Tuned Model Results:**
βœ… **Pass**
**Answer by ChatGpt 4o:**
```sql
SELECT
o.order_id,
o.order_purchase_timestamp,
c.customer_id,
c.customer_city,
c.customer_state,
oi.product_id,
p.product_category_name,
oi.price,
oi.shipping_charges
FROM orders o
JOIN customers c ON o.customer_id = c.customer_id
JOIN order_items oi ON o.order_id = oi.order_id
JOIN products p ON oi.product_id = p.product_id
ORDER BY o.order_purchase_timestamp DESC
LIMIT 1000;
```
2.
**Question:**
```
Write a Query to find the total revenue (sum of `price` + `shipping_charges`) generated for each product category in the `order_items` table, joined with the `products` table.
```
**Fine-Tuned Model Results:**
βœ… **Pass**
**Answer by ChatGpt 4o:**
```sql
SELECT
p.product_category_name,
SUM(o.price + o.shipping_charges) AS total_revenue
FROM order_items o
JOIN products p ON o.product_id = p.product_id
GROUP BY p.product_category_name
ORDER BY total_revenue DESC;
```
---