File size: 4,697 Bytes
fae86c5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
aaaffa8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fae86c5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
aaaffa8
fae86c5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
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;  
   ```  

---