Text Generation
Transformers
Safetensors
gemma3_text
text-to-sql
sql
oracle
postgresql
gemma3
trl
sft
conversational
text-generation-inference
Instructions to use chabab/gemma-3-270m-text2sql-oracle-postgres with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use chabab/gemma-3-270m-text2sql-oracle-postgres with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="chabab/gemma-3-270m-text2sql-oracle-postgres") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("chabab/gemma-3-270m-text2sql-oracle-postgres") model = AutoModelForCausalLM.from_pretrained("chabab/gemma-3-270m-text2sql-oracle-postgres", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use chabab/gemma-3-270m-text2sql-oracle-postgres with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "chabab/gemma-3-270m-text2sql-oracle-postgres" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "chabab/gemma-3-270m-text2sql-oracle-postgres", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/chabab/gemma-3-270m-text2sql-oracle-postgres
- SGLang
How to use chabab/gemma-3-270m-text2sql-oracle-postgres with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "chabab/gemma-3-270m-text2sql-oracle-postgres" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "chabab/gemma-3-270m-text2sql-oracle-postgres", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "chabab/gemma-3-270m-text2sql-oracle-postgres" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "chabab/gemma-3-270m-text2sql-oracle-postgres", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use chabab/gemma-3-270m-text2sql-oracle-postgres with Docker Model Runner:
docker model run hf.co/chabab/gemma-3-270m-text2sql-oracle-postgres
File size: 26,173 Bytes
7fe014a | 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 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 | {
"exact_match": 0.7833333333333333,
"n": 60,
"rows": [
{
"id": "ex_14b7cfd991612ffb",
"dialect": "postgres",
"difficulty": "medium",
"question": "Write a PostgreSQL query for: Find staff with last_name beginning with s ignoring case.",
"gold": "SELECT employee_id, first_name, last_name FROM employees WHERE last_name ILIKE 'S%';",
"pred": "SELECT employee_id, first_name, last_name FROM employees WHERE last_name LIKE ' ' || first_name;",
"match": false
},
{
"id": "ex_c73896e0f574d7cf",
"dialect": "oracle",
"difficulty": "easy",
"question": "Number of four-credit courses. Return only the SQL.",
"gold": "SELECT COUNT(*) AS course_count FROM courses WHERE credits = 4;",
"pred": "SELECT COUNT(*) AS course_count FROM courses WHERE credits = 4;",
"match": true
},
{
"id": "ex_a8b9ea352a33e377",
"dialect": "oracle",
"difficulty": "medium",
"question": "is_available true. Return only the SQL.",
"gold": "SELECT agent_id, agent_name, team FROM agents WHERE is_available = 1;",
"pred": "SELECT agent_id, agent_name, team FROM agents WHERE is_available = 1;",
"match": true
},
{
"id": "ex_cda1fdc3f8926260",
"dialect": "oracle",
"difficulty": "easy",
"question": "How many cancelled orders are there?",
"gold": "SELECT COUNT(*) AS cancelled_count FROM orders WHERE status = 'Cancelled';",
"pred": "SELECT COUNT(*) AS cancelled_count FROM orders WHERE status = 'Cancelled';",
"match": true
},
{
"id": "ex_805236d32a829662",
"dialect": "oracle",
"difficulty": "medium",
"question": "Write a Oracle query for: Staff whose department_id is 10, 20 or 30.",
"gold": "SELECT employee_id, first_name, last_name, department_id FROM employees WHERE department_id IN (10, 20, 30);",
"pred": "SELECT employee_id, first_name, last_name, department_id FROM employees WHERE department_id IN (10, 20, 30);",
"match": true
},
{
"id": "ex_0f91611416b0b790",
"dialect": "oracle",
"difficulty": "medium",
"question": "Return a full_name column. Return only the SQL.",
"gold": "SELECT first_name || ' ' || last_name AS full_name FROM employees;",
"pred": "SELECT first_name || ' ' || last_name AS full_name FROM employees;",
"match": true
},
{
"id": "ex_2080c243f8214291",
"dialect": "oracle",
"difficulty": "medium",
"question": "Filter employees to those three departments. Return only the SQL.",
"gold": "SELECT employee_id, first_name, last_name, department_id FROM employees WHERE department_id IN (10, 20, 30);",
"pred": "SELECT employee_id, first_name, last_name, department_id FROM employees WHERE department_id IN (10, 20, 30);",
"match": true
},
{
"id": "ex_2bcfd4ac5124c8cf",
"dialect": "postgres",
"difficulty": "easy",
"question": "Write a PostgreSQL query for: List suppliers from fastest to slowest lead_time_days.",
"gold": "SELECT supplier_id, supplier_name, lead_time_days FROM suppliers ORDER BY lead_time_days ASC;",
"pred": "SELECT supplier_id, supplier_name, lead_time_days FROM suppliers ORDER BY lead_time_days ASC LIMIT 10;",
"match": false
},
{
"id": "ex_67006ffcbb9dd990",
"dialect": "postgres",
"difficulty": "easy",
"question": "Write a PostgreSQL query for: Show customer_name and country.",
"gold": "SELECT customer_name, country FROM customers;",
"pred": "SELECT customer_name, country FROM customers;",
"match": true
},
{
"id": "ex_8fcddf883ae71117",
"dialect": "oracle",
"difficulty": "medium",
"question": "Write a Oracle query for: account_id having COUNT(*) > 20 in transactions.",
"gold": "SELECT account_id, COUNT(*) AS txn_count FROM transactions GROUP BY account_id HAVING COUNT(*) > 20;",
"pred": "SELECT account_id, COUNT(*) AS txn_count FROM transactions GROUP BY account_id HAVING COUNT(*) > 20;",
"match": true
},
{
"id": "ex_0e773b38db423d2b",
"dialect": "oracle",
"difficulty": "medium",
"question": "List staff without a manager. Return only the SQL.",
"gold": "SELECT employee_id, first_name, last_name FROM employees WHERE manager_id IS NULL;",
"pred": "SELECT employee_id, first_name, last_name FROM employees WHERE manager_id IS NULL;",
"match": true
},
{
"id": "ex_c0b3b7c1bd7f1eb4",
"dialect": "oracle",
"difficulty": "medium",
"question": "Write a Oracle query for: Set status DELIVERED and delivered_on to today for shipment 77.",
"gold": "UPDATE shipments SET status = 'DELIVERED', delivered_on = TRUNC(SYSDATE) WHERE shipment_id = 77;",
"pred": "UPDATE shipments SET status = 'DELIVERED', delivered_on = TRUNC(SYSDATE) WHERE shipment_id = 77;",
"match": true
},
{
"id": "ex_5c388e3163e58d6d",
"dialect": "postgres",
"difficulty": "medium",
"question": "Write a PostgreSQL query for: updated_at on the current date.",
"gold": "SELECT stock_id, warehouse_id, item_id, qty_on_hand FROM stock WHERE updated_at::date = CURRENT_DATE;",
"pred": "SELECT txn_id, warehouse_id, item_id, created_at FROM transactions WHERE created_at >= NOW() - INTERVAL '24 hours';",
"match": false
},
{
"id": "ex_4f23cbbbfeffd6ed",
"dialect": "oracle",
"difficulty": "medium",
"question": "Employees who have no manager.",
"gold": "SELECT employee_id, first_name, last_name FROM employees WHERE manager_id IS NULL;",
"pred": "SELECT employee_id, first_name, last_name FROM employees WHERE manager_id IS NULL;",
"match": true
},
{
"id": "ex_fd5c29ca20aca25c",
"dialect": "oracle",
"difficulty": "medium",
"question": "Busy accounts, over 20 txns. Return only the SQL.",
"gold": "SELECT account_id, COUNT(*) AS txn_count FROM transactions GROUP BY account_id HAVING COUNT(*) > 20;",
"pred": "SELECT account_id, COUNT(*) AS txn_count FROM transactions GROUP BY account_id HAVING COUNT(*) > 20;",
"match": true
},
{
"id": "ex_b3743f6061f84998",
"dialect": "oracle",
"difficulty": "hard",
"question": "Using a CTE, customers with more than 3 orders.",
"gold": "WITH order_counts AS (SELECT customer_id, COUNT(*) AS order_count FROM orders GROUP BY customer_id) SELECT c.customer_name, oc.order_count FROM order_counts oc JOIN customers c ON c.customer_id = oc.customer_id WHERE oc.order_count > 3;",
"pred": "WITH order_counts AS (SELECT customer_id, COUNT(*) AS order_count FROM orders GROUP BY customer_id) SELECT c.customer_name, oc.order_count FROM order_counts oc JOIN customers c ON c.customer_id = oc.customer_id WHERE oc.order_count > 3;",
"match": true
},
{
"id": "ex_94effceddcf7fcf8",
"dialect": "oracle",
"difficulty": "medium",
"question": "Employees in departments 10, 20, or 30.",
"gold": "SELECT employee_id, first_name, last_name, department_id FROM employees WHERE department_id IN (10, 20, 30);",
"pred": "SELECT employee_id, first_name, last_name, department_id FROM employees WHERE department_id IN (10, 20, 30);",
"match": true
},
{
"id": "ex_969dc45c17fff70b",
"dialect": "oracle",
"difficulty": "medium",
"question": "Stock rows updated today.",
"gold": "SELECT stock_id, warehouse_id, item_id, qty_on_hand FROM stock WHERE TRUNC(updated_at) = TRUNC(SYSDATE);",
"pred": "SELECT w.warehouse_id, w.warehouse_name FROM warehouses w WHERE EXISTS (SELECT 1 FROM stock s WHERE s.warehouse_id = w.warehouse_id AND s.item_id = 42);",
"match": false
},
{
"id": "ex_6c0dff5f6a58ac7c",
"dialect": "postgres",
"difficulty": "medium",
"question": "Employees whose last name starts with S, case-insensitive.",
"gold": "SELECT employee_id, first_name, last_name FROM employees WHERE last_name ILIKE 'S%';",
"pred": "SELECT employee_id, first_name, last_name FROM employees WHERE last_name LIKE 'S%';",
"match": false
},
{
"id": "ex_53abe765235df5c7",
"dialect": "oracle",
"difficulty": "medium",
"question": "Available agents.",
"gold": "SELECT agent_id, agent_name, team FROM agents WHERE is_available = 1;",
"pred": "SELECT agent_id, agent_name, team FROM agents WHERE is_available = 1;",
"match": true
},
{
"id": "ex_2f156ae4a64ebcc3",
"dialect": "postgres",
"difficulty": "easy",
"question": "List all customer names and countries.",
"gold": "SELECT customer_name, country FROM customers;",
"pred": "SELECT customer_name, country FROM customers;",
"match": true
},
{
"id": "ex_59c91c5ff4fb68e5",
"dialect": "postgres",
"difficulty": "medium",
"question": "Stock rows updated today.",
"gold": "SELECT stock_id, warehouse_id, item_id, qty_on_hand FROM stock WHERE updated_at::date = CURRENT_DATE;",
"pred": "SELECT w.warehouse_id, w.warehouse_name, s.item_id, s.qty_on_hand, t.warehouse_id, i.item_name, s.reorder_point FROM stock s JOIN items i ON s.item_id = i.item_id JOIN warehouses w ON s.warehouse_id = w.warehouse_id WHERE w.warehouse_name = 'AcmeWarehouses' AND i.item_name = 'Stock' AND s.qty_on_hand <= i.reorder_point;",
"match": false
},
{
"id": "ex_35881d0f2446ccb1",
"dialect": "postgres",
"difficulty": "easy",
"question": "Sort suppliers by lead_time_days. Return only the SQL.",
"gold": "SELECT supplier_id, supplier_name, lead_time_days FROM suppliers ORDER BY lead_time_days ASC;",
"pred": "SELECT supplier_id, supplier_name, lead_time_days FROM suppliers ORDER BY lead_time_days ASC;",
"match": true
},
{
"id": "ex_71bcc72a8600e2e8",
"dialect": "postgres",
"difficulty": "medium",
"question": "Last names that start with the letter S, any case. Return only the SQL.",
"gold": "SELECT employee_id, first_name, last_name FROM employees WHERE last_name ILIKE 'S%';",
"pred": "SELECT employee_id, SUBSTRING(last_name FROM 1 FOR 3) AS name_prefix FROM employees;",
"match": false
},
{
"id": "ex_7074e097cbb5dacc",
"dialect": "oracle",
"difficulty": "medium",
"question": "Open ticket load per agent name.",
"gold": "SELECT a.agent_name, COUNT(*) AS open_tickets FROM tickets t JOIN agents a ON t.agent_id = a.agent_id WHERE t.status = 'Open' GROUP BY a.agent_name;",
"pred": "SELECT a.agent_name, COUNT(*) AS open_tickets FROM tickets t JOIN agents a ON t.agent_id = a.agent_id WHERE t.status = 'Open' GROUP BY a.agent_name;",
"match": true
},
{
"id": "ex_a173431eb1705ce1",
"dialect": "postgres",
"difficulty": "hard",
"question": "Write a PostgreSQL query for: Customers missing from the orders table.",
"gold": "SELECT c.customer_id, c.customer_name FROM customers c WHERE NOT EXISTS (SELECT 1 FROM orders o WHERE o.customer_id = c.customer_id);",
"pred": "SELECT c.customer_id, c.customer_name FROM customers c WHERE NOT EXISTS (SELECT 1 FROM orders o WHERE o.customer_id = c.customer_id);",
"match": true
},
{
"id": "ex_c33dae39b2813158",
"dialect": "oracle",
"difficulty": "medium",
"question": "Today's stock updates. Return only the SQL.",
"gold": "SELECT stock_id, warehouse_id, item_id, qty_on_hand FROM stock WHERE TRUNC(updated_at) = TRUNC(SYSDATE);",
"pred": "SELECT txn_id, warehouse_id, item_id, qty_on_hand, created_at FROM stock WHERE qty_on_hand <= TRUNC(SYSDATE) - 1;",
"match": false
},
{
"id": "ex_314a6b2149e2f1e8",
"dialect": "oracle",
"difficulty": "easy",
"question": "The ten students with the highest GPA.",
"gold": "SELECT full_name, major, gpa FROM students ORDER BY gpa DESC FETCH FIRST 10 ROWS ONLY;",
"pred": "SELECT full_name, major, gpa FROM students ORDER BY gpa DESC FETCH FIRST 10 ROWS ONLY;",
"match": true
},
{
"id": "ex_ce4615861e7a7902",
"dialect": "oracle",
"difficulty": "medium",
"question": "Write a Oracle query for: updated_at on the current date.",
"gold": "SELECT stock_id, warehouse_id, item_id, qty_on_hand FROM stock WHERE TRUNC(updated_at) = TRUNC(SYSDATE);",
"pred": "SELECT txn_id, warehouse_id, item_id, created_at FROM transactions WHERE created_at >= SYSDATE - 1;",
"match": false
},
{
"id": "ex_64a72b64a6631d74",
"dialect": "oracle",
"difficulty": "medium",
"question": "Origins that begin with San. Return only the SQL.",
"gold": "SELECT shipment_id, tracking_no, origin_city FROM shipments WHERE origin_city LIKE 'San%';",
"pred": "SELECT shipment_id, tracking_no, origin_city FROM shipments WHERE origin_city LIKE 'San%';",
"match": true
},
{
"id": "ex_eb5014dbd237c58b",
"dialect": "oracle",
"difficulty": "medium",
"question": "Write a Oracle query for: Concatenate first and last name.",
"gold": "SELECT first_name || ' ' || last_name AS full_name FROM employees;",
"pred": "SELECT first_name || ' ' || last_name AS full_name FROM employees;",
"match": true
},
{
"id": "ex_7872027d199a94d7",
"dialect": "postgres",
"difficulty": "hard",
"question": "Customers who never placed an order.",
"gold": "SELECT c.customer_id, c.customer_name FROM customers c WHERE NOT EXISTS (SELECT 1 FROM orders o WHERE o.customer_id = c.customer_id);",
"pred": "SELECT c.customer_id, c.customer_name FROM customers c WHERE NOT EXISTS (SELECT 1 FROM orders o WHERE o.customer_id = c.customer_id);",
"match": true
},
{
"id": "ex_f59b7eb0d4cd4455",
"dialect": "oracle",
"difficulty": "medium",
"question": "Employees whose last name starts with S, case-insensitive.",
"gold": "SELECT employee_id, first_name, last_name FROM employees WHERE UPPER(last_name) LIKE 'S%';",
"pred": "SELECT employee_id, first_name, last_name FROM employees WHERE last_name LIKE '%S%';",
"match": false
},
{
"id": "ex_ded04128a74afeef",
"dialect": "oracle",
"difficulty": "medium",
"question": "Mark shipment 77 delivered today.",
"gold": "UPDATE shipments SET status = 'DELIVERED', delivered_on = TRUNC(SYSDATE) WHERE shipment_id = 77;",
"pred": "UPDATE shipments SET status = 'DELIVERED', delivered_on = TRUNC(SYSDATE) WHERE shipment_id = 77;",
"match": true
},
{
"id": "ex_bb6c014680d3ea3c",
"dialect": "oracle",
"difficulty": "medium",
"question": "Complete shipment 77. Return only the SQL.",
"gold": "UPDATE shipments SET status = 'DELIVERED', delivered_on = TRUNC(SYSDATE) WHERE shipment_id = 77;",
"pred": "UPDATE shipments SET status = 'DELIVERED', delivered_on = TRUNC(SYSDATE) WHERE shipment_id = 77;",
"match": true
},
{
"id": "ex_9e0427dcec4e7666",
"dialect": "postgres",
"difficulty": "hard",
"question": "customer_id in customers not in orders. Return only the SQL.",
"gold": "SELECT c.customer_id, c.customer_name FROM customers c WHERE NOT EXISTS (SELECT 1 FROM orders o WHERE o.customer_id = c.customer_id);",
"pred": "SELECT c.customer_id, c.customer_name FROM customers c WHERE NOT EXISTS (SELECT 1 FROM orders o WHERE o.customer_id = c.customer_id);",
"match": true
},
{
"id": "ex_ee9af559100ae7f3",
"dialect": "oracle",
"difficulty": "easy",
"question": "Write a Oracle query for: Top 10 GPA list.",
"gold": "SELECT full_name, major, gpa FROM students ORDER BY gpa DESC FETCH FIRST 10 ROWS ONLY;",
"pred": "SELECT full_name, major, gpa FROM students ORDER BY gpa DESC FETCH FIRST 10 ROWS ONLY;",
"match": true
},
{
"id": "ex_181c0867e851761a",
"dialect": "oracle",
"difficulty": "medium",
"question": "Write a Oracle query for: Find customers whose city matches %York%.",
"gold": "SELECT customer_id, customer_name, city FROM customers WHERE city LIKE '%York%';",
"pred": "SELECT customer_id, customer_name, city FROM customers WHERE city LIKE '%York%';",
"match": true
},
{
"id": "ex_5c1944bd992a4282",
"dialect": "oracle",
"difficulty": "medium",
"question": "Write a Oracle query for: Count Open tickets grouped by agent_name.",
"gold": "SELECT a.agent_name, COUNT(*) AS open_tickets FROM tickets t JOIN agents a ON t.agent_id = a.agent_id WHERE t.status = 'Open' GROUP BY a.agent_name;",
"pred": "SELECT a.agent_name, COUNT(*) AS open_tickets FROM tickets t JOIN agents a ON t.agent_id = a.agent_id WHERE t.status = 'Open' GROUP BY a.agent_name;",
"match": true
},
{
"id": "ex_4b16a4d788c97596",
"dialect": "oracle",
"difficulty": "medium",
"question": "Write a Oracle query for: Agents who are available.",
"gold": "SELECT agent_id, agent_name, team FROM agents WHERE is_available = 1;",
"pred": "SELECT agent_id, agent_name, team FROM agents WHERE is_available = 1;",
"match": true
},
{
"id": "ex_176cb0a393755a4d",
"dialect": "oracle",
"difficulty": "medium",
"question": "Shipments originating in a city starting with San.",
"gold": "SELECT shipment_id, tracking_no, origin_city FROM shipments WHERE origin_city LIKE 'San%';",
"pred": "SELECT shipment_id, tracking_no, origin_city FROM shipments WHERE origin_city LIKE 'San%';",
"match": true
},
{
"id": "ex_ca3413a258dd3e4e",
"dialect": "oracle",
"difficulty": "hard",
"question": "Write a Oracle query for: WITH clause counting orders per customer, keep count > 3.",
"gold": "WITH order_counts AS (SELECT customer_id, COUNT(*) AS order_count FROM orders GROUP BY customer_id) SELECT c.customer_name, oc.order_count FROM order_counts oc JOIN customers c ON c.customer_id = oc.customer_id WHERE oc.order_count > 3;",
"pred": "WITH order_counts AS (SELECT customer_id, COUNT(*) AS order_count FROM orders GROUP BY customer_id) SELECT c.customer_name, oc.order_count FROM order_counts oc JOIN customers c ON c.customer_id = oc.customer_id WHERE oc.order_count > 3;",
"match": true
},
{
"id": "ex_97741e5236913d36",
"dialect": "oracle",
"difficulty": "easy",
"question": "Best ten gpa values. Return only the SQL.",
"gold": "SELECT full_name, major, gpa FROM students ORDER BY gpa DESC FETCH FIRST 10 ROWS ONLY;",
"pred": "SELECT full_name, major, gpa FROM students ORDER BY gpa DESC FETCH FIRST 10 ROWS ONLY;",
"match": true
},
{
"id": "ex_79eebf63d2b46a2b",
"dialect": "oracle",
"difficulty": "hard",
"question": "Customers who ordered more than three times. Return only the SQL.",
"gold": "WITH order_counts AS (SELECT customer_id, COUNT(*) AS order_count FROM orders GROUP BY customer_id) SELECT c.customer_name, oc.order_count FROM order_counts oc JOIN customers c ON c.customer_id = oc.customer_id WHERE oc.order_count > 3;",
"pred": "WITH order_counts AS (SELECT customer_id, COUNT(*) AS order_count FROM orders GROUP BY customer_id) SELECT c.customer_name, oc.order_count FROM order_counts oc JOIN customers c ON c.customer_id = oc.customer_id WHERE oc.order_count > 3;",
"match": true
},
{
"id": "ex_adbaf24e74fb701a",
"dialect": "oracle",
"difficulty": "medium",
"question": "Customers in cities containing 'York'.",
"gold": "SELECT customer_id, customer_name, city FROM customers WHERE city LIKE '%York%';",
"pred": "SELECT customer_id, customer_name, city FROM customers WHERE city LIKE '%York%';",
"match": true
},
{
"id": "ex_2d820ef2a5909d2a",
"dialect": "postgres",
"difficulty": "medium",
"question": "Today's stock updates. Return only the SQL.",
"gold": "SELECT stock_id, warehouse_id, item_id, qty_on_hand FROM stock WHERE updated_at::date = CURRENT_DATE;",
"pred": "SELECT txn_id, warehouse_id, item_id, qty_on_hand, created_at FROM stock WHERE qty_on_hand <= CURRENT_DATE;",
"match": false
},
{
"id": "ex_d759eda0ae841fa7",
"dialect": "postgres",
"difficulty": "easy",
"question": "Return every customer's name and country. Return only the SQL.",
"gold": "SELECT customer_name, country FROM customers;",
"pred": "SELECT customer_name, country FROM customers;",
"match": true
},
{
"id": "ex_03314b46941553c7",
"dialect": "oracle",
"difficulty": "easy",
"question": "Number of cancelled orders. Return only the SQL.",
"gold": "SELECT COUNT(*) AS cancelled_count FROM orders WHERE status = 'Cancelled';",
"pred": "SELECT COUNT(*) AS cancelled_count FROM orders WHERE status = 'Cancelled';",
"match": true
},
{
"id": "ex_532b3d35b7593fb5",
"dialect": "oracle",
"difficulty": "medium",
"question": "Full name as first_name space last_name.",
"gold": "SELECT first_name || ' ' || last_name AS full_name FROM employees;",
"pred": "SELECT first_name || ' ' || last_name AS full_name FROM employees;",
"match": true
},
{
"id": "ex_8cc46343db1bdc6f",
"dialect": "oracle",
"difficulty": "easy",
"question": "How many 4-credit courses are there?",
"gold": "SELECT COUNT(*) AS course_count FROM courses WHERE credits = 4;",
"pred": "SELECT COUNT(*) AS course_count FROM courses WHERE credits = 4;",
"match": true
},
{
"id": "ex_0149a918a33d3f6e",
"dialect": "oracle",
"difficulty": "medium",
"question": "Write a Oracle query for: origin_city LIKE San%.",
"gold": "SELECT shipment_id, tracking_no, origin_city FROM shipments WHERE origin_city LIKE 'San%';",
"pred": "SELECT shipment_id, tracking_no, origin_city FROM shipments WHERE origin_city LIKE 'San%';",
"match": true
},
{
"id": "ex_6b8663da56b88c3e",
"dialect": "oracle",
"difficulty": "easy",
"question": "Write a Oracle query for: Count orders with status Cancelled.",
"gold": "SELECT COUNT(*) AS cancelled_count FROM orders WHERE status = 'Cancelled';",
"pred": "SELECT COUNT(*) AS cancelled_count FROM orders WHERE status = 'Cancelled';",
"match": true
},
{
"id": "ex_4fe32a3a1acc5588",
"dialect": "oracle",
"difficulty": "medium",
"question": "City names that include York. Return only the SQL.",
"gold": "SELECT customer_id, customer_name, city FROM customers WHERE city LIKE '%York%';",
"pred": "SELECT customer_id, customer_name, city FROM customers WHERE city LIKE '%York%';",
"match": true
},
{
"id": "ex_f508bacbf1d5a900",
"dialect": "oracle",
"difficulty": "medium",
"question": "Write a Oracle query for: Who has a null manager_id?",
"gold": "SELECT employee_id, first_name, last_name FROM employees WHERE manager_id IS NULL;",
"pred": "SELECT employee_id, first_name, last_name FROM employees WHERE manager_id IS NULL;",
"match": true
},
{
"id": "ex_fc5afbbf96202473",
"dialect": "oracle",
"difficulty": "medium",
"question": "How many open tickets does each agent have? Return only the SQL.",
"gold": "SELECT a.agent_name, COUNT(*) AS open_tickets FROM tickets t JOIN agents a ON t.agent_id = a.agent_id WHERE t.status = 'Open' GROUP BY a.agent_name;",
"pred": "SELECT a.agent_name, COUNT(*) AS open_tickets FROM tickets t JOIN agents a ON t.agent_id = a.agent_id WHERE t.status = 'Open' GROUP BY a.agent_name;",
"match": true
},
{
"id": "ex_35082fab89e9b2b4",
"dialect": "oracle",
"difficulty": "medium",
"question": "Write a Oracle query for: Find staff with last_name beginning with s ignoring case.",
"gold": "SELECT employee_id, first_name, last_name FROM employees WHERE UPPER(last_name) LIKE 'S%';",
"pred": "SELECT employee_id, first_name, last_name FROM employees WHERE last_name LIKE ' ' || first_name;",
"match": false
},
{
"id": "ex_aa62e801ddf83284",
"dialect": "postgres",
"difficulty": "easy",
"question": "Suppliers ordered by lead time ascending.",
"gold": "SELECT supplier_id, supplier_name, lead_time_days FROM suppliers ORDER BY lead_time_days ASC;",
"pred": "SELECT supplier_id, supplier_name, lead_time_days FROM suppliers ORDER BY lead_time_days ASC;",
"match": true
},
{
"id": "ex_2b281aa43a7b6fb1",
"dialect": "oracle",
"difficulty": "easy",
"question": "Write a Oracle query for: Count courses where credits = 4.",
"gold": "SELECT COUNT(*) AS course_count FROM courses WHERE credits = 4;",
"pred": "SELECT COUNT(*) AS course_count FROM courses WHERE credits = 4;",
"match": true
},
{
"id": "ex_c5783841911652e9",
"dialect": "oracle",
"difficulty": "medium",
"question": "Accounts with more than 20 transactions.",
"gold": "SELECT account_id, COUNT(*) AS txn_count FROM transactions GROUP BY account_id HAVING COUNT(*) > 20;",
"pred": "SELECT account_id, COUNT(*) AS txn_count FROM transactions GROUP BY account_id HAVING COUNT(*) > 20;",
"match": true
},
{
"id": "ex_d2f17d616d77d8be",
"dialect": "oracle",
"difficulty": "medium",
"question": "Last names that start with the letter S, any case. Return only the SQL.",
"gold": "SELECT employee_id, first_name, last_name FROM employees WHERE UPPER(last_name) LIKE 'S%';",
"pred": "SELECT employee_id, SUBSTR(last_name, 1, 3) AS name_prefix FROM employees;",
"match": false
}
]
} |