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
| { | |
| "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 | |
| } | |
| ] | |
| } |