system stringlengths 288 8.03k | 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.law_firms ( firm_id character varying(64) NOT NULL, firm_name character varying(200) NOT NULL, address t... | [
{
"role": "user",
"content": "List all pairs of law firms that were founded on the same month and day, showing their names, and the shared founding date. Exclude firms founded on January 1st."
},
{
"role": "assistant",
"content": "SELECT t1.firm_name AS firm1_name, t2.firm_name AS firm2_name, t1... |
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 character varying(64) NOT NULL, vehicle_id character varying(64) NOT NULL, ser... | [
{
"role": "user",
"content": "List all maintenance logs where the odometer reading was greater than 150000. Display log ID, vehicle ID, service date, and odometer reading."
},
{
"role": "assistant",
"content": "SELECT log_id, vehicle_id, service_date, odometer_reading FROM transportation.mainten... |
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.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name... | [
{
"role": "user",
"content": "Show all beneficiaries who were added in 2024 for any policy. List their beneficiary_id, first and last name, relationship, and the policy_id."
},
{
"role": "assistant",
"content": "SELECT beneficiary_id, first_name, last_name, relationship, policy_id\nFROM insuranc... |
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.post_hashtags ( post_hashtag_id character varying(64) NOT NULL, post_id character varying(64) NOT NULL, ha... | [
{
"role": "user",
"content": "I'd like to see a list of users who have enabled email notifications."
},
{
"role": "assistant",
"content": "SELECT user_id FROM social_media.user_settings WHERE email_notifications_enabled = true;"
},
{
"role": "user",
"content": "Also, include those us... |
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, first_name.text, last_name.text, bar_number.text, firm_id.text, email.text, ph... | [
{
"role": "user",
"content": "How many lawyers are there in each specialization?"
},
{
"role": "assistant",
"content": "SELECT specialization, COUNT(*) AS lawyer_count\nFROM legal_services.lawyers\nGROUP BY specialization;"
},
{
"role": "user",
"content": "Only include specialization... |
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.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t... | [
{
"role": "user",
"content": "List each user's username along with the number of posts they've made that include any media attachment, ordering the results by that count descending."
},
{
"role": "assistant",
"content": "SELECT u.username, COUNT(p.post_id) AS media_post_count\nFROM social_media.... |
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": "List the names of employees and the agency they work for who have scheduled at least one appointment. Show the employee's first name, last name, and agency_id."
},
{
"role": "assistant",
"content": "SELECT DISTINCT e.first_name, e.last_name, e.agency_id\nFROM govern... |
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.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ... | [
{
"role": "user",
"content": "Show me all patients who have scheduled appointments with doctors specializing in Cardiology, along with their appointment times and reasons."
},
{
"role": "assistant",
"content": "SELECT p.patient_id, p.first_name, p.last_name, a.appointment_time, a.reason FROM hea... |
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.conversations ( conversation_id text PRIMARY KEY, created_at timestamp, last_message_at timestamp, is_grou... | [
{
"role": "user",
"content": "List the names of group conversations and the usernames of participants who joined after '2023-01-01'."
},
{
"role": "assistant",
"content": "SELECT T1.group_name, T3.username FROM social_media.conversations AS T1 JOIN social_media.participants AS T2 ON T1.conversat... |
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.insurance_plans ( plan_id.text, plan_name.text, insurance_provider.text, plan_type.text, contact_phone.text,... | [
{
"role": "user",
"content": "Count how many insurance plans exist for each plan type."
},
{
"role": "assistant",
"content": "SELECT plan_type, COUNT(*) AS plan_count\nFROM healthcare.insurance_plans\nGROUP BY plan_type;"
},
{
"role": "user",
"content": "Now filter to only show plan ... |
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 erc1155_approval_for_all ( block_number bigint NOT NULL, block_timestamp timestamp(3) NOT NULL, transaction_index integ... | [
{
"role": "user",
"content": "Show me the top 5 ERC20 tokens with the highest current price, along with their symbols and contract addresses."
},
{
"role": "assistant",
"content": "SELECT t.symbol, t.address, t.price FROM token_prices_latest t ORDER BY t.price DESC LIMIT 5;"
},
{
"role":... |
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": "Retrieve the application_id, citizen_id, service_id, and service_name for all applications with status = 'Pending'."
},
{
"role": "assistant",
"content": "SELECT a.application_id, a.citizen_id, a.service_id, s.service_name\nFROM government_services.applications a\nJ... |
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.services (
service_id character varying(64) NOT NULL, -- unique identifier for a chargeable ... | [
{
"role": "user",
"content": "For each property, show the property name, average price of available services, and the maximum price of available services."
},
{
"role": "assistant",
"content": "SELECT p.property_name,\n AVG(s.price) AS avg_price,\n MAX(s.price) AS max_price\nFROM hos... |
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, first_name character varying(100) NOT NULL, last_nam... | [
{
"role": "user",
"content": "Display all invoices along with the associated case name and the full name of the client."
},
{
"role": "assistant",
"content": "SELECT i.invoice_number, cs.case_name, c.first_name || ' ' || c.last_name AS client_full_name\nFROM legal_services.invoices i\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 transportation.drivers ( driver_id text, employee_id text, first_name text, last_name text, license_number text, licens... | [
{
"role": "user",
"content": "List all drivers along with their status and license expiry date."
},
{
"role": "assistant",
"content": "SELECT driver_id, first_name, last_name, status, license_expiry_date\nFROM transportation.drivers;"
},
{
"role": "user",
"content": "Only show driver... |
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.events ( event_id character varying(64) NOT NULL, contract_id character varying(64) NOT NULL, event_name character... | [
{
"role": "user",
"content": "How many events were emitted on each date? List the date and the count of events."
},
{
"role": "assistant",
"content": "SELECT DATE(emitted_at) AS emit_date,\n COUNT(*) AS event_count\nFROM web3.events\nGROUP BY DATE(emitted_at);"
},
{
"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 token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add... | [
{
"role": "user",
"content": "Count the number of approval events in erc20_approval for each contract_address between block_number 1000000 and 2000000."
},
{
"role": "assistant",
"content": "SELECT\n contract_address,\n COUNT(*) AS approval_count\nFROM erc20_approval\nWHERE block_number 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 legal_services.clients ( client_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_nam... | [
{
"role": "user",
"content": "Get me a list of upcoming appointments with appointment_id, client full name, case number, and start_time for appointments with status 'scheduled'."
},
{
"role": "assistant",
"content": "SELECT a.appointment_id,\n CONCAT(cl.first_name, ' ', cl.last_name) AS cl... |
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.game_sessions ( session_id uuid, player_id uuid, game_id uuid, server_id uuid, start_time timestamp w... | [
{
"role": "user",
"content": "Show me all game sessions that do not have a score recorded. List the session_id, player_id, game_id, and start_time."
},
{
"role": "assistant",
"content": "SELECT session_id, player_id, game_id, start_time FROM gaming_technology.game_sessions WHERE score IS 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 transportation.drivers ( driver_id.text, employee_id.text, first_name.text, last_name.text, license_number.text, licens... | [
{
"role": "user",
"content": "Show me all drivers hired in 2023, including their full name and email address."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, email FROM transportation.drivers WHERE hire_date >= '2023-01-01' AND hire_date < '2024-01-01';"
},
{
"role":... |
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, patient_id.text, appointment_id.text, doctor_id.text, record_date.timestam... | [
{
"role": "user",
"content": "List all primary insurance policies that will expire within the next 30 days. Return patient_insurance_id, patient_id, policy_number, and expiration_date."
},
{
"role": "assistant",
"content": "SELECT patient_insurance_id,\n patient_id,\n policy_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 web3.events ( event_id.text, contract_id.text, event_name.text, data.text, emitted_at.timestamp, transaction_id.text, l... | [
{
"role": "user",
"content": "Find all users and the total value of transactions they have received, showing user_id, username, and total_received_value."
},
{
"role": "assistant",
"content": "SELECT u.user_id,\n u.username,\n COALESCE(SUM(t.value), 0) AS total_received_value\nFROM w... |
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, name text, country text, founded_year integer, website text, created_... | [
{
"role": "user",
"content": "Find all pairs of developers in the same country but founded in different years. Show each developer's name, their founded_year, and the shared country."
},
{
"role": "assistant",
"content": "SELECT d1.name AS developer1, d2.name AS developer2, d1.country, d1.founde... |
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 text, employee_id text, first_name text, last_name text, license_number text, licens... | [
{
"role": "user",
"content": "Show me all intercity routes with their origin and destination cities, along with the average passenger count for completed trips on these routes."
},
{
"role": "assistant",
"content": "SELECT r.route_id, lo.city AS origin_city, ld.city AS destination_city, AVG(t.pa... |
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 PRIMARY KEY, license_plate text, vin text, make text, model text, year int, t... | [
{
"role": "user",
"content": "What is the average maintenance cost per service_type for maintenance performed in 2023?"
},
{
"role": "assistant",
"content": "SELECT service_type, AVG(cost) AS avg_cost\nFROM transportation.maintenance_logs\nWHERE service_date BETWEEN '2023-01-01' AND '2023-12-31'... |
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.cases ( case_id text, case_number text, case_name text, client_id text, lead_lawyer_id text, case_type t... | [
{
"role": "user",
"content": "Show me all cases with a status of 'Pending', displaying their case name and court jurisdiction."
},
{
"role": "assistant",
"content": "SELECT case_name, court_jurisdiction FROM legal_services.cases WHERE status = 'Pending';"
},
{
"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 insurance.claims (
claim_id character varying(64) NOT NULL, -- unique identifier for the claim
policy_id charac... | [
{
"role": "user",
"content": "For all claims, show the claim ID, policy ID, incident date, status, and the claim handler ID, only for claims that have both an estimated loss and a settlement amount over 5000."
},
{
"role": "assistant",
"content": "SELECT claim_id, policy_id, incident_date, statu... |
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": "Show me all properties in California with a star rating above 4.0, along with their room types and base rates, ordered by star rating in descending order."
},
{
"role": "assistant",
"content": "SELECT p.property_name, p.star_rating, rt.type_name, rt.base_rate FROM h... |
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, national_id_number text, first_name text, last_name text, date_of_birth... | [
{
"role": "user",
"content": "List the first and last name of every citizen and the city of the service location where they have had an appointment scheduled."
},
{
"role": "assistant",
"content": "SELECT c.first_name, c.last_name, sl.city\nFROM government_services.appointments a\nINNER JOIN gov... |
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.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username ch... | [
{
"role": "user",
"content": "List all metadata keys and their corresponding values for the asset with symbol 'BTC'."
},
{
"role": "assistant",
"content": "SELECT m.key, m.value\nFROM trading_platform.metadata m\nJOIN trading_platform.assets a ON m.asset_id = a.asset_id\nWHERE a.symbol = 'BTC';"... |
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.agencies ( agency_id character varying(64) NOT NULL, agency_name character varying(255) NOT NULL, j... | [
{
"role": "user",
"content": "List the first and last names of employees and the number of services offered by their agency."
},
{
"role": "assistant",
"content": "SELECT e.first_name, e.last_name, COUNT(s.service_id) AS service_count\nFROM government_services.employees e\nLEFT JOIN government_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 gaming_technology.players ( player_id uuid PRIMARY KEY, username text, email text, password_hash text, registration_dat... | [
{
"role": "user",
"content": "For each game, can you show the total number of players who have unlocked at least one achievement in that game, as well as the game's genre?"
},
{
"role": "assistant",
"content": "SELECT g.game_id, g.title, g.genre, COUNT(DISTINCT pa.player_id) AS player_count\nFRO... |
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.comments ( comment_id.text, post_id.text, user_id.text, parent_comment_id.text, content.text, created_at.t... | [
{
"role": "user",
"content": "Show me a list of comments and the names of hashtags associated with the posts those comments are on."
},
{
"role": "assistant",
"content": "SELECT T1.comment_id, T3.tag_name FROM comments AS T1 JOIN post_hashtags AS T2 ON T1.post_id = T2.post_id JOIN hashtags AS T3... |
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 blockchain.blocks ( block_id text PRIMARY KEY, previous_block_id text, timestamp timestamp, nonce int, merkle_root text... | [
{
"role": "user",
"content": "Show me the average difficulty for blocks that have a previous block versus those that don't have a previous block."
},
{
"role": "assistant",
"content": "SELECT CASE WHEN previous_block_id IS NULL THEN 'No Previous Block' ELSE 'Has Previous Block' END AS block_type... |
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.rooms (
room_id character varying(64) NOT NULL, -- unique identifier for the room
prope... | [
{
"role": "user",
"content": "Show me the room number, floor, and the name of the property for all rooms located in properties in Texas."
},
{
"role": "assistant",
"content": "SELECT T1.room_number, T1.floor, T2.property_name FROM hospitality_technology.rooms AS T1 JOIN hospitality_technology.pr... |
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.game_sessions ( session_id uuid PRIMARY KEY, player_id uuid, game_id uuid, server_id uuid, start_time... | [
{
"role": "user",
"content": "Show the total session duration in seconds and the average score for each game."
},
{
"role": "assistant",
"content": "SELECT game_id, SUM(duration_seconds), AVG(score) FROM gaming_technology.game_sessions GROUP BY game_id;"
},
{
"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 transportation.vehicles (
vehicle_id character varying(64) NOT NULL, -- unique identifier for the vehicle
lice... | [
{
"role": "user",
"content": "Which vehicles are assigned to each depot? Display the depot ID, vehicle's license_plate, make, and model."
},
{
"role": "assistant",
"content": "SELECT depot_id, license_plate, make, model\nFROM transportation.vehicles\nWHERE depot_id IS NOT NULL;"
},
{
"ro... |
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 PRIMARY KEY, property_name text, address_line1 text, address_line2... | [
{
"role": "user",
"content": "For each staff member who placed a service order, show their full name and the total revenue generated from those orders."
},
{
"role": "assistant",
"content": "SELECT S.first_name, S.last_name, SUM(SO.total_price) AS total_generated_revenue FROM hospitality_technol... |
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.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, address_lin... | [
{
"role": "user",
"content": "Show all claims filed in 2024, including the claim ID, incident date, and the first and last name of the customer."
},
{
"role": "assistant",
"content": "SELECT t1.claim_id, t1.incident_date, t2.first_name, t2.last_name FROM insurance.claims AS t1 JOIN insurance.cus... |
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 Sui NFTs with status 'exists', including their object_id, name, owner, and collection_type."
},
{
"role": "assistant",
"content": "SELECT object_id, name, owner, collection_type FROM sui_nfts WHERE status = 'exists';"
},
{
"role": "user",
"co... |
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.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, ad... | [
{
"role": "user",
"content": "Retrieve all loans along with the corresponding customer's first and last name and the current principal balance."
},
{
"role": "assistant",
"content": "SELECT l.loan_id, c.first_name, c.last_name, l.current_principal_balance\nFROM financial_services.loans l\nJOIN f... |
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.policies (
policy_id character varying(64) NOT NULL, -- unique identifier for the policy
customer_id ... | [
{
"role": "user",
"content": "Show me a list of all policy numbers that have a deductible exactly equal to 0."
},
{
"role": "assistant",
"content": "SELECT policy_number\nFROM insurance.policies\nWHERE deductible = 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 healthcare.appointments ( appointment_id.text, patient_id.text, doctor_id.text, appointment_time.timestamp, duration_mi... | [
{
"role": "user",
"content": "Show all appointments that have 'follow-up' mentioned in the notes field."
},
{
"role": "assistant",
"content": "SELECT * FROM healthcare.appointments WHERE notes LIKE '%follow-up%';"
}
] |
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, -- unique identifier for the contract
address cha... | [
{
"role": "user",
"content": "List all pairs of contracts deployed on the same day by the same deployer. Show deployer_address, deployment date, and both contract IDs."
},
{
"role": "assistant",
"content": "SELECT\n c1.deployer_address,\n DATE(c1.deployed_at) AS deployment_date,\n c1.contract... |
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": "How many games are available on each platform?"
},
{
"role": "assistant",
"content": "SELECT platform,\n COUNT(*) AS game_count\nFROM gaming_technology.games\nGROUP BY platform;"
},
{
"role": "user",
"content": "Only include platforms that have mor... |
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": "List all invoices with status 'Paid' where the payment date is later than the due date, showing the invoice number, issue date, due date, payment date, total amount, and amount paid."
},
{
"role": "assistant",
"content": "SELECT invoice_number, issue_date, due_date,... |
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": "For each SUI coin type, show the total balance across all owners and the number of distinct owners."
},
{
"role": "assistant",
"content": "SELECT\n coin_type,\n SUM(CAST(balance AS DECIMAL)) AS total_balance,\n COUNT(DISTINCT owner) AS owner_count\nFROM sui_coins... |
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 character varying(64) NOT NULL, vehicle_id character varying(64) NOT NULL, ser... | [
{
"role": "user",
"content": "For each trip, list the trip ID, its scheduled departure time, and the total fare from all bookings associated with that trip."
},
{
"role": "assistant",
"content": "SELECT T2.trip_id , T2.scheduled_departure , SUM(T1.fare) FROM transportation.bookings AS T1 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 legal_services.documents ( document_id text, case_id text, document_name text, document_type text, storage_path text, u... | [
{
"role": "user",
"content": "List pairs of documents uploaded by the same lawyer but for different cases, showing both document names, their case IDs, and the lawyer ID."
},
{
"role": "assistant",
"content": "SELECT t1.document_name AS document1_name, t1.case_id AS document1_case_id, t2.documen... |
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.policy_beneficiaries ( beneficiary_id text PRIMARY KEY, policy_id text, customer_id text, first_name text, la... | [
{
"role": "user",
"content": "How many beneficiaries has each unique relationship type? List relationship and the count."
},
{
"role": "assistant",
"content": "SELECT relationship, COUNT(*) AS beneficiary_count\nFROM insurance.policy_beneficiaries\nGROUP BY relationship;"
}
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.