conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "human", "value": "Make non-nullable class properties NOT NULL in database\n\nWhen we explicitly expect a database value to not be null in PHP, we\nshould enforce this constraint in the database.\n\nThe columns made `NOT NULL` here will be accessed with methods like\n`getInt` or `getString`, which...
sql
chosen
[ { "from": "human", "value": "DB/Creature: Update some Redridge and Mount Hyjal templates, thx to Alastyr\n" }, { "from": "gpt", "value": "\n-- Redridge\nUPDATE creature_template SET minlevel=17, maxlevel=17, faction_A=72, faction_H=72 WHERE entry IN (43461, 43459, 43508, 43607, 43462);\nUPDATE c...
sql
chosen
[ { "from": "human", "value": "Set channel for all existing add-on versions\n" }, { "from": "gpt", "value": "UPDATE `versions` INNER JOIN `addons` ON ( `versions`.`addon_id` = `addons`.`id` ) SET `channel` = 1 WHERE `addons`.`is_listed` = false;\nUPDATE `versions` INNER JOIN `addons` ON ( `version...
sql
chosen
[ { "from": "human", "value": "Patch to correct two site sampleds\n" }, { "from": "gpt", "value": "-- October 6, 2015\n-- Correct site_sampled from two previously logged samples as supported by the\n-- platemaps.\n\nUPDATE ag.ag_kit_barcodes SET site_sampled = 'Stool' WHERE barcode = '000001161';\...
sql
chosen
[ { "from": "human", "value": "Add migrations for the following bugs:\n\n* https://bugzilla.mozilla.org/show_bug.cgi?id=999103\n* https://bugzilla.mozilla.org/show_bug.cgi?id=999114\n* https://bugzilla.mozilla.org/show_bug.cgi?id=999142\n* https://bugzilla.mozilla.org/show_bug.cgi?id=999153\n* https://bugzill...
sql
chosen
[ { "from": "human", "value": "Create a database and grant it to user" }, { "from": "gpt", "value": "#Create a database\ncreate database myDatabase;\n#Grant specific permissions to specific database\ngrant select,update,alter,insert,delete,drop,create on username identified by password;\n#Reset pa...
sql
chosen
[ { "from": "human", "value": "Add query for selecting coursework for student users\n" }, { "from": "gpt", "value": "SELECT Coursework.id AS coursework_id, \nCoursework.title AS title,\nCoursework.date_submitted AS date_submitted,\nCoursework.file AS file,\nCoursework.file_extension AS file_extens...
sql
chosen
[ { "from": "human", "value": "Add SQL script to output workspace IDs\nLooks like internal workspaces don't have the source_identifier set.\nPreviously was using the condition:\n\nwhere workspace not in ('INTERNAL', 'COM.ORACLE.APEX.REPOSITORY');\n\nHowever, looking at apex 4 to 5, it looks like this list cha...
sql
chosen
[ { "from": "human", "value": "Add example of using query\n" }, { "from": "gpt", "value": "CREATE EXTENSION multicorn;\n\nCREATE SERVER multicorn_es FOREIGN DATA WRAPPER multicorn\nOPTIONS (\n wrapper 'pg_es.ElasticsearchFDW'\n);\n\nCREATE FOREIGN TABLE articles_es\n (\n id BIGINT,\n ...
sql
chosen
[ { "from": "human", "value": "Add conversion of data script for mysql\n" }, { "from": "gpt", "value": "DROP DATABASE IF EXISTS ce_common_data;\n\nCREATE DATABASE ce_common_Data;\n\nUSE ce_common_data;\n\nDELIMITER //\n\nCREATE PROCEDURE TestProc001 ()\nBEGIN\nEND//\n\nCREATE PROCEDURE TestProc002...
sql
chosen
[ { "from": "human", "value": "Add firefox57 tag to the db, setting it to restricted if it already existed\n" }, { "from": "gpt", "value": "INSERT INTO tags (tag_text, denied, restricted, num_addons, created, modified) VALUES ('firefox57', 0, 1, 0, NOW(), NOW()) ON DUPLICATE KEY UPDATE restricted ...
sql
chosen
[ { "from": "system", "value": "Add explicit column names to the view\n" }, { "from": "human", "value": "\nCREATE TABLE IF NOT EXISTS users (\n id BIGSERIAL NOT NULL,\n firstName VARCHAR NOT NULL,\n middleName VARCHAR,\n lastName VARCHAR NOT NULL,\n title VARCHAR,\n streetAddress...
sql
chosen
[ { "from": "human", "value": "KCIAC-310: Create notification for action \"Abandon\"\n" }, { "from": "gpt", "value": "INSERT INTO NOTIFICATION_TYPE (NOTIFICATION_TYPE_ID, MODULE_CODE, ACTION_CODE, DESCRIPTION, SUBJECT, MESSAGE, PROMPT_USER, SEND_NOTIFICATION, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR...
sql
chosen
[ { "from": "human", "value": "KCIAC-314: Implement notification for IACUC Terminate action\n" }, { "from": "gpt", "value": "INSERT INTO NOTIFICATION_TYPE (NOTIFICATION_TYPE_ID, MODULE_CODE, ACTION_CODE, DESCRIPTION, SUBJECT, MESSAGE, PROMPT_USER, SEND_NOTIFICATION, UPDATE_USER, UPDATE_TIMESTAMP, ...
sql
chosen
[ { "from": "human", "value": "KCIAC-236: Create generic iacucadmin and iacucresearcher user ID's for testing/development\n" }, { "from": "gpt", "value": "INSERT INTO KRIM_ROLE_T (ACTV_IND,DESC_TXT,KIM_TYP_ID,LAST_UPDT_DT,NMSPC_CD,OBJ_ID,ROLE_ID,ROLE_NM,VER_NBR)\r\n VALUES ('Y','IACUC Approv...
sql
chosen
[ { "from": "human", "value": "Add sql query determining generator feedins\n\nCalculation is based on normalized timeseries (coastDat2,\ndata_processing/calc_renpass_gis/feedin/calc_feedins.py)\n" }, { "from": "gpt", "value": "/* Query to determine feedin for solar & wind generators using normali...
sql
chosen
[ { "from": "human", "value": "Add update script for timestamps in client schema\n\n- provide a script to apply timestamp schema changes to all ready\n deployed instances. Because we are changing a column to NOT NULL\n we need to define a default, the current time was chosen as this default.\n- Sets it so t...
sql
chosen
[ { "from": "human", "value": "Add constraints to s2s opportunity table\n\n" }, { "from": "gpt", "value": "ALTER TABLE S2S_OPPORTUNITY modify S2S_SUBMISSION_TYPE_CODE null;\nupdate S2S_OPPORTUNITY set S2S_SUBMISSION_TYPE_CODE = null;\nALTER TABLE S2S_OPPORTUNITY modify S2S_SUBMISSION_TYPE_CODE VAR...
sql
chosen
[ { "from": "human", "value": "ADD mysql resources, such as the tidoop_job table creation\n" }, { "from": "gpt", "value": "DROP DATABASE cosmos_gui;\nCREATE DATABASE cosmos_gui;\nUSE cosmos_gui;\n\nCREATE TABLE tidoop_job (jobType TEXT NOT NULL, jobId VARCHAR(24) NOT NULL PRIMARY KEY UNIQUE, mapPr...
sql
chosen
[ { "from": "human", "value": "Add an history/raw price sql to create tables\n\nThis should be managed by the django app. But it’s only in case people\n(or I) want to run it without any app :)\n" }, { "from": "gpt", "value": "CREATE TABLE IF NOT EXISTS `emdr_price_history` (\r\n `type_id` int(11)...
sql
chosen
[ { "from": "human", "value": "KCCOI-268: Complete permissions for COI Questionnaires\n" }, { "from": "gpt", "value": "INSERT INTO KRIM_ROLE_PERM_T (ROLE_PERM_ID, OBJ_ID, VER_NBR, ROLE_ID, PERM_ID, ACTV_IND)\r\n VALUES (KRIM_PERM_ROLE_ID_BS_S.NEXTVAL, SYS_GUID(), 1, \r\n (SELEC...
sql
chosen
[ { "from": "human", "value": "Add a migration to add the 3 new fields\n" }, { "from": "gpt", "value": "BEGIN;\n\nALTER TABLE Presence ADD COLUMN `HomeRegionID` CHAR(36) NOT NULL;\nALTER TABLE Presence ADD COLUMN `HomePosition` CHAR(64) NOT NULL DEFAULT '<0,0,0>';\nALTER TABLE Presence ADD COLUMN ...
sql
chosen
[ { "from": "human", "value": "Add test table mysql dump.\n" }, { "from": "gpt", "value": "-- phpMyAdmin SQL Dump\n-- version 4.6.6deb5\n-- https://www.phpmyadmin.net/\n--\n-- Host: localhost:3306\n-- Generation Time: Jan 26, 2019 at 04:10 PM\n-- Server version: 5.7.25-0ubuntu0.18.04.2\n-- PHP Ver...
sql
chosen
[ { "from": "human", "value": "Add dashboard slides transition interval config settings\n" }, { "from": "gpt", "value": "\ndelete from configuration_settings where key = 'DASHBOARD_SLIDES_TRANSITION_INTERVAL_MILLISECOND';\ninsert into configuration_settings(key,value,name,description,groupname,val...
sql
chosen
[ { "from": "human", "value": "Migrate db add auth_tokens table\n" }, { "from": "gpt", "value": "\n-- +goose Up\n-- SQL in section 'Up' is executed when this migration is applied\nCREATE TABLE `auth_tokens` (\n `id` INT(11) NOT NULL AUTO_INCREMENT,\n `user_id` INT(11) NOT NULL,\n `auth_token` C...
sql
chosen
[ { "from": "human", "value": "Add cascading delete to make node deletion much easier\n" }, { "from": "gpt", "value": "BEGIN TRANSACTION;\n\nALTER TABLE items\nDROP CONSTRAINT items_node_fkey,\nADD CONSTRAINT items_node_nodes_node\n FOREIGN KEY (node)\n REFERENCES nodes(node)\n ON DELETE CAS...
sql
chosen
[ { "from": "human", "value": "Add sqlite3 test script for Q1.\n" }, { "from": "gpt", "value": "drop table if exists lineitem;\ncreate table lineitem (\n l_orderkey integer not null,\n l_partkey integer not null,\n l_suppkey integer not null,\n l_linenumb...
sql
chosen
[ { "from": "human", "value": "ISSUE-984: Change text mysql type to mediumtext for large schema\n\nChange text mysql type to mediumtext for large schema\n\nAuthor: Priyank <pshah@hortonworks.com>\n\nCloses #1064 from priyank5485/ISSUE-984\n" }, { "from": "gpt", "value": "-- Copyright 2017 Hortonwo...
sql
chosen
[ { "from": "human", "value": "Create topology and use pgRouting\n" }, { "from": "gpt", "value": "-- Install extensions\nCREATE EXTENSION postgis;\nCREATE EXTENSION postgis_topology;\nCREATE EXTENSION pgrouting;\nSET search_path = topology,public;\n\n-- Part I: Create topology for 'roads' with pos...
sql
chosen
[ { "from": "human", "value": "[COLAB-2838] Fix column length for validation\n" }, { "from": "gpt", "value": "ALTER TABLE xcolab_ProposalVote MODIFY initialValidationResult varchar(25);\nALTER TABLE xcolab_ProposalVote MODIFY lastValidationResult varchar(25);\nALTER TABLE xcolab_ProposalVote MODIF...
sql
chosen
[ { "from": "human", "value": "Add cameras dummy DB data\n" }, { "from": "gpt", "value": "INSERT INTO public.cameras VALUES (\n\t'c87c0ea0-c40f-4883-9a8f-e95ff6a66b94', -- UUID\n\t'00000000-0000-0000-0000-000000000001', -- owner UUID\n\t'Camera 1 - rooftop North', -- camera name\n\tCURRENT_TIMESTA...
sql
chosen
[ { "from": "human", "value": "Fix canned response default category.\n\nFixes #11450\n" }, { "from": "gpt", "value": "-- Set the default to \"Other\"\nALTER TABLE `cannedresponses`\nMODIFY COLUMN `category` integer NOT NULL DEFAULT 1;\n\n-- Correct existing canned responses.\nUPDATE `cannedrespons...
sql
chosen
[ { "from": "human", "value": "Add back in v2 of the test script.\n" }, { "from": "gpt", "value": "-- Copyright (c) 2014 KSM Technology Partners\n--\n-- Licensed under the Apache License, Version 2.0 (the \"License\")--\n-- you may not use this file except in compliance with the License.\n-- You m...
sql
chosen
[ { "from": "human", "value": "Change TO ds table protocol column to not null\n\nFixes #1076\n" }, { "from": "gpt", "value": "/*\n\tCopyright 2016 Comcast Cable Communications Management, LLC\n\n\tLicensed under the Apache License, Version 2.0 (the \"License\");\n\tyou may not use this file except...
sql
chosen
[ { "from": "human", "value": "Add new DB upgrade script\n" }, { "from": "gpt", "value": "BEGIN;\n\n-- Rename the status_usage view to use v_XXXXXX naming convention\nALTER VIEW IF EXISTS stats_usage RENAME TO v_stats_usage;\nALTER VIEW IF EXISTS active_move_requests RENAME TO v_active_move_reques...
sql
chosen
[ { "from": "human", "value": "Add dimension sql for procedure occurrence table\n" }, { "from": "gpt", "value": "/* Build procedure occurrence dimension table. */\nINSERT INTO #dim\nSELECT\n cp.person_id,\n SUBSTRING(REPLACE(sm.source_code, '.', '') FROM 1 FOR 3) AS covariate_id,\n COUNT(...
sql
chosen
[ { "from": "human", "value": "fix(DB/Loot): Remove Bolt of Silk Cloth from creature loot\n\n" }, { "from": "gpt", "value": "INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1640238214916352424');\n\nDELETE FROM `creature_loot_template` WHERE `Item` = 4305;\n" } ]
sql
chosen
[ { "from": "human", "value": "Add index by user id on receipts_linearized\n" }, { "from": "gpt", "value": "/* Copyright 2015, 2016 OpenMarket Ltd\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You ...
sql
chosen
[ { "from": "human", "value": "Update datasource as the old one has been removed\n" }, { "from": "gpt", "value": "UPDATE oskari_statistical_datasource SET config='{\n\t\"url\": \"https://pxnet2.stat.fi/pxweb/api/v1/{language}/Kuntien_avainluvut/2019/kuntien_avainluvut_2019_aikasarja.px\",\n\t\"inf...
sql
chosen
[ { "from": "human", "value": "PT-258: Add millisecond precision for DATETIME columns\n" }, { "from": "gpt", "value": "####################### update these variables for db versioning purposes ############################################\nSET @db_verison_id = '3';\nSET @file_name = '003_millisecon...
sql
chosen
[ { "from": "human", "value": "Fix for CSI calendar 2014/2015\n" }, { "from": "gpt", "value": "-- Inizio script\r\n/*!40101 SET character_set_client = latin1 */;\r\n/*!40103 SET TIME_ZONE='+00:00' */;\r\n\r\nSET AUTOCOMMIT=0;\r\nSTART TRANSACTION;\r\n\r\n-- Fix 2a prova CSI event types\r\nupdate m...
sql
chosen
[ { "from": "human", "value": "developer: Move custom sql commands to one prefill schema file\n\nThe sql-maven plugin does not allow multiple sqlCommands to executed, only the\nlast one in the <configuration> gets executed, so moving out all the developer\nrelated schema to one file.\n\nAdds:\n - ROOT domain...
sql
chosen
[ { "from": "human", "value": "NXP-14045: Add a postgresql SQL script to list documents that hold ACLs that are not compatible with simplified ACL\n" }, { "from": "gpt", "value": "-- display the path of a doc id\nCREATE OR REPLACE FUNCTION nx_path(docid VARCHAR(36))\nRETURNS varchar\nAS $$\n-- Ret...
sql
chosen
[ { "from": "human", "value": "Add SQL from active members\n" }, { "from": "gpt", "value": "-- Members who:\n-- are in speakout member group on status Added (confirmed by email)\n-- created during last 1 month\n-- have a more than 1 activities (petitions, share)\nSELECT\n gc.contact_id, c.display...
sql
chosen
[ { "from": "human", "value": "Change ARVO table columns regarding taustakysymys.\n" }, { "from": "gpt", "value": "IF NOT EXISTS (\n select * from INFORMATION_SCHEMA.COLUMNS\n where TABLE_SCHEMA='dbo' and TABLE_NAME='sa_arvo_kaikki'\n and COLUMN_NAME='taustakysymykset'\n) BEGIN\nALTER TABLE dbo...
sql
chosen
[ { "from": "human", "value": "KCIAC-315: Implement notification for IACUC Review Complete action\n" }, { "from": "gpt", "value": "INSERT INTO NOTIFICATION_TYPE (NOTIFICATION_TYPE_ID, MODULE_CODE, ACTION_CODE, DESCRIPTION, SUBJECT, MESSAGE, PROMPT_USER, SEND_NOTIFICATION, UPDATE_USER, UPDATE_TIMES...
sql
chosen
[ { "from": "human", "value": "Add function to get orgs per user\n\nSigned-off-by: Michael Casadevall <6fe105eefab41990d7ec714c6c25ade3095cdb48@them.com>\n" }, { "from": "gpt", "value": "-- Returns the organizations for a user\nCREATE FUNCTION webui.get_organizations_for_user(_user_id bigint) RETU...
sql
chosen
[ { "from": "human", "value": "Include a copy of the database with some test data\n" }, { "from": "gpt", "value": "CREATE TABLE IF NOT EXISTS `employee_data` (\n `em_id` int(11) NOT NULL AUTO_INCREMENT,\n `em_firstname` text NOT NULL,\n `em_lastname` text NOT NULL,\n `em_shiftstart` text NOT N...
sql
chosen
[ { "from": "system", "value": "Replace 'my_user' with 'vagrant' in .sql snippet\n" }, { "from": "human", "value": "-- http://stackoverflow.com/questions/8092086/create-postgresql-role-user-if-it-doesnt-exist\nDO\n$body$\nBEGIN\n IF NOT EXISTS (\n SELECT *\n FROM pg_catalog.pg_user\n...
sql
chosen
[ { "from": "human", "value": "core: Change min allocated memory of blank template\n\nThe min allocated memory of blank template was by default 0 which is not\ncorrect and if such a template is edited, the validations fail.\n\nFixed by changing the min allocated memory to memory size for the blank\ntemplate i...
sql
chosen
[ { "from": "human", "value": "Add Identify All Logins With No Associated Default Database User script\n" }, { "from": "gpt", "value": "/*\nAuthor: Tim Ford\nOriginal link: http://sqlmag.com/security/identifying-sql-server-logins-without-default-database-users\n*/\n--==============================...
sql
chosen
[ { "from": "human", "value": "Add index on lddb__dependencies (dependsonid, relation)\n\nQueries like\n\"SELECT id FROM lddb__dependencies WHERE dependsOnId = $1 AND relation = $2\"\nwhere relation is 'broader' are frequently slow. This fixes that.\n\ne.g. for Concepts, reverse 'broader' relations are caclul...
sql
chosen
[ { "from": "human", "value": "Add procedures addYear and addDay\n" }, { "from": "gpt", "value": "SELECT 'Add procedure addYear for inserting new year' AS '';\ndelimiter //\nCREATE PROCEDURE addYear (IN year INT, IN factor DOUBLE)\nBEGIN\nINSERT INTO Year (Year, Profitfactor) VALUES ( year, factor...
sql
chosen
[ { "from": "human", "value": "[FEATURE] Add Which Indexes are not Used script\n" }, { "from": "gpt", "value": "/*\nAuthor: Greg Larsen\nOriginal links: http://www.databasejournal.com/features/mssql/which-indexes-are-not-used.html\n*/\n\nSELECT o.name Object_Name,\n SCHEMA_NAME(o.schema_id) ...
sql
chosen
[ { "from": "human", "value": "DELETE FROM KRMS_TYP_T WHERE NM='CONTEXT'\n/\nINSERT INTO KRMS_TYP_T(TYP_ID,NM,NMSPC_CD,SRVC_NM,ACTV,VER_NBR) values ('KC1003','CONTEXT','KC-KRMS',null,'Y',1)\n/\nUPDATE KRMS_CNTXT_T SET TYP_ID='KC1003' where CNTXT_ID='KC-PROTOCOL-CONTEXT'\n/\n" }, { "from": "gpt", "...
sql
chosen
[ { "from": "human", "value": "Add Attach Disk/Cpu profile permissions to all Import/Export capable roles\n\nBug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1255405\nChange-Id: Id2cc0e56bd1ea4a5f9aeac0684a2acc3998a5e9d\nSigned-off-by: Martin Sivak <361315d85e190db42db95eaca639c05fa7701076@redhat.com>\n" ...
sql
chosen
[ { "from": "human", "value": "Write up an initial schema.\n\nNo compiltion node stuff or evaluation stuff yet...\nJust users, applications, and the linkage between them.\n" }, { "from": "gpt", "value": "# ---!Ups\ncreate table users(\n id bigserial not null primary key,\n username varchar(255) ...
sql
chosen
[ { "from": "human", "value": "Add single deck select sp\n" }, { "from": "gpt", "value": "CREATE FUNCTION sp_app_decks_select\n(\n apiKey TEXT,\n deckId INTEGER\n)\n\nRETURNS TABLE\n(\n jdoc JSON\n) AS\n\n$$\nBEGIN\n RETURN QUERY\n WITH d AS (\n SELECT app_decks...
sql
chosen
[ { "from": "human", "value": "Add v1 to v2 SQL update script\n" }, { "from": "gpt", "value": "ALTER TABLE \"note\" ADD COLUMN deleted bool default false;\nCREATE TABLE \"link\" (id integer primary key, source integer not null, target integer not null, name text, FOREIGN KEY(source) REFERENCES not...
sql
chosen
[ { "from": "human", "value": "Create DB migration to fix typo in code 1S/de" }, { "from": "gpt", "value": "UPDATE code_tr\nset name = 'Milben, Allergene in der Raumluft'\nwhere code = '1S' and lang_code = 'de'\n and name = 'Milben, Allergene in den Raumluft';\n" } ]
sql
chosen
[ { "from": "human", "value": "Fix to previous migration script\n" }, { "from": "gpt", "value": "/*\n################################################################################\nMigration script to update MAPPING_METADATA table and change ENSEMBL_RELEASE_NUMBER\ntype.\n\nDesigned for executio...
sql
chosen
[ { "from": "human", "value": "[KULRICE-12713] Add created date to demo travel account records.\n\ngit-svn-id: 2a5d2b5a02908a0c4ba7967b726d8c4198d1b9ed@46837 7a7aa7f6-c479-11dc-97e2-85a2497f191d\n" }, { "from": "gpt", "value": "--\r\n-- Copyright 2005-2014 The Kuali Foundation\r\n--\r\n-- Licensed...
sql
chosen
[ { "from": "human", "value": "Add custom select query for selecting class for a student\n" }, { "from": "gpt", "value": "SELECT Class.id AS id, \nClass.module_id AS moduleId, \nModule.name AS moduldeName \nFROM Class \nINNER JOIN Module ON Module.id = Class.module_id \nINNER JOIN Semester ON Seme...
sql
chosen
[ { "from": "human", "value": "feat: Add config cleaning routine and event\n" }, { "from": "gpt", "value": "DROP EVENT IF EXISTS CleanConfig;\nDELIMITER $\nCREATE EVENT CleanConfig\n ON SCHEDULE EVERY 1 DAY\n STARTS CURRENT_TIMESTAMP\nDO\n BEGIN\n SELECT COUNT(*) INTO @cnt FROM configuration...
sql
chosen
[ { "from": "human", "value": "Add constraint to datasetVersion table\n\n…to prevent multiple draft versions\n" }, { "from": "gpt", "value": "/* ----------------------------------------\n Add unique constraint to prevent multiple drafts\n Ticket 2132\n*/ --------------------------------------...
sql
chosen
[ { "from": "human", "value": "Add reporting title configuration settings\n" }, { "from": "gpt", "value": "\ndelete from configuration_settings where key = 'REPORTING_PROGRAM_TITLE';\n\nINSERT INTO configuration_settings (key, name, groupname, description, value, valueType,displayOrder)\n values ...
sql
chosen
[ { "from": "human", "value": "Allow duplicate geoname locations to exist in the database\n" }, { "from": "gpt", "value": "-- Removes the unique constraint on geoname_id in the location table, to allow multiple locations to be tied to the same geoname (i.e. if geonames/hm fixes lat/long).\n--\n-- ...
sql
chosen
[ { "from": "human", "value": "Add SQL unit tests for materialization\n" }, { "from": "gpt", "value": "BEGIN;\n\nSELECT plan(3);\n\n\nSELECT trend.create_trendstore(\n 'test-data',\n 'Node',\n '900',\n ARRAY[\n ('x', 'integer', 'some column with integer values')\n ]::trend.tr...
sql
chosen
[ { "from": "human", "value": "KCIAC-286: Implement IACUC notification for Admin Approval\n" }, { "from": "gpt", "value": "INSERT INTO NOTIFICATION_TYPE (NOTIFICATION_TYPE_ID, MODULE_CODE, ACTION_CODE, DESCRIPTION, SUBJECT, MESSAGE, PROMPT_USER, SEND_NOTIFICATION, UPDATE_USER, UPDATE_TIMESTAMP, VE...
sql
chosen
[ { "from": "human", "value": "KCIAC-319: Implement notification for IACUC Rescheduled event\n" }, { "from": "gpt", "value": "INSERT INTO NOTIFICATION_TYPE (NOTIFICATION_TYPE_ID, MODULE_CODE, ACTION_CODE, DESCRIPTION, SUBJECT, MESSAGE, PROMPT_USER, SEND_NOTIFICATION, UPDATE_USER, UPDATE_TIMESTAMP,...
sql
chosen
[ { "from": "human", "value": "Create views to fetch statistics for the dashboard\n" }, { "from": "gpt", "value": "/*Connect to database*/\n\\connect mobydq\n\n\n\n/*Create view to get batch status summary*/\nCREATE OR REPLACE VIEW base.batch_status\nAS SELECT a.id\n , a.status\n , a.created_dat...
sql
chosen
[ { "from": "human", "value": "Add metadata fields for scenes\n" }, { "from": "gpt", "value": "--- Adds fields to scenes for storing raster source metadata\nALTER TABLE scenes\nADD COLUMN data_path text,\nADD COLUMN crs text,\nADD COLUMN band_count integer,\nADD COLUMN cell_type text,\nADD COLUMN ...
sql
chosen
[ { "from": "human", "value": "Clean tables sql script to delete from all relevant tables to testing\n" }, { "from": "gpt", "value": "-- Builds\nDELETE FROM BUILD;\n\n-- Champions\nDELETE FROM CHAMPION_TAG;\nDELETE FROM CHAMPION_SPELL_IMAGE;\nDELETE FROM CHAMPION_SPELL_COST;\nDELETE FROM CHAMPION_...
sql
chosen
[ { "from": "human", "value": "OLMIS-2609: Create rights to manage CCE\n\nassign to system administrator\n" }, { "from": "gpt", "value": "INSERT INTO rights (id, description, name, type) VALUES ('75063c92-8987-4624-9138-e8f163546541', NULL, 'CCE_MANAGE', 'GENERAL_ADMIN');\n\nINSERT INTO referenced...
sql
chosen
[ { "from": "human", "value": "Add state name to adm1_code mapping\n" }, { "from": "gpt", "value": "create table fed_state_map(\n CODE VARCHAR2(8) PRIMARY KEY,\n STATE_NAME VARCHAR2(30) NOT NULL\n);\n/\n\ninsert into fed_state_map values ('DEU-1573', 'BadenWürttemberg');\ninsert into fed_sta...
sql
chosen
[ { "from": "human", "value": "Add init DB schema script\n" }, { "from": "gpt", "value": "drop schema rondes;\ncreate schema rondes;\nuse rondes;\n\ncreate table garde(\nid_garde INT(8) UNSIGNED AUTO_INCREMENT, \nnom VARCHAR(64) NOT NULL, \nid_tag VARCHAR(16) UNIQUE NOT NULL,\nPRIMARY KEY (id_gard...
sql
chosen
[ { "from": "human", "value": "Change the action of Deathguard Terrence in Brill when he reaches the lantern: Use oneshot \"laughing\" instead of emote state\n" }, { "from": "gpt", "value": "INSERT INTO version_db_world (`sql_rev`) VALUES ('1525369154910150908');\n\nUPDATE `waypoint_data` SET `act...
sql
chosen
[ { "from": "human", "value": "Create sql migration to initialize database\n" }, { "from": "gpt", "value": "CREATE SEQUENCE \"public\".\"Movies_id_seq\"\nINCREMENT 1\nMINVALUE 1\nMAXVALUE 9223372036854775807\nSTART 1\nCACHE 1;\n\n\nCREATE SEQUENCE \"public\".\"M_genre_genre_id_seq\"\nINCREMENT 1\n...
sql
chosen
[ { "from": "human", "value": "Add sql file for creating index on source_dataset_version_log" }, { "from": "gpt", "value": "\ncreate index if not exists source_dataset_version_log_source_dataset_version_id_create_time_idx on source_dataset_version_log using btree(source_dataset_version_id, create_...
sql
chosen
[ { "from": "human", "value": "Add migration for new wof column\n" }, { "from": "gpt", "value": "DO $$\nBEGIN\n\nIF NOT EXISTS (\n SELECT 1 FROM pg_attribute\n WHERE attrelid = 'public.wof_neighbourhood'::regclass\n AND attname = 'l10n_name'\n AND NOT attisdropped) THEN\n\n ALTER TABLE ...
sql
chosen
[ { "from": "human", "value": "Create : 175 Combine Two Tables\n" }, { "from": "gpt", "value": "SELECT\n p.firstname AS FirstName,\n p.lastname AS LastName,\n a.city AS City,\n a.state AS State\nFROM\n Person AS p\n LEFT JOIN Address AS a\n ON p.personid = a.personid\n;\n" } ]
sql
chosen
[ { "from": "human", "value": "core: Fix db upgrade in PostgreSQL 8.x\n\nPostgreSQL 8.x and 9.x have a different behaviour regarding when inline\nSQL queries in PL/pgSQL code is evaluated (see\nhttp://wiki.postgresql.org/wiki/What%27s_new_in_PostgreSQL_9.0#PL.2FpgSQL_changes_which_may_cause_regressions).\n\nT...
sql
chosen
[ { "from": "human", "value": "Add migration to update index\n" }, { "from": "gpt", "value": "CREATE INDEX new_planet_osm_polygon_water_geom_index ON planet_osm_polygon USING gist(way) WHERE mz_calculate_is_water(\"amenity\", \"landuse\", \"leisure\", \"natural\", \"waterway\") = TRUE;\n\nBEGIN;\n...
sql
chosen
[ { "from": "human", "value": "Fix Abandoned Adventurer's Satchel item loot\n" }, { "from": "gpt", "value": "-- Fix Abandoned Adventurer's Satchel item loot\n\nDELETE FROM item_template_addon WHERE entry = 44663;\nDELETE FROM item_loot_template WHERE entry = 44663;\nINSERT INTO item_template_addon...
sql
chosen
[ { "from": "human", "value": "Add index to entry_item table\n" }, { "from": "gpt", "value": "create index if not exists entry_item_entry_number_index on entry_item (entry_number);\ncreate index if not exists entry_item_sha256hex_index on entry_item (sha256hex);" } ]
sql
chosen
[ { "from": "human", "value": "IFS-4631: Migrate live projects to new project docs functionality\n" }, { "from": "gpt", "value": "-- IFS-4631 Migrate live projects to new project docs functionality\n\nINSERT INTO document_config\n(competition_id, title, guidance, editable, enabled, type)\nSELECT c...
sql
chosen
[ { "from": "human", "value": "Patch to add new table geneset_QC\n" }, { "from": "gpt", "value": "-- Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute\n-- Copyright [2016] EMBL-European Bioinformatics Institute\n-- \n-- Licensed under the Apache L...
sql
chosen
[ { "from": "human", "value": "Drop obsolete columns from autoapprovalsummary table\n\nThe model fields were removed in a previous push and\nthe db columns made nullable so they are now safe to\ndrop.\n" }, { "from": "gpt", "value": "ALTER TABLE `editors_autoapprovalsummary`\n DROP COLUMN `uses...
sql
chosen
[ { "from": "human", "value": "Add sql solution for 197. Rising Temperature\n\n197. Rising Temperature: https://leetcode.com/problems/rising-temperature/\n" }, { "from": "gpt", "value": "SELECT `Weather`.`Id` FROM `Weather` LEFT JOIN `Weather` AS `yesterday` ON SUBDATE(`Weather`.`Date`, 1) = `yest...
sql
chosen
[ { "from": "human", "value": "KRACOEUS-6002: Store sent notifications for tracking purposes\n" }, { "from": "gpt", "value": "CREATE TABLE COI_NOTIFICATION\r\n(\r\n NOTIFICATION_ID NUMBER(20)\r\n , NOTIFICATION_TYPE_ID NUMBER(6) NOT NULL\r\n , DOCUMENT_NUMBER VARCHAR2(40) NOT NU...
sql
chosen
[ { "from": "human", "value": "Fix migration script for rnr status summary\n" }, { "from": "gpt", "value": "\n DROP VIEW IF EXISTS vw_rnr_status_details;\n\nCREATE OR REPLACE VIEW vw_rnr_status_details AS\n SELECT p.name AS programname, r.programid, r.periodid, ps.name AS periodname, rg.id AS re...
sql
chosen
[ { "from": "human", "value": "Add feature types SQL for wiki installation instructions\n" }, { "from": "gpt", "value": "SET SQL_MODE=\"NO_AUTO_VALUE_ON_ZERO\";\n\n\n/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;\n/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS *...
sql
chosen
[ { "from": "human", "value": "Add the website db schema\n" }, { "from": "gpt", "value": "--\n-- PostgreSQL database dump\n--\n\n-- Dumped from database version 12.2 (Ubuntu 12.2-2.pgdg19.10+1)\n-- Dumped by pg_dump version 12.2 (Ubuntu 12.2-2.pgdg19.10+1)\n\nSET statement_timeout = 0;\nSET lock_t...
sql
chosen
[ { "from": "human", "value": "Add PL/PGSQL function to find tables involved in a query\n" }, { "from": "gpt", "value": "-- Return an array of table names used by a given query\nCREATE OR REPLACE FUNCTION CDB_QueryTables(query text)\nRETURNS name[]\nAS $$\nDECLARE\n exp XML;\n tables NAME[];\nBE...
sql
chosen
[ { "from": "human", "value": "Write migration for commit cedb529\n" }, { "from": "gpt", "value": "CREATE TABLE users_locations (\n\tuser_id INTEGER, \n\tlocation_id INTEGER, \n\tFOREIGN KEY(user_id) REFERENCES user (id), \n\tFOREIGN KEY(location_id) REFERENCES location (id)\n);\n\n" } ]
sql
chosen
[ { "from": "human", "value": "Add Kenneth Fisher blocked session script\n" }, { "from": "gpt", "value": "/*\nAuthor: Kenneth Fisher\nOriginal link: https://sqlstudies.com/2017/01/18/lead-blocker/\n*/\nWITH Blocked_Sessions AS (\n -- Collect lead blockers\n -- Pull all blocking IDs...
sql
chosen
[ { "from": "human", "value": "Add query for sources list cleaning\n" }, { "from": "gpt", "value": "SELECT s.*, group_concat(DISTINCT o.ItemType) as ObjectTypes, count(o.PrimaryKey_Object_Table) as NumRecords from Sources s LEFT JOIN Objects o ON (s.SourceName = o.SourceName) GROUP BY s.SourceName...
sql
chosen
[ { "from": "human", "value": "Check if hidden columns setting is set for alert detail page\n" }, { "from": "gpt", "value": "-- Function: fn_get_notification_details(anyelement, integer)\n\n-- DROP FUNCTION fn_get_notification_details(anyelement, integer);\n\nCREATE OR REPLACE FUNCTION fn_get_noti...
sql
chosen
[ { "from": "human", "value": "Add auth token as part of the migration process\n" }, { "from": "gpt", "value": "insert into auth_tokens(id, auth_token, granted_timestamp) VALUES('3b4b6182-4914-4cf2-ac83-1247c98b4df7', 'a', current_timestamp);" } ]
sql
chosen
[ { "from": "human", "value": "Add initial cut of HBASE_STAT_DAT_SRC table sql\n" }, { "from": "gpt", "value": "/*\n * Copyright 2016 Crown Copyright\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * Y...
sql
chosen