Dataset Viewer
Auto-converted to Parquet Duplicate
conversations
list
system
string
[ { "role": "user", "content": "Show each service's name along with the total number of appointments scheduled and the number of unique locations these appointments are scheduled at." }, { "role": "assistant", "content": "SELECT s.service_name, COUNT(a.application_id) AS appointment_count, COUNT(D...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen national_id_number character varying(128) NOT NULL UNIQUE, -- official national identification number first_name character varying(100) NOT NULL, last_name character varying(100) NOT NULL, date_of_birth date NOT NULL, gender character varying(20), primary_address text NOT NULL, -- full primary residential address contact_email character varying(128) UNIQUE, contact_phone character varying(32), registration_date timestamp NOT NULL, -- when the citizen profile was created is_verified boolean DEFAULT false, -- whether identity has been officially verified PRIMARY KEY (citizen_id) ) CREATE TABLE government_services.agencies ( agency_id.text, agency_name.text, jurisdiction_level.text, primary_contact_email.text, main_phone_number.text, website_url.text, established_date.date, parent_agency_id.text ) CREATE TABLE government_services.services ( service_id text PRIMARY KEY, agency_id text, service_name text, description text, category text, eligibility_criteria text, standard_fee numeric, average_processing_time_days int, is_active boolean, online_application_url text ) CREATE TABLE government_services.applications ( application_id character varying(64) NOT NULL, citizen_id character varying(64) NOT NULL, service_id character varying(64) NOT NULL, submitted_at timestamp NOT NULL, status character varying(50) NOT NULL, last_updated_at timestamp NOT NULL, assigned_employee_id character varying(64), decision_date date, notes text, reference_number character varying(100) UNIQUE, PRIMARY KEY (application_id) ) CREATE TABLE government_services.documents ( document_id.text, application_id.text, citizen_id.text, document_type.text, file_reference.text, upload_timestamp.timestamp, expiry_date.date, verification_status.text, verified_by_employee_id.text, verification_timestamp.timestamp ) CREATE TABLE government_services.payments ( payment_id text, application_id text, citizen_id text, service_id text, amount numeric, currency text, payment_method text, payment_provider_reference text, payment_timestamp timestamp, status text, notes text ) CREATE TABLE government_services.service_locations ( location_id character varying(64) NOT NULL, -- unique identifier for the physical location agency_id character varying(64) NOT NULL, -- FK to agencies table location_name character varying(200), -- e.g., Downtown DMV Office address text NOT NULL, city character varying(100), state character varying(50), postal_code character varying(20), latitude numeric(9, 6), longitude numeric(9, 6), operating_hours text, -- description of opening times contact_phone character varying(32), is_accessible boolean, -- accessibility information (e.g., wheelchair access) PRIMARY KEY (location_id) ) CREATE TABLE government_services.notifications ( notification_id text PRIMARY KEY, citizen_id text, application_id text, message_subject text, message_body text, channel text, sent_at timestamp, status text, related_entity_type text, related_entity_id text )
[ { "role": "user", "content": "How many insurance policies does each patient have? Return patient_id and policy_count." }, { "role": "assistant", "content": "SELECT patient_id,\n COUNT(*) AS policy_count\nFROM healthcare.patient_insurance\nGROUP BY patient_id;" }, { "role": "user", ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.doctors ( doctor_id.text, first_name.text, last_name.text, specialty.text, license_number.text, phone_number.text, email.text, hospital_affiliation_id.text, created_at.timestamp, updated_at.timestamp ) CREATE 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 ) CREATE TABLE healthcare.diagnoses ( diagnosis_id.text, record_id.text, patient_id.text, doctor_id.text, diagnosis_code.text, code_type.text, description.text, diagnosis_date.date, status.text, is_chronic.boolean ) CREATE TABLE healthcare.medications ( medication_id.text, medication_name.text, generic_name.text, manufacturer.text, ndc_code.text, description.text ) CREATE TABLE healthcare.prescriptions ( prescription_id.text, record_id.text, patient_id.text, doctor_id.text, medication_id.text, dosage.text, frequency.text, route.text, start_date.date, end_date.date, quantity_dispensed.numeric, refills_allowed.integer, prescription_date.timestamp ) CREATE TABLE healthcare.insurance_plans ( plan_id.text, plan_name.text, insurance_provider.text, plan_type.text, contact_phone.text, website.text ) CREATE TABLE healthcare.patient_insurance ( patient_insurance_id.text, patient_id.text, plan_id.text, policy_number.text, group_number.text, subscriber_name.text, effective_date.date, expiration_date.date, is_primary.boolean )
[ { "role": "user", "content": "How many group chats have been created since January 1, 2024?" }, { "role": "assistant", "content": "SELECT COUNT(*) AS group_chat_count\nFROM social_media.conversations\nWHERE is_group_chat = TRUE\n AND created_at >= '2024-01-01';" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.posts ( post_id text, user_id text, content text, media_url text, media_type text, created_at timestamp, updated_at timestamp, visibility text, location_lat numeric, location_lon numeric ) CREATE TABLE social_media.likes ( like_id text, user_id text, post_id text, comment_id text, created_at timestamp ) CREATE TABLE social_media.hashtags ( hashtag_id text, tag_name text, created_at timestamp ) CREATE TABLE social_media.conversations ( conversation_id text, created_at timestamp, last_message_at timestamp, is_group_chat boolean, group_name text )
[ { "role": "user", "content": "List each user's username, email, and the total count of log entries they have recorded." }, { "role": "assistant", "content": "SELECT T1.username, T1.email, count(T2.log_id) FROM users AS T1 LEFT JOIN logs AS T2 ON T1.user_id = T2.user_id GROUP BY T1.user_id, T1.us...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.users ( user_id.text, username.text, email.text, password_hash.text, created_at.timestamp ) CREATE TABLE trading_platform.peers ( peer_id.text, ip_address.text, port.integer, last_seen.timestamp ) CREATE TABLE trading_platform.metadata ( metadata_id character varying(64) NOT NULL, asset_id character varying(64) NOT NULL, key character varying(128) NOT NULL, value text NOT NULL, PRIMARY KEY (metadata_id) ) CREATE TABLE trading_platform.kyc_audit ( kyc_audit_id.text, user_id.text, status.text, reviewed_at.timestamp ) CREATE TABLE trading_platform.logs ( log_id text PRIMARY KEY, user_id text, action text, details text, logged_at timestamp ) CREATE TABLE trading_platform.notifications ( notification_id text, user_id text, message text, sent_at timestamp, read_at timestamp )
[ { "role": "user", "content": "Can you show me the total number of passengers registered in the database?" }, { "role": "assistant", "content": "db.passengers.countDocuments({})" } ]
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure // db.createCollection('passengers') // Optional: db.passengers.createIndex({ passenger_id: 1 }, { unique: true }) // Optional: db.passengers.createIndex({ email: 1 }, { unique: true, sparse: true }) // Optional: db.passengers.createIndex({ phone_number: 1 }, { unique: true, sparse: true }) { _id: ObjectId(), passenger_id: "pass_pqr", // String (unique) first_name: "Alice", // String last_name: "Smith", // String email: "alice.smith@example.com", // String (unique, sparse) phone_number: "+15551234567", // String (unique, sparse) date_of_birth: ISODate("1990-03-20"), // Date loyalty_program_id: "LOYALTY123", // String created_at: ISODate("2023-02-01T11:00:00Z") // Date }
[ { "role": "user", "content": "Show me all available non-smoking rooms on floors 3 or higher, along with their room numbers and features, ordered by floor number." }, { "role": "assistant", "content": "SELECT room_number, floor, features FROM hospitality_technology.rooms WHERE status = 'available...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.rooms ( room_id text PRIMARY KEY, property_id text, room_number text, room_type_id text, floor int, status text, is_smoking boolean, features text, current_condition text, last_cleaned_at timestamp ) CREATE TABLE hospitality_technology.guests ( guest_id character varying(64) NOT NULL, -- unique identifier for the guest profile first_name character varying(100) NOT NULL, -- guest's first name last_name character varying(100) NOT NULL, -- guest's last name email character varying(255) UNIQUE, -- guest's email address (unique identifier?) phone_number character varying(30), -- guest's phone number date_of_birth date, -- guest's date of birth address_line1 character varying(255), -- guest's home address city character varying(100), state_province character varying(100), postal_code character varying(20), country_code character varying(3), preferences text, -- notes on guest preferences (e.g., allergies, room location) loyalty_member_id character varying(64) UNIQUE, -- FK to loyalty_members table communication_consent boolean DEFAULT true, -- consent for marketing communications created_at timestamp with time zone NOT NULL DEFAULT current_timestamp, updated_at timestamp with time zone NOT NULL DEFAULT current_timestamp, PRIMARY KEY (guest_id) )
[ { "role": "user", "content": "For each vehicle, show the vehicle_id, license_plate, the date of its most recent actual_arrival, and the total number of bookings across all its trips. Only include vehicles that have made at least one trip." }, { "role": "assistant", "content": "SELECT v.vehicle_i...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id character varying(64) NOT NULL, -- unique identifier for the vehicle license_plate character varying(32) NOT NULL UNIQUE, -- vehicle license plate vin character varying(17) UNIQUE, -- vehicle identification number make character varying(64) NOT NULL, -- manufacturer of the vehicle model character varying(64) NOT NULL, -- model of the vehicle year integer NOT NULL, -- manufacturing year type character varying(32) NOT NULL, -- type of vehicle (e.g., Bus, Train, Truck, Car, Van) capacity integer, -- passenger or cargo capacity fuel_type character varying(32) NOT NULL, -- e.g., Diesel, Gasoline, Electric, Hydrogen status character varying(32) NOT NULL, -- e.g., Active, Maintenance, Decommissioned depot_id character varying(64), -- identifier of the home depot/base acquisition_date date, -- date the vehicle was acquired PRIMARY KEY (vehicle_id) ) CREATE TABLE transportation.drivers ( driver_id character varying(64) NOT NULL, employee_id character varying(64) NOT NULL UNIQUE, first_name character varying(128) NOT NULL, last_name character varying(128) NOT NULL, license_number character varying(64) NOT NULL UNIQUE, license_expiry_date date NOT NULL, contact_number character varying(32), email character varying(128) UNIQUE, hire_date date NOT NULL, status character varying(32) NOT NULL, PRIMARY KEY (driver_id) ) CREATE 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 ) CREATE TABLE transportation.trips ( trip_id text PRIMARY KEY, 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 int, cargo_manifest_id text ) CREATE 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) )
[ { "role": "user", "content": "What is the average commission rate for active agents?" }, { "role": "assistant", "content": "SELECT AVG(commission_rate) FROM insurance.agents WHERE status = 'Active';" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, address_line1.text, address_line2.text, city.text, state.text, zip_code.text, country.text, phone_number.text, email.text, created_at.timestamp, updated_at.timestamp, status.text ) CREATE TABLE insurance.policies ( policy_id text, customer_id text, product_id text, agent_id text, policy_number text, start_date date, end_date date, premium_amount numeric, coverage_limit numeric, deductible numeric, status text, issued_at timestamp, cancellation_date date, cancellation_reason text ) CREATE TABLE insurance.claims ( claim_id text PRIMARY KEY, policy_id text, customer_id text, incident_date timestamp, reported_date timestamp, description text, estimated_loss numeric, status text, settlement_amount numeric, settlement_date date, claim_handler_id text, police_report_number text ) CREATE TABLE insurance.insurance_products ( product_id text PRIMARY KEY, product_name text, product_type text, description text, base_premium numeric, coverage_details text, underwriting_rules text, is_active boolean, created_at timestamp, updated_at timestamp ) CREATE TABLE insurance.agents ( agent_id.text, first_name.text, last_name.text, agency_name.text, license_number.text, license_state.text, contact_email.text, contact_phone.text, hire_date.date, termination_date.date, status.text, commission_rate.numeric, manager_id.text ) CREATE TABLE insurance.policy_beneficiaries ( beneficiary_id text, policy_id text, customer_id text, first_name text, last_name text, relationship text, percentage_share numeric, contact_info text, added_at timestamp )
[ { "role": "user", "content": "List all smart money addresses that have a negative PNL but a positive Realized Ratio. Show the address, chain, PNL, and Realized Ratio." }, { "role": "assistant", "content": "SELECT token_address, chain, pnl, realized_ratio FROM smart_money_token_performance WHERE ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE smart_money_token_performance ( token_address.text, token_symbol.text, pnl.numeric, net_flow.numeric, avg_cost.numeric, price.numeric, realized_ratio.numeric, roi.numeric, chain.text )
[ { "role": "user", "content": "List each lawyer's full name with the full name of the partner at the same firm." }, { "role": "assistant", "content": "SELECT l.lawyer_id,\n CONCAT(l.first_name, ' ', l.last_name) AS lawyer_name,\n CONCAT(p.first_name, ' ', p.last_name) AS partner_name\...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.lawyers ( lawyer_id character varying(64) NOT NULL, -- unique identifier for the lawyer first_name character varying(100) NOT NULL, -- lawyer's first name last_name character varying(100) NOT NULL, -- lawyer's last name bar_number character varying(64) UNIQUE NOT NULL, -- lawyer's bar association number firm_id character varying(64), -- FK to law_firms table email character varying(128) UNIQUE NOT NULL, -- lawyer's professional email phone character varying(32), -- lawyer's contact phone number specialization text, -- areas of legal expertise hire_date timestamp NOT NULL, -- date the lawyer was hired or joined is_partner boolean DEFAULT false, -- flag indicating if the lawyer is a partner PRIMARY KEY (lawyer_id) )
[ { "role": "user", "content": "Show all users who have liked comments made by users with a specified location, say 'Paris'. For each, show their username, the comment_id, and the location of the comment's author." }, { "role": "assistant", "content": "SELECT l.user_id AS liker_user_id, u_liker.us...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id character varying(64) NOT NULL, -- unique identifier for the user username character varying(50) NOT NULL UNIQUE, -- user's unique handle email character varying(128) NOT NULL UNIQUE, -- user's email address password_hash text NOT NULL, -- hashed password full_name character varying(100), -- user's full name profile_picture_url text, -- URL to the profile picture bio text, -- short user biography location character varying(100), -- user's location created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp of account creation updated_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp of last profile update is_verified boolean NOT NULL DEFAULT false, -- verification status PRIMARY KEY (user_id) ) CREATE TABLE social_media.comments ( comment_id character varying(64) NOT NULL, -- unique identifier for the comment post_id character varying(64) NOT NULL, -- identifier of the post being commented on (FK to posts.post_id) user_id character varying(64) NOT NULL, -- identifier of the user who made the comment (FK to users.user_id) parent_comment_id character varying(64), -- identifier of the parent comment if it's a reply (FK to comments.comment_id) content text NOT NULL, -- textual content of the comment created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp of comment creation updated_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp of last comment edit PRIMARY KEY (comment_id) ) CREATE TABLE social_media.likes ( like_id character varying(64) NOT NULL, -- unique identifier for the like user_id character varying(64) NOT NULL, -- identifier of the user who liked (FK to users.user_id) post_id character varying(64), -- identifier of the post being liked (FK to posts.post_id, nullable) comment_id character varying(64), -- identifier of the comment being liked (FK to comments.comment_id, nullable) created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp of when the like occurred PRIMARY KEY (like_id), CONSTRAINT unique_user_like UNIQUE (user_id, post_id, comment_id), -- prevent duplicate likes CONSTRAINT check_like_target CHECK (post_id IS NOT NULL OR comment_id IS NOT NULL) -- ensure it likes something ) CREATE TABLE social_media.follows ( follow_id character varying(64) NOT NULL, -- unique identifier for the follow relationship follower_user_id character varying(64) NOT NULL, -- identifier of the user who is following (FK to users.user_id) following_user_id character varying(64) NOT NULL, -- identifier of the user being followed (FK to users.user_id) created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp of when the follow started PRIMARY KEY (follow_id), CONSTRAINT unique_follow UNIQUE (follower_user_id, following_user_id) -- prevent duplicate follows ) CREATE TABLE social_media.hashtags ( hashtag_id character varying(64) NOT NULL, -- unique identifier for the hashtag tag_name character varying(100) NOT NULL UNIQUE, -- the actual hashtag text (without '#') created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp when the hashtag was first used PRIMARY KEY (hashtag_id) ) CREATE TABLE social_media.conversations ( conversation_id character varying(64) NOT NULL, -- unique identifier for the conversation created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp when conversation was initiated last_message_at timestamp, -- timestamp of the last message in the conversation is_group_chat boolean NOT NULL DEFAULT false, -- indicates if it's a group chat or direct message group_name character varying(100), -- name of the group chat (if applicable) PRIMARY KEY (conversation_id) ) CREATE TABLE social_media.conversation_participants ( participant_id character varying(64) NOT NULL, -- unique identifier for the participant entry conversation_id character varying(64) NOT NULL, -- identifier of the conversation (FK to conversations.conversation_id) user_id character varying(64) NOT NULL, -- identifier of the user in the conversation (FK to users.user_id) joined_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp when user joined the conversation last_read_at timestamp, -- timestamp indicating up to when the user has read messages PRIMARY KEY (participant_id), CONSTRAINT unique_user_conversation UNIQUE (conversation_id, user_id) -- prevent user being added multiple times ) CREATE TABLE social_media.notifications ( notification_id character varying(64) NOT NULL, -- unique identifier for the notification recipient_user_id character varying(64) NOT NULL, -- user receiving the notification (FK to users.user_id) sender_user_id character varying(64), -- user triggering the notification (FK to users.user_id, can be null for system notifications) notification_type character varying(30) NOT NULL, -- type of notification ('like', 'comment', 'follow', 'mention', 'message') target_entity_id character varying(64), -- ID of the related entity (post_id, comment_id, user_id, conversation_id) target_entity_type character varying(20), -- type of the related entity ('post', 'comment', 'user', 'conversation') created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp notification was created read_at timestamp, -- timestamp notification was marked as read PRIMARY KEY (notification_id) ) CREATE TABLE social_media.user_settings ( setting_id character varying(64) NOT NULL, -- unique identifier for the setting entry user_id character varying(64) NOT NULL UNIQUE, -- user the settings belong to (FK to users.user_id) theme character varying(20) DEFAULT 'light', -- UI theme ('light', 'dark') email_notifications_enabled boolean DEFAULT true, -- enable/disable email notifications push_notifications_enabled boolean DEFAULT true, -- enable/disable push notifications private_profile boolean DEFAULT false, -- is the user profile private updated_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp of last setting change PRIMARY KEY (setting_id) )
[ { "role": "user", "content": "Show all routes including their number, type, and description." }, { "role": "assistant", "content": "SELECT route_number , type , description FROM transportation.routes" }, { "role": "user", "content": "Only show routes of type 'City Bus'." }, { ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id character varying(64) NOT NULL, -- unique identifier for the vehicle license_plate character varying(32) NOT NULL UNIQUE, -- vehicle license plate vin character varying(17) UNIQUE, -- vehicle identification number make character varying(64) NOT NULL, -- manufacturer of the vehicle model character varying(64) NOT NULL, -- model of the vehicle year integer NOT NULL, -- manufacturing year type character varying(32) NOT NULL, -- type of vehicle (e.g., Bus, Train, Truck, Car, Van) capacity integer, -- passenger or cargo capacity fuel_type character varying(32) NOT NULL, -- e.g., Diesel, Gasoline, Electric, Hydrogen status character varying(32) NOT NULL, -- e.g., Active, Maintenance, Decommissioned depot_id character varying(64), -- identifier of the home depot/base acquisition_date date, -- date the vehicle was acquired PRIMARY KEY (vehicle_id) ) CREATE TABLE transportation.drivers ( driver_id character varying(64) NOT NULL, -- unique identifier for the driver employee_id character varying(64) NOT NULL UNIQUE, -- employee reference number first_name character varying(128) NOT NULL, -- driver's first name last_name character varying(128) NOT NULL, -- driver's last name license_number character varying(64) NOT NULL UNIQUE, -- driving license number license_expiry_date date NOT NULL, -- expiry date of the license contact_number character varying(32), -- phone number email character varying(128) UNIQUE, -- email address hire_date date NOT NULL, -- date the driver was hired status character varying(32) NOT NULL, -- e.g., Active, On Leave, Terminated PRIMARY KEY (driver_id) ) CREATE TABLE transportation.routes ( route_id character varying(64) NOT NULL, -- unique identifier for the route route_number character varying(32) NOT NULL UNIQUE, -- public-facing route number/name description text, -- description of the route origin_location_id character varying(64) NOT NULL, -- identifier of the starting location destination_location_id character varying(64) NOT NULL, -- identifier of the ending location distance_km numeric(10, 2), -- estimated distance in kilometers estimated_duration_minutes integer, -- estimated travel time in minutes type character varying(32) NOT NULL, -- e.g., City Bus, Intercity Train, Cargo Delivery PRIMARY KEY (route_id) ) CREATE TABLE transportation.locations ( location_id character varying(64) NOT NULL, -- unique identifier for the location name character varying(255) NOT NULL, -- name of the location (e.g., Central Station, Depot Alpha, Pier 7) type character varying(64) NOT NULL, -- e.g., Station, Stop, Depot, Port, Airport, Customer Address address_line1 character varying(255), -- street address city character varying(128), -- city name state_province character varying(128), -- state or province postal_code character varying(32), -- postal code country character varying(64) NOT NULL, -- country name latitude numeric(9, 6), -- geographic latitude longitude numeric(9, 6), -- geographic longitude timezone character varying(64), -- IANA timezone name (e.g., America/New_York) PRIMARY KEY (location_id) ) CREATE TABLE transportation.fuel_logs ( fuel_log_id character varying(64) NOT NULL, -- unique identifier for the fuel log entry vehicle_id character varying(64) NOT NULL, -- identifier of the vehicle fueled trip_id character varying(64), -- optional: identifier of the trip during which fueling occurred log_timestamp timestamp with time zone NOT NULL, -- time when fueling occurred fuel_type character varying(32) NOT NULL, -- type of fuel added (matches vehicle's fuel type) quantity numeric(10, 3) NOT NULL, -- amount of fuel added (e.g., Liters, Gallons, kWh) unit character varying(16) NOT NULL, -- unit of quantity (e.g., L, gal, kWh) cost_per_unit numeric(8, 4), -- price per unit of fuel total_cost numeric(10, 2) NOT NULL, -- total cost of the fuel purchase odometer_reading integer, -- vehicle mileage at time of fueling location_id character varying(64), -- identifier of the fueling station/location PRIMARY KEY (fuel_log_id) )
[ { "role": "user", "content": "List all log entries associated with users who have participated in any trade, showing the log details and the trade ID." }, { "role": "assistant", "content": "SELECT T1.log_id, T1.action, T1.details, T1.logged_at, T2.trade_id, T2.buyer_id, T2.seller_id FROM logs AS...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.wallets ( wallet_id.text, user_id.text, address.text, private_key.text, created_at.timestamp ) CREATE TABLE trading_platform.trades ( trade_id.text, order_id.text, buyer_id.text, seller_id.text, asset_id.text, quantity.numeric, price.numeric, traded_at.timestamp ) CREATE TABLE trading_platform.utxos ( utxo_id.text, transaction_id.text, output_index.integer, address.text, amount.numeric, spent.boolean ) CREATE TABLE trading_platform.dapps ( dapp_id.text, name.text, description.text, url.text ) CREATE TABLE trading_platform.peers ( peer_id.text, ip_address.text, port.integer, last_seen.timestamp ) CREATE TABLE trading_platform.logs ( log_id.text, user_id.text, action.text, details.text, logged_at.timestamp )
[ { "role": "user", "content": "List each transaction along with its status and the names of any events that were emitted during that transaction." }, { "role": "assistant", "content": "SELECT tr.transaction_id, tr.status, e.event_name\nFROM web3.transactions tr\nLEFT JOIN web3.events e ON tr.tran...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, address character varying(128) NOT NULL, abi text NOT NULL, bytecode text NOT NULL, deployer_address character varying(128) NOT NULL, deployed_at timestamp NOT NULL, network_id character varying(64) NOT NULL, status character varying(32) NOT NULL, PRIMARY KEY (contract_id) ) CREATE TABLE web3.events ( event_id.text, contract_id.text, event_name.text, data.text, emitted_at.timestamp, transaction_id.text, log_index.integer ) CREATE TABLE web3.transactions ( transaction_id character varying(64) NOT NULL, from_address character varying(128) NOT NULL, to_address character varying(128), value numeric(38,14) NOT NULL, gas_used integer NOT NULL, gas_price numeric(38,14) NOT NULL, block_number integer NOT NULL, timestamp timestamp NOT NULL, input_data text, status character varying(32) NOT NULL, nonce integer NOT NULL, PRIMARY KEY (transaction_id) ) CREATE TABLE web3.tokens ( token_id character varying(64) NOT NULL, -- unique identifier for the token contract_address character varying(128) NOT NULL, -- address of the token contract token_name character varying(128) NOT NULL, -- name of the token token_symbol character varying(32) NOT NULL, -- symbol of the token decimals integer NOT NULL, -- number of decimals for the token total_supply numeric(38,14) NOT NULL, -- total supply of the token PRIMARY KEY (token_id) ) CREATE 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 ) CREATE TABLE web3.wallets ( wallet_id text, user_id text, address text, private_key text, created_at timestamp )
[ { "role": "user", "content": "Show me the top 5 ERC20 tokens with the highest total supply, along with their names and contract addresses, but only include tokens where the price is greater than $0.10." }, { "role": "assistant", "content": "SELECT tm.name, tm.contract_address, tm.total_supply FR...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE token_metas ( block_timestamp timestamp(6) NOT NULL, -- Timestamp of the block when token metadata was recorded block_number bigint NOT NULL, -- Block number uniquely identifying the block transaction_hash varchar NOT NULL, -- Hash value of the transaction transaction_index bigint NOT NULL, -- Index of the transaction within the block from_address varchar NOT NULL, -- Address from which the transaction originated contract_address varchar NOT NULL, -- Address of the token contract symbol varchar NOT NULL, -- Symbol of the token total_supply varchar NOT NULL, -- erc20 contract total supply name varchar NOT NULL, -- Name of the token decimals bigint NOT NULL, -- Number of decimal places for the token is_erc20 integer NOT NULL, -- Flag indicating if the token is an ERC-20 token (0 or 1) is_erc721 integer NOT NULL, -- Flag indicating if the token is an ERC-721 token (0 or 1) is_erc1155 integer NOT NULL, -- Flag indicating if the token is an ERC-1155 token (0 or 1) is_proxy integer NOT NULL, -- Flag indicating if the token is a proxy (0 or 1) extra_info varchar NOT NULL, -- Additional information about the token pk integer NOT NULL -- Partition key for the table(floor(block_number / 5760)) ) CREATE TABLE erc1155_approval_for_all ( block_number bigint NOT NULL, -- Block number containing the transaction block_timestamp timestamp(3) NOT NULL, -- Timestamp of the block containing the transaction transaction_index integer NOT NULL, -- Index of the transaction within the block transaction_hash varchar(66) NOT NULL, -- Transaction hash log_index integer NOT NULL, -- Log index contract_address varchar(42) NOT NULL -- Event contract address ) CREATE TABLE erc20_balances ( block_number bigint NOT NULL, contract_address varchar NOT NULL, wallet_address varchar NOT NULL, amount varchar NOT NULL, pk varchar NOT NULL ) CREATE TABLE erc20_balances_historical ( block_number bigint NOT NULL, contract_address varchar NOT NULL, wallet_address varchar NOT NULL, amount varchar NOT NULL, pk integer NOT NULL ) CREATE TABLE nft_holders ( block_number bigint NOT NULL, -- Block number containing the transaction contract_address varchar NOT NULL, -- Event contract address wallet_address varchar NOT NULL, -- The wallet address for the contract(with bloom filter) token_id varchar NOT NULL, -- NFT token id contract_type varchar NOT NULL, -- NFT contract type amount varchar NOT NULL, -- Number of held NFTs pk varchar NOT NULL -- The last string partition of the contract. ) CREATE TABLE sui_coins ( object_id varchar NOT NULL, status varchar NOT NULL, coin_type varchar NOT NULL, balance varchar NOT NULL, owner varchar NOT NULL ) CREATE TABLE sui_nfts ( object_id text, status text, collection_type text, package_id text, previous_transaction text, display text, owner text, name text ) CREATE TABLE nft_metadata ( blockchain text, contract_address text, token_id text, contract_name text, erc_type text, amount bigint, minter text, owner text, mint_block_number bigint, mint_time bigint, mint_transaction_hash text, mint_price text, token_uri text, metadata text, name text, image_uri text, traits text, updated_at bigint, status text, rarity_score real, rarity_rank integer, unique_attribute_count integer, pk integer ) CREATE TABLE erc20_approval ( block_number bigint, block_timestamp timestamp, transaction_index integer, transaction_hash text, log_index integer, contract_address text, pk integer ) CREATE TABLE token_info ( block_timestamp timestamp(3) NOT NULL, -- Timestamp of the block containing the inscription (matches block_timestamp in transactions table) block_number bigint NOT NULL, -- Block number containing the inscription (matches block_number in transactions table) tx_index integer NOT NULL, -- Index of the transaction containing the inscription (matches transaction_index in transactions table) tx_hash varchar(66) NOT NULL, -- Unique identifier of the transaction containing the inscription (matches hash in transactions table) tick varchar NOT NULL, -- Token tick max_supply decimal(38,0) NOT NULL, -- Max supply lim decimal(38,0) NOT NULL, -- Limit of each mint wlim decimal(38,0) NOT NULL, -- Limit of each address can maximum mint dec integer NOT NULL, -- Decimal for minimum divie creator varchar(42) NOT NULL -- Address originating the inscription (matches from_address in transactions table) ) CREATE TABLE token_activities ( block_timestamp timestamp(3) NOT NULL, -- Timestamp of the block containing the inscription (matches block_timestamp in transactions table) block_number bigint NOT NULL, -- Block number containing the inscription (matches block_number in transactions table) tx_index integer NOT NULL, -- Index of the transaction containing the inscription (matches transaction_index in transactions table) tx_hash varchar(66) NOT NULL, -- Unique identifier of the transaction containing the inscription (matches hash in transactions table) log_index integer NOT NULL, -- Index of the log within the transaction type varchar NOT NULL, -- mint | transfer | burn tick varchar NOT NULL, -- Token tick id varchar(255) NOT NULL, -- Unique identifier of the inscription amt decimal(38,0) NOT NULL, -- Mint amount from_address varchar(42) NOT NULL, -- Address sending the inscription (matches from_address in transactions table) to_address varchar(42) NOT NULL -- Address receiving the inscription (match to_address in transactions table) ) CREATE TABLE token_activities_bitcoin ( block_timestamp timestamp, block_number bigint, tx_index integer, tx_hash text, log_index integer, type text, tick text, id text, amt decimal, from_address text, to_address text ) CREATE TABLE token_activities_avalanche ( block_timestamp.timestamp, block_number.bigint, tx_index.integer, tx_hash.text, log_index.integer, type.text, tick.text, id.text, amt.decimal, from_address.text, to_address.text )
[ { "role": "user", "content": "What is the schedule of trains arriving at platform 1A at station XYZ on December 25th, 2023?" }, { "role": "assistant", "content": "I'm sorry, but I can't provide information about train schedules or specific arrival times as this data is not included in the platfo...
You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE train_station_management.platforms ( platform_id character varying(64) NOT NULL, -- Unique identifier for the platform station_id character varying(64) NOT NULL, -- Foreign key referencing stations platform_number character varying(10) NOT NULL, -- Platform identifier (e.g., '1A', '5') track_number character varying(10), -- Associated track number, if different status character varying(32) NOT NULL DEFAULT 'Operational', -- e.g., Operational, Maintenance, Closed length_meters numeric(8,2), -- Length of the platform in meters accessible boolean NOT NULL DEFAULT false, -- Is the platform accessible (e.g., wheelchair)? PRIMARY KEY (platform_id), FOREIGN KEY (station_id) REFERENCES train_station_management.stations(station_id) )
[ { "role": "user", "content": "List the document ID, file name, and size for all documents uploaded in the last 30 days by user 'agent_smith' that are larger than 5 megabytes, ordered by upload time descending." }, { "role": "assistant", "content": "SELECT document_id, file_name, file_size_bytes ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.claim_documents ( document_id text PRIMARY KEY, claim_id text, document_type text, file_name text, file_path text, file_size_bytes int, mime_type text, uploaded_by text, uploaded_at timestamp, description text )
[ { "role": "user", "content": "Find all contracts where the deployer address is the same as the contract address, indicating self-deployed contracts, and show their network IDs and deployment timestamps." }, { "role": "assistant", "content": "SELECT address, network_id, deployed_at FROM web3.cont...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, address character varying(128) NOT NULL, abi text NOT NULL, bytecode text NOT NULL, deployer_address character varying(128) NOT NULL, deployed_at timestamp NOT NULL, network_id character varying(64) NOT NULL, status character varying(32) NOT NULL, PRIMARY KEY (contract_id) )
[ { "role": "user", "content": "What is the fuel consumption rate of train number T1234?" }, { "role": "assistant", "content": "I'm sorry, but I don't have information on the fuel consumption rate of train number T1234. The data available in the system only includes details such as train ID, model...
You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE train_station_management.trains ( train_id character varying(64) NOT NULL, train_number character varying(32) NOT NULL, model character varying(128), manufacturer character varying(128), year_manufactured integer, capacity integer NOT NULL, status character varying(32) NOT NULL DEFAULT 'Active', last_maintenance_date date, next_maintenance_date date, PRIMARY KEY (train_id), UNIQUE (train_number) )
[ { "role": "user", "content": "What is the detailed repair history of the equipment used by the staff with staff_id 'STAFF123' during maintenance tasks?" }, { "role": "assistant", "content": "I'm sorry, but I can't provide information on the detailed repair history of equipment used by staff memb...
You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE train_station_management.maintenance_records ( record_id.text, asset_id.text, asset_type.text, maintenance_type.text, staff_id.text, start_datetime.timestamp, end_datetime.timestamp, description.text, cost.numeric, status.text )
[ { "role": "user", "content": "Show me the number of approval-for-all events for each ERC1155 contract in the erc1155_approval_for_all table." }, { "role": "assistant", "content": "SELECT contract_address, COUNT(*) AS approval_count FROM erc1155_approval_for_all GROUP BY contract_address;" }, ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE erc1155_approval_for_all ( block_number bigint NOT NULL, -- Block number containing the transaction block_timestamp timestamp(3) NOT NULL, -- Timestamp of the block containing the transaction transaction_index integer NOT NULL, -- Index of the transaction within the block transaction_hash varchar(66) NOT NULL, -- Transaction hash log_index integer NOT NULL, -- Log index contract_address varchar(42) NOT NULL -- Event contract address ) CREATE TABLE erc20_balances_historical ( block_number bigint NOT NULL, contract_address varchar NOT NULL, wallet_address varchar NOT NULL, amount varchar NOT NULL, pk integer NOT NULL ) CREATE TABLE nft_holders ( block_number bigint NOT NULL, contract_address varchar NOT NULL, wallet_address varchar NOT NULL, token_id varchar NOT NULL, contract_type varchar NOT NULL, amount varchar NOT NULL, pk varchar NOT NULL ) CREATE TABLE nft_holder_historical ( block_number bigint NOT NULL, contract_address varchar NOT NULL, wallet_address varchar NOT NULL, token_id varchar NOT NULL, contract_type varchar NOT NULL, amount varchar NOT NULL, pk integer NOT NULL ) CREATE TABLE sui_nfts ( object_id text, status text, collection_type text, package_id text, previous_transaction text, display text, owner text, name text ) CREATE TABLE nft_metadata ( blockchain text, contract_address text, token_id text, contract_name text, erc_type text, amount bigint, minter text, owner text, mint_block_number bigint, mint_time bigint, mint_transaction_hash text, mint_price text, token_uri text, metadata text, name text, image_uri text, traits text, updated_at bigint, status text, rarity_score real, rarity_rank integer, unique_attribute_count integer, pk integer ) CREATE TABLE nft_collections ( blockchain varchar NOT NULL, contract_address varchar NOT NULL, name varchar NOT NULL, symbol varchar NOT NULL, deploy_block_number bigint NOT NULL, deploy_block_time bigint NOT NULL, erc_type varchar NOT NULL, owner varchar NOT NULL, traits varchar NOT NULL, description varchar NOT NULL, slug varchar NOT NULL, media_info varchar NOT NULL, image_url varchar NOT NULL, banner_image_url varchar NOT NULL, updated_at bigint NOT NULL, banner varchar NOT NULL, token_count bigint NOT NULL, floor_price varchar NOT NULL, floor_price_symbol varchar NOT NULL, floor_price_contract varchar NOT NULL, pk integer NOT NULL ) CREATE TABLE token_prices ( uuid text, blockchain text, address text, decimals bigint, symbol text, price real, timestamp timestamp ) CREATE TABLE token_prices_latest ( blockchain varchar(36) NOT NULL, -- blockchain fields for the functionType in contract address varchar(42) NOT NULL, -- address fields for the functionType in contract decimals bigint NOT NULL, -- decimals fields for the functionType in contract symbol varchar(36) NOT NULL, -- symbol fields for the functionType in contract price real NOT NULL, -- price fields for the functionType in contract timestamp timestamp(6) NOT NULL -- timestamp fields for the functionType in contract ) CREATE TABLE erc20_approval ( block_number bigint NOT NULL, block_timestamp timestamp(6) NOT NULL, transaction_index integer NOT NULL, transaction_hash varchar NOT NULL, log_index integer NOT NULL, contract_address varchar NOT NULL, pk integer NOT NULL ) CREATE TABLE token_info ( block_timestamp timestamp(3) NOT NULL, -- Timestamp of the block containing the inscription (matches block_timestamp in transactions table) block_number bigint NOT NULL, -- Block number containing the inscription (matches block_number in transactions table) tx_index integer NOT NULL, -- Index of the transaction containing the inscription (matches transaction_index in transactions table) tx_hash varchar(66) NOT NULL, -- Unique identifier of the transaction containing the inscription (matches hash in transactions table) tick varchar NOT NULL, -- Token tick max_supply decimal(38,0) NOT NULL, -- Max supply lim decimal(38,0) NOT NULL, -- Limit of each mint wlim decimal(38,0) NOT NULL, -- Limit of each address can maximum mint dec integer NOT NULL, -- Decimal for minimum divie creator varchar(42) NOT NULL -- Address originating the inscription (matches from_address in transactions table) ) CREATE TABLE token_info_bitcoin ( block_timestamp.timestamp, block_number.bigint, tx_index.integer, tx_hash.text, tick.text, max_supply.decimal, lim.decimal, wlim.decimal, dec.integer, creator.text ) CREATE TABLE token_activities_bitcoin ( block_timestamp timestamp, block_number bigint, tx_index integer, tx_hash text, log_index integer, type text, tick text, id text, amt decimal, from_address text, to_address text ) CREATE TABLE token_activities_avalanche ( block_timestamp timestamp(3) NOT NULL, -- Timestamp of the block containing the inscription (matches block_timestamp in transactions table) block_number bigint NOT NULL, -- Block number containing the inscription (matches block_number in transactions table) tx_index integer NOT NULL, -- Index of the transaction containing the inscription (matches transaction_index in transactions table) tx_hash varchar(66) NOT NULL, -- Unique identifier of the transaction containing the inscription (matches hash in transactions table) log_index integer NOT NULL, -- Index of the log within the transaction type varchar(20) NOT NULL, -- Operation: Type of event (deploy, mint, transfer, list) tick varchar(255) NOT NULL, -- Ticker: Identifier of the inscription id varchar(255) NOT NULL, -- Unique identifier of the inscription amt decimal(38,0) NOT NULL, -- Amount to mint: States the amount of the inscription to operation. When operation is mint, has to be less or equal to "lim" from_address varchar(42) NOT NULL, -- Address sending the inscription to_address varchar(42) NOT NULL -- Address receiving the inscription ) CREATE TABLE token_balances_avalanche ( block_number bigint, block_timestamp timestamp, tick varchar, wallet_address varchar, total_supply decimal, amount decimal ) CREATE TABLE token_info_avalanche ( block_timestamp timestamp, block_number bigint, tx_index integer, tx_hash text, tick text, max_supply decimal, lim decimal, wlim decimal, dec integer, creator text, minted decimal, holders decimal, txs decimal, updated_timestamp timestamp, completed_timestamp timestamp, id text )
[ { "role": "user", "content": "Show me the top 5 addresses with the highest balances, along with their public keys." }, { "role": "assistant", "content": "SELECT address_id, public_key, balance FROM blockchain.addresses ORDER BY balance DESC LIMIT 5;" }, { "role": "user", "content": "...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE blockchain.addresses ( address_id.text, public_key.text, balance.numeric )
[ { "role": "user", "content": "List all auto loans (loan_id, principal_amount, interest_rate) where the current principal balance is less than 40% of the original principal amount, along with the account_id and the difference between principal_amount and current_principal_balance." }, { "role": "assi...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.loans ( loan_id character varying(64) NOT NULL, account_id character varying(64) NOT NULL UNIQUE, loan_type character varying(50) NOT NULL, principal_amount numeric(19, 4) NOT NULL, current_principal_balance numeric(19, 4) NOT NULL, interest_rate numeric(6, 4) NOT NULL, term_months integer NOT NULL, origination_date date NOT NULL, maturity_date date NOT NULL, monthly_payment numeric(12, 4), collateral_description text, status character varying(32) NOT NULL, PRIMARY KEY (loan_id), FOREIGN KEY (account_id) REFERENCES financial_services.accounts(account_id) )
[ { "role": "user", "content": "List all tokens with a price below $1 and a 24-hour trading volume over $10 million." }, { "role": "assistant", "content": "SELECT token_name, token_symbol, price, total_volume FROM token_basic_info WHERE price < 1 AND CAST(total_volume AS double precision) > 100000...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE token_basic_info ( coin_id character varying(100) NOT NULL, token_name character varying(100) NOT NULL, token_symbol character varying(100) NOT NULL, token_address character varying(100) NOT NULL, chain text, price double precision, price_change_percentage_1h double precision, price_change_percentage_24h double precision, price_change_percentage_7d double precision, highest_price_24h double precision, lowest_price_24h double precision, market_cap double precision, market_cap_rank bigint, market_cap_change_percentage_24h text, total_volume text, narrative text, trend_rank bigint )
[ { "role": "user", "content": "What is the ticket price for a journey on train number T4321?" }, { "role": "assistant", "content": "I'm sorry, but I don't have access to information about ticket prices for specific trains. The data I have is limited to train details such as model, manufacturer, c...
You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE train_station_management.trains ( train_id text PRIMARY KEY, train_number text UNIQUE, model text, manufacturer text, year_manufactured int, capacity int, status text, last_maintenance_date date, next_maintenance_date date )
[ { "role": "user", "content": "Which staff members are managing properties, and what are the names and email addresses of those properties?" }, { "role": "assistant", "content": "SELECT s.staff_id, s.first_name, s.last_name, p.property_name, p.email_address FROM hospitality_technology.staff s INN...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id text PRIMARY KEY, property_name text, address_line1 text, address_line2 text, city text, state_province text, postal_code text, country_code text, phone_number text, email_address text, property_type text, star_rating numeric, timezone text, manager_staff_id text, created_at timestamp, updated_at timestamp ) CREATE TABLE hospitality_technology.room_types ( room_type_id text PRIMARY KEY, property_id text, type_name text, description text, base_rate numeric, max_occupancy int, bed_type text, area_sqft numeric, amenities text ) CREATE TABLE hospitality_technology.guests ( guest_id text PRIMARY KEY, first_name text, last_name text, email text, phone_number text, date_of_birth date, address_line1 text, city text, state_province text, postal_code text, country_code text, preferences text, loyalty_member_id text, communication_consent boolean, created_at timestamp, updated_at timestamp ) CREATE TABLE hospitality_technology.staff ( staff_id text PRIMARY KEY, property_id text, first_name text, last_name text, position text, work_email text, work_phone text, hire_date date, termination_date date, is_active boolean, access_level int, manager_id text, created_at timestamp ) CREATE TABLE hospitality_technology.payments ( payment_id text PRIMARY KEY, reservation_id text, guest_id text, bill_id text, amount numeric, currency_code text, payment_method text, card_type text, card_last_four text, transaction_ref text, payment_timestamp timestamp, status text, staff_id_processed text, notes text )
[ { "role": "user", "content": "I need a list of claim_ids that have at least one document of type 'Photo' and at least one of type 'Invoice'." }, { "role": "assistant", "content": "SELECT DISTINCT cd.claim_id\nFROM insurance.claim_documents cd\nWHERE cd.document_type IN ('Photo', 'Invoice');" }...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.customers ( customer_id character varying(64) NOT NULL, -- unique identifier for the customer first_name character varying(100) NOT NULL, -- customer's first name last_name character varying(100) NOT NULL, -- customer's last name date_of_birth date NOT NULL, -- customer's date of birth ssn_hash character varying(128), -- Hashed social security number (or national ID) address_line1 character varying(255) NOT NULL, address_line2 character varying(255), city character varying(100) NOT NULL, state character varying(50) NOT NULL, zip_code character varying(20) NOT NULL, country character varying(50) NOT NULL DEFAULT 'USA', phone_number character varying(30), email character varying(128) UNIQUE, -- unique email address created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- when the customer record was created updated_at timestamp, -- when the customer record was last updated status character varying(20) NOT NULL DEFAULT 'Active', -- e.g., Active, Inactive, Prospect PRIMARY KEY (customer_id) ) CREATE TABLE insurance.policies ( policy_id character varying(64) NOT NULL, -- unique identifier for the policy customer_id character varying(64) NOT NULL, -- identifier for the policyholder (FK to customers) product_id character varying(64) NOT NULL, -- identifier for the insurance product (FK to insurance_products) agent_id character varying(64), -- identifier for the agent who sold the policy (FK to agents) policy_number character varying(100) NOT NULL UNIQUE, -- customer-facing policy number start_date date NOT NULL, -- date the policy coverage begins end_date date NOT NULL, -- date the policy coverage ends premium_amount numeric(12, 2) NOT NULL, -- total premium for the policy term coverage_limit numeric(15, 2) NOT NULL, -- maximum amount covered deductible numeric(10, 2) NOT NULL, -- amount customer pays before coverage kicks in status character varying(30) NOT NULL, -- e.g., Active, Expired, Cancelled, Pending issued_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- when the policy was issued cancellation_date date, cancellation_reason text, PRIMARY KEY (policy_id) ) CREATE TABLE insurance.claims ( claim_id character varying(64) NOT NULL, -- unique identifier for the claim policy_id character varying(64) NOT NULL, -- identifier of the policy under which the claim is made (FK to policies) customer_id character varying(64) NOT NULL, -- identifier of the customer making the claim (FK to customers) incident_date timestamp NOT NULL, -- date and time of the incident leading to the claim reported_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- date the claim was reported description text NOT NULL, -- detailed description of the incident and claim estimated_loss numeric(15, 2), -- initial estimated cost of the loss status character varying(30) NOT NULL, -- e.g., Filed, Processing, Under Review, Approved, Denied, Settled settlement_amount numeric(15, 2), -- final amount paid out settlement_date date, claim_handler_id character varying(64), -- identifier for the employee handling the claim (FK to employees/adjusters) police_report_number character varying(100), PRIMARY KEY (claim_id) ) CREATE TABLE insurance.insurance_products ( product_id character varying(64) NOT NULL, -- unique identifier for the insurance product product_name character varying(150) NOT NULL, -- name of the insurance product (e.g., 'Comprehensive Auto Insurance') product_type character varying(50) NOT NULL, -- category like 'Auto', 'Home', 'Life', 'Health', 'Travel' description text, -- detailed description of the product base_premium numeric(10, 2) NOT NULL, -- starting premium before adjustments coverage_details text, -- details about what is covered (could be JSON or structured text) underwriting_rules text, -- rules used for assessing risk and eligibility is_active boolean NOT NULL DEFAULT true, -- whether the product is currently offered created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, updated_at timestamp, PRIMARY KEY (product_id) ) CREATE TABLE insurance.agents ( agent_id character varying(64) NOT NULL, -- unique identifier for the agent first_name character varying(100) NOT NULL, last_name character varying(100) NOT NULL, agency_name character varying(150), license_number character varying(100) NOT NULL UNIQUE, -- state insurance license number license_state character varying(50) NOT NULL, contact_email character varying(128) UNIQUE, contact_phone character varying(30), hire_date date, termination_date date, status character varying(20) NOT NULL DEFAULT 'Active', -- e.g., Active, Terminated, On Leave commission_rate numeric(5, 4) NOT NULL DEFAULT 0.05, -- percentage commission manager_id character varying(64), -- identifier for the agent's manager (FK to agents or employees) PRIMARY KEY (agent_id) ) CREATE TABLE insurance.claim_documents ( document_id character varying(64) NOT NULL, -- unique identifier for the document claim_id character varying(64) NOT NULL, -- identifier of the claim this document relates to (FK to claims) document_type character varying(50) NOT NULL, -- e.g., Police Report, Photo, Invoice, Medical Bill file_name character varying(255) NOT NULL, -- original name of the uploaded file file_path character varying(512) NOT NULL, -- storage path (e.g., S3 URL, network path) file_size_bytes integer, -- size of the file in bytes mime_type character varying(100), -- MIME type of the file (e.g., 'image/jpeg', 'application/pdf') uploaded_by character varying(64), -- identifier of the user/system who uploaded (FK to users/customers) uploaded_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- time of upload description text, -- optional description of the document PRIMARY KEY (document_id) ) CREATE TABLE insurance.policy_beneficiaries ( beneficiary_id character varying(64) NOT NULL, -- unique identifier for the beneficiary entry policy_id character varying(64) NOT NULL, -- identifier of the life/relevant policy (FK to policies) customer_id character varying(64) NOT NULL, -- identifier of the beneficiary (could be FK to customers or store info directly) first_name character varying(100) NOT NULL, -- beneficiary first name (if not linking to customers table) last_name character varying(100) NOT NULL, -- beneficiary last name relationship character varying(50) NOT NULL, -- relationship to the policyholder (e.g., Spouse, Child, Parent) percentage_share numeric(5, 2) NOT NULL CHECK (percentage_share > 0 AND percentage_share <= 100), -- percentage of payout contact_info text, -- contact details for the beneficiary added_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (beneficiary_id), UNIQUE (policy_id, customer_id) -- Ensure a person is listed only once per policy )
[ { "role": "user", "content": "List each driver along with the driver_id of the driver who was hired immediately after them." }, { "role": "assistant", "content": "SELECT d1.driver_id AS current_driver_id, d2.driver_id AS next_driver_id FROM transportation.drivers d1 LEFT JOIN transportation.driv...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.drivers ( driver_id.text, employee_id.text, first_name.text, last_name.text, license_number.text, license_expiry_date.date, contact_number.text, email.text, hire_date.date, status.text )
[ { "role": "user", "content": "Show the full names and contact emails of all citizens who have applied for services with a standard fee greater than 100." }, { "role": "assistant", "content": "SELECT c.first_name || ' ' || c.last_name AS full_name, c.contact_email\nFROM government_services.citize...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id character varying(64) NOT NULL, national_id_number character varying(128) NOT NULL UNIQUE, first_name character varying(100) NOT NULL, last_name character varying(100) NOT NULL, date_of_birth date NOT NULL, gender character varying(20), primary_address text NOT NULL, contact_email character varying(128) UNIQUE, contact_phone character varying(32), registration_date timestamp NOT NULL, is_verified boolean DEFAULT false, PRIMARY KEY (citizen_id) ) CREATE TABLE government_services.services ( service_id.text, agency_id.text, service_name.text, description.text, category.text, eligibility_criteria.text, standard_fee.numeric, average_processing_time_days.integer, is_active.boolean, online_application_url.text )
[ { "role": "user", "content": "List all peers who were last seen after July 10, 2024, along with their IP address and port." }, { "role": "assistant", "content": "SELECT peer_id, ip_address, port, last_seen\nFROM trading_platform.peers\nWHERE last_seen > '2024-07-10'\nORDER BY last_seen DESC;" ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.users ( user_id character varying(64) NOT NULL, -- unique identifier for the user username character varying(128) NOT NULL, -- username of the user email character varying(128) NOT NULL, -- email address of the user password_hash text NOT NULL, -- hashed password of the user created_at timestamp NOT NULL, -- time when the user account was created PRIMARY KEY (user_id) ) CREATE TABLE trading_platform.wallets ( wallet_id.text, user_id.text, address.text, private_key.text, created_at.timestamp ) CREATE TABLE trading_platform.orders ( order_id.text, user_id.text, wallet_id.text, asset_id.text, order_type.text, quantity.numeric, price.numeric, status.text, created_at.timestamp ) CREATE TABLE trading_platform.utxos ( utxo_id text PRIMARY KEY, transaction_id text, output_index int, address text, amount numeric, spent boolean ) CREATE TABLE trading_platform.peers ( peer_id.text, ip_address.text, port.integer, last_seen.timestamp ) CREATE TABLE trading_platform.metadata ( metadata_id character varying(64) NOT NULL, asset_id character varying(64) NOT NULL, key character varying(128) NOT NULL, value text NOT NULL, PRIMARY KEY (metadata_id) ) CREATE TABLE trading_platform.kyc_audit ( kyc_audit_id character varying(64) NOT NULL, -- unique identifier for the KYC audit user_id character varying(64) NOT NULL, -- identifier of the user being audited status character varying(32) NOT NULL, -- status of the KYC audit (e.g., pending, approved, rejected) reviewed_at timestamp NOT NULL, -- time when the KYC audit was reviewed PRIMARY KEY (kyc_audit_id) ) CREATE TABLE trading_platform.logs ( log_id character varying(64) NOT NULL, user_id character varying(64), action character varying(128) NOT NULL, details text NOT NULL, logged_at timestamp NOT NULL, PRIMARY KEY (log_id) ) CREATE TABLE trading_platform.notifications ( notification_id.text, user_id.text, message.text, sent_at.timestamp, read_at.timestamp )
[ { "role": "user", "content": "Which route numbers connect locations with a distance less than 80 km and more than 5 words in their description? Include the route type in the results." }, { "role": "assistant", "content": "SELECT route_number, type FROM transportation.routes WHERE distance_km < 8...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE 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 )
[ { "role": "user", "content": "What is the average number of wallets each user owns?" }, { "role": "assistant", "content": "SELECT\n AVG(wallet_count) AS avg_wallets_per_user\nFROM (\n SELECT user_id, COUNT(*) AS wallet_count\n FROM web3.wallets\n GROUP BY user_id\n) AS sub;" }, { "ro...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.wallets ( wallet_id text PRIMARY KEY, user_id text, address text, private_key text, created_at timestamp )
[ { "role": "user", "content": "Show me all maintenance logs for 'Oil Change' services performed in the last 3 months, including the vehicle ID, service date, and cost." }, { "role": "assistant", "content": "SELECT vehicle_id, service_date, cost FROM transportation.maintenance_logs WHERE service_t...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.maintenance_logs ( log_id character varying(64) NOT NULL, -- unique identifier for the maintenance record vehicle_id character varying(64) NOT NULL, -- identifier of the vehicle serviced service_date date NOT NULL, -- date the service was performed odometer_reading integer, -- vehicle mileage at time of service service_type character varying(128) NOT NULL, -- type of service (e.g., Oil Change, Tire Rotation, Engine Repair) description text NOT NULL, -- detailed description of work done cost numeric(10, 2), -- cost of the service mechanic_name character varying(128), -- name or ID of the mechanic/shop next_service_due_date date, -- recommended date for next service PRIMARY KEY (log_id) )
[ { "role": "user", "content": "How many employees work in each department? List the department name and the count." }, { "role": "assistant", "content": "SELECT department, COUNT(*) FROM government_services.employees GROUP BY department" }, { "role": "user", "content": "Only show depa...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id text, national_id_number text, first_name text, last_name text, date_of_birth date, gender text, primary_address text, contact_email text, contact_phone text, registration_date timestamp, is_verified boolean ) CREATE TABLE government_services.agencies ( agency_id text, agency_name text, jurisdiction_level text, primary_contact_email text, main_phone_number text, website_url text, established_date date, parent_agency_id text ) CREATE TABLE government_services.services ( service_id character varying(64) NOT NULL, -- unique identifier for the service agency_id character varying(64) NOT NULL, -- FK to agencies table service_name character varying(255) NOT NULL, -- name of the service (e.g., Driver's License Renewal) description text, category character varying(100), -- e.g., Licensing, Benefits, Taxation, Permits eligibility_criteria text, -- description of who is eligible standard_fee numeric(10, 2) DEFAULT 0.00, -- typical fee for the service average_processing_time_days integer, -- estimated processing time is_active boolean DEFAULT true, -- whether the service is currently offered online_application_url character varying(255), PRIMARY KEY (service_id) ) CREATE TABLE government_services.employees ( employee_id text, agency_id text, first_name text, last_name text, job_title text, department text, work_email text, work_phone text, hire_date date, termination_date date, access_level text, manager_employee_id text ) CREATE TABLE government_services.service_locations ( location_id character varying(64) NOT NULL, agency_id character varying(64) NOT NULL, location_name character varying(200), address text NOT NULL, city character varying(100), state character varying(50), postal_code character varying(20), latitude numeric(9, 6), longitude numeric(9, 6), operating_hours text, contact_phone character varying(32), is_accessible boolean, PRIMARY KEY (location_id) ) CREATE TABLE government_services.appointments ( appointment_id.text, citizen_id.text, employee_id.text, location_id.text, service_id.text, scheduled_start_time.timestamp, scheduled_end_time.timestamp, purpose.text, status.text, booking_method.text, created_at.timestamp, notes.text )
[ { "role": "user", "content": "Show the total number of customers in each state." }, { "role": "assistant", "content": "SELECT\n state,\n COUNT(customer_id)\nFROM insurance.customers\nGROUP BY\n state;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, address_line1 text, address_line2 text, city text, state text, zip_code text, country text, phone_number text, email text, created_at timestamp, updated_at timestamp, status text ) CREATE TABLE insurance.claims ( claim_id character varying(64) NOT NULL, -- unique identifier for the claim policy_id character varying(64) NOT NULL, -- identifier of the policy under which the claim is made (FK to policies) customer_id character varying(64) NOT NULL, -- identifier of the customer making the claim (FK to customers) incident_date timestamp NOT NULL, -- date and time of the incident leading to the claim reported_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- date the claim was reported description text NOT NULL, -- detailed description of the incident and claim estimated_loss numeric(15, 2), -- initial estimated cost of the loss status character varying(30) NOT NULL, -- e.g., Filed, Processing, Under Review, Approved, Denied, Settled settlement_amount numeric(15, 2), -- final amount paid out settlement_date date, claim_handler_id character varying(64), -- identifier for the employee handling the claim (FK to employees/adjusters) police_report_number character varying(100), PRIMARY KEY (claim_id) ) CREATE TABLE insurance.insurance_products ( product_id character varying(64) NOT NULL, -- unique identifier for the insurance product product_name character varying(150) NOT NULL, -- name of the insurance product (e.g., 'Comprehensive Auto Insurance') product_type character varying(50) NOT NULL, -- category like 'Auto', 'Home', 'Life', 'Health', 'Travel' description text, -- detailed description of the product base_premium numeric(10, 2) NOT NULL, -- starting premium before adjustments coverage_details text, -- details about what is covered (could be JSON or structured text) underwriting_rules text, -- rules used for assessing risk and eligibility is_active boolean NOT NULL DEFAULT true, -- whether the product is currently offered created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, updated_at timestamp, PRIMARY KEY (product_id) ) CREATE TABLE insurance.claim_documents ( document_id character varying(64) NOT NULL, claim_id character varying(64) NOT NULL, document_type character varying(50) NOT NULL, file_name character varying(255) NOT NULL, file_path character varying(512) NOT NULL, file_size_bytes integer, mime_type character varying(100), uploaded_by character varying(64), uploaded_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, description text, PRIMARY KEY (document_id) )
[ { "role": "user", "content": "Which customers have policies that expired in the last month? Please show the customer ID, policy number, and expiration date." }, { "role": "assistant", "content": "SELECT c.customer_id, p.policy_number, p.end_date\nFROM insurance.customers c\nJOIN insurance.polici...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, address_line1 text, address_line2 text, city text, state text, zip_code text, country text, phone_number text, email text, created_at timestamp, updated_at timestamp, status text ) CREATE TABLE insurance.policies ( policy_id text, customer_id text, product_id text, agent_id text, policy_number text, start_date date, end_date date, premium_amount numeric, coverage_limit numeric, deductible numeric, status text, issued_at timestamp, cancellation_date date, cancellation_reason text ) CREATE TABLE insurance.claims ( claim_id text, policy_id text, customer_id text, incident_date timestamp, reported_date timestamp, description text, estimated_loss numeric, status text, settlement_amount numeric, settlement_date date, claim_handler_id text, police_report_number text ) CREATE TABLE insurance.insurance_products ( product_id text, product_name text, product_type text, description text, base_premium numeric, coverage_details text, underwriting_rules text, is_active boolean, created_at timestamp, updated_at timestamp )
[ { "role": "user", "content": "Show me the first name, last name, and email address for all passengers who are part of the loyalty program with ID 'Gold'." }, { "role": "assistant", "content": "SELECT first_name , last_name , email FROM transportation.passengers WHERE loyalty_program_id = 'Go...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE 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 ) CREATE 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 ) CREATE 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 ) CREATE 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 )
[ { "role": "user", "content": "Which subscribers have more than one active insurance policy as of today? Show the subscriber_name and the count of such policies." }, { "role": "assistant", "content": "SELECT subscriber_name, COUNT(*) AS policy_count FROM healthcare.patient_insurance WHERE (expira...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patient_insurance ( patient_insurance_id character varying(64) NOT NULL, -- unique identifier for this patient-plan link patient_id character varying(64) NOT NULL, -- FK to patients table plan_id character varying(64) NOT NULL, -- FK to insurance_plans table policy_number character varying(100) NOT NULL, -- patient's policy number group_number character varying(100), -- group number, if applicable subscriber_name character varying(200), -- name of the primary policy holder effective_date date NOT NULL, -- date the coverage begins expiration_date date, -- date the coverage ends (if known) is_primary boolean NOT NULL DEFAULT true, -- indicates if this is the primary insurance PRIMARY KEY (patient_insurance_id), UNIQUE (patient_id, plan_id, policy_number) -- ensure a patient doesn't have the same policy twice )
[ { "role": "user", "content": "List all properties and the room types they offer, including the base rate for each room type." }, { "role": "assistant", "content": "SELECT T1.property_name, T2.type_name, T2.base_rate FROM hospitality_technology.properties AS T1 JOIN hospitality_technology.room_ty...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.rooms ( room_id character varying(64) NOT NULL, -- unique identifier for the room property_id character varying(64) NOT NULL, -- FK to properties table room_number character varying(10) NOT NULL, -- room number identifier (e.g., '101', 'Suite 2B') room_type_id character varying(64) NOT NULL, -- FK to room_types table floor integer, -- floor number the room is on status character varying(50) NOT NULL, -- e.g., Available, Occupied, Cleaning, OutOfOrder, Maintenance is_smoking boolean NOT NULL DEFAULT false, -- smoking allowed flag features text, -- description of features (e.g., Balcony, Sea View, Jacuzzi) current_condition text, -- notes on room condition last_cleaned_at timestamp with time zone, -- timestamp of last cleaning PRIMARY KEY (room_id), FOREIGN KEY (property_id) REFERENCES hospitality_technology.properties(property_id), FOREIGN KEY (room_type_id) REFERENCES hospitality_technology.room_types(room_type_id) ) CREATE TABLE hospitality_technology.guests ( guest_id text PRIMARY KEY, first_name text, last_name text, email text, phone_number text, date_of_birth date, address_line1 text, city text, state_province text, postal_code text, country_code text, preferences text, loyalty_member_id text, communication_consent boolean, created_at timestamp, updated_at timestamp ) CREATE TABLE hospitality_technology.reservations ( reservation_id character varying(64) NOT NULL, property_id character varying(64) NOT NULL, guest_id character varying(64) NOT NULL, room_id character varying(64), room_type_id character varying(64) NOT NULL, check_in_date date NOT NULL, check_out_date date NOT NULL, actual_check_in_ts timestamp with time zone, actual_check_out_ts timestamp with time zone, num_adults integer NOT NULL, num_children integer DEFAULT 0, status character varying(50) NOT NULL, booking_source character varying(100), rate_plan_id character varying(64), total_amount numeric(12, 2), amount_paid numeric(12, 2) DEFAULT 0.00, special_requests text, created_at timestamp with time zone NOT NULL DEFAULT current_timestamp, updated_at timestamp with time zone NOT NULL DEFAULT current_timestamp, PRIMARY KEY (reservation_id), FOREIGN KEY (property_id) REFERENCES hospitality_technology.properties(property_id), FOREIGN KEY (guest_id) REFERENCES hospitality_technology.guests(guest_id), FOREIGN KEY (room_id) REFERENCES hospitality_technology.rooms(room_id), FOREIGN KEY (room_type_id) REFERENCES hospitality_technology.room_types(room_type_id) ) CREATE TABLE hospitality_technology.staff ( staff_id text PRIMARY KEY, property_id text, first_name text, last_name text, position text, work_email text, work_phone text, hire_date date, termination_date date, is_active boolean, access_level int, manager_id text, created_at timestamp ) CREATE TABLE hospitality_technology.services ( service_id character varying(64) NOT NULL, property_id character varying(64) NOT NULL, service_name character varying(150) NOT NULL, description text, category character varying(100), price numeric(10, 2) NOT NULL, unit character varying(30), is_available boolean NOT NULL DEFAULT true, department character varying(100), PRIMARY KEY (service_id), FOREIGN KEY (property_id) REFERENCES hospitality_technology.properties(property_id) ) CREATE TABLE hospitality_technology.payments ( payment_id.text, reservation_id.text, guest_id.text, bill_id.text, amount.numeric, currency_code.text, payment_method.text, card_type.text, card_last_four.text, transaction_ref.text, payment_timestamp.timestamp, status.text, staff_id_processed.text, notes.text ) CREATE TABLE hospitality_technology.reviews ( review_id text PRIMARY KEY, property_id text, reservation_id text, guest_id text, rating_overall int, rating_cleanliness int, rating_service int, rating_location int, rating_value int, comment text, review_source text, review_date timestamp, is_public boolean, staff_response text, response_staff_id text, response_date timestamp )
[ { "role": "user", "content": "Show me all home loans (loan_id, principal_amount, interest_rate) where the current principal balance is more than 75% of the original principal amount, along with the account_id and employee details (first_name, last_name) of the employee who processed the loan application." ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.transactions ( transaction_id.text, account_id.text, related_account_id.text, transaction_type.text, amount.numeric, currency.text, transaction_date.timestamp, effective_date.date, description.text, status.text, reference_number.text ) CREATE TABLE financial_services.securities ( security_id.text, ticker_symbol.text, isin_code.text, cusip_code.text, security_name.text, security_type.text, exchange.text, currency.text, issuer_name.text, sector.text, last_updated.timestamp ) CREATE TABLE financial_services.market_data ( data_point_id.bigint, security_id.text, data_timestamp.timestamp, open_price.numeric, high_price.numeric, low_price.numeric, close_price.numeric, adjusted_close_price.numeric, volume.bigint, source.text ) CREATE TABLE financial_services.employees ( employee_id.text, first_name.text, last_name.text, job_title.text, department.text, branch_id.text, email.text, phone_extension.text, hire_date.date, termination_date.date, manager_id.text, status.text ) CREATE TABLE financial_services.loans ( loan_id.text, account_id.text, loan_type.text, principal_amount.numeric, current_principal_balance.numeric, interest_rate.numeric, term_months.integer, origination_date.date, maturity_date.date, monthly_payment.numeric, collateral_description.text, status.text )
[ { "role": "user", "content": "Show me the top 5 NFT collections with the highest floor price on Ethereum, along with their names and contract addresses, but only include collections with more than 5000 tokens." }, { "role": "assistant", "content": "SELECT nc.name, nc.contract_address, nc.floor_p...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE token_metas ( block_timestamp timestamp(6) NOT NULL, block_number bigint NOT NULL, transaction_hash varchar NOT NULL, transaction_index bigint NOT NULL, from_address varchar NOT NULL, contract_address varchar NOT NULL, symbol varchar NOT NULL, total_supply varchar NOT NULL, name varchar NOT NULL, decimals bigint NOT NULL, is_erc20 integer NOT NULL, is_erc721 integer NOT NULL, is_erc1155 integer NOT NULL, is_proxy integer NOT NULL, extra_info varchar NOT NULL, pk integer NOT NULL ) CREATE TABLE erc1155_approval_for_all ( block_number bigint NOT NULL, block_timestamp timestamp(3) NOT NULL, transaction_index integer NOT NULL, transaction_hash varchar(66) NOT NULL, log_index integer NOT NULL, contract_address varchar(42) NOT NULL ) CREATE TABLE erc20_balances ( block_number bigint NOT NULL, contract_address varchar NOT NULL, wallet_address varchar NOT NULL, amount varchar NOT NULL, pk varchar NOT NULL ) CREATE TABLE erc20_balances_historical ( block_number bigint NOT NULL, contract_address varchar NOT NULL, wallet_address varchar NOT NULL, amount varchar NOT NULL, pk integer NOT NULL ) CREATE TABLE nft_holders ( block_number bigint NOT NULL, contract_address varchar NOT NULL, wallet_address varchar NOT NULL, token_id varchar NOT NULL, contract_type varchar NOT NULL, amount varchar NOT NULL, pk varchar NOT NULL ) CREATE TABLE nft_holder_historical ( block_number bigint NOT NULL, contract_address varchar NOT NULL, wallet_address varchar NOT NULL, token_id varchar NOT NULL, contract_type varchar NOT NULL, amount varchar NOT NULL, pk integer NOT NULL ) CREATE TABLE sui_coins ( object_id varchar NOT NULL, status varchar NOT NULL, coin_type varchar NOT NULL, balance varchar NOT NULL, owner varchar NOT NULL ) CREATE TABLE sui_coins_metadata ( object_id varchar NOT NULL, coin_type varchar NOT NULL, status varchar NOT NULL, decimals bigint NOT NULL, description varchar NOT NULL, icon_url varchar NOT NULL, symbol varchar NOT NULL, name varchar NOT NULL ) CREATE TABLE sui_nfts ( object_id varchar NOT NULL, status varchar NOT NULL, collection_type varchar NOT NULL, package_id varchar NOT NULL, previous_transaction varchar NOT NULL, display varchar NOT NULL, owner varchar NOT NULL, name varchar NOT NULL ) CREATE TABLE nft_metadata ( blockchain varchar NOT NULL, contract_address varchar NOT NULL, token_id varchar NOT NULL, contract_name varchar NOT NULL, erc_type varchar NOT NULL, amount bigint NOT NULL, minter varchar NOT NULL, owner varchar NOT NULL, mint_block_number bigint NOT NULL, mint_time bigint NOT NULL, mint_transaction_hash varchar NOT NULL, mint_price varchar NOT NULL, token_uri varchar NOT NULL, metadata varchar NOT NULL, name varchar NOT NULL, image_uri varchar NOT NULL, traits varchar NOT NULL, updated_at bigint NOT NULL, status varchar NOT NULL, rarity_score real NOT NULL, rarity_rank integer NOT NULL, unique_attribute_count integer NOT NULL, pk integer NOT NULL ) CREATE TABLE nft_collections ( blockchain varchar NOT NULL, contract_address varchar NOT NULL, name varchar NOT NULL, symbol varchar NOT NULL, deploy_block_number bigint NOT NULL, deploy_block_time bigint NOT NULL, erc_type varchar NOT NULL, owner varchar NOT NULL, traits varchar NOT NULL, description varchar NOT NULL, slug varchar NOT NULL, media_info varchar NOT NULL, image_url varchar NOT NULL, banner_image_url varchar NOT NULL, updated_at bigint NOT NULL, banner varchar NOT NULL, token_count bigint NOT NULL, floor_price varchar NOT NULL, floor_price_symbol varchar NOT NULL, floor_price_contract varchar NOT NULL, pk integer NOT NULL ) CREATE TABLE token_prices ( uuid varchar(36) NOT NULL, blockchain varchar(36) NOT NULL, address varchar(42) NOT NULL, decimals bigint NOT NULL, symbol varchar(36) NOT NULL, price real NOT NULL, timestamp timestamp(6) NOT NULL ) CREATE TABLE token_prices_latest ( blockchain varchar(36) NOT NULL, address varchar(42) NOT NULL, decimals bigint NOT NULL, symbol varchar(36) NOT NULL, price real NOT NULL, timestamp timestamp(6) NOT NULL ) CREATE TABLE erc20_approval ( block_number bigint NOT NULL, block_timestamp timestamp(6) NOT NULL, transaction_index integer NOT NULL, transaction_hash varchar NOT NULL, log_index integer NOT NULL, contract_address varchar NOT NULL, pk integer NOT NULL ) CREATE TABLE token_balances ( block_number bigint NOT NULL, block_timestamp timestamp(3) NOT NULL, tick varchar NOT NULL, wallet_address varchar(42) NOT NULL, total_supply decimal(38,0) NOT NULL, amount decimal(38,0) NOT NULL ) CREATE TABLE token_info ( block_timestamp timestamp(3) NOT NULL, block_number bigint NOT NULL, tx_index integer NOT NULL, tx_hash varchar(66) NOT NULL, tick varchar NOT NULL, max_supply decimal(38,0) NOT NULL, lim decimal(38,0) NOT NULL, wlim decimal(38,0) NOT NULL, dec integer NOT NULL, creator varchar(42) NOT NULL ) CREATE TABLE token_info_bitcoin ( block_timestamp timestamp(3) NOT NULL, block_number bigint NOT NULL, tx_index integer NOT NULL, tx_hash varchar(66) NOT NULL, tick varchar(255) NOT NULL, max_supply decimal(38,0) NOT NULL, lim decimal(38,0) NOT NULL, wlim decimal(38,0) NOT NULL, dec integer NOT NULL, creator varchar(42) NOT NULL ) CREATE TABLE token_activities_bitcoin ( block_timestamp timestamp(3) NOT NULL, block_number bigint NOT NULL, tx_index integer NOT NULL, tx_hash varchar(66) NOT NULL, log_index integer NOT NULL, type varchar(20) NOT NULL, tick varchar(255) NOT NULL, id varchar(255) NOT NULL, amt decimal(38,0) NOT NULL, from_address varchar(62) NOT NULL, to_address varchar(62) NOT NULL ) CREATE TABLE token_activities_avalanche ( block_timestamp timestamp(3) NOT NULL, block_number bigint NOT NULL, tx_index integer NOT NULL, tx_hash varchar(66) NOT NULL, log_index integer NOT NULL, type varchar(20) NOT NULL, tick varchar(255) NOT NULL, id varchar(255) NOT NULL, amt decimal(38,0) NOT NULL, from_address varchar(42) NOT NULL, to_address varchar(42) NOT NULL ) CREATE TABLE token_balances_avalanche ( block_number bigint NOT NULL, block_timestamp timestamp(3) NOT NULL, tick varchar(20) NOT NULL, wallet_address varchar(42) NOT NULL, total_supply decimal(38,0) NOT NULL, amount decimal(38,0) NOT NULL ) CREATE TABLE token_info_avalanche ( block_timestamp timestamp(3) NOT NULL, block_number bigint NOT NULL, tx_index integer NOT NULL, tx_hash varchar(66) NOT NULL, tick varchar(20) NOT NULL, max_supply decimal(38,0) NOT NULL, lim decimal(38,0) NOT NULL, wlim decimal(38,0) NOT NULL, dec integer NOT NULL, creator varchar(42) NOT NULL, minted decimal(38,0) NOT NULL, holders decimal(38,0) NOT NULL, txs decimal(38,0) NOT NULL, updated_timestamp timestamp(3) NOT NULL, completed_timestamp timestamp(3) NOT NULL, id varchar(255) NOT NULL )
[ { "role": "user", "content": "Show me all active managers along with their property IDs and the number of staff members they supervise, ordered by the number of supervised staff in descending order." }, { "role": "assistant", "content": "SELECT s.staff_id, s.property_id, s.first_name, s.last_nam...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.staff ( staff_id character varying(64) NOT NULL, -- unique identifier for the staff member property_id character varying(64) NOT NULL, -- FK to properties table (primary property) first_name character varying(100) NOT NULL, last_name character varying(100) NOT NULL, position character varying(100) NOT NULL, -- e.g., Front Desk Agent, Housekeeper, Manager, Concierge work_email character varying(255) UNIQUE, -- staff member's work email work_phone character varying(30), hire_date date NOT NULL, termination_date date, -- date employment ended (if applicable) is_active boolean NOT NULL DEFAULT true, -- currently employed flag access_level integer NOT NULL, -- permission level within systems (e.g., 1=basic, 5=admin) manager_id character varying(64), -- FK to staff table (self-referencing for supervisor) 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) )
[ { "role": "user", "content": "Count the number of registered citizens by gender." }, { "role": "assistant", "content": "SELECT\n gender,\n COUNT(*) AS citizen_count\nFROM government_services.citizens\nGROUP BY gender;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id character varying(64) NOT NULL, national_id_number character varying(128) NOT NULL UNIQUE, first_name character varying(100) NOT NULL, last_name character varying(100) NOT NULL, date_of_birth date NOT NULL, gender character varying(20), primary_address text NOT NULL, contact_email character varying(128) UNIQUE, contact_phone character varying(32), registration_date timestamp NOT NULL, is_verified boolean DEFAULT false, PRIMARY KEY (citizen_id) ) CREATE TABLE government_services.payments ( payment_id character varying(64) NOT NULL, application_id character varying(64), citizen_id character varying(64) NOT NULL, service_id character varying(64), amount numeric(12, 2) NOT NULL, currency character varying(3) NOT NULL DEFAULT 'USD', payment_method character varying(50), payment_provider_reference character varying(128), payment_timestamp timestamp NOT NULL, status character varying(30) NOT NULL, notes text, PRIMARY KEY (payment_id) ) CREATE TABLE government_services.employees ( employee_id character varying(64) NOT NULL, agency_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name character varying(100) NOT NULL, job_title character varying(150) NOT NULL, department character varying(100), work_email character varying(128) NOT NULL UNIQUE, work_phone character varying(32), hire_date date NOT NULL, termination_date date, access_level character varying(50), manager_employee_id character varying(64), PRIMARY KEY (employee_id) ) CREATE TABLE government_services.service_locations ( location_id character varying(64) NOT NULL, agency_id character varying(64) NOT NULL, location_name character varying(200), address text NOT NULL, city character varying(100), state character varying(50), postal_code character varying(20), latitude numeric(9, 6), longitude numeric(9, 6), operating_hours text, contact_phone character varying(32), is_accessible boolean, PRIMARY KEY (location_id) ) CREATE TABLE government_services.appointments ( appointment_id character varying(64) NOT NULL, citizen_id character varying(64) NOT NULL, employee_id character varying(64), location_id character varying(64), service_id character varying(64), scheduled_start_time timestamp NOT NULL, scheduled_end_time timestamp, purpose text NOT NULL, status character varying(30) NOT NULL, booking_method character varying(50), created_at timestamp NOT NULL, notes text, PRIMARY KEY (appointment_id) ) CREATE TABLE government_services.notifications ( notification_id character varying(64) NOT NULL, citizen_id character varying(64) NOT NULL, application_id character varying(64), message_subject character varying(255), message_body text NOT NULL, channel character varying(30) NOT NULL, sent_at timestamp NOT NULL, status character varying(30) NOT NULL, related_entity_type character varying(50), related_entity_id character varying(64), PRIMARY KEY (notification_id) )
[ { "role": "user", "content": "Count the total number of unique insurance providers in the system." }, { "role": "assistant", "content": "SELECT COUNT(DISTINCT insurance_provider) FROM healthcare.insurance_plans;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.insurance_plans ( plan_id.text, plan_name.text, insurance_provider.text, plan_type.text, contact_phone.text, website.text )
[ { "role": "user", "content": "List all posts where the content mentions 'meeting'." }, { "role": "assistant", "content": "SELECT post_id, user_id, content, created_at FROM social_media.posts WHERE content LIKE '%meeting%'" }, { "role": "user", "content": "Also, only include those pos...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.posts ( post_id text PRIMARY KEY, user_id text, content text, media_url text, media_type text, created_at timestamp, updated_at timestamp, visibility text, location_lat numeric, location_lon numeric )
[ { "role": "user", "content": "List all ERC20 tokens with their names and symbols where the price is greater than $100, sorted by price in descending order." }, { "role": "assistant", "content": "SELECT scm.name, scm.symbol, tpl.price FROM sui_coins_metadata scm JOIN token_prices_latest tpl ON sc...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE nft_holder_historical ( block_number.bigint, contract_address.text, wallet_address.text, token_id.text, contract_type.text, amount.text, pk.integer ) CREATE TABLE sui_coins_metadata ( object_id.text, coin_type.text, status.text, decimals.bigint, description.text, icon_url.text, symbol.text, name.text ) CREATE TABLE sui_nfts ( object_id.text, status.text, collection_type.text, package_id.text, previous_transaction.text, display.text, owner.text, name.text ) CREATE TABLE nft_metadata ( blockchain.text, contract_address.text, token_id.text, contract_name.text, erc_type.text, amount.bigint, minter.text, owner.text, mint_block_number.bigint, mint_time.bigint, mint_transaction_hash.text, mint_price.text, token_uri.text, metadata.text, name.text, image_uri.text, traits.text, updated_at.bigint, status.text, rarity_score.real, rarity_rank.integer, unique_attribute_count.integer, pk.integer ) CREATE TABLE token_prices_latest ( blockchain.text, address.text, decimals.bigint, symbol.text, price.real, timestamp.timestamp ) CREATE TABLE erc20_approval ( block_number.bigint, block_timestamp.timestamp, transaction_index.integer, transaction_hash.text, log_index.integer, contract_address.text, pk.integer ) CREATE TABLE token_activities ( block_timestamp.timestamp, block_number.bigint, tx_index.integer, tx_hash.text, log_index.integer, type.text, tick.text, id.text, amt.decimal, from_address.text, to_address.text ) CREATE TABLE token_info_bitcoin ( block_timestamp.timestamp, block_number.bigint, tx_index.integer, tx_hash.text, tick.text, max_supply.decimal, lim.decimal, wlim.decimal, dec.integer, creator.text ) CREATE TABLE token_activities_avalanche ( block_timestamp.timestamp, block_number.bigint, tx_index.integer, tx_hash.text, log_index.integer, type.text, tick.text, id.text, amt.decimal, from_address.text, to_address.text ) CREATE TABLE token_balances_avalanche ( block_number.bigint, block_timestamp.timestamp, tick.text, wallet_address.text, total_supply.decimal, amount.decimal ) CREATE TABLE token_info_avalanche ( block_timestamp.timestamp, block_number.bigint, tx_index.integer, tx_hash.text, tick.text, max_supply.decimal, lim.decimal, wlim.decimal, dec.integer, creator.text, minted.decimal, holders.decimal, txs.decimal, updated_timestamp.timestamp, completed_timestamp.timestamp, id.text )
[ { "role": "user", "content": "For each user, show their username and the timestamp of their most recent notification. Include users who have never received notifications." }, { "role": "assistant", "content": "SELECT T1.username, max(T2.sent_at) FROM users AS T1 LEFT JOIN trading_platform.notifi...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.notifications ( notification_id.text, user_id.text, message.text, sent_at.timestamp, read_at.timestamp )
[ { "role": "user", "content": "Show me all cryptocurrency assets that have been traded more than 50 times but have never been traded in quantities greater than 100, along with their average trade price." }, { "role": "assistant", "content": "SELECT a.asset_id, a.name, a.symbol, COUNT(t.trade_id) ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.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) ) CREATE TABLE trading_platform.wallets ( wallet_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, address character varying(128) NOT NULL, private_key text NOT NULL, created_at timestamp NOT NULL, PRIMARY KEY (wallet_id) ) CREATE TABLE trading_platform.orders ( order_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, wallet_id character varying(64) NOT NULL, asset_id character varying(64) NOT NULL, order_type character varying(32) NOT NULL, quantity numeric(38,14) NOT NULL, price numeric(38,14) NOT NULL, status character varying(32) NOT NULL, created_at timestamp NOT NULL, PRIMARY KEY (order_id) ) CREATE TABLE trading_platform.trades ( trade_id character varying(64) NOT NULL, order_id character varying(64) NOT NULL, buyer_id character varying(64) NOT NULL, seller_id character varying(64) NOT NULL, asset_id character varying(64) NOT NULL, quantity numeric(38,14) NOT NULL, price numeric(38,14) NOT NULL, traded_at timestamp NOT NULL, PRIMARY KEY (trade_id) ) CREATE TABLE trading_platform.assets ( asset_id character varying(64) NOT NULL, name character varying(128) NOT NULL, symbol character varying(32) NOT NULL, type character varying(32) NOT NULL, PRIMARY KEY (asset_id) ) CREATE TABLE trading_platform.utxos ( utxo_id character varying(64) NOT NULL, transaction_id character varying(64) NOT NULL, output_index integer NOT NULL, address character varying(128) NOT NULL, amount numeric(38,14) NOT NULL, spent boolean NOT NULL, PRIMARY KEY (utxo_id) ) CREATE TABLE trading_platform.dapps ( dapp_id character varying(64) NOT NULL, name character varying(128) NOT NULL, description text NOT NULL, url character varying(256) NOT NULL, PRIMARY KEY (dapp_id) ) CREATE TABLE trading_platform.peers ( peer_id character varying(64) NOT NULL, ip_address character varying(15) NOT NULL, port integer NOT NULL, last_seen timestamp NOT NULL, PRIMARY KEY (peer_id) ) CREATE TABLE trading_platform.metadata ( metadata_id character varying(64) NOT NULL, asset_id character varying(64) NOT NULL, key character varying(128) NOT NULL, value text NOT NULL, PRIMARY KEY (metadata_id) ) CREATE TABLE trading_platform.kyc_audit ( kyc_audit_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, status character varying(32) NOT NULL, reviewed_at timestamp NOT NULL, PRIMARY KEY (kyc_audit_id) ) CREATE TABLE trading_platform.notifications ( notification_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, message text NOT NULL, sent_at timestamp NOT NULL, read_at timestamp, PRIMARY KEY (notification_id) )
[ { "role": "user", "content": "For each player, list the total number of 'Legendary' rarity items they have in their inventory, along with the titles of the respective games those items belong to." }, { "role": "assistant", "content": "SELECT pi.player_id, g.game_id, g.title, COUNT(*) AS legendar...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.game_sessions ( session_id uuid PRIMARY KEY, player_id uuid, game_id uuid, server_id uuid, start_time timestamptz, end_time timestamptz, duration_seconds int, score int, session_data jsonb ) CREATE TABLE gaming_technology.servers ( server_id.uuid, game_id.uuid, server_name.text, region.text, ip_address.text, port.integer, current_players.integer, max_players.integer, status.text, last_heartbeat.timestamptz ) CREATE TABLE gaming_technology.player_achievements ( player_achievement_id uuid NOT NULL DEFAULT gen_random_uuid(), player_id uuid NOT NULL, achievement_id uuid NOT NULL, unlocked_at timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (player_achievement_id), UNIQUE (player_id, achievement_id) ) CREATE TABLE gaming_technology.in_game_items ( item_id uuid, game_id uuid, item_name text, item_type text, description text, rarity text, cost_currency text, cost_amount numeric, attributes jsonb )
[ { "role": "user", "content": "Find all medical records where the vitals JSON field contains a blood pressure reading with systolic higher than 140, and show the patient_id, record_date, and vitals." }, { "role": "assistant", "content": "SELECT patient_id, record_date, vitals FROM healthcare.medi...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.medical_records ( record_id character varying(64) NOT NULL, -- unique identifier for the medical record entry patient_id character varying(64) NOT NULL, -- FK to patients table appointment_id character varying(64) UNIQUE, -- FK to appointments table (can be null if record not tied to specific appt) doctor_id character varying(64) NOT NULL, -- FK to doctors table (doctor creating the record) record_date timestamp with time zone NOT NULL, -- date the record/observation was made chief_complaint text, -- patient's primary reason for visit present_illness_history text, -- detailed history of the current issue past_medical_history text, -- relevant past conditions/surgeries physical_examination_notes text, -- findings from the physical exam assessment text, -- doctor's assessment/diagnosis summary treatment_plan text, -- planned course of action vitals jsonb, -- store vitals like BP, HR, Temp as structured JSON created_at timestamp with time zone NOT NULL DEFAULT current_timestamp, PRIMARY KEY (record_id) )
[ { "role": "user", "content": "Show me the top 5 games by number of online servers in European regions. I want the game title and the server count." }, { "role": "assistant", "content": "SELECT g.title, COUNT(s.server_id) AS server_count\nFROM gaming_technology.games g\nJOIN gaming_technology.ser...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.players ( player_id uuid PRIMARY KEY, username text, email text, password_hash text, registration_date timestamptz, last_login timestamptz, country_code text, status text, profile_data jsonb ) CREATE TABLE gaming_technology.games ( game_id uuid PRIMARY KEY, title text, developer_id uuid, publisher_id uuid, genre text, release_date date, description text, platform text, engine text, website text ) CREATE TABLE gaming_technology.servers ( server_id uuid PRIMARY KEY, game_id uuid, server_name text, region text, ip_address text, port int, current_players int, max_players int, status text, last_heartbeat timestamptz ) CREATE TABLE gaming_technology.achievements ( achievement_id uuid PRIMARY KEY, game_id uuid, name text, description text, icon_url text, points int, hidden boolean ) CREATE TABLE gaming_technology.player_achievements ( player_achievement_id uuid PRIMARY KEY, player_id uuid, achievement_id uuid, unlocked_at timestamptz ) CREATE TABLE gaming_technology.in_game_items ( item_id uuid PRIMARY KEY, game_id uuid, item_name text, item_type text, description text, rarity text, cost_currency text, cost_amount numeric, attributes jsonb ) CREATE TABLE gaming_technology.player_inventory ( inventory_id uuid PRIMARY KEY, player_id uuid, item_id uuid, quantity int, acquired_at timestamptz, instance_data jsonb )
[ { "role": "user", "content": "Show me all events emitted by contracts where the event name contains 'Approval', along with the contract ID and transaction ID, sorted by emitted timestamp in descending order." }, { "role": "assistant", "content": "SELECT event_id, contract_id, event_name, transac...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.events ( event_id character varying(64) NOT NULL, -- unique identifier for the event contract_id character varying(64) NOT NULL, -- identifier of the contract emitting the event event_name character varying(128) NOT NULL, -- name of the event data text NOT NULL, -- data payload of the event emitted_at timestamp NOT NULL, -- time when the event was emitted transaction_id character varying(64) NOT NULL, -- identifier of the transaction that triggered the event log_index integer NOT NULL, -- index of the event log in the transaction PRIMARY KEY (event_id) )
[ { "role": "user", "content": "Give me the total number of reservations and the sum of total_amount by month for the year 2023." }, { "role": "assistant", "content": "SELECT DATE_TRUNC('month', check_in_date) AS month,\n COUNT(*) AS reservation_count,\n SUM(tot...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.reservations ( reservation_id text PRIMARY KEY, property_id text, guest_id text, room_id text, room_type_id text, check_in_date date, check_out_date date, actual_check_in_ts timestamp, actual_check_out_ts timestamp, num_adults int, num_children int, status text, booking_source text, rate_plan_id text, total_amount numeric, amount_paid numeric, special_requests text, created_at timestamp, updated_at timestamp )
[ { "role": "user", "content": "Show me the top 5 ERC20 tokens with the highest total supply, along with their names and contract addresses, but only include tokens where the price is greater than $0.10." }, { "role": "assistant", "content": "SELECT tm.name, tm.contract_address, tm.total_supply FR...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE token_metas ( block_timestamp timestamp(6) NOT NULL, block_number bigint NOT NULL, transaction_hash varchar NOT NULL, transaction_index bigint NOT NULL, from_address varchar NOT NULL, contract_address varchar NOT NULL, symbol varchar NOT NULL, total_supply varchar NOT NULL, name varchar NOT NULL, decimals bigint NOT NULL, is_erc20 integer NOT NULL, is_erc721 integer NOT NULL, is_erc1155 integer NOT NULL, is_proxy integer NOT NULL, extra_info varchar NOT NULL, pk integer NOT NULL ) CREATE TABLE erc1155_approval_for_all ( block_number bigint NOT NULL, block_timestamp timestamp(3) NOT NULL, transaction_index integer NOT NULL, transaction_hash varchar(66) NOT NULL, log_index integer NOT NULL, contract_address varchar(42) NOT NULL ) CREATE TABLE erc20_balances ( block_number bigint NOT NULL, contract_address varchar NOT NULL, wallet_address varchar NOT NULL, amount varchar NOT NULL, pk varchar NOT NULL ) CREATE TABLE erc20_balances_historical ( block_number bigint NOT NULL, contract_address varchar NOT NULL, wallet_address varchar NOT NULL, amount varchar NOT NULL, pk integer NOT NULL ) CREATE TABLE nft_holders ( block_number bigint NOT NULL, contract_address varchar NOT NULL, wallet_address varchar NOT NULL, token_id varchar NOT NULL, contract_type varchar NOT NULL, amount varchar NOT NULL, pk varchar NOT NULL ) CREATE TABLE nft_holder_historical ( block_number bigint NOT NULL, contract_address varchar NOT NULL, wallet_address varchar NOT NULL, token_id varchar NOT NULL, contract_type varchar NOT NULL, amount varchar NOT NULL, pk integer NOT NULL ) CREATE TABLE sui_coins ( object_id varchar NOT NULL, status varchar NOT NULL, coin_type varchar NOT NULL, balance varchar NOT NULL, owner varchar NOT NULL ) CREATE TABLE sui_coins_metadata ( object_id varchar NOT NULL, coin_type varchar NOT NULL, status varchar NOT NULL, decimals bigint NOT NULL, description varchar NOT NULL, icon_url varchar NOT NULL, symbol varchar NOT NULL, name varchar NOT NULL ) CREATE TABLE sui_nfts ( object_id varchar NOT NULL, status varchar NOT NULL, collection_type varchar NOT NULL, package_id varchar NOT NULL, previous_transaction varchar NOT NULL, display varchar NOT NULL, owner varchar NOT NULL, name varchar NOT NULL ) CREATE TABLE nft_metadata ( blockchain varchar NOT NULL, contract_address varchar NOT NULL, token_id varchar NOT NULL, contract_name varchar NOT NULL, erc_type varchar NOT NULL, amount bigint NOT NULL, minter varchar NOT NULL, owner varchar NOT NULL, mint_block_number bigint NOT NULL, mint_time bigint NOT NULL, mint_transaction_hash varchar NOT NULL, mint_price varchar NOT NULL, token_uri varchar NOT NULL, metadata varchar NOT NULL, name varchar NOT NULL, image_uri varchar NOT NULL, traits varchar NOT NULL, updated_at bigint NOT NULL, status varchar NOT NULL, rarity_score real NOT NULL, rarity_rank integer NOT NULL, unique_attribute_count integer NOT NULL, pk integer NOT NULL ) CREATE TABLE nft_collections ( blockchain varchar NOT NULL, contract_address varchar NOT NULL, name varchar NOT NULL, symbol varchar NOT NULL, deploy_block_number bigint NOT NULL, deploy_block_time bigint NOT NULL, erc_type varchar NOT NULL, owner varchar NOT NULL, traits varchar NOT NULL, description varchar NOT NULL, slug varchar NOT NULL, media_info varchar NOT NULL, image_url varchar NOT NULL, banner_image_url varchar NOT NULL, updated_at bigint NOT NULL, banner varchar NOT NULL, token_count bigint NOT NULL, floor_price varchar NOT NULL, floor_price_symbol varchar NOT NULL, floor_price_contract varchar NOT NULL, pk integer NOT NULL ) CREATE TABLE token_prices ( uuid varchar(36) NOT NULL, blockchain varchar(36) NOT NULL, address varchar(42) NOT NULL, decimals bigint NOT NULL, symbol varchar(36) NOT NULL, price real NOT NULL, timestamp timestamp(6) NOT NULL ) CREATE TABLE token_prices_latest ( blockchain varchar(36) NOT NULL, address varchar(42) NOT NULL, decimals bigint NOT NULL, symbol varchar(36) NOT NULL, price real NOT NULL, timestamp timestamp(6) NOT NULL ) CREATE TABLE erc20_approval ( block_number bigint NOT NULL, block_timestamp timestamp(6) NOT NULL, transaction_index integer NOT NULL, transaction_hash varchar NOT NULL, log_index integer NOT NULL, contract_address varchar NOT NULL, pk integer NOT NULL ) CREATE TABLE token_balances ( block_number bigint NOT NULL, block_timestamp timestamp(3) NOT NULL, tick varchar NOT NULL, wallet_address varchar(42) NOT NULL, total_supply decimal(38,0) NOT NULL, amount decimal(38,0) NOT NULL ) CREATE TABLE token_info ( block_timestamp timestamp(3) NOT NULL, block_number bigint NOT NULL, tx_index integer NOT NULL, tx_hash varchar(66) NOT NULL, tick varchar NOT NULL, max_supply decimal(38,0) NOT NULL, lim decimal(38,0) NOT NULL, wlim decimal(38,0) NOT NULL, dec integer NOT NULL, creator varchar(42) NOT NULL ) CREATE TABLE token_activities ( block_timestamp timestamp(3) NOT NULL, block_number bigint NOT NULL, tx_index integer NOT NULL, tx_hash varchar(66) NOT NULL, log_index integer NOT NULL, type varchar NOT NULL, tick varchar NOT NULL, id varchar(255) NOT NULL, amt decimal(38,0) NOT NULL, from_address varchar(42) NOT NULL, to_address varchar(42) NOT NULL ) CREATE TABLE mud_holesky_redstone ( address varchar NOT NULL, table_id varchar NOT NULL, key_bytes varchar NOT NULL, key0 varchar NOT NULL, key1 varchar NOT NULL, static_data varchar NOT NULL, encoded_lengths varchar NOT NULL, dynamic_data varchar NOT NULL, is_deleted boolean NOT NULL, block_number bigint NOT NULL, log_index bigint NOT NULL ) CREATE TABLE token_balances_bitcoin ( block_number bigint NOT NULL, block_timestamp timestamp(3) NOT NULL, tick varchar(255) NOT NULL, wallet_address varchar(42) NOT NULL, total_supply varchar NOT NULL, amount varchar NOT NULL ) CREATE TABLE token_activities_bitcoin ( block_timestamp timestamp(3) NOT NULL, block_number bigint NOT NULL, tx_index integer NOT NULL, tx_hash varchar(66) NOT NULL, log_index integer NOT NULL, type varchar(20) NOT NULL, tick varchar(255) NOT NULL, id varchar(255) NOT NULL, amt decimal(38,0) NOT NULL, from_address varchar(62) NOT NULL, to_address varchar(62) NOT NULL ) CREATE TABLE token_activities_avalanche ( block_timestamp timestamp(3) NOT NULL, block_number bigint NOT NULL, tx_index integer NOT NULL, tx_hash varchar(66) NOT NULL, log_index integer NOT NULL, type varchar(20) NOT NULL, tick varchar(255) NOT NULL, id varchar(255) NOT NULL, amt decimal(38,0) NOT NULL, from_address varchar(42) NOT NULL, to_address varchar(42) NOT NULL ) CREATE TABLE token_balances_avalanche ( block_number bigint NOT NULL, block_timestamp timestamp(3) NOT NULL, tick varchar(20) NOT NULL, wallet_address varchar(42) NOT NULL, total_supply decimal(38,0) NOT NULL, amount decimal(38,0) NOT NULL ) CREATE TABLE token_info_avalanche ( block_timestamp timestamp(3) NOT NULL, block_number bigint NOT NULL, tx_index integer NOT NULL, tx_hash varchar(66) NOT NULL, tick varchar(20) NOT NULL, max_supply decimal(38,0) NOT NULL, lim decimal(38,0) NOT NULL, wlim decimal(38,0) NOT NULL, dec integer NOT NULL, creator varchar(42) NOT NULL, minted decimal(38,0) NOT NULL, holders decimal(38,0) NOT NULL, txs decimal(38,0) NOT NULL, updated_timestamp timestamp(3) NOT NULL, completed_timestamp timestamp(3) NOT NULL, id varchar(255) NOT NULL )
[ { "role": "user", "content": "What is the history of incidents or accidents that occurred on platform 5 at station GHI?" }, { "role": "assistant", "content": "I'm sorry, but I can't provide information about the history of incidents or accidents on platform 5 at station GHI. My data is limited t...
You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE train_station_management.platforms ( platform_id.text, station_id.text, platform_number.text, track_number.text, status.text, length_meters.numeric, accessible.boolean )
[ { "role": "user", "content": "Show me all wallet addresses that hold more than 1000 of any ERC1155 token, along with the token ID and contract address." }, { "role": "assistant", "content": "SELECT wallet_address, token_id, contract_address FROM nft_holders WHERE contract_type = 'ERC1155' AND CA...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE token_metas ( block_timestamp timestamp(6) NOT NULL, -- Timestamp of the block when token metadata was recorded block_number bigint NOT NULL, -- Block number uniquely identifying the block transaction_hash varchar NOT NULL, -- Hash value of the transaction transaction_index bigint NOT NULL, -- Index of the transaction within the block from_address varchar NOT NULL, -- Address from which the transaction originated contract_address varchar NOT NULL, -- Address of the token contract symbol varchar NOT NULL, -- Symbol of the token total_supply varchar NOT NULL, -- erc20 contract total supply name varchar NOT NULL, -- Name of the token decimals bigint NOT NULL, -- Number of decimal places for the token is_erc20 integer NOT NULL, -- Flag indicating if the token is an ERC-20 token (0 or 1) is_erc721 integer NOT NULL, -- Flag indicating if the token is an ERC-721 token (0 or 1) is_erc1155 integer NOT NULL, -- Flag indicating if the token is an ERC-1155 token (0 or 1) is_proxy integer NOT NULL, -- Flag indicating if the token is a proxy (0 or 1) extra_info varchar NOT NULL, -- Additional information about the token pk integer NOT NULL -- Partition key for the table(floor(block_number / 5760)) ) CREATE TABLE erc1155_approval_for_all ( block_number bigint NOT NULL, -- Block number containing the transaction block_timestamp timestamp(3) NOT NULL, -- Timestamp of the block containing the transaction transaction_index integer NOT NULL, -- Index of the transaction within the block transaction_hash varchar(66) NOT NULL, -- Transaction hash log_index integer NOT NULL, -- Log index contract_address varchar(42) NOT NULL -- Event contract address ) CREATE TABLE erc20_balances ( block_number bigint NOT NULL, contract_address varchar NOT NULL, wallet_address varchar NOT NULL, amount varchar NOT NULL, pk varchar NOT NULL ) CREATE TABLE erc20_balances_historical ( block_number bigint NOT NULL, contract_address varchar NOT NULL, wallet_address varchar NOT NULL, amount varchar NOT NULL, pk integer NOT NULL ) CREATE TABLE nft_holders ( block_number bigint NOT NULL, -- Block number containing the transaction contract_address varchar NOT NULL, -- Event contract address wallet_address varchar NOT NULL, -- The wallet address for the contract(with bloom filter) token_id varchar NOT NULL, -- NFT token id contract_type varchar NOT NULL, -- NFT contract type amount varchar NOT NULL, -- Number of held NFTs pk varchar NOT NULL -- The last string partition of the contract. ) CREATE TABLE sui_coins ( object_id varchar NOT NULL, status varchar NOT NULL, coin_type varchar NOT NULL, balance varchar NOT NULL, owner varchar NOT NULL ) CREATE TABLE sui_nfts ( object_id text, status text, collection_type text, package_id text, previous_transaction text, display text, owner text, name text ) CREATE TABLE nft_metadata ( blockchain text, contract_address text, token_id text, contract_name text, erc_type text, amount bigint, minter text, owner text, mint_block_number bigint, mint_time bigint, mint_transaction_hash text, mint_price text, token_uri text, metadata text, name text, image_uri text, traits text, updated_at bigint, status text, rarity_score real, rarity_rank integer, unique_attribute_count integer, pk integer ) CREATE TABLE erc20_approval ( block_number bigint, block_timestamp timestamp, transaction_index integer, transaction_hash text, log_index integer, contract_address text, pk integer ) CREATE TABLE token_info ( block_timestamp timestamp(3) NOT NULL, -- Timestamp of the block containing the inscription (matches block_timestamp in transactions table) block_number bigint NOT NULL, -- Block number containing the inscription (matches block_number in transactions table) tx_index integer NOT NULL, -- Index of the transaction containing the inscription (matches transaction_index in transactions table) tx_hash varchar(66) NOT NULL, -- Unique identifier of the transaction containing the inscription (matches hash in transactions table) tick varchar NOT NULL, -- Token tick max_supply decimal(38,0) NOT NULL, -- Max supply lim decimal(38,0) NOT NULL, -- Limit of each mint wlim decimal(38,0) NOT NULL, -- Limit of each address can maximum mint dec integer NOT NULL, -- Decimal for minimum divie creator varchar(42) NOT NULL -- Address originating the inscription (matches from_address in transactions table) ) CREATE TABLE token_activities ( block_timestamp timestamp(3) NOT NULL, -- Timestamp of the block containing the inscription (matches block_timestamp in transactions table) block_number bigint NOT NULL, -- Block number containing the inscription (matches block_number in transactions table) tx_index integer NOT NULL, -- Index of the transaction containing the inscription (matches transaction_index in transactions table) tx_hash varchar(66) NOT NULL, -- Unique identifier of the transaction containing the inscription (matches hash in transactions table) log_index integer NOT NULL, -- Index of the log within the transaction type varchar NOT NULL, -- mint | transfer | burn tick varchar NOT NULL, -- Token tick id varchar(255) NOT NULL, -- Unique identifier of the inscription amt decimal(38,0) NOT NULL, -- Mint amount from_address varchar(42) NOT NULL, -- Address sending the inscription (matches from_address in transactions table) to_address varchar(42) NOT NULL -- Address receiving the inscription (match to_address in transactions table) ) CREATE TABLE token_activities_bitcoin ( block_timestamp timestamp, block_number bigint, tx_index integer, tx_hash text, log_index integer, type text, tick text, id text, amt decimal, from_address text, to_address text ) CREATE TABLE token_activities_avalanche ( block_timestamp.timestamp, block_number.bigint, tx_index.integer, tx_hash.text, log_index.integer, type.text, tick.text, id.text, amt.decimal, from_address.text, to_address.text )
[ { "role": "user", "content": "For each group chat, can you show me each participant's username and the date they joined the chat?" }, { "role": "assistant", "content": "SELECT u.username, c.group_name, cp.joined_at\nFROM social_media.conversation_participants cp\nJOIN social_media.users u ON cp....
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url text, bio text, location text, created_at timestamp, updated_at timestamp, is_verified boolean ) CREATE TABLE social_media.posts ( post_id text, user_id text, content text, media_url text, media_type text, created_at timestamp, updated_at timestamp, visibility text, location_lat numeric, location_lon numeric ) CREATE TABLE social_media.comments ( comment_id text, post_id text, user_id text, parent_comment_id text, content text, created_at timestamp, updated_at timestamp ) CREATE TABLE social_media.follows ( follow_id text, follower_user_id text, following_user_id text, created_at timestamp ) CREATE TABLE social_media.post_hashtags ( post_hashtag_id text, post_id text, hashtag_id text ) CREATE TABLE social_media.messages ( message_id text, conversation_id text, sender_user_id text, content text, media_url text, media_type text, sent_at timestamp, read_at timestamp ) CREATE TABLE social_media.conversation_participants ( participant_id text, conversation_id text, user_id text, joined_at timestamp, last_read_at timestamp ) CREATE TABLE social_media.notifications ( notification_id text, recipient_user_id text, sender_user_id text, notification_type text, target_entity_id text, target_entity_type text, created_at timestamp, read_at timestamp ) CREATE TABLE social_media.user_settings ( setting_id text, user_id text, theme text, email_notifications_enabled boolean, push_notifications_enabled boolean, private_profile boolean, updated_at timestamp )
[ { "role": "user", "content": "Show all likes made by user 'U555' on comments, including the comment_id and like creation time." }, { "role": "assistant", "content": "SELECT like_id, comment_id, created_at\nFROM social_media.likes\nWHERE user_id = 'U555' AND comment_id IS NOT NULL;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.posts ( post_id.text, user_id.text, content.text, media_url.text, media_type.text, created_at.timestamp, updated_at.timestamp, visibility.text, location_lat.numeric, location_lon.numeric ) CREATE TABLE social_media.likes ( like_id.text, user_id.text, post_id.text, comment_id.text, created_at.timestamp ) CREATE TABLE social_media.hashtags ( hashtag_id text, tag_name text, created_at timestamp ) CREATE TABLE social_media.post_hashtags ( post_hashtag_id text, post_id text, hashtag_id text ) CREATE TABLE social_media.conversation_participants ( participant_id character varying(64) NOT NULL, conversation_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, joined_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, last_read_at timestamp, PRIMARY KEY (participant_id), CONSTRAINT unique_user_conversation UNIQUE (conversation_id, user_id) ) CREATE TABLE social_media.notifications ( notification_id character varying(64) NOT NULL, -- unique identifier for the notification recipient_user_id character varying(64) NOT NULL, -- user receiving the notification (FK to users.user_id) sender_user_id character varying(64), -- user triggering the notification (FK to users.user_id, can be null for system notifications) notification_type character varying(30) NOT NULL, -- type of notification ('like', 'comment', 'follow', 'mention', 'message') target_entity_id character varying(64), -- ID of the related entity (post_id, comment_id, user_id, conversation_id) target_entity_type character varying(20), -- type of the related entity ('post', 'comment', 'user', 'conversation') created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp notification was created read_at timestamp, -- timestamp notification was marked as read PRIMARY KEY (notification_id) )
[ { "role": "user", "content": "List the names of citizens who have submitted applications for services with a standard fee greater than 50." }, { "role": "assistant", "content": "SELECT DISTINCT T1.first_name, T1.last_name FROM government_services.citizens AS T1 JOIN government_services.applicati...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id text, national_id_number text, first_name text, last_name text, date_of_birth date, gender text, primary_address text, contact_email text, contact_phone text, registration_date timestamp, is_verified boolean ) CREATE TABLE government_services.services ( service_id character varying(64) NOT NULL, -- unique identifier for the service agency_id character varying(64) NOT NULL, -- FK to agencies table service_name character varying(255) NOT NULL, -- name of the service (e.g., Driver's License Renewal) description text, category character varying(100), -- e.g., Licensing, Benefits, Taxation, Permits eligibility_criteria text, -- description of who is eligible standard_fee numeric(10, 2) DEFAULT 0.00, -- typical fee for the service average_processing_time_days integer, -- estimated processing time is_active boolean DEFAULT true, -- whether the service is currently offered online_application_url character varying(255), PRIMARY KEY (service_id) ) CREATE TABLE government_services.applications ( application_id text, citizen_id text, service_id text, submitted_at timestamp, status text, last_updated_at timestamp, assigned_employee_id text, decision_date date, notes text, reference_number text ) CREATE TABLE government_services.payments ( payment_id text PRIMARY KEY, application_id text, citizen_id text, service_id text, amount numeric, currency text, payment_method text, payment_provider_reference text, payment_timestamp timestamp, status text, notes text ) CREATE TABLE government_services.employees ( employee_id text, agency_id text, first_name text, last_name text, job_title text, department text, work_email text, work_phone text, hire_date date, termination_date date, access_level text, manager_employee_id text ) CREATE TABLE government_services.service_locations ( location_id character varying(64) NOT NULL, agency_id character varying(64) NOT NULL, location_name character varying(200), address text NOT NULL, city character varying(100), state character varying(50), postal_code character varying(20), latitude numeric(9, 6), longitude numeric(9, 6), operating_hours text, contact_phone character varying(32), is_accessible boolean, PRIMARY KEY (location_id) ) CREATE TABLE government_services.appointments ( appointment_id.text, citizen_id.text, employee_id.text, location_id.text, service_id.text, scheduled_start_time.timestamp, scheduled_end_time.timestamp, purpose.text, status.text, booking_method.text, created_at.timestamp, notes.text )
[ { "role": "user", "content": "List all post IDs and their corresponding hashtag names for posts that include media." }, { "role": "assistant", "content": "SELECT ph.post_id, h.tag_name\nFROM social_media.post_hashtags ph\nJOIN social_media.hashtags h ON ph.hashtag_id = h.hashtag_id\nJOIN social_...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.posts ( post_id text PRIMARY KEY, user_id text, content text, media_url text, media_type text, created_at timestamp, updated_at timestamp, visibility text, location_lat numeric, location_lon numeric ) CREATE TABLE social_media.follows ( follow_id character varying(64) NOT NULL, -- unique identifier for the follow relationship follower_user_id character varying(64) NOT NULL, -- identifier of the user who is following (FK to users.user_id) following_user_id character varying(64) NOT NULL, -- identifier of the user being followed (FK to users.user_id) created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp of when the follow started PRIMARY KEY (follow_id), CONSTRAINT unique_follow UNIQUE (follower_user_id, following_user_id) -- prevent duplicate follows ) CREATE TABLE social_media.hashtags ( hashtag_id character varying(64) NOT NULL, tag_name character varying(100) NOT NULL UNIQUE, created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (hashtag_id) ) CREATE TABLE social_media.post_hashtags ( post_hashtag_id character varying(64) NOT NULL, -- unique identifier for the post-hashtag link post_id character varying(64) NOT NULL, -- identifier of the post (FK to posts.post_id) hashtag_id character varying(64) NOT NULL, -- identifier of the hashtag (FK to hashtags.hashtag_id) PRIMARY KEY (post_hashtag_id), CONSTRAINT unique_post_hashtag UNIQUE (post_id, hashtag_id) -- prevent duplicate tags on a post ) CREATE TABLE social_media.messages ( message_id character varying(64) NOT NULL, -- unique identifier for the message conversation_id character varying(64) NOT NULL, -- identifier for the conversation thread (FK to conversations.conversation_id) sender_user_id character varying(64) NOT NULL, -- identifier of the sender (FK to users.user_id) content text, -- textual content of the message media_url text, -- URL to attached media (image/video) media_type character varying(20), -- type of media ('image', 'video', null) sent_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp when message was sent read_at timestamp, -- timestamp when message was read by recipient(s) PRIMARY KEY (message_id) ) CREATE TABLE social_media.conversations ( conversation_id text PRIMARY KEY, created_at timestamp, last_message_at timestamp, is_group_chat bool, group_name text ) CREATE TABLE social_media.conversation_participants ( participant_id character varying(64) NOT NULL, -- unique identifier for the participant entry conversation_id character varying(64) NOT NULL, -- identifier of the conversation (FK to conversations.conversation_id) user_id character varying(64) NOT NULL, -- identifier of the user in the conversation (FK to users.user_id) joined_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp when user joined the conversation last_read_at timestamp, -- timestamp indicating up to when the user has read messages PRIMARY KEY (participant_id), CONSTRAINT unique_user_conversation UNIQUE (conversation_id, user_id) -- prevent user being added multiple times ) CREATE TABLE social_media.notifications ( notification_id character varying(64) NOT NULL, -- unique identifier for the notification recipient_user_id character varying(64) NOT NULL, -- user receiving the notification (FK to users.user_id) sender_user_id character varying(64), -- user triggering the notification (FK to users.user_id, can be null for system notifications) notification_type character varying(30) NOT NULL, -- type of notification ('like', 'comment', 'follow', 'mention', 'message') target_entity_id character varying(64), -- ID of the related entity (post_id, comment_id, user_id, conversation_id) target_entity_type character varying(20), -- type of the related entity ('post', 'comment', 'user', 'conversation') created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp notification was created read_at timestamp, -- timestamp notification was marked as read PRIMARY KEY (notification_id) ) CREATE 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) )
[ { "role": "user", "content": "For each driver, find the other driver whose license_expiry_date is the next one after theirs. Show both IDs, names and their expiry dates." }, { "role": "assistant", "content": "SELECT\n d1.driver_id AS driver_id,\n d1.first_name || ' ' || d1.last_name...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE 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 )
[ { "role": "user", "content": "Which rooms on the 4th floor are non-smoking, along with their property IDs and type IDs?" }, { "role": "assistant", "content": "SELECT room_id, property_id, room_number, room_type_id FROM hospitality_technology.rooms WHERE floor = 4 AND is_smoking = FALSE;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.rooms ( room_id character varying(64) NOT NULL, property_id character varying(64) NOT NULL, room_number character varying(10) NOT NULL, room_type_id character varying(64) NOT NULL, floor integer, status character varying(50) NOT NULL, is_smoking boolean NOT NULL DEFAULT false, features text, current_condition text, last_cleaned_at timestamp with time zone, PRIMARY KEY (room_id), FOREIGN KEY (property_id) REFERENCES hospitality_technology.properties(property_id), FOREIGN KEY (room_type_id) REFERENCES hospitality_technology.room_types(room_type_id) )
[ { "role": "user", "content": "Show me all in-progress trips with their current locations (origin_location_id) and destinations, along with the scheduled vs actual departure time difference in minutes." }, { "role": "assistant", "content": "SELECT trip_id, origin_location_id, destination_location...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.trips ( trip_id character varying(64) NOT NULL, -- unique identifier for a specific trip instance route_id character varying(64), -- identifier of the route being followed (can be null for ad-hoc trips) vehicle_id character varying(64) NOT NULL, -- identifier of the vehicle used driver_id character varying(64) NOT NULL, -- identifier of the driver operating scheduled_departure timestamp with time zone NOT NULL, -- planned departure time actual_departure timestamp with time zone, -- actual departure time scheduled_arrival timestamp with time zone NOT NULL, -- planned arrival time actual_arrival timestamp with time zone, -- actual arrival time origin_location_id character varying(64) NOT NULL, -- actual starting location (could differ from route origin) destination_location_id character varying(64) NOT NULL, -- actual ending location (could differ from route destination) status character varying(32) NOT NULL, -- e.g., Scheduled, In Progress, Completed, Delayed, Cancelled passenger_count integer, -- number of passengers (if applicable) cargo_manifest_id character varying(64), -- link to cargo details (if applicable) PRIMARY KEY (trip_id) )
[ { "role": "user", "content": "For each player, show the player_id and the count of inventory items they acquired with a quantity greater than 1." }, { "role": "assistant", "content": "SELECT player_id, COUNT(inventory_id) AS items_qty_gt_1_count FROM gaming_technology.player_inventory WHERE quan...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), username character varying(100) NOT NULL UNIQUE, email character varying(255) NOT NULL UNIQUE, password_hash text NOT NULL, registration_date timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, last_login timestamp with time zone, country_code character(2), status character varying(20) NOT NULL DEFAULT 'active', profile_data jsonb, PRIMARY KEY (player_id) ) CREATE TABLE gaming_technology.games ( game_id uuid NOT NULL DEFAULT gen_random_uuid(), title character varying(200) NOT NULL, developer_id uuid NOT NULL, publisher_id uuid, genre character varying(100), release_date date, description text, platform character varying(50) NOT NULL, engine character varying(100), website character varying(255), PRIMARY KEY (game_id) ) CREATE TABLE gaming_technology.servers ( server_id uuid NOT NULL DEFAULT gen_random_uuid(), game_id uuid NOT NULL, server_name character varying(150), region character varying(50) NOT NULL, ip_address character varying(45), port integer, current_players integer NOT NULL DEFAULT 0, max_players integer NOT NULL, status character varying(30) NOT NULL DEFAULT 'offline', last_heartbeat timestamp with time zone, PRIMARY KEY (server_id) ) CREATE TABLE gaming_technology.in_game_items ( item_id uuid NOT NULL DEFAULT gen_random_uuid(), game_id uuid NOT NULL, item_name character varying(150) NOT NULL, item_type character varying(50) NOT NULL, description text, rarity character varying(30), cost_currency character varying(10), cost_amount numeric(12, 2), attributes jsonb, PRIMARY KEY (item_id) ) CREATE TABLE gaming_technology.player_inventory ( inventory_id uuid NOT NULL DEFAULT gen_random_uuid(), player_id uuid NOT NULL, item_id uuid NOT NULL, quantity integer NOT NULL DEFAULT 1, acquired_at timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, instance_data jsonb, PRIMARY KEY (inventory_id) )
[ { "role": "user", "content": "List all applications that have at least one document with a verification status of 'Verified'. Show the application reference number and the name of the service associated with the application." }, { "role": "assistant", "content": "SELECT\n T1.reference_number,\n...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen national_id_number character varying(128) NOT NULL UNIQUE, -- official national identification number first_name character varying(100) NOT NULL, last_name character varying(100) NOT NULL, date_of_birth date NOT NULL, gender character varying(20), primary_address text NOT NULL, -- full primary residential address contact_email character varying(128) UNIQUE, contact_phone character varying(32), registration_date timestamp NOT NULL, -- when the citizen profile was created is_verified boolean DEFAULT false, -- whether identity has been officially verified PRIMARY KEY (citizen_id) ) CREATE TABLE government_services.agencies ( agency_id character varying(64) NOT NULL, -- unique identifier for the agency agency_name character varying(255) NOT NULL, -- full name of the government agency jurisdiction_level character varying(50) NOT NULL, -- e.g., Federal, State, County, City primary_contact_email character varying(128), main_phone_number character varying(32), website_url character varying(255), established_date date, parent_agency_id character varying(64), -- FK to self for hierarchical structure PRIMARY KEY (agency_id) ) CREATE TABLE government_services.services ( service_id character varying(64) NOT NULL, -- unique identifier for the service agency_id character varying(64) NOT NULL, -- FK to agencies table service_name character varying(255) NOT NULL, -- name of the service (e.g., Driver's License Renewal) description text, category character varying(100), -- e.g., Licensing, Benefits, Taxation, Permits eligibility_criteria text, -- description of who is eligible standard_fee numeric(10, 2) DEFAULT 0.00, -- typical fee for the service average_processing_time_days integer, -- estimated processing time is_active boolean DEFAULT true, -- whether the service is currently offered online_application_url character varying(255), PRIMARY KEY (service_id) ) CREATE TABLE government_services.documents ( document_id character varying(64) NOT NULL, -- unique identifier for the document instance application_id character varying(64), -- FK to applications table (optional, could be linked to citizen directly) citizen_id character varying(64) NOT NULL, -- FK to citizens table document_type character varying(100) NOT NULL, -- e.g., Passport Scan, Proof of Address, Birth Certificate file_reference text NOT NULL, -- reference to the stored file (e.g., S3 URL, internal path) upload_timestamp timestamp NOT NULL, expiry_date date, verification_status character varying(30) DEFAULT 'Pending', -- e.g., Pending, Verified, Rejected verified_by_employee_id character varying(64), -- FK to employees table verification_timestamp timestamp, PRIMARY KEY (document_id) ) CREATE TABLE government_services.appointments ( appointment_id character varying(64) NOT NULL, -- unique identifier for the appointment citizen_id character varying(64) NOT NULL, -- FK to citizens table employee_id character varying(64), -- FK to employees table (optional, if assigned) location_id character varying(64), -- FK to service_locations table (if physical) service_id character varying(64), -- FK to services table (optional, if related to specific service) scheduled_start_time timestamp NOT NULL, scheduled_end_time timestamp, purpose text NOT NULL, -- reason for the appointment status character varying(30) NOT NULL, -- e.g., Scheduled, Completed, Cancelled, No-Show booking_method character varying(50), -- e.g., Online, Phone, In-Person created_at timestamp NOT NULL, -- when the appointment was booked notes text, PRIMARY KEY (appointment_id) ) CREATE TABLE government_services.notifications ( notification_id character varying(64) NOT NULL, -- unique identifier for the notification citizen_id character varying(64) NOT NULL, -- FK to citizens table application_id character varying(64), -- FK to applications table (optional) message_subject character varying(255), message_body text NOT NULL, channel character varying(30) NOT NULL, -- e.g., Email, SMS, Portal Message, Mail sent_at timestamp NOT NULL, status character varying(30) NOT NULL, -- e.g., Queued, Sent, Delivered, Failed, Read related_entity_type character varying(50), -- e.g., Application, Appointment, Document Request related_entity_id character varying(64), -- ID of the related entity PRIMARY KEY (notification_id) )
[ { "role": "user", "content": "Which smart money address on the Ethereum chain has the lowest ROI, and what are their profit and rank?" }, { "role": "assistant", "content": "SELECT address, roi, profit, rank FROM smart_money_profit WHERE chain = 'Ethereum' ORDER BY roi ASC LIMIT 1;" }, { ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE smart_money_profit ( address.text, rank.numeric, profit.numeric, roi.numeric, realized_ratio.numeric, most_profit_token.text, last_trade_time.text, chain.text )
[ { "role": "user", "content": "List all reviews where the cleanliness rating is 3 or below. Include the review comment and the full name of the guest who submitted it." }, { "role": "assistant", "content": "SELECT T1.comment, T2.first_name, T2.last_name FROM hospitality_technology.reviews AS T1 J...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.reservations ( reservation_id character varying(64) NOT NULL, -- unique identifier for the booking property_id character varying(64) NOT NULL, -- FK to properties table guest_id character varying(64) NOT NULL, -- FK to guests table (primary guest) room_id character varying(64), -- FK to rooms table (assigned room, might be null initially) room_type_id character varying(64) NOT NULL, -- FK to room_types table (booked room type) check_in_date date NOT NULL, -- scheduled check-in date check_out_date date NOT NULL, -- scheduled check-out date actual_check_in_ts timestamp with time zone, -- actual check-in time actual_check_out_ts timestamp with time zone, -- actual check-out time num_adults integer NOT NULL, -- number of adults num_children integer DEFAULT 0, -- number of children status character varying(50) NOT NULL, -- e.g., Pending, Confirmed, CheckedIn, CheckedOut, Cancelled, NoShow booking_source character varying(100), -- e.g., Website, OTA (Expedia, Booking.com), Phone, WalkIn rate_plan_id character varying(64), -- FK to rate_plans table (optional) total_amount numeric(12, 2), -- estimated or final total cost amount_paid numeric(12, 2) DEFAULT 0.00, -- amount already paid special_requests text, -- specific guest requests for this booking created_at timestamp with time zone NOT NULL DEFAULT current_timestamp, updated_at timestamp with time zone NOT NULL DEFAULT current_timestamp, PRIMARY KEY (reservation_id), FOREIGN KEY (property_id) REFERENCES hospitality_technology.properties(property_id), FOREIGN KEY (guest_id) REFERENCES hospitality_technology.guests(guest_id), FOREIGN KEY (room_id) REFERENCES hospitality_technology.rooms(room_id), FOREIGN KEY (room_type_id) REFERENCES hospitality_technology.room_types(room_type_id) ) CREATE TABLE hospitality_technology.payments ( payment_id character varying(64) NOT NULL, -- unique identifier for the payment transaction reservation_id character varying(64), -- FK to reservations (if payment is for a stay) guest_id character varying(64) NOT NULL, -- FK to guests (who paid) bill_id character varying(64), -- FK to bills/invoices this payment applies to amount numeric(12,2) NOT NULL, -- amount of the payment currency_code character varying(3) NOT NULL, -- ISO currency code (e.g., USD, EUR) payment_method character varying(50) NOT NULL, -- e.g., CreditCard, Cash, BankTransfer, Points, Voucher card_type character varying(50), -- e.g., Visa, MasterCard, Amex (if CC) card_last_four character varying(4), -- last 4 digits of CC (if CC) transaction_ref character varying(128), -- reference ID from payment gateway or processor payment_timestamp timestamp with time zone NOT NULL DEFAULT current_timestamp, -- when the payment occurred status character varying(50) NOT NULL, -- e.g., Pending, Succeeded, Failed, Refunded, Disputed staff_id_processed character varying(64), -- FK to staff (who processed the payment) notes text, -- notes about the payment PRIMARY KEY (payment_id), FOREIGN KEY (reservation_id) REFERENCES hospitality_technology.reservations(reservation_id), FOREIGN KEY (guest_id) REFERENCES hospitality_technology.guests(guest_id), FOREIGN KEY (staff_id_processed) REFERENCES hospitality_technology.staff(staff_id) ) CREATE TABLE hospitality_technology.reviews ( review_id character varying(64) NOT NULL, -- unique identifier for the review property_id character varying(64) NOT NULL, -- FK to properties table reservation_id character varying(64) UNIQUE, -- FK to reservations (link review to a specific stay, optional but good) guest_id character varying(64) NOT NULL, -- FK to guests table rating_overall integer, -- overall score (e.g., 1-5 or 1-10) rating_cleanliness integer, rating_service integer, rating_location integer, rating_value integer, comment text, -- guest's written feedback review_source character varying(100), -- e.g., DirectSurvey, TripAdvisor, Google, Booking.com review_date timestamp with time zone NOT NULL DEFAULT current_timestamp, -- when the review was submitted is_public boolean DEFAULT true, -- whether the review is publicly visible staff_response text, -- official response from the property response_staff_id character varying(64), -- FK to staff (who responded) response_date timestamp with time zone, -- when the response was posted PRIMARY KEY (review_id), FOREIGN KEY (property_id) REFERENCES hospitality_technology.properties(property_id), FOREIGN KEY (reservation_id) REFERENCES hospitality_technology.reservations(reservation_id), FOREIGN KEY (guest_id) REFERENCES hospitality_technology.guests(guest_id), FOREIGN KEY (response_staff_id) REFERENCES hospitality_technology.staff(staff_id) )
[ { "role": "user", "content": "Which citizens have received notifications for applications processed by employees from the 'Legal' department? List the citizen ID, full name, and notification ID." }, { "role": "assistant", "content": "SELECT n.citizen_id, CONCAT(e.first_name, ' ', e.last_name) AS...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.agencies ( agency_id text, agency_name text, jurisdiction_level text, primary_contact_email text, main_phone_number text, website_url text, established_date date, parent_agency_id text ) CREATE TABLE government_services.services ( service_id text, agency_id text, service_name text, description text, category text, eligibility_criteria text, standard_fee numeric, average_processing_time_days integer, is_active boolean, online_application_url text ) CREATE TABLE government_services.payments ( payment_id text, application_id text, citizen_id text, service_id text, amount numeric, currency text, payment_method text, payment_provider_reference text, payment_timestamp timestamp, status text, notes text ) CREATE TABLE government_services.employees ( employee_id text, agency_id text, first_name text, last_name text, job_title text, department text, work_email text, work_phone text, hire_date date, termination_date date, access_level text, manager_employee_id text ) CREATE TABLE government_services.notifications ( notification_id text, citizen_id text, application_id text, message_subject text, message_body text, channel text, sent_at timestamp, status text, related_entity_type text, related_entity_id text )
End of preview. Expand in Data Studio

No dataset card yet

Downloads last month
6