conversations
listlengths
2
2
[ { "content": "List all the records from the CSV files located in the 'data' folder.\nSCHEMA: CREATE TABLE \"member\" (\n \"Member_ID\" INTEGER,\n \"Card_Number\" VARCHAR(255),\n \"Name\" VARCHAR(255),\n \"Hometown\" VARCHAR(255),\n \"Level\" INTEGER,\n \"Previous_Branches\" INT[], \n PRIMAR...
[ { "content": "Load JSON data from the file 'array.json' with array format.\nSCHEMA: ", "role": "user" }, { "content": "SELECT * FROM read_json_auto('array.json', format='array');", "role": "assistant" } ]
[ { "content": "Calculate the number of complete hour partitions between two specific timestamps.\nSCHEMA: CREATE TABLE \"Campuses\" (\n \"Id\" INTEGER PRIMARY KEY, \n \"Campus\" TEXT, \n \"Location\" TEXT, \n \"County\" TEXT, \n \"Year\" INTEGER,\n \"CampusInfo\" JSON\n);\n\nCREATE TABLE \"csu_...
[ { "content": "Perform a bitwise OR operation between two bitstrings.\nSCHEMA: CREATE TABLE \"Investors\" (\n\"investor_id\" INTEGER PRIMARY KEY,\n\"Investor_details\" VARCHAR(255),\n\"investor_json\" JSON\n);\n\nCREATE TABLE \"Lots\" (\n\"lot_id\" INTEGER PRIMARY KEY,\n\"investor_id\" INTEGER NOT NULL,\n\"lot_d...
[ { "content": "How many transactions did each investor make in January 2022?\nSCHEMA: CREATE TABLE \"Investors\" (\n\"investor_id\" INTEGER PRIMARY KEY,\n\"Investor_details\" VARCHAR(255),\n\"investor_json\" JSON\n);\n\nCREATE TABLE \"Lots\" (\n\"lot_id\" INTEGER PRIMARY KEY,\n\"investor_id\" INTEGER NOT NULL,\n...
[ { "content": "Create a phone table by reading a CSV file named 'phonedata.csv' and ignoring any parsing errors encountered.\nSCHEMA: CREATE TABLE \"phone\" (\n \"Name\" VARCHAR(255),\n \"Phone_ID\" INTEGER,\n \"Memory_in_G\" INTEGER,\n \"Carrier\" VARCHAR(255),\n \"Price\" DOUBLE,\n \"Features...
[ { "content": "Export the `protein` table to an S3 bucket with partitions based on the `sequence_length` and `sequence_identity_to_human_protein` columns.\nSCHEMA: CREATE TABLE \"building\" (\n \"building_id\" VARCHAR(255),\n \"Name\" VARCHAR(255),\n \"Street_address\" VARCHAR(255),\n \"Years_as_tall...
[ { "content": "Instruction: Insert records from the DuckDB 'category' table into the Postgres 'category' table in an attached Postgres database, but only for rows with a reviewcount greater than 100.\nSCHEMA: CREATE TABLE \"checkin\" (\n \"cid\" INTEGER,\n \"business_id\" VARCHAR(255) REFERENCES \"busines...
[ { "content": "Which authors have a Hamming distance of less than 3 compared to the string 'duck'?\nSCHEMA: CREATE TABLE \"venue\" (\n \"venueId\" INTEGER NOT NULL,\n \"venueName\" VARCHAR(100),\n \"venueInfo\" JSON,\n PRIMARY KEY (\"venueId\")\n);\n\nCREATE TABLE \"author\" (\n \"authorId\" INTEGER NOT NUL...
[ { "content": "Find employees who had a job assignment between January 1, 2020, and December 31, 2020.\nSCHEMA: CREATE TABLE IF NOT EXISTS \"regions\" (\n \"REGION_ID\" BIGINT NOT NULL,\n \"REGION_NAME\" VARCHAR(25),\n \"REGION_EMPLOYEES\" INT[],\n PRIMARY KEY (\"REGION_ID\")\n);\n\nCREATE TABLE IF NOT EXIST...
[ { "content": "Remove the `journalInfo` column from the `journal` table, if there are no dependencies.\nSCHEMA: CREATE TABLE \"venue\" (\n \"venueId\" INTEGER NOT NULL,\n \"venueName\" VARCHAR(100),\n \"venueInfo\" JSON,\n PRIMARY KEY (\"venueId\")\n);\n\nCREATE TABLE \"author\" (\n \"authorId\" INTEGER NOT...
[ { "content": "Get the name of the region, the start and end dates of the party membership for all members who were in office in North America between 2010 and 2015.\nSCHEMA: CREATE TABLE \"region\" (\n \"Region_ID\" INTEGER PRIMARY KEY,\n \"Region_name\" VARCHAR(255),\n \"Date\" DATE,\n ...
[ { "content": "What are the metadata about columns for the `train` table in the `your_database` database?\nSCHEMA: ", "role": "user" }, { "content": "SELECT * FROM duckdb_columns WHERE database_name = 'your_database' AND table_name = 'train';", "role": "assistant" } ]
[ { "content": "For each year, find the farm that utilizes the fewest working horses efficiently.\nSCHEMA: CREATE TABLE \"city\" (\n \"City_ID\" INTEGER,\n \"Official_Name\" VARCHAR(255),\n \"Status\" VARCHAR(255),\n \"Area_km_2\" DOUBLE,\n \"Population\" DOUBLE,\n \"Census_Ranking\" VARCHAR(255...
[ { "content": "Create a pivot table for the `race` table, grouped by `Track_ID`, and display the total seating for each class.\nSCHEMA: CREATE TABLE race (\n Race_ID INTEGER,\n Name VARCHAR(255),\n Class VARCHAR(255),\n Date DATE,\n Track_ID INTEGER,\n Track_Info ROW(Na...
[ { "content": "Compose a SQL query to export the names of the members and their respective party names from the `member` and `party` tables to a CSV file named 'memberparty.csv' using a comma (,) as the delimiter and include a header line.\nSCHEMA: CREATE TABLE \"region\" (\n \"Region_ID\" INTEGER PRIMAR...
[ { "content": "Create a new table 'lakemanual' based on the 'lakes.csv' file using the `read_csv_auto` function with manual column types definition.\nSCHEMA: ", "role": "user" }, { "content": "CREATE TABLE lake_manual AS SELECT * FROM read_csv_auto('lakes.csv', COLUMNS={'lake_name': 'VARCHAR(255)', '...
[ { "content": "How many news reports are there for events with an attendance greater than 10,000?\nSCHEMA: CREATE TABLE \"event\" (\n \"Event_ID\" INTEGER,\n \"Date\" DATE,\n \"Venue\" VARCHAR(255),\n \"Name\" VARCHAR(255),\n \"Event_Attendance\" INTEGER,\n \"Attendees_List\" INT[],\n PRIMAR...
[ { "content": "How can we filter union values using a comparison with a union value?\nSCHEMA: CREATE TABLE \"election\" (\n \"Election_ID\" INTEGER,\n \"Representative_ID\" INTEGER,\n \"Date\" DATE,\n \"Votes\" DOUBLE,\n \"Vote_Percent\" DOUBLE,\n \"Seats\" DOUBLE,\n \"Place\" DOUBLE,\n \...
[ { "content": "Get the current value of the TimeZone setting.\nSCHEMA: CREATE TABLE \"entrepreneur\" (\n \"Entrepreneur_ID\" INTEGER,\n \"People_ID\" INTEGER,\n \"Company\" VARCHAR(255),\n \"Money_Requested\" FLOAT,\n \"Investor\" VARCHAR(255),\n \"Entrepreneur_Info\" JSON,\n PRIMARY KEY (\"...
[ { "content": "Show me the sequence metadata for the 'my_database' database.\nSCHEMA: CREATE TABLE \"TV_Channel\" (\n \"id\" VARCHAR(255),\n \"series_name\" VARCHAR(255),\n \"Country\" VARCHAR(255),\n \"Language\" VARCHAR(255),\n \"Content\" VARCHAR(255),\n \"Pixel_aspect_ratio_PAR\" VARCHAR(25...
[ { "content": "Get the metadata about the current settings in the DuckDB instance.\nSCHEMA: CREATE TABLE \"swimmer\" (\n \"ID\" INTEGER,\n \"name\" VARCHAR(255),\n \"Nationality\" VARCHAR(255),\n \"meter_100\" FLOAT,\n \"meter_200\" FLOAT,\n \"meter_300\" FLOAT,\n \"meter_400\" FLOAT,\n \...
[ { "content": "Get all document types and location codes and names by combining rows using UNION BY NAME, even if the number of columns is not the same.\nSCHEMA: CREATE TABLE Ref_Document_Types (\n Document_Type_Code CHAR(15) NOT NULL,\n Document_Type_Name VARCHAR(255) NOT NULL,\n Document_Type_Descript...
[ { "content": "Generate a list of school IDs by unnesting the `school_list` column from the `school` table.\nSCHEMA: CREATE TABLE \"school\" (\n \"School_ID\" INTEGER,\n \"School\" VARCHAR(255),\n \"Location\" VARCHAR(255),\n \"Enrollment\" REAL,\n \"Founded\" REAL,\n \"Denomination\" VARCHAR(2...
[ { "content": "Select a sample of 10% of the train table using system sampling.\nSCHEMA: CREATE TABLE \"train\" (\n \"id\" INTEGER,\n \"train_number\" INTEGER,\n \"name\" VARCHAR(255),\n \"origin\" VARCHAR(255),\n \"destination\" VARCHAR(255),\n \"time\" TIME,\n \"interval\" INTERVAL,\n \...
[ { "content": "Create a struct type `user_activity` with userid as INTEGER and activity as VARCHAR.\nSCHEMA: ", "role": "user" }, { "content": "CREATE TYPE user_activity AS STRUCT(user_id INTEGER, activity VARCHAR);", "role": "assistant" } ]
[ { "content": "What would be the result of a cross product join between the `Customers` and `Customer_Addresses` tables?\nSCHEMA: CREATE TABLE \"Addresses\" (\n\"address_id\" INTEGER PRIMARY KEY,\n\"address_content\" VARCHAR(80),\n\"city\" VARCHAR(50),\n\"zip_postcode\" VARCHAR(20),\n\"state_province_county\" VA...
[ { "content": "Find the names of all storms that start with the letter 'A'.\nSCHEMA: CREATE TABLE storm (\n Storm_ID INTEGER,\n Name VARCHAR(255),\n Dates_active VARCHAR(255),\n Max_speed INTEGER,\n Damage_millions_USD REAL,\n Number_Deaths INTEGER,\n Storm_Info STRUCT(Max_speed INTEGER, Dam...
[ { "content": "Show the current value of the 'autoinstallextensionrepository' configuration setting.\nSCHEMA: CREATE TABLE \"course_arrange\" (\n\"Course_ID\" INTEGER,\n\"Teacher_ID\" INTEGER,\n\"Grade\" INTEGER,\n\"Class_Details\" VARCHAR(255),\nPRIMARY KEY (\"Course_ID\",\"Teacher_ID\",\"Grade\"),\nFOREIGN KE...
[ { "content": "List the column details for the `Catalogs` table.\nSCHEMA: CREATE TABLE \"Attribute_Definitions\" (\n\"attribute_id\" INTEGER PRIMARY KEY,\n\"attribute_name\" VARCHAR(30),\n\"attribute_data_type\" VARCHAR(10),\n\"attribute_values\" VARCHAR(255)[]\n);\n\nCREATE TABLE \"Catalogs\" (\n\"catalog_id\" ...
[ { "content": "Show the primary key constraints for the 'publication' table.\nSCHEMA: CREATE TABLE book (\n Book_ID INTEGER,\n Title VARCHAR,\n Issues DOUBLE,\n Writer VARCHAR,\n Book_Info ROW(title VARCHAR, issues DOUBLE, writer VARCHAR), \n PRIMARY KEY (Book_ID)\n ...
[ { "content": "Find all instruments that are musical notes in the range of A to G (including sharps and flats).\nSCHEMA: CREATE TABLE \"Songs\" ( \n\t\"SongId\" INTEGER PRIMARY KEY, \n\t\"Title\" TEXT,\n\t\"InstrumentList\" TEXT[]\n);\n\nCREATE TABLE \"Albums\" ( \n\t\"AId\" INTEGER PRIMARY KEY, \n\t\"Title\" TE...
[ { "content": "Load AWS credentials using the `load_aws_credentials` pragma function.\nSCHEMA: CREATE TABLE \"Roles\" (\n \"role_code\" VARCHAR(15) PRIMARY KEY,\n \"role_description\" VARCHAR(80),\n \"role_users\" INT[]\n);\n\nCREATE TABLE \"Users\" (\n \"user_id\" INTEGER PRIMARY KEY,\n \"role_c...
[ { "content": "Order the 'writes' table by the pages and order values from the JSON object, first in ascending order for pages and then in descending order for order.\nSCHEMA: CREATE TABLE \"venue\" (\n \"venueId\" INTEGER NOT NULL,\n \"venueName\" VARCHAR(100),\n \"venueInfo\" JSON,\n PRIMARY KEY (\"venueId...
[ { "content": "Count the number of set bits in the `Net_Worth_Millions` column (interpreted as bitstrings) and return the top 5 singers with the highest bit counts (representing the highest wealth).\nSCHEMA: CREATE TABLE \"singer\" (\n \"Singer_ID\" INTEGER,\n \"Name\" VARCHAR(255),\n \"Birth_Year\" REA...
[ { "content": "For each customer, get their order ID, order status code, and the number of their most recent orders.\nSCHEMA: CREATE TABLE \"Customer_Addresses\" (\n\"customer_id\" INTEGER NOT NULL,\n\"premise_id\" INTEGER NOT NULL,\n\"date_address_from\" DATETIME NOT NULL,\n\"address_type_code\" VARCHAR(15) NO...
[ { "content": "Create a new player table with a column for player position using an Enum type.\nSCHEMA: CREATE TABLE \"club\" (\n \"Club_ID\" INTEGER,\n \"name\" VARCHAR(255),\n \"Region\" VARCHAR(255),\n \"Start_year\" INTEGER,\n \"Club_Info\" STRUCT(\n \"Region\" VARCHAR(255),\n \"...
[ { "content": "Force a checkpoint on the 'my_db' database, interrupting any ongoing transactions.\nSCHEMA: CREATE TABLE race (\n Race_ID INTEGER,\n Name VARCHAR(255),\n Class VARCHAR(255),\n Date DATE,\n Track_ID INTEGER,\n Track_Info ROW(Name VARCHAR(255), Location VAR...
[ { "content": "Update existing rows in the table based on a given condition and new column values.\nSCHEMA: CREATE TABLE mission (\n Mission_ID INTEGER,\n Ship_ID INTEGER,\n Code VARCHAR(255),\n Launched_Year INTEGER,\n Location VARCHAR(255),\n Speed_knots INTEGER,\n Fate VARCHAR(255),\n ...
[ { "content": "Compute the cotangent of the Share column for TV series with a Weekly_Rank greater than 100, and return the one with the highest cotangent result.\nSCHEMA: CREATE TABLE \"TV_Channel\" (\n \"id\" VARCHAR(255),\n \"series_name\" VARCHAR(255),\n \"Country\" VARCHAR(255),\n \"Language\" VA...
[ { "content": "List all tables available in the DuckDB instance.\nSCHEMA: CREATE TABLE \"conductor\" (\n \"Conductor_ID\" INTEGER,\n \"Name\" VARCHAR(255),\n \"Age\" INTEGER,\n \"Nationality\" VARCHAR(255),\n \"Year_of_Work\" INTEGER,\n \"Conductor_Info\" STRUCT(\n \"Birth_Place\" VARCHA...
[ { "content": "How would you create an Excel file named 'large_revenue_manufacturers.xlsx' containing only the manufacturers with a revenue greater than 100,000,000?\nSCHEMA: CREATE TABLE Manufacturers (\n Code INTEGER,\n Name VARCHAR(255) NOT NULL,\n Headquarter VARCHAR(255) NOT NULL,\n Founder VARCHAR(255)...
[ { "content": "Find all markets that are of type 'supermarket' based on the Market_Info JSON column.\nSCHEMA: CREATE TABLE \"phone\" (\n \"Name\" VARCHAR(255),\n \"Phone_ID\" INTEGER,\n \"Memory_in_G\" INTEGER,\n \"Carrier\" VARCHAR(255),\n \"Price\" DOUBLE,\n \"Features\" JSON,\n PRIMARY KE...
[ { "content": "Calculate the number of days between registration and attendance for each student-course pair.\nSCHEMA: CREATE TABLE People (\n person_id INTEGER NOT NULL,\n first_name TEXT,\n middle_name TEXT,\n last_name TEXT,\n cell_mobile_number VARCHAR(40),\n email_...
[ { "content": "Export the `enrollments` table to an S3 bucket in Parquet format.\nSCHEMA: CREATE TABLE \"Campuses\" (\n \"Id\" INTEGER PRIMARY KEY, \n \"Campus\" TEXT, \n \"Location\" TEXT, \n \"County\" TEXT, \n \"Year\" INTEGER,\n \"CampusInfo\" JSON\n);\n\nCREATE TABLE \"csu_fees\" ( \n \...
[ { "content": "What is the current DuckDB API surface version being used?\nSCHEMA: CREATE TABLE \"Breeds\" (\n\"breed_code\" VARCHAR(10) PRIMARY KEY ,\n\"breed_name\" VARCHAR(80),\n\"additional_info\" JSON\n);\n\nCREATE TABLE \"Charges\" (\n\"charge_id\" INTEGER PRIMARY KEY ,\n\"charge_type\" VARCHAR(10),\n\"cha...
[ { "content": "List all catalogs and schemas present in the database.\nSCHEMA: CREATE TABLE \"Breeds\" (\n\"breed_code\" VARCHAR(10) PRIMARY KEY ,\n\"breed_name\" VARCHAR(80),\n\"additional_info\" JSON\n);\n\nCREATE TABLE \"Charges\" (\n\"charge_id\" INTEGER PRIMARY KEY ,\n\"charge_type\" VARCHAR(10),\n\"charge_...
[ { "content": "Truncate the date '1992-03-07' to the first day of the month.\nSCHEMA: CREATE TABLE Customer_Master_Index (\n master_customer_id INTEGER NOT NULL,\n cmi_details VARCHAR(255),\n cmi_details_struct STRUCT(name VARCHAR, age INTEGER),\n PRIMARY KEY (master_customer_id)\n);\n\nCREATE TABLE ...
[ { "content": "Format the birth date of gymnasts as the month and year of their birth.\nSCHEMA: CREATE TABLE gymnast (\n Gymnast_ID INT,\n Floor_Exercise_Points FLOAT,\n Pommel_Horse_Points FLOAT,\n Rings_Points FLOAT,\n Vault_Points FLOAT,\n Parallel_Bars_Points FLOAT,\n Horizontal_Bar_Poin...
[ { "content": "Generate a SQL query that calculates and displays the price of a specific film in a cinema rounded to two decimal places.\nSCHEMA: CREATE TABLE \"film\" (\n \"Film_ID\" INTEGER,\n \"Rank_in_series\" INTEGER,\n \"Number_in_season\" INTEGER,\n \"Title\" VARCHAR(255),\n \"Directors\" V...
[ { "content": "Reset the memory limit of the system back to the default.\nSCHEMA: CREATE TABLE \"Investors\" (\n\"investor_id\" INTEGER PRIMARY KEY,\n\"Investor_details\" VARCHAR(255),\n\"investor_json\" JSON\n);\n\nCREATE TABLE \"Lots\" (\n\"lot_id\" INTEGER PRIMARY KEY,\n\"investor_id\" INTEGER NOT NULL,\n\"lo...
[ { "content": "What is the sign of the year of founded for each orchestra?\nSCHEMA: CREATE TABLE \"conductor\" (\n \"Conductor_ID\" INTEGER,\n \"Name\" VARCHAR(255),\n \"Age\" INTEGER,\n \"Nationality\" VARCHAR(255),\n \"Year_of_Work\" INTEGER,\n \"Conductor_Info\" STRUCT(\n \"Birth_Plac...
[ { "content": "Retrieve the metadata about the settings available in the DuckDB instance.\nSCHEMA: CREATE TABLE people (\n People_ID INT,\n Name VARCHAR(255),\n Country VARCHAR(255),\n Is_Male BOOLEAN,\n Age INT,\n Address STRUCT(street VARCHAR, city VARCHAR, zip INT),\n PRIMARY KEY (People_...
[ { "content": "Read a JSON file with a custom format and column definitions.\nSCHEMA: ", "role": "user" }, { "content": "SELECT * FROM read_json('todos.json', format='array', columns={userId: 'UBIGINT', id: 'UBIGINT', title: 'VARCHAR', completed: 'BOOLEAN'});", "role": "assistant" } ]
[ { "content": "How can I create a table named 'ontime' by reading the CSV file 'flights.csv' using the `read_csv_auto` function and inserting the data into the table?\nSCHEMA: CREATE TABLE IF NOT EXISTS \"regions\" (\n \"REGION_ID\" BIGINT NOT NULL,\n \"REGION_NAME\" VARCHAR(25),\n \"REGION_EMPLOYEES\" INT[],...
[ { "content": "Delete the FTS index for the 'documents' table.\nSCHEMA: CREATE TABLE wrestler (\n Wrestler_ID INTEGER,\n Name VARCHAR(255),\n Reign VARCHAR(255),\n Days_held VARCHAR(255),\n Location VARCHAR(255),\n Event VARCHAR(255),\n Wrestler_Info STRUCT(Name VARCHAR(255), Reign VARCHAR(...
[ { "content": "List representatives with their total votes and average votes per seat, sorted by the average votes per seat in descending order.\nSCHEMA: CREATE TABLE \"election\" (\n \"Election_ID\" INTEGER,\n \"Representative_ID\" INTEGER,\n \"Date\" DATE,\n \"Votes\" DOUBLE,\n \"Vote_Percent\" ...
[ { "content": "Extract the value with the tag 'k' from the UNION values created for Mortgage and Car Loan types in the loan table.\nSCHEMA: CREATE TABLE bank (\n branch_ID INTEGER PRIMARY KEY,\n bname VARCHAR(20),\n no_of_customers INTEGER,\n city VARCHAR(10),\n state VARCHAR(20),\n contact_in...
[ { "content": "Create a timetz instance for an event that occurred on September 20, 1992, at 11:30:00.123456 local time, in a timezone 2 hours behind UTC.\nSCHEMA: CREATE TABLE \"body_builder\" (\n \"Body_Builder_ID\" INTEGER,\n \"People_ID\" INTEGER,\n \"Snatch\" FLOAT,\n \"Clean_Jerk\" FLOAT,\n ...
[ { "content": "Delete the row with `id` 42 from the table `tbl`, and then select all the rows from the table.\nSCHEMA: CREATE TABLE race (\n Race_ID INTEGER,\n Name VARCHAR(255),\n Class VARCHAR(255),\n Date DATE,\n Track_ID INTEGER,\n Track_Info ROW(Name VARCHAR(255), ...
[ { "content": "How can I filter and read only the parquet files with document_type_code as 'PDF' and document_structure_code as 'Sectioned' from a hive partitioned data set?\nSCHEMA: CREATE TABLE \"Roles\" (\n \"role_code\" VARCHAR(15) PRIMARY KEY,\n \"role_description\" VARCHAR(80),\n \"role_users\" I...
[ { "content": "Calculate the number of complete hours between two given times.\nSCHEMA: CREATE TABLE \"buildings\" (\n \"id\" INTEGER,\n \"name\" VARCHAR(255),\n \"City\" VARCHAR(255),\n \"Height\" INTEGER,\n \"Stories\" INTEGER,\n \"Status\" VARCHAR(255),\n \"Additional_Info\" JSON,\n PR...
[ { "content": "Load data from a Parquet file over HTTP(S) into DuckDB.\nSCHEMA: CREATE TABLE \"driver\" (\n \"Driver_ID\" INTEGER,\n \"Name\" VARCHAR(255),\n \"Party\" VARCHAR(255),\n \"Home_city\" VARCHAR(255),\n \"Age\" INTEGER,\n \"Additional_Info\" JSON,\n PRIMARY KEY (\"Driver_ID\")\n);...
[ { "content": "Read data from a JSON file named 'example.json' and return all records.\nSCHEMA: ", "role": "user" }, { "content": "SELECT * FROM read_json_auto('example.json');", "role": "assistant" } ]
[ { "content": "What is the JSON representation of the Substrait plan for counting the number of rows in the `crossfit` table?\nSCHEMA: ", "role": "user" }, { "content": "SELECT json FROM get_substrait_json('SELECT COUNT(*) FROM crossfit') AS t(json BLOB);", "role": "assistant" } ]
[ { "content": "What would be the result if we replace the first 10 characters of the orchestra's name with the same 10 characters, effectively removing any characters before the first 10?\nSCHEMA: CREATE TABLE \"conductor\" (\n \"Conductor_ID\" INTEGER,\n \"Name\" VARCHAR(255),\n \"Age\" INTEGER,\n \...
[ { "content": "Get the metadata of all non-internal columns for the 'match' table.\nSCHEMA: CREATE TABLE \"city\" (\n \"City_ID\" INTEGER PRIMARY KEY,\n \"City\" VARCHAR(255),\n \"Hanzi\" VARCHAR(255),\n \"Hanyu_Pinyin\" VARCHAR(255),\n \"Regional_Population\" INTEGER,\n ...
[ { "content": "Return a sample of 10 random rows from the subquery that filters artists older than 30.\nSCHEMA: CREATE TABLE \"artist\" (\n \"Artist_ID\" INTEGER,\n \"Artist\" VARCHAR(255),\n \"Age\" INTEGER,\n \"Famous_Title\" VARCHAR(255),\n \"Famous_Release_date\" DATE,\n \"Awards\" VARCHAR(...
[ { "content": "Set the profiling output format to QUERY_TREE to get a visual representation of the query execution plan.\nSCHEMA: CREATE TABLE \"checkin\" (\n \"cid\" INTEGER,\n \"business_id\" VARCHAR(255) REFERENCES \"business\"(\"business_id\"),\n \"count\" INTEGER,\n \"day\" VARCHAR(255),\n \...
[ { "content": "Which user-defined columns have the name 'JournalID'?\nSCHEMA: CREATE TABLE IF NOT EXISTS \"journal\" (\n \"Journal_ID\" INTEGER,\n \"Date\" DATE,\n \"Theme\" VARCHAR(255),\n \"Sales\" INTEGER,\n \"Extra_Info\" JSON,\n \"Authors\" VARCHAR(255)[],\n PRIMARY KEY (\"Journal_ID\")...
[ { "content": "Get the last apartment type from the `apartment_types` array in the `building_info` JSON column for the building with `building_id` 1.\nSCHEMA: CREATE TABLE Apartments (\n apt_id INTEGER NOT NULL ,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n b...
[ { "content": "What is the total amount of transactions for each day of the week?\nSCHEMA: CREATE TABLE \"Investors\" (\n\"investor_id\" INTEGER PRIMARY KEY,\n\"Investor_details\" VARCHAR(255),\n\"investor_json\" JSON\n);\n\nCREATE TABLE \"Lots\" (\n\"lot_id\" INTEGER PRIMARY KEY,\n\"investor_id\" INTEGER NOT NU...
[ { "content": "Create a table 'sales' by reading the gzip-compressed CSV file 'salesdata.csv'.\nSCHEMA: CREATE TABLE \"shop\" (\n \"Shop_ID\" INTEGER,\n \"Address\" VARCHAR(255),\n \"Num_of_staff\" INTEGER,\n \"Score\" REAL,\n \"Open_Year\" INTEGER,\n \"Staff_List\" INT[], \n PRIMARY KEY (\"...
[ { "content": "Get the year component of the `date_on_market` field for each property in the `Properties` table.\nSCHEMA: CREATE TABLE \"Ref_Feature_Types\" (\n\"feature_type_code\" VARCHAR(20) PRIMARY KEY,\n\"feature_type_name\" VARCHAR(80),\n\"feature_type_attributes\" JSON\n);\n\nCREATE TABLE \"Ref_Property_T...
[ { "content": "Find all citations made in the year 2022, assuming the first element in the 'citeInfo' array stores the citation's year in ISO 8601 format (YYYY).\nSCHEMA: CREATE TABLE \"venue\" (\n \"venueId\" INTEGER NOT NULL,\n \"venueName\" VARCHAR(100),\n \"venueInfo\" JSON,\n PRIMARY KEY (\"venueId\")\n...
[ { "content": "Find all rows in table `tbl4` where the `UNION` column `u` is greater than 1 and less than 4.\nSCHEMA: ", "role": "user" }, { "content": "CREATE TABLE tbl4(u UNION(num INT, str VARCHAR));\nINSERT INTO tbl4 VALUES (1), ('two'), (3), (NULL);\nSELECT * FROM tbl4 WHERE u > 1 AND u < 4;", ...
[ { "content": "Count the number of entries for each (PerpetratorID, PeopleID) pair in all Parquet files starting with 'perpetrator' in the 'crimedata' directory.\nSCHEMA: CREATE TABLE perpetrator (\n Perpetrator_ID INTEGER,\n People_ID INTEGER,\n Date VARCHAR,\n Year DOUBLE,\n Location VARCHAR,\n ...
[ { "content": "What is the `Artist_ID` of artists with `Artist_ID` greater than 100, converted to `DOUBLE` type?\nSCHEMA: CREATE TABLE \"artist\" (\n \"Artist_ID\" INTEGER,\n \"Name\" VARCHAR(255),\n \"Country\" VARCHAR(255),\n \"Year_Join\" INTEGER,\n \"Age\" INTEGER,\n \"Artist_Info\" JSON,\n...
[ { "content": "Get the details of employees who have a salary greater than 50000 and receive a commission.\nSCHEMA: CREATE TABLE IF NOT EXISTS \"regions\" (\n \"REGION_ID\" BIGINT NOT NULL,\n \"REGION_NAME\" VARCHAR(25),\n \"REGION_EMPLOYEES\" INT[],\n PRIMARY KEY (\"REGION_ID\")\n);\n\nCREATE TABLE IF NOT E...
[ { "content": "What are the file paths of the DELETED data files for the `lineitem_iceberg` table in the Iceberg format?\nSCHEMA: CREATE TABLE \"stadium\" (\n \"Stadium_ID\" INTEGER,\n \"Location\" VARCHAR(255),\n \"Name\" VARCHAR(255),\n \"Capacity\" INTEGER,\n \"Highest\" INTEGER,\n \"Lowest\...
[ { "content": "Create a new user-defined type 'mountainrange' as an Enum with hardcoded values.\nSCHEMA: CREATE TABLE \"mountain\" (\n \"Mountain_ID\" INTEGER,\n \"Name\" VARCHAR(255),\n \"Height\" FLOAT,\n \"Prominence\" FLOAT,\n \"Range\" VARCHAR(255),\n \"Country\" VARCHAR(255),\n \"Climb...
[ { "content": "*Find all people living in a city, regardless of the case of the city name*\nSCHEMA: CREATE TABLE people (\n People_ID INT,\n Name VARCHAR(255),\n Country VARCHAR(255),\n Is_Male BOOLEAN,\n Age INT,\n Address STRUCT(street VARCHAR, city VARCHAR, zip INT),\n PRIMARY KEY (People...
[ { "content": "Generate two rows with city names and their respective IDs, and return them as a result set with column aliases.\nSCHEMA: CREATE TABLE \"Products\" (\n\"product_id\" INTEGER PRIMARY KEY,\n\"product_type_code\" VARCHAR(15),\n\"product_name\" VARCHAR(80),\n\"product_price\" DOUBLE PRECISION NULL,\n...
[ { "content": "Calculate the average city population for each district headquarters, using a pivot query within a CTE.\nSCHEMA: CREATE TABLE \"product\" (\n \"product_id\" INTEGER,\n \"product\" VARCHAR(255),\n \"dimensions\" VARCHAR(255),\n \"dpi\" REAL,\n \"pages_per_minute_color\" REAL,\n \"...
[ { "content": "What is the current value of the 'homedirectory' configuration option?\nSCHEMA: CREATE TABLE \"conductor\" (\n \"Conductor_ID\" INTEGER,\n \"Name\" VARCHAR(255),\n \"Age\" INTEGER,\n \"Nationality\" VARCHAR(255),\n \"Year_of_Work\" INTEGER,\n \"Conductor_Info\" STRUCT(\n \...
[ { "content": "Export the entire database to a target directory in CSV format with a pipe delimiter.\nSCHEMA: CREATE TABLE \"company\" (\n \"Company_ID\" INTEGER,\n \"Rank\" INTEGER,\n \"Company\" VARCHAR(255),\n \"Headquarters\" VARCHAR(255),\n \"Main_Industry\" VARCHAR(255),\n \"Sales_billion...
[ { "content": "Find the absolute value of the Totalpounds column for rows in the purchase table where Totalpounds is negative.\nSCHEMA: CREATE TABLE \"member\" (\n \"Member_ID\" INTEGER,\n \"Card_Number\" VARCHAR(255),\n \"Name\" VARCHAR(255),\n \"Hometown\" VARCHAR(255),\n \"Level\" INTEGER,\n ...
[ { "content": "Retrieve all columns for records in the `bank` table where the `state` is 'NY'.\nSCHEMA: CREATE TABLE bank (\n branch_ID INTEGER PRIMARY KEY,\n bname VARCHAR(20),\n no_of_customers INTEGER,\n city VARCHAR(10),\n state VARCHAR(20),\n contact_info STRUCT(address VARCHAR, phone VAR...
[ { "content": "What is the SQL query to rename the 'userroles' column to 'userrolecodes' in the 'Users' table?\nSCHEMA: CREATE TABLE \"Roles\" (\n \"role_code\" VARCHAR(15) PRIMARY KEY,\n \"role_description\" VARCHAR(80),\n \"role_users\" INT[]\n);\n\nCREATE TABLE \"Users\" (\n \"user_id\" INTEGER P...
[ { "content": "Create a new user-defined type 'mood' as an Enum, a table 'person' with attributes name (string type) and currentmood (mood type), and insert some sample data into the table.\nSCHEMA: CREATE TABLE wrestler (\n Wrestler_ID INTEGER,\n Name VARCHAR(255),\n Reign VARCHAR(255),\n Days_held...
[ { "content": "Export the database to a target directory in Parquet format with LZO compression and a row group size of 75,000.\nSCHEMA: CREATE TABLE \"Investors\" (\n\"investor_id\" INTEGER PRIMARY KEY,\n\"Investor_details\" VARCHAR(255),\n\"investor_json\" JSON\n);\n\nCREATE TABLE \"Lots\" (\n\"lot_id\" INTEGE...
[ { "content": "Instruction: Count the number of NULL values for all JSON columns in the Lots Parquet file.\nSCHEMA: CREATE TABLE \"Investors\" (\n\"investor_id\" INTEGER PRIMARY KEY,\n\"Investor_details\" VARCHAR(255),\n\"investor_json\" JSON\n);\n\nCREATE TABLE \"Lots\" (\n\"lot_id\" INTEGER PRIMARY KEY,\n\"inv...
[ { "content": "Read JSON objects from the file 'myfile1.json'.\nSCHEMA: ", "role": "user" }, { "content": "SELECT * FROM read_json_objects('my_file1.json');", "role": "assistant" } ]
[ { "content": "Format the review year into a more common date format.\nSCHEMA: CREATE TABLE \"checkin\" (\n \"cid\" INTEGER,\n \"business_id\" VARCHAR(255) REFERENCES \"business\"(\"business_id\"),\n \"count\" INTEGER,\n \"day\" VARCHAR(255),\n \"checkin_info\" JSON,\n primary key(\"cid\")\n);...
[ { "content": "Find the number of days between two elections for each representative.\nSCHEMA: CREATE TABLE \"election\" (\n \"Election_ID\" INTEGER,\n \"Representative_ID\" INTEGER,\n \"Date\" DATE,\n \"Votes\" DOUBLE,\n \"Vote_Percent\" DOUBLE,\n \"Seats\" DOUBLE,\n \"Place\" DOUBLE,\n ...
[ { "content": "Export the bus routes for School_ID 123 from the 'school_bus' table to a Parquet file named 'bus_routes_123.parquet' with Snappy compression.\nSCHEMA: CREATE TABLE \"driver\" (\n \"Driver_ID\" INTEGER,\n \"Name\" VARCHAR(255),\n \"Party\" VARCHAR(255),\n \"Home_city\" VARCHAR(255),\n ...
[ { "content": "Create a CSV file named 'nypeople.csv' containing the first name, last name, and email address of people living in NY with headers and comma-delimited.\nSCHEMA: CREATE TABLE People (\n person_id INTEGER NOT NULL,\n first_name TEXT,\n middle_name TEXT,\n last_name TEXT,...
[ { "content": "Create a derived table to extract the year, month, day, hour, minute, second, and microsecond from the `Staring_Date` column, then construct a `TIMESTAMP` value using the `duckdb::Value` type.\nSCHEMA: CREATE TABLE \"course_arrange\" (\n\"Course_ID\" INTEGER,\n\"Teacher_ID\" INTEGER,\n\"Grade\" I...
[ { "content": "Create a sequence named `unique_musical_id` that starts at 1 and has a maximum value of the largest possible `BIGINT` value. This sequence will be used to generate unique IDs for the `musical` table.\nSCHEMA: CREATE TABLE \"musical\" (\n\"Musical_ID\" INTEGER,\n\"Name\" TEXT\n);", "role": "us...
[ { "content": "What awards were given to musicals between 2000 and 2009? Export the results to an Excel file.\nSCHEMA: CREATE TABLE \"musical\" (\n\"Musical_ID\" INTEGER,\n\"Name\" TEXT\n);", "role": "user" }, { "content": "INSTALL spatial; -- Only needed once per DuckDB connection\nLOAD spatial; --...