Upload data.jsonl with huggingface_hub
Browse files- data.jsonl +2 -2
data.jsonl
CHANGED
|
@@ -44,6 +44,7 @@
|
|
| 44 |
{"system": "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. \n##Table Structure\nCREATE TABLE blockchain.nodes (\n node_id character varying(64) NOT NULL, -- unique identifier for the node\n ip_address character varying(15) NOT NULL, -- IP address of the node\n port integer NOT NULL, -- port number of the node\n last_seen timestamp NOT NULL, -- last time the node was active\n PRIMARY KEY (node_id)\n)\nCREATE TABLE blockchain.wallets ( wallet_id.text, user_id.text, address_id.text, private_key.text )\nCREATE TABLE blockchain.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email character varying(128) NOT NULL, password_hash text NOT NULL, PRIMARY KEY (user_id) )\nCREATE TABLE blockchain.smart_contracts ( contract_id character varying(64) NOT NULL, creator_address character varying(128) NOT NULL, code text NOT NULL, timestamp timestamp NOT NULL, PRIMARY KEY (contract_id) )\n", "conversations": [{"role": "user", "content": "Retrieve all users and their associated wallet identifiers."}, {"role": "assistant", "content": "SELECT T1.username , T2.wallet_id FROM blockchain.users AS T1 JOIN blockchain.wallets AS T2 ON T1.user_id = T2.user_id"}, {"role": "user", "content": "Only show users whose username starts with 'J'."}, {"role": "assistant", "content": "SELECT T1.username , T2.wallet_id FROM blockchain.users AS T1 JOIN blockchain.wallets AS T2 ON T1.user_id = T2.user_id WHERE T1.username LIKE 'J%'"}, {"role": "user", "content": "Further filter to only include wallets where the address_id contains 'abc'."}, {"role": "assistant", "content": "SELECT T1.username , T2.wallet_id FROM blockchain.users AS T1 JOIN blockchain.wallets AS T2 ON T1.user_id = T2.user_id WHERE T1.username LIKE 'J%' AND T2.address_id LIKE '%abc%'"}, {"role": "user", "content": "For the filtered users and wallets, count how many wallets each user has."}, {"role": "assistant", "content": "SELECT T1.username , COUNT(T2.wallet_id) FROM blockchain.users AS T1 JOIN blockchain.wallets AS T2 ON T1.user_id = T2.user_id WHERE T1.username LIKE 'J%' AND T2.address_id LIKE '%abc%' GROUP BY T1.username"}]}
|
| 45 |
{"system": "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. \n##Table Structure\nCREATE TABLE web3.token_transfers ( transfer_id text PRIMARY KEY, token_id text, from_address text, to_address text, value numeric, transaction_id text, log_index int )\n", "conversations": [{"role": "user", "content": "List all pairs of token transfers occurring within the same transaction where one transferred value is greater than the other, showing both transfer IDs, the transaction ID, and both values."}, {"role": "assistant", "content": "SELECT t1.transaction_id,\n t1.transfer_id AS transfer_id_1,\n t2.transfer_id AS transfer_id_2,\n t1.value AS value_1,\n t2.value AS value_2\nFROM web3.token_transfers t1\nJOIN web3.token_transfers t2\n ON t1.transaction_id = t2.transaction_id\n AND t1.value > t2.value;"}]}
|
| 46 |
{"system": "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. \n##Table Structure\nCREATE TABLE social_media.conversations ( conversation_id text PRIMARY KEY, created_at timestamp, last_message_at timestamp, is_group_chat bool, group_name text )\n", "conversations": [{"role": "user", "content": "List group conversation names and the count of messages sent in each conversation after '2024-06-01'."}, {"role": "assistant", "content": "SELECT T1.group_name, COUNT(T2.message_id) FROM social_media.conversations AS T1 JOIN social_media.messages AS T2 ON T1.conversation_id = T2.conversation_id WHERE T1.is_group_chat = TRUE AND T2.sent_at > '2024-06-01' GROUP BY T1.conversation_id, T1.group_name;"}, {"role": "user", "content": "Only show conversations that have more than 5 messages sent after that date."}, {"role": "assistant", "content": "SELECT T1.group_name, COUNT(T2.message_id) FROM social_media.conversations AS T1 JOIN social_media.messages AS T2 ON T1.conversation_id = T2.conversation_id WHERE T1.is_group_chat = TRUE AND T2.sent_at > '2024-06-01' GROUP BY T1.conversation_id, T1.group_name HAVING COUNT(T2.message_id) > 5;"}]}
|
|
|
|
| 47 |
{"system": "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. \n##Table Structure\nCREATE TABLE social_media.likes ( like_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, post_id character varying(64), comment_id character varying(64), created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (like_id), CONSTRAINT unique_user_like UNIQUE (user_id, post_id, comment_id), CONSTRAINT check_like_target CHECK (post_id IS NOT NULL OR comment_id IS NOT NULL) )\nCREATE TABLE social_media.conversations ( conversation_id character varying(64) NOT NULL, created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, last_message_at timestamp, is_group_chat boolean NOT NULL DEFAULT false, group_name character varying(100), PRIMARY KEY (conversation_id) )\nCREATE TABLE social_media.user_settings ( setting_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL UNIQUE, theme character varying(20) DEFAULT 'light', email_notifications_enabled boolean DEFAULT true, push_notifications_enabled boolean DEFAULT true, private_profile boolean DEFAULT false, updated_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (setting_id) )\n", "conversations": [{"role": "user", "content": "List user IDs and the creation timestamp of likes made by users who have email notifications enabled."}, {"role": "assistant", "content": "SELECT T1.user_id, T1.created_at FROM social_media.likes AS T1 JOIN social_media.user_settings AS T2 ON T1.user_id = T2.user_id WHERE T2.email_notifications_enabled = true;"}, {"role": "user", "content": "Only show likes created in the year 2024."}, {"role": "assistant", "content": "SELECT T1.user_id, T1.created_at FROM social_media.likes AS T1 JOIN social_media.user_settings AS T2 ON T1.user_id = T2.user_id WHERE T2.email_notifications_enabled = true AND T1.created_at >= '2024-01-01' AND T1.created_at < '2025-01-01';"}, {"role": "user", "content": "Filter to only include users whose profile is not private."}, {"role": "assistant", "content": "SELECT T1.user_id, T1.created_at FROM social_media.likes AS T1 JOIN social_media.user_settings AS T2 ON T1.user_id = T2.user_id WHERE T2.email_notifications_enabled = true AND T1.created_at >= '2024-01-01' AND T1.created_at < '2025-01-01' AND T2.private_profile = false;"}]}
|
| 48 |
{"system": "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. \n##Table Structure\nCREATE TABLE legal_services.clients ( client_id.text, first_name.text, last_name.text, company_name.text, email.text, phone.text, address.text, date_registered.timestamp, status.text )\nCREATE TABLE legal_services.law_firms ( firm_id.text, firm_name.text, address.text, phone.text, website.text, founded_date.date, managing_partner_id.text )\nCREATE TABLE legal_services.documents ( document_id.text, case_id.text, document_name.text, document_type.text, storage_path.text, uploaded_by_lawyer_id.text, upload_timestamp.timestamp, version.integer, description.text )\nCREATE TABLE legal_services.time_entries ( entry_id.text, case_id.text, lawyer_id.text, date_worked.date, hours_spent.numeric, billing_rate.numeric, description.text, is_billable.boolean, is_billed.boolean, invoice_id.text, created_at.timestamp )\nCREATE TABLE legal_services.invoices ( invoice_id.text, invoice_number.text, client_id.text, case_id.text, issue_date.date, due_date.date, total_amount.numeric, amount_paid.numeric, status.text, payment_date.timestamp, notes.text, created_at.timestamp )\nCREATE TABLE legal_services.appointments ( appointment_id.text, client_id.text, lawyer_id.text, case_id.text, start_time.timestamp, end_time.timestamp, location.text, subject.text, notes.text, status.text, created_at.timestamp )\n", "conversations": [{"role": "user", "content": "List all documents along with the case number they are associated with, as well as the name and email of the lawyer who uploaded them."}, {"role": "assistant", "content": "SELECT d.document_name, d.document_type, d.case_id, l.first_name || ' ' || l.last_name AS lawyer_full_name, l.email FROM legal_services.documents d JOIN legal_services.lawyers l ON d.uploaded_by_lawyer_id = l.lawyer_id;"}, {"role": "user", "content": "Only include documents uploaded after April 1st, 2024."}, {"role": "assistant", "content": "SELECT d.document_name, d.document_type, d.case_id, l.first_name || ' ' || l.last_name AS lawyer_full_name, l.email FROM legal_services.documents d JOIN legal_services.lawyers l ON d.uploaded_by_lawyer_id = l.lawyer_id WHERE d.upload_timestamp > '2024-04-01';"}, {"role": "user", "content": "Add the case name and make sure only documents with version greater than 1 are listed."}, {"role": "assistant", "content": "SELECT d.document_name, d.document_type, d.case_id, c.case_name, l.first_name || ' ' || l.last_name AS lawyer_full_name, l.email FROM legal_services.documents d JOIN legal_services.cases c ON d.case_id = c.case_id JOIN legal_services.lawyers l ON d.uploaded_by_lawyer_id = l.lawyer_id WHERE d.upload_timestamp > '2024-04-01' AND d.version > 1;"}, {"role": "user", "content": "Order the results by upload_timestamp ascending."}, {"role": "assistant", "content": "SELECT d.document_name, d.document_type, d.case_id, c.case_name, l.first_name || ' ' || l.last_name AS lawyer_full_name, l.email, d.upload_timestamp FROM legal_services.documents d JOIN legal_services.cases c ON d.case_id = c.case_id JOIN legal_services.lawyers l ON d.uploaded_by_lawyer_id = l.lawyer_id WHERE d.upload_timestamp > '2024-04-01' AND d.version > 1 ORDER BY d.upload_timestamp ASC;"}]}
|
| 49 |
{"system": "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. \n##Table Structure\nCREATE TABLE legal_services.invoices ( invoice_id text PRIMARY KEY, invoice_number text UNIQUE, client_id text, case_id text, issue_date date, due_date date, total_amount numeric, amount_paid numeric, status text, payment_date timestamp, notes text, created_at timestamp )\n", "conversations": [{"role": "user", "content": "Show me each invoice and the invoice_number of the next invoice for the same client, along with how many days apart their issue_dates are."}, {"role": "assistant", "content": "SELECT a.invoice_number AS invoice_number,\n b.invoice_number AS next_invoice_number,\n (b.issue_date - a.issue_date) AS days_between\n FROM legal_services.invoices a\n JOIN legal_services.invoices b\n ON a.client_id = b.client_id\n AND b.issue_date > a.issue_date;"}, {"role": "user", "content": "Please restrict to pairs where the days_between is greater than 30."}, {"role": "assistant", "content": "SELECT a.invoice_number AS invoice_number,\n b.invoice_number AS next_invoice_number,\n (b.issue_date - a.issue_date) AS days_between\n FROM legal_services.invoices a\n JOIN legal_services.invoices b\n ON a.client_id = b.client_id\n AND b.issue_date > a.issue_date\n WHERE (b.issue_date - a.issue_date) > 30;"}, {"role": "user", "content": "And only include pairs where both invoices have status 'Overdue'."}, {"role": "assistant", "content": "SELECT a.invoice_number AS invoice_number,\n b.invoice_number AS next_invoice_number,\n (b.issue_date - a.issue_date) AS days_between\n FROM legal_services.invoices a\n JOIN legal_services.invoices b\n ON a.client_id = b.client_id\n AND b.issue_date > a.issue_date\n WHERE (b.issue_date - a.issue_date) > 30\n AND a.status = 'Overdue'\n AND b.status = 'Overdue';"}]}
|
|
@@ -205,7 +206,6 @@
|
|
| 205 |
{"system": "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. \n##Table Structure\nCREATE TABLE transportation.vehicles ( vehicle_id.text, license_plate.text, vin.text, make.text, model.text, year.integer, type.text, capacity.integer, fuel_type.text, status.text, depot_id.text, acquisition_date.date )\n", "conversations": [{"role": "user", "content": "For each vehicle, find the vehicle acquired immediately before it in the same depot. Show current vehicle_id, acquisition_date, previous_vehicle_id, and previous_acquisition_date."}, {"role": "assistant", "content": "SELECT v.vehicle_id,\n v.acquisition_date,\n prev.vehicle_id AS previous_vehicle_id,\n prev.acquisition_date AS previous_acquisition_date\nFROM transportation.vehicles v\nLEFT JOIN transportation.vehicles prev\n ON v.depot_id = prev.depot_id\n AND prev.acquisition_date = (\n SELECT MAX(acquisition_date)\n FROM transportation.vehicles\n WHERE depot_id = v.depot_id\n AND acquisition_date < v.acquisition_date\n );"}]}
|
| 206 |
{"system": "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. \n##Table Structure\nCREATE TABLE transportation.routes ( route_id text PRIMARY KEY, route_number text, description text, origin_location_id text, destination_location_id text, distance_km numeric, estimated_duration_minutes int, type text )\nCREATE TABLE transportation.locations ( location_id text PRIMARY KEY, name text, type text, address_line1 text, city text, state_province text, postal_code text, country text, latitude numeric, longitude numeric, timezone text )\nCREATE TABLE transportation.bookings ( booking_id character varying(64) NOT NULL, passenger_id character varying(64) NOT NULL, trip_id character varying(64) NOT NULL, seat_number character varying(16), booking_time timestamp with time zone NOT NULL, status character varying(32) NOT NULL, fare numeric(10, 2) NOT NULL, payment_transaction_id character varying(128), special_requests text, PRIMARY KEY (booking_id) )\n", "conversations": [{"role": "user", "content": "Show the booking ID and seat number for all bookings that have a fare equal to 50."}, {"role": "assistant", "content": "SELECT booking_id, seat_number\nFROM transportation.bookings\nWHERE fare = 50;"}, {"role": "user", "content": "Also include the booking status and order the results by booking time ascending."}, {"role": "assistant", "content": "SELECT booking_id, seat_number, status\nFROM transportation.bookings\nWHERE fare = 50\nORDER BY booking_time ASC;"}]}
|
| 207 |
{"system": "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. \n##Table Structure\nCREATE TABLE transportation.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text, make text, model text, year int, type text, capacity int, fuel_type text, status text, depot_id text, acquisition_date date )\nCREATE TABLE transportation.drivers ( driver_id text PRIMARY KEY, employee_id text, first_name text, last_name text, license_number text, license_expiry_date date, contact_number text, email text, hire_date date, status text )\nCREATE TABLE transportation.fuel_logs ( fuel_log_id.text, vehicle_id.text, trip_id.text, log_timestamp.timestamp, fuel_type.text, quantity.numeric, unit.text, cost_per_unit.numeric, total_cost.numeric, odometer_reading.integer, location_id.text )\nCREATE TABLE transportation.passengers ( passenger_id text PRIMARY KEY, first_name text, last_name text, email text, phone_number text, date_of_birth date, loyalty_program_id text, created_at timestamp )\nCREATE TABLE transportation.bookings ( booking_id.text, passenger_id.text, trip_id.text, seat_number.text, booking_time.timestamp, status.text, fare.numeric, payment_transaction_id.text, special_requests.text )\n", "conversations": [{"role": "user", "content": "Retrieve the daily total fare collected for bookings with status 'Completed' in March 2024. Display the booking_date and total_fare."}, {"role": "assistant", "content": "SELECT\n DATE(booking_time) AS booking_date,\n SUM(fare) AS total_fare\nFROM transportation.bookings\nWHERE status = 'Completed'\n AND booking_time >= '2024-03-01'\n AND booking_time < '2024-04-01'\nGROUP BY DATE(booking_time);"}, {"role": "user", "content": "Now include only days where the total_fare exceeds 1000."}, {"role": "assistant", "content": "SELECT\n DATE(booking_time) AS booking_date,\n SUM(fare) AS total_fare\nFROM transportation.bookings\nWHERE status = 'Completed'\n AND booking_time >= '2024-03-01'\n AND booking_time < '2024-04-01'\nGROUP BY DATE(booking_time)\nHAVING SUM(fare) > 1000;"}]}
|
| 208 |
-
{"system": "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. \n##Table Structure\nCREATE TABLE transportation.vehicles ( vehicle_id text, license_plate text, vin text, make text, model text, year integer, type text, capacity integer, fuel_type text, status text, depot_id text, acquisition_date date )\nCREATE TABLE transportation.drivers (\n driver_id character varying(64) NOT NULL, -- unique identifier for the driver\n employee_id character varying(64) NOT NULL UNIQUE, -- employee reference number\n first_name character varying(128) NOT NULL, -- driver's first name\n last_name character varying(128) NOT NULL, -- driver's last name\n license_number character varying(64) NOT NULL UNIQUE, -- driving license number\n license_expiry_date date NOT NULL, -- expiry date of the license\n contact_number character varying(32), -- phone number\n email character varying(128) UNIQUE, -- email address\n hire_date date NOT NULL, -- date the driver was hired\n status character varying(32) NOT NULL, -- e.g., Active, On Leave, Terminated\n PRIMARY KEY (driver_id)\n)\nCREATE TABLE transportation.routes ( route_id text PRIMARY KEY, route_number text, description text, origin_location_id text, destination_location_id text, distance_km numeric, estimated_duration_minutes int, type text )\nCREATE TABLE transportation.maintenance_logs ( log_id.text, vehicle_id.text, service_date.date, odometer_reading.integer, service_type.text, description.text, cost.numeric, mechanic_name.text, next_service_due_date.date )\nCREATE TABLE transportation.fuel_logs ( fuel_log_id text, vehicle_id text, trip_id text, log_timestamp timestamp, fuel_type text, quantity numeric, unit text, cost_per_unit numeric, total_cost numeric, odometer_reading integer, location_id text )\n", "conversations": [{"role": "user", "content": "Show me all maintenance logs for vehicles of make 'Toyota' performed after January 1, 2024. Include the log ID, vehicle ID, service date, and service type."}, {"role": "assistant", "content": "SELECT ml.log_id, ml.vehicle_id, ml.service_date, ml.service_type\nFROM transportation.maintenance_logs ml\nJOIN transportation.vehicles v ON ml.vehicle_id = v.vehicle_id\nWHERE v.make = 'Toyota' AND ml.service_date > '2024-01-01';"}, {"role": "user", "content": "Can you add the maintenance cost and mechanic name to each entry and sort the results by service date descending?"}, {"role": "assistant", "content": "SELECT ml.log_id, ml.vehicle_id, ml.service_date, ml.service_type, ml.cost, ml.mechanic_name\nFROM transportation.maintenance_logs ml\nJOIN transportation.vehicles v ON ml.vehicle_id = v.vehicle_id\nWHERE v.make = 'Toyota' AND ml.service_date > '2024-01-01'\nORDER BY ml.service_date DESC;"}, {"role": "user", "content": "Actually, only show logs where the maintenance cost is greater than 1000."}, {"role": "assistant", "content": "SELECT ml.log_id, ml.vehicle_id, ml.service_date, ml.service_type, ml.cost, ml.mechanic_name\nFROM transportation.maintenance_logs ml\nJOIN transportation.vehicles v ON ml.vehicle_id = v.vehicle_id\nWHERE v.make = 'Toyota' AND ml.service_date > '2024-01-01' AND ml.cost > 1000\nORDER BY ml.service_date DESC;"}]}
|
| 209 |
{"system": "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. \n##Table Structure\nCREATE TABLE transportation.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text, make text, model text, year int, type text, capacity int, fuel_type text, status text, depot_id text, acquisition_date date )\n", "conversations": [{"role": "user", "content": "Could you provide the number of vehicles for each fuel_type?"}, {"role": "assistant", "content": "SELECT fuel_type, COUNT(*) AS vehicle_count\nFROM transportation.vehicles\nGROUP BY fuel_type;"}, {"role": "user", "content": "Filter out fuel types having fewer than 10 vehicles."}, {"role": "assistant", "content": "SELECT fuel_type, COUNT(*) AS vehicle_count\nFROM transportation.vehicles\nGROUP BY fuel_type\nHAVING COUNT(*) >= 10;"}, {"role": "user", "content": "Now order the result by vehicle_count descending and limit to the top 5 entries."}, {"role": "assistant", "content": "SELECT fuel_type, COUNT(*) AS vehicle_count\nFROM transportation.vehicles\nGROUP BY fuel_type\nHAVING COUNT(*) >= 10\nORDER BY vehicle_count DESC\nLIMIT 5;"}, {"role": "user", "content": "Also add the average capacity for each fuel_type."}, {"role": "assistant", "content": "SELECT fuel_type,\n COUNT(*) AS vehicle_count,\n AVG(capacity) AS avg_capacity\nFROM transportation.vehicles\nGROUP BY fuel_type\nHAVING COUNT(*) >= 10\nORDER BY vehicle_count DESC\nLIMIT 5;"}]}
|
| 210 |
{"system": "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. \n##Table Structure\nCREATE TABLE transportation.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text, make text, model text, year int, type text, capacity int, fuel_type text, status text, depot_id text, acquisition_date date )\nCREATE TABLE transportation.locations ( location_id text, name text, type text, address_line1 text, city text, state_province text, postal_code text, country text, latitude numeric, longitude numeric, timezone text )\nCREATE TABLE transportation.passengers (\n passenger_id character varying(64) NOT NULL, -- unique identifier for the passenger\n first_name character varying(128) NOT NULL, -- passenger's first name\n last_name character varying(128) NOT NULL, -- passenger's last name\n email character varying(128) UNIQUE, -- email address\n phone_number character varying(32) UNIQUE, -- phone number\n date_of_birth date, -- passenger's date of birth\n loyalty_program_id character varying(64), -- identifier for loyalty program membership\n created_at timestamp with time zone NOT NULL, -- time when the passenger record was created\n PRIMARY KEY (passenger_id)\n)\nCREATE TABLE transportation.bookings ( booking_id character varying(64) NOT NULL, passenger_id character varying(64) NOT NULL, trip_id character varying(64) NOT NULL, seat_number character varying(16), booking_time timestamp with time zone NOT NULL, status character varying(32) NOT NULL, fare numeric(10, 2) NOT NULL, payment_transaction_id character varying(128), special_requests text, PRIMARY KEY (booking_id) )\n", "conversations": [{"role": "user", "content": "List the number of bookings made by each passenger, including passenger_id, first_name, last_name, and booking_count."}, {"role": "assistant", "content": "SELECT p.passenger_id,\n p.first_name,\n p.last_name,\n COUNT(b.booking_id) AS booking_count\nFROM transportation.passengers p\nLEFT JOIN transportation.bookings b\n ON p.passenger_id = b.passenger_id\nGROUP BY p.passenger_id,\n p.first_name,\n p.last_name;"}, {"role": "user", "content": "Actually, only include passengers who have made at least 2 bookings."}, {"role": "assistant", "content": "SELECT p.passenger_id,\n p.first_name,\n p.last_name,\n COUNT(b.booking_id) AS booking_count\nFROM transportation.passengers p\nLEFT JOIN transportation.bookings b\n ON p.passenger_id = b.passenger_id\nGROUP BY p.passenger_id,\n p.first_name,\n p.last_name\nHAVING COUNT(b.booking_id) >= 2;"}, {"role": "user", "content": "Also include the average fare per passenger."}, {"role": "assistant", "content": "SELECT p.passenger_id,\n p.first_name,\n p.last_name,\n COUNT(b.booking_id) AS booking_count,\n AVG(b.fare) AS average_fare\nFROM transportation.passengers p\nLEFT JOIN transportation.bookings b\n ON p.passenger_id = b.passenger_id\nGROUP BY p.passenger_id,\n p.first_name,\n p.last_name\nHAVING COUNT(b.booking_id) >= 2;"}, {"role": "user", "content": "Sort the results by average_fare descending and limit to the top 5."}, {"role": "assistant", "content": "SELECT p.passenger_id,\n p.first_name,\n p.last_name,\n COUNT(b.booking_id) AS booking_count,\n AVG(b.fare) AS average_fare\nFROM transportation.passengers p\nLEFT JOIN transportation.bookings b\n ON p.passenger_id = b.passenger_id\nGROUP BY p.passenger_id,\n p.first_name,\n p.last_name\nHAVING COUNT(b.booking_id) >= 2\nORDER BY average_fare DESC\nLIMIT 5;"}]}
|
| 211 |
{"system": "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. \n##Table Structure\nCREATE TABLE transportation.routes ( route_id text, route_number text, description text, origin_location_id text, destination_location_id text, distance_km numeric, estimated_duration_minutes integer, type text )\n", "conversations": [{"role": "user", "content": "Find pairs of distinct routes that share the same destination location but start from different origins. Include the route ID and route number for both routes and the shared destination location ID."}, {"role": "assistant", "content": "SELECT\n r1.route_id AS route1_id,\n r1.route_number AS route1_number,\n r2.route_id AS route2_id,\n r2.route_number AS route2_number,\n r1.destination_location_id AS shared_destination_location_id\nFROM transportation.routes AS r1\nJOIN transportation.routes AS r2\n ON r1.destination_location_id = r2.destination_location_id\n AND r1.route_id < r2.route_id\nWHERE\n r1.origin_location_id != r2.origin_location_id;"}]}
|
|
@@ -247,4 +247,4 @@
|
|
| 247 |
{"system": "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. \n##Table Structure\nCREATE TABLE healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name character varying(100) NOT NULL, date_of_birth date NOT NULL, gender character varying(10), address text, phone_number character varying(20), email character varying(128) UNIQUE, emergency_contact_name character varying(200), emergency_contact_phone character varying(20), created_at timestamp with time zone NOT NULL DEFAULT current_timestamp, updated_at timestamp with time zone NOT NULL DEFAULT current_timestamp, PRIMARY KEY (patient_id) )\nCREATE TABLE healthcare.doctors ( doctor_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name character varying(100) NOT NULL, specialty character varying(100) NOT NULL, license_number character varying(50) UNIQUE NOT NULL, phone_number character varying(20), email character varying(128) UNIQUE, hospital_affiliation_id character varying(64), created_at timestamp with time zone NOT NULL DEFAULT current_timestamp, updated_at timestamp with time zone NOT NULL DEFAULT current_timestamp, PRIMARY KEY (doctor_id) )\nCREATE TABLE healthcare.diagnoses ( diagnosis_id character varying(64) NOT NULL, record_id character varying(64) NOT NULL, patient_id character varying(64) NOT NULL, doctor_id character varying(64) NOT NULL, diagnosis_code character varying(20) NOT NULL, code_type character varying(10) NOT NULL DEFAULT 'ICD-10', description text, diagnosis_date date NOT NULL, status character varying(32) NOT NULL, is_chronic boolean DEFAULT false, PRIMARY KEY (diagnosis_id) )\nCREATE TABLE healthcare.medications ( medication_id character varying(64) NOT NULL, medication_name character varying(255) NOT NULL, generic_name character varying(255), manufacturer character varying(100), ndc_code character varying(20) UNIQUE, description text, PRIMARY KEY (medication_id) )\nCREATE TABLE healthcare.insurance_plans ( plan_id character varying(64) NOT NULL, plan_name character varying(200) NOT NULL, insurance_provider character varying(100) NOT NULL, plan_type character varying(50), contact_phone character varying(20), website character varying(255), PRIMARY KEY (plan_id) )\nCREATE TABLE healthcare.patient_insurance ( patient_insurance_id character varying(64) NOT NULL, patient_id character varying(64) NOT NULL, plan_id character varying(64) NOT NULL, policy_number character varying(100) NOT NULL, group_number character varying(100), subscriber_name character varying(200), effective_date date NOT NULL, expiration_date date, is_primary boolean NOT NULL DEFAULT true, PRIMARY KEY (patient_insurance_id), UNIQUE (patient_id, plan_id, policy_number) )\n", "conversations": [{"role": "user", "content": "Which patients have a primary insurance policy and are subscribed to a plan provided by 'Cigna'? List patient ID, full name, policy number, plan ID, and insurance provider."}, {"role": "assistant", "content": "SELECT p.patient_id, p.first_name, p.last_name, pi.policy_number, pi.plan_id, ip.insurance_provider\nFROM healthcare.patient_insurance pi\nJOIN healthcare.patients p ON pi.patient_id = p.patient_id\nJOIN healthcare.insurance_plans ip ON pi.plan_id = ip.plan_id\nWHERE pi.is_primary = true AND ip.insurance_provider = 'Cigna';"}, {"role": "user", "content": "Additionally, only show results where the policy has not expired yet."}, {"role": "assistant", "content": "SELECT p.patient_id, p.first_name, p.last_name, pi.policy_number, pi.plan_id, ip.insurance_provider\nFROM healthcare.patient_insurance pi\nJOIN healthcare.patients p ON pi.patient_id = p.patient_id\nJOIN healthcare.insurance_plans ip ON pi.plan_id = ip.plan_id\nWHERE pi.is_primary = true AND ip.insurance_provider = 'Cigna' AND (pi.expiration_date IS NULL OR pi.expiration_date >= CURRENT_DATE);"}]}
|
| 248 |
{"system": "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. \n##Table Structure\nCREATE TABLE legal_services.clients ( client_id text, first_name text, last_name text, company_name text, email text, phone text, address text, date_registered timestamp, status text )\nCREATE TABLE legal_services.lawyers ( lawyer_id text, first_name text, last_name text, bar_number text, firm_id text, email text, phone text, specialization text, hire_date timestamp, is_partner boolean )\nCREATE TABLE legal_services.law_firms ( firm_id text, firm_name text, address text, phone text, website text, founded_date date, managing_partner_id text )\nCREATE TABLE legal_services.documents ( document_id text, case_id text, document_name text, document_type text, storage_path text, uploaded_by_lawyer_id text, upload_timestamp timestamp, version integer, description text )\nCREATE TABLE legal_services.time_entries ( entry_id text, case_id text, lawyer_id text, date_worked date, hours_spent numeric, billing_rate numeric, description text, is_billable boolean, is_billed boolean, invoice_id text, created_at timestamp )\nCREATE TABLE legal_services.appointments ( appointment_id text, client_id text, lawyer_id text, case_id text, start_time timestamp, end_time timestamp, location text, subject text, notes text, status text, created_at timestamp )\n", "conversations": [{"role": "user", "content": "I need a list showing the name of each law firm and the full name of every lawyer employed by that firm."}, {"role": "assistant", "content": "SELECT T1.firm_name, T2.first_name, T2.last_name FROM law_firms AS T1 JOIN lawyers AS T2 ON T1.firm_id = T2.firm_id;"}]}
|
| 249 |
{"system": "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. \n##Table Structure\nCREATE TABLE financial_services.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, address text, city text, state text, zip_code text, country text, email text, phone_number text, created_at timestamp, status text, risk_profile text )\n", "conversations": [{"role": "user", "content": "Show me all customers (customer_id, first_name, last_name, email) who were born after 1985 (date_of_birth > '1985-12-31') and have an email address ending with '@yahoo.com', along with their city and state information."}, {"role": "assistant", "content": "SELECT customer_id, first_name, last_name, email, city, state FROM financial_services.customers WHERE date_of_birth > '1985-12-31' AND email LIKE '%@yahoo.com';"}]}
|
| 250 |
-
{"system": "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. \n##Table Structure\nCREATE TABLE
|
|
|
|
| 44 |
{"system": "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. \n##Table Structure\nCREATE TABLE blockchain.nodes (\n node_id character varying(64) NOT NULL, -- unique identifier for the node\n ip_address character varying(15) NOT NULL, -- IP address of the node\n port integer NOT NULL, -- port number of the node\n last_seen timestamp NOT NULL, -- last time the node was active\n PRIMARY KEY (node_id)\n)\nCREATE TABLE blockchain.wallets ( wallet_id.text, user_id.text, address_id.text, private_key.text )\nCREATE TABLE blockchain.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email character varying(128) NOT NULL, password_hash text NOT NULL, PRIMARY KEY (user_id) )\nCREATE TABLE blockchain.smart_contracts ( contract_id character varying(64) NOT NULL, creator_address character varying(128) NOT NULL, code text NOT NULL, timestamp timestamp NOT NULL, PRIMARY KEY (contract_id) )\n", "conversations": [{"role": "user", "content": "Retrieve all users and their associated wallet identifiers."}, {"role": "assistant", "content": "SELECT T1.username , T2.wallet_id FROM blockchain.users AS T1 JOIN blockchain.wallets AS T2 ON T1.user_id = T2.user_id"}, {"role": "user", "content": "Only show users whose username starts with 'J'."}, {"role": "assistant", "content": "SELECT T1.username , T2.wallet_id FROM blockchain.users AS T1 JOIN blockchain.wallets AS T2 ON T1.user_id = T2.user_id WHERE T1.username LIKE 'J%'"}, {"role": "user", "content": "Further filter to only include wallets where the address_id contains 'abc'."}, {"role": "assistant", "content": "SELECT T1.username , T2.wallet_id FROM blockchain.users AS T1 JOIN blockchain.wallets AS T2 ON T1.user_id = T2.user_id WHERE T1.username LIKE 'J%' AND T2.address_id LIKE '%abc%'"}, {"role": "user", "content": "For the filtered users and wallets, count how many wallets each user has."}, {"role": "assistant", "content": "SELECT T1.username , COUNT(T2.wallet_id) FROM blockchain.users AS T1 JOIN blockchain.wallets AS T2 ON T1.user_id = T2.user_id WHERE T1.username LIKE 'J%' AND T2.address_id LIKE '%abc%' GROUP BY T1.username"}]}
|
| 45 |
{"system": "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. \n##Table Structure\nCREATE TABLE web3.token_transfers ( transfer_id text PRIMARY KEY, token_id text, from_address text, to_address text, value numeric, transaction_id text, log_index int )\n", "conversations": [{"role": "user", "content": "List all pairs of token transfers occurring within the same transaction where one transferred value is greater than the other, showing both transfer IDs, the transaction ID, and both values."}, {"role": "assistant", "content": "SELECT t1.transaction_id,\n t1.transfer_id AS transfer_id_1,\n t2.transfer_id AS transfer_id_2,\n t1.value AS value_1,\n t2.value AS value_2\nFROM web3.token_transfers t1\nJOIN web3.token_transfers t2\n ON t1.transaction_id = t2.transaction_id\n AND t1.value > t2.value;"}]}
|
| 46 |
{"system": "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. \n##Table Structure\nCREATE TABLE social_media.conversations ( conversation_id text PRIMARY KEY, created_at timestamp, last_message_at timestamp, is_group_chat bool, group_name text )\n", "conversations": [{"role": "user", "content": "List group conversation names and the count of messages sent in each conversation after '2024-06-01'."}, {"role": "assistant", "content": "SELECT T1.group_name, COUNT(T2.message_id) FROM social_media.conversations AS T1 JOIN social_media.messages AS T2 ON T1.conversation_id = T2.conversation_id WHERE T1.is_group_chat = TRUE AND T2.sent_at > '2024-06-01' GROUP BY T1.conversation_id, T1.group_name;"}, {"role": "user", "content": "Only show conversations that have more than 5 messages sent after that date."}, {"role": "assistant", "content": "SELECT T1.group_name, COUNT(T2.message_id) FROM social_media.conversations AS T1 JOIN social_media.messages AS T2 ON T1.conversation_id = T2.conversation_id WHERE T1.is_group_chat = TRUE AND T2.sent_at > '2024-06-01' GROUP BY T1.conversation_id, T1.group_name HAVING COUNT(T2.message_id) > 5;"}]}
|
| 47 |
+
{"system": "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. \n##Table Structure\nCREATE TABLE legal_services.law_firms (\n firm_id character varying(64) NOT NULL, -- unique identifier for the law firm\n firm_name character varying(200) NOT NULL, -- official name of the law firm\n address text NOT NULL, -- primary address of the firm\n phone character varying(32), -- firm's main phone number\n website character varying(255), -- firm's website URL\n founded_date date, -- date the firm was established\n managing_partner_id character varying(64), -- FK to lawyers table (optional)\n PRIMARY KEY (firm_id)\n)\n", "conversations": [{"role": "user", "content": "List the first name, last name, and the name of the law firm for all lawyers."}, {"role": "assistant", "content": "SELECT T1.first_name, T1.last_name, T2.firm_name FROM lawyers AS T1 JOIN law_firms AS T2 ON T1.firm_id = T2.firm_id"}, {"role": "user", "content": "Now, filter this list to only include lawyers who work for firms founded after the year 2010."}, {"role": "assistant", "content": "SELECT T1.first_name, T1.last_name, T2.firm_name FROM lawyers AS T1 JOIN law_firms AS T2 ON T1.firm_id = T2.firm_id WHERE T2.founded_date > '2010-12-31'"}, {"role": "user", "content": "For these lawyers, also include the firm's phone number and sort the results alphabetically by firm name."}, {"role": "assistant", "content": "SELECT T1.first_name, T1.last_name, T2.firm_name, T2.phone FROM lawyers AS T1 JOIN law_firms AS T2 ON T1.firm_id = T2.firm_id WHERE T2.founded_date > '2010-12-31' ORDER BY T2.firm_name"}]}
|
| 48 |
{"system": "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. \n##Table Structure\nCREATE TABLE social_media.likes ( like_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, post_id character varying(64), comment_id character varying(64), created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (like_id), CONSTRAINT unique_user_like UNIQUE (user_id, post_id, comment_id), CONSTRAINT check_like_target CHECK (post_id IS NOT NULL OR comment_id IS NOT NULL) )\nCREATE TABLE social_media.conversations ( conversation_id character varying(64) NOT NULL, created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, last_message_at timestamp, is_group_chat boolean NOT NULL DEFAULT false, group_name character varying(100), PRIMARY KEY (conversation_id) )\nCREATE TABLE social_media.user_settings ( setting_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL UNIQUE, theme character varying(20) DEFAULT 'light', email_notifications_enabled boolean DEFAULT true, push_notifications_enabled boolean DEFAULT true, private_profile boolean DEFAULT false, updated_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (setting_id) )\n", "conversations": [{"role": "user", "content": "List user IDs and the creation timestamp of likes made by users who have email notifications enabled."}, {"role": "assistant", "content": "SELECT T1.user_id, T1.created_at FROM social_media.likes AS T1 JOIN social_media.user_settings AS T2 ON T1.user_id = T2.user_id WHERE T2.email_notifications_enabled = true;"}, {"role": "user", "content": "Only show likes created in the year 2024."}, {"role": "assistant", "content": "SELECT T1.user_id, T1.created_at FROM social_media.likes AS T1 JOIN social_media.user_settings AS T2 ON T1.user_id = T2.user_id WHERE T2.email_notifications_enabled = true AND T1.created_at >= '2024-01-01' AND T1.created_at < '2025-01-01';"}, {"role": "user", "content": "Filter to only include users whose profile is not private."}, {"role": "assistant", "content": "SELECT T1.user_id, T1.created_at FROM social_media.likes AS T1 JOIN social_media.user_settings AS T2 ON T1.user_id = T2.user_id WHERE T2.email_notifications_enabled = true AND T1.created_at >= '2024-01-01' AND T1.created_at < '2025-01-01' AND T2.private_profile = false;"}]}
|
| 49 |
{"system": "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. \n##Table Structure\nCREATE TABLE legal_services.clients ( client_id.text, first_name.text, last_name.text, company_name.text, email.text, phone.text, address.text, date_registered.timestamp, status.text )\nCREATE TABLE legal_services.law_firms ( firm_id.text, firm_name.text, address.text, phone.text, website.text, founded_date.date, managing_partner_id.text )\nCREATE TABLE legal_services.documents ( document_id.text, case_id.text, document_name.text, document_type.text, storage_path.text, uploaded_by_lawyer_id.text, upload_timestamp.timestamp, version.integer, description.text )\nCREATE TABLE legal_services.time_entries ( entry_id.text, case_id.text, lawyer_id.text, date_worked.date, hours_spent.numeric, billing_rate.numeric, description.text, is_billable.boolean, is_billed.boolean, invoice_id.text, created_at.timestamp )\nCREATE TABLE legal_services.invoices ( invoice_id.text, invoice_number.text, client_id.text, case_id.text, issue_date.date, due_date.date, total_amount.numeric, amount_paid.numeric, status.text, payment_date.timestamp, notes.text, created_at.timestamp )\nCREATE TABLE legal_services.appointments ( appointment_id.text, client_id.text, lawyer_id.text, case_id.text, start_time.timestamp, end_time.timestamp, location.text, subject.text, notes.text, status.text, created_at.timestamp )\n", "conversations": [{"role": "user", "content": "List all documents along with the case number they are associated with, as well as the name and email of the lawyer who uploaded them."}, {"role": "assistant", "content": "SELECT d.document_name, d.document_type, d.case_id, l.first_name || ' ' || l.last_name AS lawyer_full_name, l.email FROM legal_services.documents d JOIN legal_services.lawyers l ON d.uploaded_by_lawyer_id = l.lawyer_id;"}, {"role": "user", "content": "Only include documents uploaded after April 1st, 2024."}, {"role": "assistant", "content": "SELECT d.document_name, d.document_type, d.case_id, l.first_name || ' ' || l.last_name AS lawyer_full_name, l.email FROM legal_services.documents d JOIN legal_services.lawyers l ON d.uploaded_by_lawyer_id = l.lawyer_id WHERE d.upload_timestamp > '2024-04-01';"}, {"role": "user", "content": "Add the case name and make sure only documents with version greater than 1 are listed."}, {"role": "assistant", "content": "SELECT d.document_name, d.document_type, d.case_id, c.case_name, l.first_name || ' ' || l.last_name AS lawyer_full_name, l.email FROM legal_services.documents d JOIN legal_services.cases c ON d.case_id = c.case_id JOIN legal_services.lawyers l ON d.uploaded_by_lawyer_id = l.lawyer_id WHERE d.upload_timestamp > '2024-04-01' AND d.version > 1;"}, {"role": "user", "content": "Order the results by upload_timestamp ascending."}, {"role": "assistant", "content": "SELECT d.document_name, d.document_type, d.case_id, c.case_name, l.first_name || ' ' || l.last_name AS lawyer_full_name, l.email, d.upload_timestamp FROM legal_services.documents d JOIN legal_services.cases c ON d.case_id = c.case_id JOIN legal_services.lawyers l ON d.uploaded_by_lawyer_id = l.lawyer_id WHERE d.upload_timestamp > '2024-04-01' AND d.version > 1 ORDER BY d.upload_timestamp ASC;"}]}
|
| 50 |
{"system": "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. \n##Table Structure\nCREATE TABLE legal_services.invoices ( invoice_id text PRIMARY KEY, invoice_number text UNIQUE, client_id text, case_id text, issue_date date, due_date date, total_amount numeric, amount_paid numeric, status text, payment_date timestamp, notes text, created_at timestamp )\n", "conversations": [{"role": "user", "content": "Show me each invoice and the invoice_number of the next invoice for the same client, along with how many days apart their issue_dates are."}, {"role": "assistant", "content": "SELECT a.invoice_number AS invoice_number,\n b.invoice_number AS next_invoice_number,\n (b.issue_date - a.issue_date) AS days_between\n FROM legal_services.invoices a\n JOIN legal_services.invoices b\n ON a.client_id = b.client_id\n AND b.issue_date > a.issue_date;"}, {"role": "user", "content": "Please restrict to pairs where the days_between is greater than 30."}, {"role": "assistant", "content": "SELECT a.invoice_number AS invoice_number,\n b.invoice_number AS next_invoice_number,\n (b.issue_date - a.issue_date) AS days_between\n FROM legal_services.invoices a\n JOIN legal_services.invoices b\n ON a.client_id = b.client_id\n AND b.issue_date > a.issue_date\n WHERE (b.issue_date - a.issue_date) > 30;"}, {"role": "user", "content": "And only include pairs where both invoices have status 'Overdue'."}, {"role": "assistant", "content": "SELECT a.invoice_number AS invoice_number,\n b.invoice_number AS next_invoice_number,\n (b.issue_date - a.issue_date) AS days_between\n FROM legal_services.invoices a\n JOIN legal_services.invoices b\n ON a.client_id = b.client_id\n AND b.issue_date > a.issue_date\n WHERE (b.issue_date - a.issue_date) > 30\n AND a.status = 'Overdue'\n AND b.status = 'Overdue';"}]}
|
|
|
|
| 206 |
{"system": "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. \n##Table Structure\nCREATE TABLE transportation.vehicles ( vehicle_id.text, license_plate.text, vin.text, make.text, model.text, year.integer, type.text, capacity.integer, fuel_type.text, status.text, depot_id.text, acquisition_date.date )\n", "conversations": [{"role": "user", "content": "For each vehicle, find the vehicle acquired immediately before it in the same depot. Show current vehicle_id, acquisition_date, previous_vehicle_id, and previous_acquisition_date."}, {"role": "assistant", "content": "SELECT v.vehicle_id,\n v.acquisition_date,\n prev.vehicle_id AS previous_vehicle_id,\n prev.acquisition_date AS previous_acquisition_date\nFROM transportation.vehicles v\nLEFT JOIN transportation.vehicles prev\n ON v.depot_id = prev.depot_id\n AND prev.acquisition_date = (\n SELECT MAX(acquisition_date)\n FROM transportation.vehicles\n WHERE depot_id = v.depot_id\n AND acquisition_date < v.acquisition_date\n );"}]}
|
| 207 |
{"system": "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. \n##Table Structure\nCREATE TABLE transportation.routes ( route_id text PRIMARY KEY, route_number text, description text, origin_location_id text, destination_location_id text, distance_km numeric, estimated_duration_minutes int, type text )\nCREATE TABLE transportation.locations ( location_id text PRIMARY KEY, name text, type text, address_line1 text, city text, state_province text, postal_code text, country text, latitude numeric, longitude numeric, timezone text )\nCREATE TABLE transportation.bookings ( booking_id character varying(64) NOT NULL, passenger_id character varying(64) NOT NULL, trip_id character varying(64) NOT NULL, seat_number character varying(16), booking_time timestamp with time zone NOT NULL, status character varying(32) NOT NULL, fare numeric(10, 2) NOT NULL, payment_transaction_id character varying(128), special_requests text, PRIMARY KEY (booking_id) )\n", "conversations": [{"role": "user", "content": "Show the booking ID and seat number for all bookings that have a fare equal to 50."}, {"role": "assistant", "content": "SELECT booking_id, seat_number\nFROM transportation.bookings\nWHERE fare = 50;"}, {"role": "user", "content": "Also include the booking status and order the results by booking time ascending."}, {"role": "assistant", "content": "SELECT booking_id, seat_number, status\nFROM transportation.bookings\nWHERE fare = 50\nORDER BY booking_time ASC;"}]}
|
| 208 |
{"system": "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. \n##Table Structure\nCREATE TABLE transportation.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text, make text, model text, year int, type text, capacity int, fuel_type text, status text, depot_id text, acquisition_date date )\nCREATE TABLE transportation.drivers ( driver_id text PRIMARY KEY, employee_id text, first_name text, last_name text, license_number text, license_expiry_date date, contact_number text, email text, hire_date date, status text )\nCREATE TABLE transportation.fuel_logs ( fuel_log_id.text, vehicle_id.text, trip_id.text, log_timestamp.timestamp, fuel_type.text, quantity.numeric, unit.text, cost_per_unit.numeric, total_cost.numeric, odometer_reading.integer, location_id.text )\nCREATE TABLE transportation.passengers ( passenger_id text PRIMARY KEY, first_name text, last_name text, email text, phone_number text, date_of_birth date, loyalty_program_id text, created_at timestamp )\nCREATE TABLE transportation.bookings ( booking_id.text, passenger_id.text, trip_id.text, seat_number.text, booking_time.timestamp, status.text, fare.numeric, payment_transaction_id.text, special_requests.text )\n", "conversations": [{"role": "user", "content": "Retrieve the daily total fare collected for bookings with status 'Completed' in March 2024. Display the booking_date and total_fare."}, {"role": "assistant", "content": "SELECT\n DATE(booking_time) AS booking_date,\n SUM(fare) AS total_fare\nFROM transportation.bookings\nWHERE status = 'Completed'\n AND booking_time >= '2024-03-01'\n AND booking_time < '2024-04-01'\nGROUP BY DATE(booking_time);"}, {"role": "user", "content": "Now include only days where the total_fare exceeds 1000."}, {"role": "assistant", "content": "SELECT\n DATE(booking_time) AS booking_date,\n SUM(fare) AS total_fare\nFROM transportation.bookings\nWHERE status = 'Completed'\n AND booking_time >= '2024-03-01'\n AND booking_time < '2024-04-01'\nGROUP BY DATE(booking_time)\nHAVING SUM(fare) > 1000;"}]}
|
|
|
|
| 209 |
{"system": "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. \n##Table Structure\nCREATE TABLE transportation.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text, make text, model text, year int, type text, capacity int, fuel_type text, status text, depot_id text, acquisition_date date )\n", "conversations": [{"role": "user", "content": "Could you provide the number of vehicles for each fuel_type?"}, {"role": "assistant", "content": "SELECT fuel_type, COUNT(*) AS vehicle_count\nFROM transportation.vehicles\nGROUP BY fuel_type;"}, {"role": "user", "content": "Filter out fuel types having fewer than 10 vehicles."}, {"role": "assistant", "content": "SELECT fuel_type, COUNT(*) AS vehicle_count\nFROM transportation.vehicles\nGROUP BY fuel_type\nHAVING COUNT(*) >= 10;"}, {"role": "user", "content": "Now order the result by vehicle_count descending and limit to the top 5 entries."}, {"role": "assistant", "content": "SELECT fuel_type, COUNT(*) AS vehicle_count\nFROM transportation.vehicles\nGROUP BY fuel_type\nHAVING COUNT(*) >= 10\nORDER BY vehicle_count DESC\nLIMIT 5;"}, {"role": "user", "content": "Also add the average capacity for each fuel_type."}, {"role": "assistant", "content": "SELECT fuel_type,\n COUNT(*) AS vehicle_count,\n AVG(capacity) AS avg_capacity\nFROM transportation.vehicles\nGROUP BY fuel_type\nHAVING COUNT(*) >= 10\nORDER BY vehicle_count DESC\nLIMIT 5;"}]}
|
| 210 |
{"system": "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. \n##Table Structure\nCREATE TABLE transportation.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text, make text, model text, year int, type text, capacity int, fuel_type text, status text, depot_id text, acquisition_date date )\nCREATE TABLE transportation.locations ( location_id text, name text, type text, address_line1 text, city text, state_province text, postal_code text, country text, latitude numeric, longitude numeric, timezone text )\nCREATE TABLE transportation.passengers (\n passenger_id character varying(64) NOT NULL, -- unique identifier for the passenger\n first_name character varying(128) NOT NULL, -- passenger's first name\n last_name character varying(128) NOT NULL, -- passenger's last name\n email character varying(128) UNIQUE, -- email address\n phone_number character varying(32) UNIQUE, -- phone number\n date_of_birth date, -- passenger's date of birth\n loyalty_program_id character varying(64), -- identifier for loyalty program membership\n created_at timestamp with time zone NOT NULL, -- time when the passenger record was created\n PRIMARY KEY (passenger_id)\n)\nCREATE TABLE transportation.bookings ( booking_id character varying(64) NOT NULL, passenger_id character varying(64) NOT NULL, trip_id character varying(64) NOT NULL, seat_number character varying(16), booking_time timestamp with time zone NOT NULL, status character varying(32) NOT NULL, fare numeric(10, 2) NOT NULL, payment_transaction_id character varying(128), special_requests text, PRIMARY KEY (booking_id) )\n", "conversations": [{"role": "user", "content": "List the number of bookings made by each passenger, including passenger_id, first_name, last_name, and booking_count."}, {"role": "assistant", "content": "SELECT p.passenger_id,\n p.first_name,\n p.last_name,\n COUNT(b.booking_id) AS booking_count\nFROM transportation.passengers p\nLEFT JOIN transportation.bookings b\n ON p.passenger_id = b.passenger_id\nGROUP BY p.passenger_id,\n p.first_name,\n p.last_name;"}, {"role": "user", "content": "Actually, only include passengers who have made at least 2 bookings."}, {"role": "assistant", "content": "SELECT p.passenger_id,\n p.first_name,\n p.last_name,\n COUNT(b.booking_id) AS booking_count\nFROM transportation.passengers p\nLEFT JOIN transportation.bookings b\n ON p.passenger_id = b.passenger_id\nGROUP BY p.passenger_id,\n p.first_name,\n p.last_name\nHAVING COUNT(b.booking_id) >= 2;"}, {"role": "user", "content": "Also include the average fare per passenger."}, {"role": "assistant", "content": "SELECT p.passenger_id,\n p.first_name,\n p.last_name,\n COUNT(b.booking_id) AS booking_count,\n AVG(b.fare) AS average_fare\nFROM transportation.passengers p\nLEFT JOIN transportation.bookings b\n ON p.passenger_id = b.passenger_id\nGROUP BY p.passenger_id,\n p.first_name,\n p.last_name\nHAVING COUNT(b.booking_id) >= 2;"}, {"role": "user", "content": "Sort the results by average_fare descending and limit to the top 5."}, {"role": "assistant", "content": "SELECT p.passenger_id,\n p.first_name,\n p.last_name,\n COUNT(b.booking_id) AS booking_count,\n AVG(b.fare) AS average_fare\nFROM transportation.passengers p\nLEFT JOIN transportation.bookings b\n ON p.passenger_id = b.passenger_id\nGROUP BY p.passenger_id,\n p.first_name,\n p.last_name\nHAVING COUNT(b.booking_id) >= 2\nORDER BY average_fare DESC\nLIMIT 5;"}]}
|
| 211 |
{"system": "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. \n##Table Structure\nCREATE TABLE transportation.routes ( route_id text, route_number text, description text, origin_location_id text, destination_location_id text, distance_km numeric, estimated_duration_minutes integer, type text )\n", "conversations": [{"role": "user", "content": "Find pairs of distinct routes that share the same destination location but start from different origins. Include the route ID and route number for both routes and the shared destination location ID."}, {"role": "assistant", "content": "SELECT\n r1.route_id AS route1_id,\n r1.route_number AS route1_number,\n r2.route_id AS route2_id,\n r2.route_number AS route2_number,\n r1.destination_location_id AS shared_destination_location_id\nFROM transportation.routes AS r1\nJOIN transportation.routes AS r2\n ON r1.destination_location_id = r2.destination_location_id\n AND r1.route_id < r2.route_id\nWHERE\n r1.origin_location_id != r2.origin_location_id;"}]}
|
|
|
|
| 247 |
{"system": "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. \n##Table Structure\nCREATE TABLE healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name character varying(100) NOT NULL, date_of_birth date NOT NULL, gender character varying(10), address text, phone_number character varying(20), email character varying(128) UNIQUE, emergency_contact_name character varying(200), emergency_contact_phone character varying(20), created_at timestamp with time zone NOT NULL DEFAULT current_timestamp, updated_at timestamp with time zone NOT NULL DEFAULT current_timestamp, PRIMARY KEY (patient_id) )\nCREATE TABLE healthcare.doctors ( doctor_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name character varying(100) NOT NULL, specialty character varying(100) NOT NULL, license_number character varying(50) UNIQUE NOT NULL, phone_number character varying(20), email character varying(128) UNIQUE, hospital_affiliation_id character varying(64), created_at timestamp with time zone NOT NULL DEFAULT current_timestamp, updated_at timestamp with time zone NOT NULL DEFAULT current_timestamp, PRIMARY KEY (doctor_id) )\nCREATE TABLE healthcare.diagnoses ( diagnosis_id character varying(64) NOT NULL, record_id character varying(64) NOT NULL, patient_id character varying(64) NOT NULL, doctor_id character varying(64) NOT NULL, diagnosis_code character varying(20) NOT NULL, code_type character varying(10) NOT NULL DEFAULT 'ICD-10', description text, diagnosis_date date NOT NULL, status character varying(32) NOT NULL, is_chronic boolean DEFAULT false, PRIMARY KEY (diagnosis_id) )\nCREATE TABLE healthcare.medications ( medication_id character varying(64) NOT NULL, medication_name character varying(255) NOT NULL, generic_name character varying(255), manufacturer character varying(100), ndc_code character varying(20) UNIQUE, description text, PRIMARY KEY (medication_id) )\nCREATE TABLE healthcare.insurance_plans ( plan_id character varying(64) NOT NULL, plan_name character varying(200) NOT NULL, insurance_provider character varying(100) NOT NULL, plan_type character varying(50), contact_phone character varying(20), website character varying(255), PRIMARY KEY (plan_id) )\nCREATE TABLE healthcare.patient_insurance ( patient_insurance_id character varying(64) NOT NULL, patient_id character varying(64) NOT NULL, plan_id character varying(64) NOT NULL, policy_number character varying(100) NOT NULL, group_number character varying(100), subscriber_name character varying(200), effective_date date NOT NULL, expiration_date date, is_primary boolean NOT NULL DEFAULT true, PRIMARY KEY (patient_insurance_id), UNIQUE (patient_id, plan_id, policy_number) )\n", "conversations": [{"role": "user", "content": "Which patients have a primary insurance policy and are subscribed to a plan provided by 'Cigna'? List patient ID, full name, policy number, plan ID, and insurance provider."}, {"role": "assistant", "content": "SELECT p.patient_id, p.first_name, p.last_name, pi.policy_number, pi.plan_id, ip.insurance_provider\nFROM healthcare.patient_insurance pi\nJOIN healthcare.patients p ON pi.patient_id = p.patient_id\nJOIN healthcare.insurance_plans ip ON pi.plan_id = ip.plan_id\nWHERE pi.is_primary = true AND ip.insurance_provider = 'Cigna';"}, {"role": "user", "content": "Additionally, only show results where the policy has not expired yet."}, {"role": "assistant", "content": "SELECT p.patient_id, p.first_name, p.last_name, pi.policy_number, pi.plan_id, ip.insurance_provider\nFROM healthcare.patient_insurance pi\nJOIN healthcare.patients p ON pi.patient_id = p.patient_id\nJOIN healthcare.insurance_plans ip ON pi.plan_id = ip.plan_id\nWHERE pi.is_primary = true AND ip.insurance_provider = 'Cigna' AND (pi.expiration_date IS NULL OR pi.expiration_date >= CURRENT_DATE);"}]}
|
| 248 |
{"system": "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. \n##Table Structure\nCREATE TABLE legal_services.clients ( client_id text, first_name text, last_name text, company_name text, email text, phone text, address text, date_registered timestamp, status text )\nCREATE TABLE legal_services.lawyers ( lawyer_id text, first_name text, last_name text, bar_number text, firm_id text, email text, phone text, specialization text, hire_date timestamp, is_partner boolean )\nCREATE TABLE legal_services.law_firms ( firm_id text, firm_name text, address text, phone text, website text, founded_date date, managing_partner_id text )\nCREATE TABLE legal_services.documents ( document_id text, case_id text, document_name text, document_type text, storage_path text, uploaded_by_lawyer_id text, upload_timestamp timestamp, version integer, description text )\nCREATE TABLE legal_services.time_entries ( entry_id text, case_id text, lawyer_id text, date_worked date, hours_spent numeric, billing_rate numeric, description text, is_billable boolean, is_billed boolean, invoice_id text, created_at timestamp )\nCREATE TABLE legal_services.appointments ( appointment_id text, client_id text, lawyer_id text, case_id text, start_time timestamp, end_time timestamp, location text, subject text, notes text, status text, created_at timestamp )\n", "conversations": [{"role": "user", "content": "I need a list showing the name of each law firm and the full name of every lawyer employed by that firm."}, {"role": "assistant", "content": "SELECT T1.firm_name, T2.first_name, T2.last_name FROM law_firms AS T1 JOIN lawyers AS T2 ON T1.firm_id = T2.firm_id;"}]}
|
| 249 |
{"system": "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. \n##Table Structure\nCREATE TABLE financial_services.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, address text, city text, state text, zip_code text, country text, email text, phone_number text, created_at timestamp, status text, risk_profile text )\n", "conversations": [{"role": "user", "content": "Show me all customers (customer_id, first_name, last_name, email) who were born after 1985 (date_of_birth > '1985-12-31') and have an email address ending with '@yahoo.com', along with their city and state information."}, {"role": "assistant", "content": "SELECT customer_id, first_name, last_name, email, city, state FROM financial_services.customers WHERE date_of_birth > '1985-12-31' AND email LIKE '%@yahoo.com';"}]}
|
| 250 |
+
{"system": "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. \n##Table Structure\nCREATE TABLE financial_services.securities (\n security_id character varying(64) NOT NULL, -- unique identifier for the security\n ticker_symbol character varying(20) NOT NULL UNIQUE, -- stock ticker or fund symbol\n isin_code character varying(12) UNIQUE, -- International Securities Identification Number\n cusip_code character varying(9) UNIQUE, -- CUSIP number\n security_name text NOT NULL, -- full name of the security\n security_type character varying(50) NOT NULL, -- e.g., Stock, Bond, ETF, Mutual Fund, Option, Future\n exchange character varying(50), -- primary exchange where traded (e.g., NYSE, NASDAQ)\n currency character varying(3) NOT NULL, -- currency the security is denominated in\n issuer_name character varying(255), -- name of the issuing entity\n sector character varying(100), -- industry sector\n last_updated timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (security_id)\n)\n", "conversations": [{"role": "user", "content": "Show the number of securities per exchange and the average length of their ticker symbols, including only exchanges that have more than 5 securities."}, {"role": "assistant", "content": "SELECT exchange, COUNT(*) AS securities_count, AVG(LENGTH(ticker_symbol)) AS avg_ticker_length\nFROM financial_services.securities\nGROUP BY exchange\nHAVING COUNT(*) > 5;"}, {"role": "user", "content": "Actually, exclude any entries where exchange is NULL."}, {"role": "assistant", "content": "SELECT exchange, COUNT(*) AS securities_count, AVG(LENGTH(ticker_symbol)) AS avg_ticker_length\nFROM financial_services.securities\nWHERE exchange IS NOT NULL\nGROUP BY exchange\nHAVING COUNT(*) > 5;"}, {"role": "user", "content": "Also, sort the output by the securities_count in descending order."}, {"role": "assistant", "content": "SELECT exchange, COUNT(*) AS securities_count, AVG(LENGTH(ticker_symbol)) AS avg_ticker_length\nFROM financial_services.securities\nWHERE exchange IS NOT NULL\nGROUP BY exchange\nHAVING COUNT(*) > 5\nORDER BY securities_count DESC;"}]}
|