Upload data.jsonl with huggingface_hub
Browse files- data.jsonl +2 -2
data.jsonl
CHANGED
|
@@ -213,6 +213,7 @@
|
|
| 213 |
{"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.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": "List each booking with its previous booking time for the same passenger."}, {"role": "assistant", "content": "SELECT b.booking_id,\n b.passenger_id,\n b.booking_time,\n LAG(b.booking_time) OVER (PARTITION BY b.passenger_id ORDER BY b.booking_time) AS previous_booking_time\nFROM transportation.bookings b;"}, {"role": "user", "content": "I only want records where the gap between bookings is more than 7 days."}, {"role": "assistant", "content": "SELECT booking_id,\n passenger_id,\n booking_time,\n previous_booking_time\nFROM (\n SELECT booking_id,\n passenger_id,\n booking_time,\n LAG(booking_time) OVER (PARTITION BY passenger_id ORDER BY booking_time) AS previous_booking_time\n FROM transportation.bookings\n) t\nWHERE previous_booking_time IS NOT NULL\n AND booking_time - previous_booking_time > INTERVAL '7 days';"}, {"role": "user", "content": "Also include the total number of bookings for each passenger."}, {"role": "assistant", "content": "SELECT booking_id,\n passenger_id,\n booking_time,\n previous_booking_time,\n COUNT(*) OVER (PARTITION BY passenger_id) AS total_bookings\nFROM (\n SELECT booking_id,\n passenger_id,\n booking_time,\n LAG(booking_time) OVER (PARTITION BY passenger_id ORDER BY booking_time) AS previous_booking_time\n FROM transportation.bookings\n) t\nWHERE previous_booking_time IS NOT NULL\n AND booking_time - previous_booking_time > INTERVAL '7 days';"}]}
|
| 214 |
{"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.wallets ( wallet_id text, user_id text, address text, private_key text, created_at timestamp )\n", "conversations": [{"role": "user", "content": "For each user, what is the average time difference in days between their wallet creations? Return user_id and avg_diff_days."}, {"role": "assistant", "content": "WITH diffs AS (\n SELECT\n user_id,\n EXTRACT(EPOCH FROM (created_at - LAG(created_at) OVER (PARTITION BY user_id ORDER BY created_at))) / 86400 AS diff_days\n FROM web3.wallets\n)\nSELECT\n user_id,\n AVG(diff_days) AS avg_diff_days\nFROM diffs\nWHERE diff_days IS NOT NULL\nGROUP BY user_id;"}, {"role": "user", "content": "Actually, only include users who have created more than 2 wallets."}, {"role": "assistant", "content": "WITH diffs AS (\n SELECT\n user_id,\n EXTRACT(EPOCH FROM (created_at - LAG(created_at) OVER (PARTITION BY user_id ORDER BY created_at))) / 86400 AS diff_days\n FROM web3.wallets\n)\nSELECT\n user_id,\n AVG(diff_days) AS avg_diff_days\nFROM diffs\nWHERE diff_days IS NOT NULL\nGROUP BY user_id\nHAVING COUNT(diff_days) > 1;"}]}
|
| 215 |
{"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.contracts ( contract_id text PRIMARY KEY, address text, abi text, bytecode text, deployer_address text, deployed_at timestamp, network_id text, status text )\nCREATE TABLE web3.events (\n event_id character varying(64) NOT NULL, -- unique identifier for the event\n contract_id character varying(64) NOT NULL, -- identifier of the contract emitting the event\n event_name character varying(128) NOT NULL, -- name of the event\n data text NOT NULL, -- data payload of the event\n emitted_at timestamp NOT NULL, -- time when the event was emitted\n transaction_id character varying(64) NOT NULL, -- identifier of the transaction that triggered the event\n log_index integer NOT NULL, -- index of the event log in the transaction\n PRIMARY KEY (event_id)\n)\nCREATE TABLE web3.transactions ( transaction_id text, from_address text, to_address text, value numeric, gas_used integer, gas_price numeric, block_number integer, timestamp timestamp, input_data text, status text, nonce integer )\nCREATE TABLE web3.tokens ( token_id.text, contract_address.text, token_name.text, token_symbol.text, decimals.integer, total_supply.numeric )\nCREATE TABLE web3.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, created_at timestamp )\n", "conversations": [{"role": "user", "content": "List all failed transactions along with the from and to addresses, and the gas used."}, {"role": "assistant", "content": "SELECT transaction_id, from_address, to_address, gas_used FROM web3.transactions WHERE status = 'failed';"}, {"role": "user", "content": "Actually, I also need to see the block number and timestamp for these failed transactions."}, {"role": "assistant", "content": "SELECT transaction_id, from_address, to_address, gas_used, block_number, timestamp FROM web3.transactions WHERE status = 'failed';"}, {"role": "user", "content": "There's a typo in your SQL, it should be 'timestamp' not 'timestamp'. Also, sort the results by block number in descending order."}, {"role": "assistant", "content": "SELECT transaction_id, from_address, to_address, gas_used, block_number, timestamp FROM web3.transactions WHERE status = 'failed' ORDER BY block_number DESC;"}, {"role": "user", "content": "Now filter to only show transactions with gas used greater than 100,000."}, {"role": "assistant", "content": "SELECT transaction_id, from_address, to_address, gas_used, block_number, timestamp FROM web3.transactions WHERE status = 'failed' AND gas_used > 100000 ORDER BY block_number DESC;"}]}
|
|
|
|
| 216 |
{"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.wallets ( wallet_id text PRIMARY KEY, user_id text, address text, private_key text, created_at timestamp )\n", "conversations": [{"role": "user", "content": "Find pairs of wallets that were created at the exact same timestamp but are owned by different users. List the IDs of both wallets and the shared creation timestamp."}, {"role": "assistant", "content": "SELECT\n w1.wallet_id AS wallet1_id,\n w2.wallet_id AS wallet2_id,\n w1.created_at\nFROM\n web3.wallets w1\nJOIN\n web3.wallets w2 ON w1.created_at = w2.created_at\nWHERE\n w1.wallet_id < w2.wallet_id\n AND w1.user_id != w2.user_id;"}]}
|
| 217 |
{"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.users ( user_id text, username text, email text, password_hash text, created_at timestamp )\n", "conversations": [{"role": "user", "content": "Find pairs of users who registered on the same weekday but in different years. List the user ID and registration date for both users, and the weekday name."}, {"role": "assistant", "content": "SELECT u1.user_id, u1.created_at AS user1_created_at, u2.user_id, u2.created_at AS user2_created_at, TO_CHAR(u1.created_at, 'Day') AS registration_weekday FROM web3.users u1 JOIN web3.users u2 ON TO_CHAR(u1.created_at, 'Day') = TO_CHAR(u2.created_at, 'Day') AND EXTRACT(YEAR FROM u1.created_at) <> EXTRACT(YEAR FROM u2.created_at) AND u1.user_id < u2.user_id ORDER BY TO_CHAR(u1.created_at, 'D'), u1.created_at;"}]}
|
| 218 |
{"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.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, created_at timestamp NOT NULL, PRIMARY KEY (user_id) )\n", "conversations": [{"role": "user", "content": "For each user, find the previous user by registration time. List current user_id and username, previous user_id and username, and the time difference in minutes between their registrations."}, {"role": "assistant", "content": "SELECT u.user_id AS current_user_id,\n u.username AS current_username,\n p.user_id AS previous_user_id,\n p.username AS previous_username,\n EXTRACT(EPOCH FROM (u.created_at - p.created_at)) / 60 AS diff_minutes\nFROM web3.users u\nJOIN web3.users p\n ON p.created_at = (\n SELECT MAX(created_at)\n FROM web3.users\n WHERE created_at < u.created_at\n )\nORDER BY u.created_at;"}]}
|
|
@@ -242,9 +243,8 @@
|
|
| 242 |
{"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 ( driver_id.text, 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.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 )\nCREATE TABLE transportation.trips ( trip_id.text, route_id.text, vehicle_id.text, driver_id.text, scheduled_departure.timestamp, actual_departure.timestamp, scheduled_arrival.timestamp, actual_arrival.timestamp, origin_location_id.text, destination_location_id.text, status.text, passenger_count.integer, cargo_manifest_id.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 )\nCREATE TABLE transportation.passengers ( passenger_id.text, 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": "Show the vehicle ID and the total number of fuel logs recorded for each vehicle."}, {"role": "assistant", "content": "SELECT vehicle_id , count(*) FROM transportation.fuel_logs GROUP BY vehicle_id"}, {"role": "user", "content": "Filter this list to only show vehicles with more than 5 fuel log entries."}, {"role": "assistant", "content": "SELECT vehicle_id , count(*) FROM transportation.fuel_logs GROUP BY vehicle_id HAVING count(*) > 5"}]}
|
| 243 |
{"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.lawyers (\n lawyer_id character varying(64) NOT NULL, -- unique identifier for the lawyer\n first_name character varying(100) NOT NULL, -- lawyer's first name\n last_name character varying(100) NOT NULL, -- lawyer's last name\n bar_number character varying(64) UNIQUE NOT NULL, -- lawyer's bar association number\n firm_id character varying(64), -- FK to law_firms table\n email character varying(128) UNIQUE NOT NULL, -- lawyer's professional email\n phone character varying(32), -- lawyer's contact phone number\n specialization text, -- areas of legal expertise\n hire_date timestamp NOT NULL, -- date the lawyer was hired or joined\n is_partner boolean DEFAULT false, -- flag indicating if the lawyer is a partner\n PRIMARY KEY (lawyer_id)\n)\n", "conversations": [{"role": "user", "content": "List all partners who have provided a phone number, showing their full name and email."}, {"role": "assistant", "content": "SELECT first_name, last_name, email FROM legal_services.lawyers WHERE is_partner = TRUE AND phone IS NOT NULL;"}, {"role": "user", "content": "Okay, now only include those partners hired between 2020-01-01 and 2022-12-31."}, {"role": "assistant", "content": "SELECT first_name, last_name, email FROM legal_services.lawyers WHERE is_partner = TRUE AND phone IS NOT NULL AND hire_date BETWEEN '2020-01-01' AND '2022-12-31';"}, {"role": "user", "content": "Can you also add their specialization to the output?"}, {"role": "assistant", "content": "SELECT first_name, last_name, email, specialization FROM legal_services.lawyers WHERE is_partner = TRUE AND phone IS NOT NULL AND hire_date BETWEEN '2020-01-01' AND '2022-12-31';"}, {"role": "user", "content": "Finally, order the results by specialization in ascending order, then by last name."}, {"role": "assistant", "content": "SELECT first_name, last_name, email, specialization FROM legal_services.lawyers WHERE is_partner = TRUE AND phone IS NOT NULL AND hire_date BETWEEN '2020-01-01' AND '2022-12-31' ORDER BY specialization ASC, last_name ASC;"}]}
|
| 244 |
{"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 hospitality_technology.staff ( staff_id character varying(64) NOT NULL, property_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name character varying(100) NOT NULL, position character varying(100) NOT NULL, work_email character varying(255) UNIQUE, work_phone character varying(30), hire_date date NOT NULL, termination_date date, is_active boolean NOT NULL DEFAULT true, access_level integer NOT NULL, manager_id character varying(64), created_at timestamp with time zone NOT NULL DEFAULT current_timestamp, PRIMARY KEY (staff_id), FOREIGN KEY (property_id) REFERENCES hospitality_technology.properties(property_id), FOREIGN KEY (manager_id) REFERENCES hospitality_technology.staff(staff_id) )\n", "conversations": [{"role": "user", "content": "Show me the email addresses and hire dates for all staff who have a manager."}, {"role": "assistant", "content": "SELECT work_email, hire_date\nFROM hospitality_technology.staff\nWHERE manager_id IS NOT NULL;"}, {"role": "user", "content": "Only include staff who were hired after January 1, 2023."}, {"role": "assistant", "content": "SELECT work_email, hire_date\nFROM hospitality_technology.staff\nWHERE manager_id IS NOT NULL AND hire_date > '2023-01-01';"}]}
|
| 245 |
-
{"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.appointments ( appointment_id text, patient_id text, doctor_id text, appointment_time timestamp, duration_minutes integer, reason text, status text, location_id text, notes text, created_at timestamp )\n", "conversations": [{"role": "user", "content": "Get the total number of appointments grouped by status."}, {"role": "assistant", "content": "SELECT status,\n COUNT(*) AS appointment_count\nFROM healthcare.appointments\nGROUP BY status;"}, {"role": "user", "content": "Now filter to include only statuses with more than 50 appointments."}, {"role": "assistant", "content": "SELECT status,\n COUNT(*) AS appointment_count\nFROM healthcare.appointments\nGROUP BY status\nHAVING COUNT(*) > 50;"}]}
|
| 246 |
{"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.users (\n user_id character varying(64) NOT NULL, -- unique identifier for the user\n username character varying(50) NOT NULL UNIQUE, -- user's unique handle\n email character varying(128) NOT NULL UNIQUE, -- user's email address\n password_hash text NOT NULL, -- hashed password\n full_name character varying(100), -- user's full name\n profile_picture_url text, -- URL to the profile picture\n bio text, -- short user biography\n location character varying(100), -- user's location\n created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp of account creation\n updated_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp of last profile update\n is_verified boolean NOT NULL DEFAULT false, -- verification status\n PRIMARY KEY (user_id)\n)\nCREATE TABLE social_media.posts (\n post_id character varying(64) NOT NULL, -- unique identifier for the post\n user_id character varying(64) NOT NULL, -- identifier of the user who created the post (FK to users.user_id)\n content text, -- textual content of the post\n media_url text, -- URL to attached media (image/video)\n media_type character varying(20), -- type of media ('image', 'video', null)\n created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp of post creation\n updated_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp of last post edit\n visibility character varying(20) NOT NULL DEFAULT 'public', -- visibility ('public', 'friends', 'private')\n location_lat numeric(9,6), -- latitude of post location\n location_lon numeric(9,6), -- longitude of post location\n PRIMARY KEY (post_id)\n)\nCREATE TABLE social_media.comments (\n comment_id character varying(64) NOT NULL, -- unique identifier for the comment\n post_id character varying(64) NOT NULL, -- identifier of the post being commented on (FK to posts.post_id)\n user_id character varying(64) NOT NULL, -- identifier of the user who made the comment (FK to users.user_id)\n parent_comment_id character varying(64), -- identifier of the parent comment if it's a reply (FK to comments.comment_id)\n content text NOT NULL, -- textual content of the comment\n created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp of comment creation\n updated_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp of last comment edit\n PRIMARY KEY (comment_id)\n)\nCREATE TABLE social_media.likes (\n like_id character varying(64) NOT NULL, -- unique identifier for the like\n user_id character varying(64) NOT NULL, -- identifier of the user who liked (FK to users.user_id)\n post_id character varying(64), -- identifier of the post being liked (FK to posts.post_id, nullable)\n comment_id character varying(64), -- identifier of the comment being liked (FK to comments.comment_id, nullable)\n created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp of when the like occurred\n PRIMARY KEY (like_id),\n CONSTRAINT unique_user_like UNIQUE (user_id, post_id, comment_id), -- prevent duplicate likes\n CONSTRAINT check_like_target CHECK (post_id IS NOT NULL OR comment_id IS NOT NULL) -- ensure it likes something\n)\nCREATE TABLE social_media.follows (\n follow_id character varying(64) NOT NULL, -- unique identifier for the follow relationship\n follower_user_id character varying(64) NOT NULL, -- identifier of the user who is following (FK to users.user_id)\n following_user_id character varying(64) NOT NULL, -- identifier of the user being followed (FK to users.user_id)\n created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp of when the follow started\n PRIMARY KEY (follow_id),\n CONSTRAINT unique_follow UNIQUE (follower_user_id, following_user_id) -- prevent duplicate follows\n)\nCREATE TABLE social_media.hashtags (\n hashtag_id character varying(64) NOT NULL, -- unique identifier for the hashtag\n tag_name character varying(100) NOT NULL UNIQUE, -- the actual hashtag text (without '#')\n created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp when the hashtag was first used\n PRIMARY KEY (hashtag_id)\n)\nCREATE TABLE social_media.post_hashtags (\n post_hashtag_id character varying(64) NOT NULL, -- unique identifier for the post-hashtag link\n post_id character varying(64) NOT NULL, -- identifier of the post (FK to posts.post_id)\n hashtag_id character varying(64) NOT NULL, -- identifier of the hashtag (FK to hashtags.hashtag_id)\n PRIMARY KEY (post_hashtag_id),\n CONSTRAINT unique_post_hashtag UNIQUE (post_id, hashtag_id) -- prevent duplicate tags on a post\n)\nCREATE TABLE social_media.messages (\n message_id character varying(64) NOT NULL, -- unique identifier for the message\n conversation_id character varying(64) NOT NULL, -- identifier for the conversation thread (FK to conversations.conversation_id)\n sender_user_id character varying(64) NOT NULL, -- identifier of the sender (FK to users.user_id)\n content text, -- textual content of the message\n media_url text, -- URL to attached media (image/video)\n media_type character varying(20), -- type of media ('image', 'video', null)\n sent_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp when message was sent\n read_at timestamp, -- timestamp when message was read by recipient(s)\n PRIMARY KEY (message_id)\n)\nCREATE TABLE social_media.conversations (\n conversation_id character varying(64) NOT NULL, -- unique identifier for the conversation\n created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp when conversation was initiated\n last_message_at timestamp, -- timestamp of the last message in the conversation\n is_group_chat boolean NOT NULL DEFAULT false, -- indicates if it's a group chat or direct message\n group_name character varying(100), -- name of the group chat (if applicable)\n PRIMARY KEY (conversation_id)\n)\nCREATE TABLE social_media.conversation_participants (\n participant_id character varying(64) NOT NULL, -- unique identifier for the participant entry\n conversation_id character varying(64) NOT NULL, -- identifier of the conversation (FK to conversations.conversation_id)\n user_id character varying(64) NOT NULL, -- identifier of the user in the conversation (FK to users.user_id)\n joined_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp when user joined the conversation\n last_read_at timestamp, -- timestamp indicating up to when the user has read messages\n PRIMARY KEY (participant_id),\n CONSTRAINT unique_user_conversation UNIQUE (conversation_id, user_id) -- prevent user being added multiple times\n)\n", "conversations": [{"role": "user", "content": "List all group chats created in 2024, showing the group_name, conversation_id, and creation time."}, {"role": "assistant", "content": "SELECT conversation_id, group_name, created_at\nFROM social_media.conversations\nWHERE is_group_chat = true AND created_at >= '2024-01-01' AND created_at < '2025-01-01';"}]}
|
| 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
|
|
|
|
| 213 |
{"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.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": "List each booking with its previous booking time for the same passenger."}, {"role": "assistant", "content": "SELECT b.booking_id,\n b.passenger_id,\n b.booking_time,\n LAG(b.booking_time) OVER (PARTITION BY b.passenger_id ORDER BY b.booking_time) AS previous_booking_time\nFROM transportation.bookings b;"}, {"role": "user", "content": "I only want records where the gap between bookings is more than 7 days."}, {"role": "assistant", "content": "SELECT booking_id,\n passenger_id,\n booking_time,\n previous_booking_time\nFROM (\n SELECT booking_id,\n passenger_id,\n booking_time,\n LAG(booking_time) OVER (PARTITION BY passenger_id ORDER BY booking_time) AS previous_booking_time\n FROM transportation.bookings\n) t\nWHERE previous_booking_time IS NOT NULL\n AND booking_time - previous_booking_time > INTERVAL '7 days';"}, {"role": "user", "content": "Also include the total number of bookings for each passenger."}, {"role": "assistant", "content": "SELECT booking_id,\n passenger_id,\n booking_time,\n previous_booking_time,\n COUNT(*) OVER (PARTITION BY passenger_id) AS total_bookings\nFROM (\n SELECT booking_id,\n passenger_id,\n booking_time,\n LAG(booking_time) OVER (PARTITION BY passenger_id ORDER BY booking_time) AS previous_booking_time\n FROM transportation.bookings\n) t\nWHERE previous_booking_time IS NOT NULL\n AND booking_time - previous_booking_time > INTERVAL '7 days';"}]}
|
| 214 |
{"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.wallets ( wallet_id text, user_id text, address text, private_key text, created_at timestamp )\n", "conversations": [{"role": "user", "content": "For each user, what is the average time difference in days between their wallet creations? Return user_id and avg_diff_days."}, {"role": "assistant", "content": "WITH diffs AS (\n SELECT\n user_id,\n EXTRACT(EPOCH FROM (created_at - LAG(created_at) OVER (PARTITION BY user_id ORDER BY created_at))) / 86400 AS diff_days\n FROM web3.wallets\n)\nSELECT\n user_id,\n AVG(diff_days) AS avg_diff_days\nFROM diffs\nWHERE diff_days IS NOT NULL\nGROUP BY user_id;"}, {"role": "user", "content": "Actually, only include users who have created more than 2 wallets."}, {"role": "assistant", "content": "WITH diffs AS (\n SELECT\n user_id,\n EXTRACT(EPOCH FROM (created_at - LAG(created_at) OVER (PARTITION BY user_id ORDER BY created_at))) / 86400 AS diff_days\n FROM web3.wallets\n)\nSELECT\n user_id,\n AVG(diff_days) AS avg_diff_days\nFROM diffs\nWHERE diff_days IS NOT NULL\nGROUP BY user_id\nHAVING COUNT(diff_days) > 1;"}]}
|
| 215 |
{"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.contracts ( contract_id text PRIMARY KEY, address text, abi text, bytecode text, deployer_address text, deployed_at timestamp, network_id text, status text )\nCREATE TABLE web3.events (\n event_id character varying(64) NOT NULL, -- unique identifier for the event\n contract_id character varying(64) NOT NULL, -- identifier of the contract emitting the event\n event_name character varying(128) NOT NULL, -- name of the event\n data text NOT NULL, -- data payload of the event\n emitted_at timestamp NOT NULL, -- time when the event was emitted\n transaction_id character varying(64) NOT NULL, -- identifier of the transaction that triggered the event\n log_index integer NOT NULL, -- index of the event log in the transaction\n PRIMARY KEY (event_id)\n)\nCREATE TABLE web3.transactions ( transaction_id text, from_address text, to_address text, value numeric, gas_used integer, gas_price numeric, block_number integer, timestamp timestamp, input_data text, status text, nonce integer )\nCREATE TABLE web3.tokens ( token_id.text, contract_address.text, token_name.text, token_symbol.text, decimals.integer, total_supply.numeric )\nCREATE TABLE web3.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, created_at timestamp )\n", "conversations": [{"role": "user", "content": "List all failed transactions along with the from and to addresses, and the gas used."}, {"role": "assistant", "content": "SELECT transaction_id, from_address, to_address, gas_used FROM web3.transactions WHERE status = 'failed';"}, {"role": "user", "content": "Actually, I also need to see the block number and timestamp for these failed transactions."}, {"role": "assistant", "content": "SELECT transaction_id, from_address, to_address, gas_used, block_number, timestamp FROM web3.transactions WHERE status = 'failed';"}, {"role": "user", "content": "There's a typo in your SQL, it should be 'timestamp' not 'timestamp'. Also, sort the results by block number in descending order."}, {"role": "assistant", "content": "SELECT transaction_id, from_address, to_address, gas_used, block_number, timestamp FROM web3.transactions WHERE status = 'failed' ORDER BY block_number DESC;"}, {"role": "user", "content": "Now filter to only show transactions with gas used greater than 100,000."}, {"role": "assistant", "content": "SELECT transaction_id, from_address, to_address, gas_used, block_number, timestamp FROM web3.transactions WHERE status = 'failed' AND gas_used > 100000 ORDER BY block_number DESC;"}]}
|
| 216 |
+
{"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, token_id text, from_address text, to_address text, value numeric, transaction_id text, log_index integer )\n", "conversations": [{"role": "user", "content": "For each transaction, show its transaction_id and the count of tokens transferred within that transaction."}, {"role": "assistant", "content": "SELECT transaction_id, COUNT(token_id) AS tokens_transferred FROM web3.token_transfers GROUP BY transaction_id;"}]}
|
| 217 |
{"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.wallets ( wallet_id text PRIMARY KEY, user_id text, address text, private_key text, created_at timestamp )\n", "conversations": [{"role": "user", "content": "Find pairs of wallets that were created at the exact same timestamp but are owned by different users. List the IDs of both wallets and the shared creation timestamp."}, {"role": "assistant", "content": "SELECT\n w1.wallet_id AS wallet1_id,\n w2.wallet_id AS wallet2_id,\n w1.created_at\nFROM\n web3.wallets w1\nJOIN\n web3.wallets w2 ON w1.created_at = w2.created_at\nWHERE\n w1.wallet_id < w2.wallet_id\n AND w1.user_id != w2.user_id;"}]}
|
| 218 |
{"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.users ( user_id text, username text, email text, password_hash text, created_at timestamp )\n", "conversations": [{"role": "user", "content": "Find pairs of users who registered on the same weekday but in different years. List the user ID and registration date for both users, and the weekday name."}, {"role": "assistant", "content": "SELECT u1.user_id, u1.created_at AS user1_created_at, u2.user_id, u2.created_at AS user2_created_at, TO_CHAR(u1.created_at, 'Day') AS registration_weekday FROM web3.users u1 JOIN web3.users u2 ON TO_CHAR(u1.created_at, 'Day') = TO_CHAR(u2.created_at, 'Day') AND EXTRACT(YEAR FROM u1.created_at) <> EXTRACT(YEAR FROM u2.created_at) AND u1.user_id < u2.user_id ORDER BY TO_CHAR(u1.created_at, 'D'), u1.created_at;"}]}
|
| 219 |
{"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.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, created_at timestamp NOT NULL, PRIMARY KEY (user_id) )\n", "conversations": [{"role": "user", "content": "For each user, find the previous user by registration time. List current user_id and username, previous user_id and username, and the time difference in minutes between their registrations."}, {"role": "assistant", "content": "SELECT u.user_id AS current_user_id,\n u.username AS current_username,\n p.user_id AS previous_user_id,\n p.username AS previous_username,\n EXTRACT(EPOCH FROM (u.created_at - p.created_at)) / 60 AS diff_minutes\nFROM web3.users u\nJOIN web3.users p\n ON p.created_at = (\n SELECT MAX(created_at)\n FROM web3.users\n WHERE created_at < u.created_at\n )\nORDER BY u.created_at;"}]}
|
|
|
|
| 243 |
{"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 ( driver_id.text, 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.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 )\nCREATE TABLE transportation.trips ( trip_id.text, route_id.text, vehicle_id.text, driver_id.text, scheduled_departure.timestamp, actual_departure.timestamp, scheduled_arrival.timestamp, actual_arrival.timestamp, origin_location_id.text, destination_location_id.text, status.text, passenger_count.integer, cargo_manifest_id.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 )\nCREATE TABLE transportation.passengers ( passenger_id.text, 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": "Show the vehicle ID and the total number of fuel logs recorded for each vehicle."}, {"role": "assistant", "content": "SELECT vehicle_id , count(*) FROM transportation.fuel_logs GROUP BY vehicle_id"}, {"role": "user", "content": "Filter this list to only show vehicles with more than 5 fuel log entries."}, {"role": "assistant", "content": "SELECT vehicle_id , count(*) FROM transportation.fuel_logs GROUP BY vehicle_id HAVING count(*) > 5"}]}
|
| 244 |
{"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.lawyers (\n lawyer_id character varying(64) NOT NULL, -- unique identifier for the lawyer\n first_name character varying(100) NOT NULL, -- lawyer's first name\n last_name character varying(100) NOT NULL, -- lawyer's last name\n bar_number character varying(64) UNIQUE NOT NULL, -- lawyer's bar association number\n firm_id character varying(64), -- FK to law_firms table\n email character varying(128) UNIQUE NOT NULL, -- lawyer's professional email\n phone character varying(32), -- lawyer's contact phone number\n specialization text, -- areas of legal expertise\n hire_date timestamp NOT NULL, -- date the lawyer was hired or joined\n is_partner boolean DEFAULT false, -- flag indicating if the lawyer is a partner\n PRIMARY KEY (lawyer_id)\n)\n", "conversations": [{"role": "user", "content": "List all partners who have provided a phone number, showing their full name and email."}, {"role": "assistant", "content": "SELECT first_name, last_name, email FROM legal_services.lawyers WHERE is_partner = TRUE AND phone IS NOT NULL;"}, {"role": "user", "content": "Okay, now only include those partners hired between 2020-01-01 and 2022-12-31."}, {"role": "assistant", "content": "SELECT first_name, last_name, email FROM legal_services.lawyers WHERE is_partner = TRUE AND phone IS NOT NULL AND hire_date BETWEEN '2020-01-01' AND '2022-12-31';"}, {"role": "user", "content": "Can you also add their specialization to the output?"}, {"role": "assistant", "content": "SELECT first_name, last_name, email, specialization FROM legal_services.lawyers WHERE is_partner = TRUE AND phone IS NOT NULL AND hire_date BETWEEN '2020-01-01' AND '2022-12-31';"}, {"role": "user", "content": "Finally, order the results by specialization in ascending order, then by last name."}, {"role": "assistant", "content": "SELECT first_name, last_name, email, specialization FROM legal_services.lawyers WHERE is_partner = TRUE AND phone IS NOT NULL AND hire_date BETWEEN '2020-01-01' AND '2022-12-31' ORDER BY specialization ASC, last_name ASC;"}]}
|
| 245 |
{"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 hospitality_technology.staff ( staff_id character varying(64) NOT NULL, property_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name character varying(100) NOT NULL, position character varying(100) NOT NULL, work_email character varying(255) UNIQUE, work_phone character varying(30), hire_date date NOT NULL, termination_date date, is_active boolean NOT NULL DEFAULT true, access_level integer NOT NULL, manager_id character varying(64), created_at timestamp with time zone NOT NULL DEFAULT current_timestamp, PRIMARY KEY (staff_id), FOREIGN KEY (property_id) REFERENCES hospitality_technology.properties(property_id), FOREIGN KEY (manager_id) REFERENCES hospitality_technology.staff(staff_id) )\n", "conversations": [{"role": "user", "content": "Show me the email addresses and hire dates for all staff who have a manager."}, {"role": "assistant", "content": "SELECT work_email, hire_date\nFROM hospitality_technology.staff\nWHERE manager_id IS NOT NULL;"}, {"role": "user", "content": "Only include staff who were hired after January 1, 2023."}, {"role": "assistant", "content": "SELECT work_email, hire_date\nFROM hospitality_technology.staff\nWHERE manager_id IS NOT NULL AND hire_date > '2023-01-01';"}]}
|
|
|
|
| 246 |
{"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.users (\n user_id character varying(64) NOT NULL, -- unique identifier for the user\n username character varying(50) NOT NULL UNIQUE, -- user's unique handle\n email character varying(128) NOT NULL UNIQUE, -- user's email address\n password_hash text NOT NULL, -- hashed password\n full_name character varying(100), -- user's full name\n profile_picture_url text, -- URL to the profile picture\n bio text, -- short user biography\n location character varying(100), -- user's location\n created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp of account creation\n updated_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp of last profile update\n is_verified boolean NOT NULL DEFAULT false, -- verification status\n PRIMARY KEY (user_id)\n)\nCREATE TABLE social_media.posts (\n post_id character varying(64) NOT NULL, -- unique identifier for the post\n user_id character varying(64) NOT NULL, -- identifier of the user who created the post (FK to users.user_id)\n content text, -- textual content of the post\n media_url text, -- URL to attached media (image/video)\n media_type character varying(20), -- type of media ('image', 'video', null)\n created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp of post creation\n updated_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp of last post edit\n visibility character varying(20) NOT NULL DEFAULT 'public', -- visibility ('public', 'friends', 'private')\n location_lat numeric(9,6), -- latitude of post location\n location_lon numeric(9,6), -- longitude of post location\n PRIMARY KEY (post_id)\n)\nCREATE TABLE social_media.comments (\n comment_id character varying(64) NOT NULL, -- unique identifier for the comment\n post_id character varying(64) NOT NULL, -- identifier of the post being commented on (FK to posts.post_id)\n user_id character varying(64) NOT NULL, -- identifier of the user who made the comment (FK to users.user_id)\n parent_comment_id character varying(64), -- identifier of the parent comment if it's a reply (FK to comments.comment_id)\n content text NOT NULL, -- textual content of the comment\n created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp of comment creation\n updated_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp of last comment edit\n PRIMARY KEY (comment_id)\n)\nCREATE TABLE social_media.likes (\n like_id character varying(64) NOT NULL, -- unique identifier for the like\n user_id character varying(64) NOT NULL, -- identifier of the user who liked (FK to users.user_id)\n post_id character varying(64), -- identifier of the post being liked (FK to posts.post_id, nullable)\n comment_id character varying(64), -- identifier of the comment being liked (FK to comments.comment_id, nullable)\n created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp of when the like occurred\n PRIMARY KEY (like_id),\n CONSTRAINT unique_user_like UNIQUE (user_id, post_id, comment_id), -- prevent duplicate likes\n CONSTRAINT check_like_target CHECK (post_id IS NOT NULL OR comment_id IS NOT NULL) -- ensure it likes something\n)\nCREATE TABLE social_media.follows (\n follow_id character varying(64) NOT NULL, -- unique identifier for the follow relationship\n follower_user_id character varying(64) NOT NULL, -- identifier of the user who is following (FK to users.user_id)\n following_user_id character varying(64) NOT NULL, -- identifier of the user being followed (FK to users.user_id)\n created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp of when the follow started\n PRIMARY KEY (follow_id),\n CONSTRAINT unique_follow UNIQUE (follower_user_id, following_user_id) -- prevent duplicate follows\n)\nCREATE TABLE social_media.hashtags (\n hashtag_id character varying(64) NOT NULL, -- unique identifier for the hashtag\n tag_name character varying(100) NOT NULL UNIQUE, -- the actual hashtag text (without '#')\n created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp when the hashtag was first used\n PRIMARY KEY (hashtag_id)\n)\nCREATE TABLE social_media.post_hashtags (\n post_hashtag_id character varying(64) NOT NULL, -- unique identifier for the post-hashtag link\n post_id character varying(64) NOT NULL, -- identifier of the post (FK to posts.post_id)\n hashtag_id character varying(64) NOT NULL, -- identifier of the hashtag (FK to hashtags.hashtag_id)\n PRIMARY KEY (post_hashtag_id),\n CONSTRAINT unique_post_hashtag UNIQUE (post_id, hashtag_id) -- prevent duplicate tags on a post\n)\nCREATE TABLE social_media.messages (\n message_id character varying(64) NOT NULL, -- unique identifier for the message\n conversation_id character varying(64) NOT NULL, -- identifier for the conversation thread (FK to conversations.conversation_id)\n sender_user_id character varying(64) NOT NULL, -- identifier of the sender (FK to users.user_id)\n content text, -- textual content of the message\n media_url text, -- URL to attached media (image/video)\n media_type character varying(20), -- type of media ('image', 'video', null)\n sent_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp when message was sent\n read_at timestamp, -- timestamp when message was read by recipient(s)\n PRIMARY KEY (message_id)\n)\nCREATE TABLE social_media.conversations (\n conversation_id character varying(64) NOT NULL, -- unique identifier for the conversation\n created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp when conversation was initiated\n last_message_at timestamp, -- timestamp of the last message in the conversation\n is_group_chat boolean NOT NULL DEFAULT false, -- indicates if it's a group chat or direct message\n group_name character varying(100), -- name of the group chat (if applicable)\n PRIMARY KEY (conversation_id)\n)\nCREATE TABLE social_media.conversation_participants (\n participant_id character varying(64) NOT NULL, -- unique identifier for the participant entry\n conversation_id character varying(64) NOT NULL, -- identifier of the conversation (FK to conversations.conversation_id)\n user_id character varying(64) NOT NULL, -- identifier of the user in the conversation (FK to users.user_id)\n joined_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp when user joined the conversation\n last_read_at timestamp, -- timestamp indicating up to when the user has read messages\n PRIMARY KEY (participant_id),\n CONSTRAINT unique_user_conversation UNIQUE (conversation_id, user_id) -- prevent user being added multiple times\n)\n", "conversations": [{"role": "user", "content": "List all group chats created in 2024, showing the group_name, conversation_id, and creation time."}, {"role": "assistant", "content": "SELECT conversation_id, group_name, created_at\nFROM social_media.conversations\nWHERE is_group_chat = true AND created_at >= '2024-01-01' AND created_at < '2025-01-01';"}]}
|
| 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 legal_services.documents (\n document_id character varying(64) NOT NULL, -- unique identifier for the document\n case_id character varying(64) NOT NULL, -- FK to cases table\n document_name character varying(255) NOT NULL, -- name of the document file\n document_type character varying(100), -- e.g., Pleading, Contract, Evidence, Correspondence\n storage_path text NOT NULL, -- path or reference to the document storage location\n uploaded_by_lawyer_id character varying(64), -- FK to lawyers table (who uploaded it)\n upload_timestamp timestamp NOT NULL, -- time the document was uploaded\n version integer DEFAULT 1, -- document version number\n description text, -- brief description or notes about the document\n PRIMARY KEY (document_id)\n)\n", "conversations": [{"role": "user", "content": "Show me document names and upload timestamps for documents linked to cases that were opened after January 1, 2023."}, {"role": "assistant", "content": "SELECT T1.document_name, T1.upload_timestamp FROM documents AS T1 JOIN cases AS T2 ON T1.case_id = T2.case_id WHERE T2.date_opened > '2023-01-01';"}, {"role": "user", "content": "Additionally, only include documents that have a version number greater than 1."}, {"role": "assistant", "content": "SELECT T1.document_name, T1.upload_timestamp FROM documents AS T1 JOIN cases AS T2 ON T1.case_id = T2.case_id WHERE T2.date_opened > '2023-01-01' AND T1.version > 1;"}]}
|