system stringlengths 288 8.23k | conversations listlengths 2 8 |
|---|---|
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.invoices (
invoice_id character varying(64) NOT NULL, -- unique identifier for the invoice
invo... | [
{
"role": "user",
"content": "Which invoices have a status of 'Partially Paid' and have not reached their due date yet? Show the invoice number, client ID, due date, and amount paid."
},
{
"role": "assistant",
"content": "SELECT invoice_number, client_id, due_date, amount_paid\nFROM legal_servic... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.services (
service_id character varying(64) NOT NULL, -- unique identifier for the service
... | [
{
"role": "user",
"content": "Show the scheduled start times and service names for all appointments, along with the description of those services."
},
{
"role": "assistant",
"content": "SELECT a.scheduled_start_time, s.service_name, s.description\nFROM government_services.appointments a\nJOIN go... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE erc20_balances ( block_number bigint, contract_address varchar, wallet_address varchar, amount varchar, pk varchar )
CR... | [
{
"role": "user",
"content": "Show me all ERC20 token transfers where the amount is over 5000, including the sender and receiver addresses."
},
{
"role": "assistant",
"content": "SELECT from_address, to_address, amt, tick, tx_hash FROM token_activities WHERE type = 'transfer' AND CAST(amt AS DEC... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claim_documents ( document_id text, claim_id text, document_type text, file_name text, file_path text, file_s... | [
{
"role": "user",
"content": "Show me all medical report documents with their claim IDs and descriptions, sorted by upload date."
},
{
"role": "assistant",
"content": "SELECT document_id, claim_id, description, uploaded_at FROM insurance.claim_documents WHERE document_type = 'medical_report' ORD... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add... | [
{
"role": "user",
"content": "Show me all wallets holding SUI coins with a balance greater than 2,000,000. Include the coin_type, balance, and owner address."
},
{
"role": "assistant",
"content": "SELECT coin_type, balance, owner FROM sui_coins WHERE status = 'exists' AND CAST(balance AS bigint)... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.trips (
trip_id character varying(64) NOT NULL, -- unique identifier for a specific trip instance
... | [
{
"role": "user",
"content": "List all trips that were completed and experienced a significant delay in actual arrival compared to the scheduled arrival (more than 45 minutes)."
},
{
"role": "assistant",
"content": "SELECT\n trip_id,\n vehicle_id,\n driver_id,\n scheduled_arrival,\n actual_... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE erc20_balances ( block_number bigint, contract_address varchar, wallet_address varchar, amount varchar, pk varchar )
CR... | [
{
"role": "user",
"content": "Show me the top 5 most recently minted NFTs on the Ethereum blockchain with their contract_address, token_id, name, and rarity_score from nft_metadata."
},
{
"role": "assistant",
"content": "SELECT contract_address, token_id, name, rarity_score\nFROM nft_metadata\nW... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id.text, property_name.text, address_line1.text, address_line2.text, city.... | [
{
"role": "user",
"content": "What is the average delivery time in hours for all delivered service orders?"
},
{
"role": "assistant",
"content": "SELECT AVG(EXTRACT(EPOCH FROM (so.delivery_timestamp - so.order_timestamp)) / 3600) AS avg_delivery_hours\nFROM hospitality_technology.service_orders ... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.invoices ( invoice_id text, invoice_number text, client_id text, case_id text, issue_date date, due_date... | [
{
"role": "user",
"content": "Show me all invoices where the notes field is not null. Display invoice number, client ID, and notes."
},
{
"role": "assistant",
"content": "SELECT invoice_number, client_id, notes FROM legal_services.invoices WHERE notes IS NOT NULL;"
}
] |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, address character varying(128) NOT NULL, abi text NOT NULL... | [
{
"role": "user",
"content": "List all users who have deployed contracts, along with their email addresses and the count of contracts they've deployed."
},
{
"role": "assistant",
"content": "SELECT u.user_id, u.email, COUNT(c.contract_id) AS contract_count FROM web3.users u JOIN web3.contracts c... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.accounts ( account_id character varying(64) NOT NULL, customer_id character varying(64) NOT NULL, ac... | [
{
"role": "user",
"content": "What is the total balance for each currency in the accounts table?"
},
{
"role": "assistant",
"content": "SELECT currency, SUM(balance) AS total_balance FROM financial_services.accounts GROUP BY currency;"
},
{
"role": "user",
"content": "Can you also sh... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.fuel_logs ( fuel_log_id text, vehicle_id text, trip_id text, log_timestamp timestamp, fuel_type text, qu... | [
{
"role": "user",
"content": "Calculate the average cost_per_unit for each fuel_type from the fuel_logs table."
},
{
"role": "assistant",
"content": "SELECT fuel_type,\n AVG(cost_per_unit) AS avg_cost_per_unit\nFROM transportation.fuel_logs\nGROUP BY fuel_type;"
},
{
"role": "user"... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.services ( service_id text, agency_id text, service_name text, description text, category text, eli... | [
{
"role": "user",
"content": "Show me the first name and last name of citizens who have scheduled appointments for services offered by agencies whose agency_id starts with 'AG'. Also include the service name."
},
{
"role": "assistant",
"content": "SELECT c.first_name, c.last_name, s.service_name... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.clients (
client_id character varying(64) NOT NULL, -- unique identifier for the client
first_n... | [
{
"role": "user",
"content": "Show me the full name and email of clients whose status is 'prospect' and who registered before 2023-01-01."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, email FROM legal_services.clients WHERE status = 'prospect' AND date_registered < '2023-0... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.hashtags (
hashtag_id character varying(64) NOT NULL, -- unique identifier for the hashtag
tag_nam... | [
{
"role": "user",
"content": "List all hashtags created after '2024-06-01', showing hashtag_id and tag_name."
},
{
"role": "assistant",
"content": "SELECT hashtag_id, tag_name\nFROM social_media.hashtags\nWHERE created_at > '2024-06-01';"
},
{
"role": "user",
"content": "Now also inc... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.player_achievements ( player_achievement_id.uuid, player_id.uuid, achievement_id.uuid, unlocked_at.ti... | [
{
"role": "user",
"content": "List each player's most recent achievement unlock, showing the player_id, achievement_id, and unlocked_at timestamp."
},
{
"role": "assistant",
"content": "SELECT pa.player_id, pa.achievement_id, pa.unlocked_at FROM gaming_technology.player_achievements pa INNER JOI... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI... | [
{
"role": "user",
"content": "For each case, show its name, case number, the total hours worked by all lawyers, and the name of the client associated with the case."
},
{
"role": "assistant",
"content": "SELECT c.case_name, c.case_number, SUM(te.hours_spent) AS total_hours, cl.first_name || ' ' ... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE token_metas ( block_timestamp timestamp(6) NOT NULL, block_number bigint NOT NULL, t... | [
{
"role": "user",
"content": "Show the wallet address and amount for the token with tick 'ordi', along with its maximum supply from the `token_info` table."
},
{
"role": "assistant",
"content": "SELECT T1.wallet_address, T1.amount, T2.max_supply FROM token_balances AS T1 JOIN token_info AS T2 ON... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.developers ( developer_id uuid NOT NULL DEFAULT gen_random_uuid(), name character varying(150) NOT NU... | [
{
"role": "user",
"content": "I want to see each server's name, region, and the number of game sessions that have been started on that server."
},
{
"role": "assistant",
"content": "SELECT s.server_name, s.region, COUNT(gs.session_id) AS session_count\nFROM gaming_technology.servers s\nLEFT JOIN... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.appointments ( appointment_id character varying(64) NOT NULL, patient_id character varying(64) NOT NULL, doc... | [
{
"role": "user",
"content": "Find all medications that have been prescribed to patients with chronic diagnoses, showing the medication name and the count of patients prescribed each medication."
},
{
"role": "assistant",
"content": "SELECT m.medication_name, COUNT(DISTINCT d.patient_id) AS pati... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.maintenance_logs ( log_id text, vehicle_id text, service_date date, odometer_reading integer, service_ty... | [
{
"role": "user",
"content": "Show me all maintenance logs for vehicles that had a 'Brake Inspection' service type, along with the mechanic who performed the service."
},
{
"role": "assistant",
"content": "SELECT log_id, vehicle_id, service_date, mechanic_name FROM transportation.maintenance_log... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.drivers ( driver_id character varying(64) NOT NULL, employee_id character varying(64) NOT NULL UNIQUE, f... | [
{
"role": "user",
"content": "Provide the route_number, description, origin location name, and destination location name for all routes of type 'Express'."
},
{
"role": "assistant",
"content": "SELECT r.route_number,\n r.description,\n o.name AS origin_name,\n d.name AS destina... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.medical_records ( record_id text PRIMARY KEY, patient_id text, appointment_id text, doctor_id text, record_d... | [
{
"role": "user",
"content": "For each medical record, find the number of diagnoses it has and display record_id, patient_id, and diagnosis_count, but include only records with at least two diagnoses."
},
{
"role": "assistant",
"content": "SELECT m.record_id,\n m.patient_id,\n COUNT(... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d... | [
{
"role": "user",
"content": "List the document ID, document type, and verification status for all documents verified by employees working for the agency with ID 'AG101'. Also include the verifying employee's full name."
},
{
"role": "assistant",
"content": "SELECT T1.document_id , T1.document_... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.players ( player_id uuid PRIMARY KEY, username text, email text, password_hash text, registration_dat... | [
{
"role": "user",
"content": "Show me the top 5 games by number of online servers in European regions. I want the game title and the server count."
},
{
"role": "assistant",
"content": "SELECT g.title, COUNT(s.server_id) AS server_count\nFROM gaming_technology.games g\nJOIN gaming_technology.ser... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties (
property_id character varying(64) NOT NULL, -- unique identifier for the prope... | [
{
"role": "user",
"content": "Find all properties in California (state_province = 'California') that have a phone number and email address listed."
},
{
"role": "assistant",
"content": "SELECT property_name, city, phone_number, email_address FROM hospitality_technology.properties WHERE state_pro... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.documents ( document_id text PRIMARY KEY, case_id text, document_name text, document_type text, storage_... | [
{
"role": "user",
"content": "Show all documents where the document description includes the word 'summary'. Please display their document name and type."
},
{
"role": "assistant",
"content": "SELECT document_name, document_type FROM legal_services.documents WHERE description ILIKE '%summary%';"... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE manufacturing.components (
component_id character varying(64) NOT NULL, -- uniqu... | [
{
"role": "user",
"content": "我想查询所有来自美国供应商的组件信息,包括组件名称、供应商名称和供应商的质量评分。"
},
{
"role": "assistant",
"content": "SELECT c.component_name, s.supplier_name, s.quality_rating\nFROM manufacturing.components c\nJOIN manufacturing.suppliers s ON c.supplier_id = s.supplier_id\nWHERE s.country = 'USA';"
... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.medical_records ( record_id character varying(64) NOT NULL, patient_id character varying(64) NOT NULL, appoi... | [
{
"role": "user",
"content": "How many medical records does each doctor have? Show doctor_id and record_count."
},
{
"role": "assistant",
"content": "SELECT doctor_id,\n COUNT(*) AS record_count\nFROM healthcare.medical_records\nGROUP BY doctor_id;"
},
{
"role": "user",
"conten... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ... | [
{
"role": "user",
"content": "For each guest, calculate the total number of service orders they have placed and the sum of quantities ordered. Show guest_id, order_count, and total_quantity."
},
{
"role": "assistant",
"content": "SELECT guest_id,\n COUNT(order_id) AS order_count,\n S... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.passengers ( passenger_id character varying(64) NOT NULL, first_name character varying(128) NOT NULL, la... | [
{
"role": "user",
"content": "How many passengers were created each year? Provide the year and passenger_count."
},
{
"role": "assistant",
"content": "SELECT EXTRACT(YEAR FROM created_at) AS year, COUNT(*) AS passenger_count\nFROM transportation.passengers\nGROUP BY year\nORDER BY year;"
},
... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patient_insurance ( patient_insurance_id text, patient_id text, plan_id text, policy_number text, group_numb... | [
{
"role": "user",
"content": "How many primary insurance policies are currently active for each plan_id? Show plan_id and active_count."
},
{
"role": "assistant",
"content": "SELECT plan_id,\n COUNT(*) AS active_count\nFROM healthcare.patient_insurance\nWHERE is_primary = TRUE\n AND (expi... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.games ( game_id.uuid, title.text, developer_id.uuid, publisher_id.uuid, genre.text, release_date.date... | [
{
"role": "user",
"content": "Could you list each player and the title of the games for which they have acquired items?"
},
{
"role": "assistant",
"content": "SELECT DISTINCT pi.player_id, g.title FROM gaming_technology.player_inventory pi JOIN gaming_technology.games g ON pi.item_id = g.game_id... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.room_types (
room_type_id character varying(64) NOT NULL, -- unique identifier for the room ... | [
{
"role": "user",
"content": "List all guests with country code 'US'."
},
{
"role": "assistant",
"content": "SELECT guest_id, first_name, last_name, email, country_code\nFROM hospitality_technology.guests\nWHERE country_code = 'US';"
},
{
"role": "user",
"content": "Actually, only in... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.player_inventory ( inventory_id uuid PRIMARY KEY, player_id uuid, item_id uuid, quantity int, acquire... | [
{
"role": "user",
"content": "Find all pairs of inventory entries where the same player acquired the same item twice. Show the player_id, item_id, the earlier inventory_id as first_inv, and the later inventory_id as second_inv."
},
{
"role": "assistant",
"content": "SELECT p1.player_id,\n ... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.lawyers ( lawyer_id text PRIMARY KEY, first_name text, last_name text, bar_number text UNIQUE, firm_id t... | [
{
"role": "user",
"content": "Find all pairs of lawyers from the same firm who have the same specialization."
},
{
"role": "assistant",
"content": "SELECT a.lawyer_id AS lawyer_id_1, a.first_name AS first_name_1, a.last_name AS last_name_1, b.lawyer_id AS lawyer_id_2, b.first_name AS first_name_... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.reservations ( reservation_id text, property_id text, guest_id text, room_id text, room_type_id ... | [
{
"role": "user",
"content": "Find pairs of reservations at the same property where the second check-in is within 7 days after the first check-out. Return first_reservation, second_reservation, and gap_days."
},
{
"role": "assistant",
"content": "SELECT r1.reservation_id AS first_reservation,\n ... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.players ( player_id uuid PRIMARY KEY, username text, email text, password_hash text, registration_dat... | [
{
"role": "user",
"content": "Which developers have at least one player who unlocked an achievement on a game they developed?"
},
{
"role": "assistant",
"content": "SELECT DISTINCT d.developer_id, d.name\nFROM gaming_technology.developers d\nJOIN gaming_technology.games g ON d.developer_id = g.d... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.documents ( document_id.text, application_id.text, citizen_id.text, document_type.text, file_refere... | [
{
"role": "user",
"content": "Show the number of documents uploaded per month in the year 2024."
},
{
"role": "assistant",
"content": "SELECT STRFTIME('%Y-%m', T1.upload_timestamp), COUNT(T1.document_id) FROM government_services.documents AS T1 WHERE STRFTIME('%Y', T1.upload_timestamp) = '2024' ... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.service_orders ( order_id text PRIMARY KEY, reservation_id text, guest_id text, service_id text,... | [
{
"role": "user",
"content": "List each staff member who delivered orders, along with the number of orders they delivered."
},
{
"role": "assistant",
"content": "SELECT staff_id_delivered, COUNT(order_id) AS delivered_orders FROM hospitality_technology.service_orders WHERE staff_id_delivered IS ... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.medical_records ( record_id text PRIMARY KEY, patient_id text, appointment_id text, doctor_id text, record_d... | [
{
"role": "user",
"content": "Count the number of medical records created for each doctor, and list the doctor_id alongside their record count."
},
{
"role": "assistant",
"content": "SELECT doctor_id, COUNT(*) AS record_count FROM healthcare.medical_records GROUP BY doctor_id;"
}
] |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.games (
game_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the game
ti... | [
{
"role": "user",
"content": "Show me the average number of current players per server for each region."
},
{
"role": "assistant",
"content": "SELECT region, AVG(current_players) AS avg_current_players\nFROM gaming_technology.servers\nGROUP BY region;"
},
{
"role": "user",
"content":... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.appointments (
appointment_id character varying(64) NOT NULL, -- unique identifier for the appointment
... | [
{
"role": "user",
"content": "Count how many diagnoses were recorded each month in 2024. Show the month (as the first day of the month) and the count."
},
{
"role": "assistant",
"content": "SELECT DATE_TRUNC('month', diagnosis_date)::date AS diagnosis_month, COUNT(*) FROM healthcare.diagnoses WH... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.wallets ( wallet_id.text, user_id.text, address.text, private_key.text, created_at.timestamp )
CREATE ... | [
{
"role": "user",
"content": "List all users who have bought assets, along with their wallet addresses."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.user_id, T1.address FROM wallets AS T1 JOIN trades AS T2 ON T1.user_id = T2.buyer_id;"
},
{
"role": "user",
"content": "Fi... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varchar, transaction_index bigint, from_... | [
{
"role": "user",
"content": "Which SUI coins have 'exists' status and what is the total balance across all owners for each coin_type? Please include coin_type, symbol, name, and total_balance."
},
{
"role": "assistant",
"content": "SELECT sc.coin_type,\n sm.symbol,\n sm.name,\n ... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.transactions ( transaction_id text PRIMARY KEY, from_address text, to_address text, value numeric, gas_used int, g... | [
{
"role": "user",
"content": "For each block number, show the minimum transaction value and the transaction_id(s) that have that minimum value."
},
{
"role": "assistant",
"content": "SELECT t.block_number, t.transaction_id, t.value\nFROM web3.transactions t\nINNER JOIN (\n SELECT block_number, ... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.doctors (
doctor_id character varying(64) NOT NULL, -- unique identifier for the doctor
first_name ... | [
{
"role": "user",
"content": "List the description and diagnosis date for all diagnoses that are marked as chronic and were made in the year 2023."
},
{
"role": "assistant",
"content": "SELECT description, diagnosis_date FROM healthcare.diagnoses WHERE is_chronic = true AND diagnosis_date BETWEE... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles ( vehicle_id text, license_plate text, vin text, make text, model text, year integer, type text... | [
{
"role": "user",
"content": "List all bookings with the first and last name of the passenger and trip_id."
},
{
"role": "assistant",
"content": "SELECT b.booking_id, b.trip_id, p.first_name, p.last_name\nFROM transportation.bookings b\nJOIN transportation.passengers p ON b.passenger_id = p.pass... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
// PUT /stations
{
"mappings": {
"properties": {
"station_id": { "type": "keyword" },... | [
{
"role": "user",
"content": "Can you provide the total capacity of all train cars for a specific train with train_id 'TR789'?"
},
{
"role": "assistant",
"content": "SELECT SUM(capacity) AS total_capacity\nFROM train_cars\nWHERE train_id = 'TR789';"
}
] |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.trades ( trade_id.text, account_id.text, security_id.text, order_id.text, trade_type.text, quantity.... | [
{
"role": "user",
"content": "List all employees (employee_id, first_name, last_name) who have processed trades with a commission greater than $500."
},
{
"role": "assistant",
"content": "SELECT DISTINCT e.employee_id, e.first_name, e.last_name FROM financial_services.employees e JOIN financial_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.