conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "human", "value": "Remove status of a monitored layer when layer is removed\n" }, { "from": "gpt", "value": "-- Delete status when layer is removed with cascade. Otherwise prevents monitored layers from being removed.\nalter table oskari_backendstatus drop constraint oskari_backendstat...
sql
chosen
[ { "from": "human", "value": "Add function List_Messages() to return list of Messages\n" }, { "from": "gpt", "value": "CREATE OR REPLACE FUNCTION List_Messages(OUT Datestamp timestamptz, OUT MessageID char(10), OUT MessageType text, OUT FromBankID text, OUT ToBankID text) RETURNS SETOF RECORD AS ...
sql
chosen
[ { "from": "human", "value": "Add First version of DDL\n" }, { "from": "gpt", "value": "DROP TABLE IF EXISTS `wiki`;\nCREATE TABLE `wiki` (\n `id` INTEGER PRIMARY KEY AUTOINCREMENT,\n `title` TEXT NOT NULL,\n `content` TEXT NOT NULL,\n `unixtime` BIGINT NOT NULL\n);\n\nDROP TABLE IF EXISTS `w...
sql
chosen
[ { "from": "human", "value": "Add pushplan to create Conflicts column in db\n\nAdd SQL commands needed to create / rollback the 'Conflicts' column in\nthe push_requests DB field.\n" }, { "from": "gpt", "value": "/*\nAdd conflicts column to push_requests\n*/\n\n# MySQL Syntax\nALTER TABLE `push_re...
sql
chosen
[ { "from": "human", "value": "Add password for root admin account\n" }, { "from": "gpt", "value": "insert into user_passwords\n(guid, user_guid, algorithm_key, hash, created_by_guid, updated_by_guid)\nvalues\n('d5f119dd-1e69-4a84-8b75-7bf73362c563',\n (select guid from users where deleted_at is n...
sql
chosen
[ { "from": "human", "value": "Add test SQL script with sub-queries\n" }, { "from": "gpt", "value": "SELECT *\n FROM (\n SELECT t1m.id,\n t1m.group_id,\n piv.c_black,\n piv.c_brown,\n piv.c_red,\n piv.c_orange,\n ...
sql
chosen
[ { "from": "human", "value": "Add SQL export of database/table structure\n" }, { "from": "gpt", "value": "-- phpMyAdmin SQL Dump\n-- version 4.2.7.1\n-- http://www.phpmyadmin.net\n--\n-- Host: 127.0.0.1\n-- Generation Time: Apr 20, 2015 at 09:38 PM\n-- Server version: 5.5.39\n-- PHP Version: 5.4....
sql
chosen
[ { "from": "human", "value": "Add query to list bank clients subscribed to the bot\n" }, { "from": "gpt", "value": "/* users subscribed that are clients in the bank will never get an answer\n this query list them\n */\nSELECT cached_results.user_id, users.rut, cached_results.rut, result\nFROM c...
sql
chosen
[ { "from": "human", "value": "Expand index on pending authz to include expires.\n" }, { "from": "gpt", "value": "\n-- +goose Up\n-- SQL in section 'Up' is executed when this migration is applied\n\nCREATE INDEX `regId_expires_idx` on `pendingAuthorizations` (`registrationID`, `expires`);\nDROP IN...
sql
chosen
[ { "from": "system", "value": "OF-631: Fix upgrade script for SQLServer\n" }, { "from": "human", "value": "// add columns for SASL SCRAM-SHA-1\r\nALTER TABLE ofUser ADD COLUMN storedKey VARCHAR(32);\r\nALTER TABLE ofUser ADD COLUMN serverKey VARCHAR(32);\r\nALTER TABLE ofUser ADD COLUMN salt VARC...
sql
chosen
[ { "from": "human", "value": "Add additional nmap scan types\n\nSigned-off-by: Michael Casadevall <6fe105eefab41990d7ec714c6c25ade3095cdb48@them.com>\n" }, { "from": "gpt", "value": "-- Adds additional types to NMAP types in the database\n\n-- Reasons in scans that were previously overlooked.\nAL...
sql
chosen
[ { "from": "human", "value": "Add SQL script to convert production to development database\n" }, { "from": "gpt", "value": "DELETE FROM content WHERE id NOT IN (SELECT id FROM content WHERE hashId IN ('4rcn', '100', 'h', '100U', 'hdfm'));\nDELETE FROM flickr WHERE contentId NOT IN (SELECT id FROM...
sql
chosen
[ { "from": "human", "value": "IFS-3980: Update all webtest users to have agreed to the new terms and conditions, so acceptance tests aren't broken\n" }, { "from": "gpt", "value": "-- IFS-3980\n-- Set all of the webtest users to have already agreed to the new terms and conditions\n-- Needed since ...
sql
chosen
[ { "from": "human", "value": "Remove print bundle from 3D view\n" }, { "from": "gpt", "value": "delete from portti_view_bundle_seq\nwhere bundleinstance = 'printout'\nand exists (select id from portti_view v where id = view_id and name = 'Geoportal Ol Cesium');" } ]
sql
chosen
[ { "from": "human", "value": "Sort listings by most recent\n" }, { "from": "gpt", "value": "USE print_to_resist;\n\nDROP PROCEDURE IF EXISTS get_approved_listings;\nDELIMITER //\n\nCREATE PROCEDURE get_approved_listings ()\nBEGIN\n SELECT l.*,\n (SELECT GROUP_CONCAT(image_id SEPARATOR \"...
sql
chosen
[ { "from": "human", "value": "Change listing tags to cascade\n" }, { "from": "gpt", "value": "USE print_to_resist;\n\nALTER TABLE tags\nDROP FOREIGN KEY tags_fk_listings;\n\nALTER TABLE tags\nADD CONSTRAINT tags_fk_listings\n FOREIGN KEY (listing_id)\n REFERENCES listings (listing_id)\n ...
sql
chosen
[ { "from": "human", "value": "core: Add upgrade script for sound cards support\n\nChange-Id: I3a6d056e87dc6b3eff1937db4bbb1efef212095b\n" }, { "from": "gpt", "value": "CREATE OR REPLACE FUNCTION add_vm_device_soundcard_0730()\nRETURNS void\nAS $function$\nDECLARE\n -- get all VM desktops\n ...
sql
chosen
[ { "from": "human", "value": "IFS-4629: Add new documents functionality to an aexisting webtest competition\n" }, { "from": "gpt", "value": "-- IFS 4629 Add new documents fucntionality to an existing webtest competition to aid with acceptance tests\n\nINSERT INTO `document_config`\n(`competition_...
sql
chosen
[ { "from": "system", "value": "Add cleanup data script for inReview/Released DS Versions\n" }, { "from": "human", "value": "/* ---------------------------------------\nSeparate Terms of Use and Access from Dataset Version \nand add to Template\n*/ ---------------------------------------\nALTER TA...
sql
chosen
[ { "from": "human", "value": "Remove indicatorKey as it doesn't make sense here\n" }, { "from": "gpt", "value": "UPDATE oskari_statistical_datasource SET config='{\n \"url\": \"https://statdb.luke.fi/pxweb/api/v1/{language}/LUKE\",\n \"info\": {\n \"url\": \"https://stat.luke.fi/\"\n...
sql
chosen
[ { "from": "human", "value": "Change Sotkanet REST and info URL\n" }, { "from": "gpt", "value": "UPDATE oskari_statistical_datasource SET config = replace(config, '\"https://www.sotkanet.fi', '\"https://sotkanet.fi') WHERE (config::json)->>'url' = 'https://www.sotkanet.fi/rest';\n" } ]
sql
chosen
[ { "from": "human", "value": "Add `on delete cascade` migration\n" }, { "from": "gpt", "value": "-- // \n-- Migration SQL that makes the change goes here.\nALTER TABLE video_dl_queue\n DROP CONSTRAINT video_dl_queue_track_id_fkey,\n ADD CONSTRAINT video_dl_queue_track_id_fkey\n FOREIGN KEY (...
sql
chosen
[ { "from": "human", "value": "Add missing migration from 602144100.\n" }, { "from": "gpt", "value": "-- Remove surrogate key, and use tweet ID instead. Make reply_to a foreign key,\n-- and rename it to conform to our conventions.\nALTER TABLE customercare_tweet DROP id, ADD PRIMARY KEY (tweet_id)...
sql
chosen
[ { "from": "human", "value": "Make users have secret keys, not the user/app relationship.\n" }, { "from": "gpt", "value": "# ---!Ups\nalter table application_users drop column secret_key;\nalter table users add column secret_key varchar(36) not null;\ndrop index application_users_idx;\ncreate ind...
sql
chosen
[ { "from": "human", "value": "Change URL & region key for TK API\n" }, { "from": "gpt", "value": "UPDATE oskari_statistical_datasource SET config='{\n\t\"url\": \"https://pxnet2.stat.fi/pxweb/api/v1/fi/Kuntien_avainluvut/2018/kuntien_avainluvut_2018_aikasarja.px\",\n\t\"info\": {\n\t\t\"url\": \"...
sql
chosen
[ { "from": "human", "value": "Add import code for audit reports to upsert script\n" }, { "from": "gpt", "value": "BEGIN;\n\nCREATE TEMPORARY TABLE audit_reports_upsert\n(\n demarcation_code TEXT,\n financial_year integer,\n url TEXT\n) ON COMMIT DROP;\n\n\\copy audit_reports_...
sql
chosen
[ { "from": "human", "value": "Add SQL update script for pa_project.expiration.\n" }, { "from": "gpt", "value": "\n-- Add an expiration column to the pa_project table. Existing projects\n-- will not have an expiration time, and thus will never expire. New\n-- projects will either be configured to ...
sql
chosen
[ { "from": "human", "value": "Add trigger to clean old project_views\n" }, { "from": "gpt", "value": "# --- !Ups\n\nCREATE OR REPLACE FUNCTION delete_old_project_views()\n RETURNS trigger AS\n$$\nBEGIN\n DELETE FROM project_views WHERE created_at < current_date - interval '30' day;;\n RETURN N...
sql
chosen
[ { "from": "system", "value": "Fix bad upgrade014_015 ALTER TABLE command\n\nReviewed-by: Cedric Beust <a2650cde75a208e78840b38a73898d8daf5e4b6f@google.com>\nSigned-off-by: Shawn O. Pearce <f3ea74d906fa9fe97c1fef6bad9cb871485c7045@google.com>\n" }, { "from": "human", "value": "-- Upgrade: schema_...
sql
chosen
[ { "from": "human", "value": "Create GIST index on tasks location column\n\n* Add evolution ensuring that GIST index is created on tasks `location`\ncolumn\n" }, { "from": "gpt", "value": "# --- !Ups\n-- Add spatial index to task location, if missing\nCREATE INDEX IF NOT EXISTS idx_tasks_location...
sql
chosen
[ { "from": "human", "value": "Allow null feed_ids. Index on full_id.\n" }, { "from": "gpt", "value": "-- Migration from version 1 - 2 of classifier database.\n--\n-- Changes entries.feed_id to remove the NOT NULL\nbegin;\n\nCREATE TEMPORARY TABLE TEMP_TABLE(\n id integer PRIMARY KEY, \n full_i...
sql
chosen
[ { "from": "human", "value": "Migrate db partition incomes by user_id\n" }, { "from": "gpt", "value": "\n-- +goose Up\n-- SQL in section 'Up' is executed when this migration is applied\nALTER TABLE `incomes` DROP PRIMARY KEY, ADD PRIMARY KEY (`id`, `user_id`) PARTITION BY HASH(`user_id`) PARTITIO...
sql
chosen
[ { "from": "human", "value": "Add SQL snippet to create the \"extracts\" table." }, { "from": "gpt", "value": "CREATE TABLE extracts (\n id VARCHAR(255) NOT NULL,\n extract JSON,\n active BOOLEAN NOT NULL DEFAULT TRUE,\n created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n modif...
sql
chosen
[ { "from": "system", "value": "Add active field to manuscript table\n" }, { "from": "human", "value": "-- Author: dan.leehr@nescent.org\n--\n\n-- Organizations\nCREATE SEQUENCE organization_seq;\nCREATE TABLE organization\n(\n organization_id INTEGER PRIMARY KEY not null default nextval('organiz...
sql
chosen
[ { "from": "human", "value": "Add script showing cyclic parents in Nominatim\n" }, { "from": "gpt", "value": "select c.place_id,c.name,c.parent_place_id,c.linked_place_id,c.osm_id,c.osm_type,c.indexed_status \nfrom placex c \njoin placex r on r.place_id=c.parent_place_id \nwhere r.parent_place_id...
sql
chosen
[ { "from": "human", "value": "IFS-5966: Migrate withdrawn applications to successful state and remove withdrawn state\n" }, { "from": "gpt", "value": "-- IFS-5966\n\nSET @application_withdrawn_activity_state_id =\n(SELECT id from activity_state\nWHERE activity_type = 'APPLICATION'\nAND state = 'W...
sql
chosen
[ { "from": "human", "value": "Change all char postgres types to varchar.\n" }, { "from": "gpt", "value": "ALTER TABLE customers ALTER COLUMN customer_id TYPE VARCHAR(256), ALTER COLUMN data TYPE VARCHAR;\n\nALTER TABLE profileimages ALTER COLUMN customer_id TYPE VARCHAR(256), ALTER COLUMN content...
sql
chosen
[ { "from": "human", "value": "KCIAC-332: Implement COI event type of \"IACUC Protocol\"\n" }, { "from": "gpt", "value": "INSERT INTO KRCR_PARM_T (NMSPC_CD, CMPNT_CD, PARM_NM, OBJ_ID, VER_NBR, PARM_TYP_CD, VAL, PARM_DESC_TXT, EVAL_OPRTR_CD, APPL_ID)\r\nVALUES ('KC-IACUC', 'Document', 'PROTOCOL_DIS...
sql
chosen
[ { "from": "human", "value": "Update db to support emojis in text-component\n" }, { "from": "gpt", "value": "ALTER TABLE `kwc_basic_text` CHANGE `content` `content` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL;\nALTER TABLE `kwc_basic_text` CHANGE `content_edit` `content_edit` T...
sql
chosen
[ { "from": "human", "value": "Add Account-CMECredit binding for attestation.\n" }, { "from": "gpt", "value": "create table AccountCMECreditBinding (\n\taccount integer not null references Account(id) on delete cascade,\n\tcredit integer not null references CMECredit(id) on delete cascade,\n\n\tpr...
sql
chosen
[ { "from": "human", "value": "Add table for marketing reports\n" }, { "from": "gpt", "value": "CREATE TABLE `phone_first_order` (\n `id_phone_first_order` int(11) unsigned NOT NULL AUTO_INCREMENT,\n `id_phone` int(11) unsigned DEFAULT NULL,\n `id_order` int(11) unsigned DEFAULT NULL,\n PRIMAR...
sql
chosen
[ { "from": "human", "value": "Migrate db update referer_reward_reate to decimal(5,4)\n" }, { "from": "gpt", "value": "\n-- +goose Up\n-- SQL in section 'Up' is executed when this migration is applied\nALTER TABLE `configs` MODIFY `referer_reward_rate` DECIMAL(5, 4);\n\n-- +goose Down\n-- SQL sect...
sql
chosen
[ { "from": "human", "value": "Add valid default value for json column\n\n - PRO-1651\n - This commit adds a default, non-null, value for the discarded_attrs\n column in the device registry db. This is to fix 500 errors we got\n due to null values in this column which are unexpected by slick as\n the co...
sql
chosen
[ { "from": "human", "value": "feat: Add indices for fast queries\n\nFixes #81\n" }, { "from": "gpt", "value": "CREATE INDEX department_name_index ON department (name);\nCREATE INDEX course_active_index ON course (active DESC);\nCREATE INDEX course_in_charge_section_index ON course_in_charge (sect...
sql
chosen
[ { "from": "human", "value": "KCIAC-289: Implement IACUC notification for Request Lift Hold\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": "Add record cell_info to event (E1-E3)\n" }, { "from": "gpt", "value": "\ninsert into cell_info values\n (35, 1, 1, 'A', true, false),\n (35, 1, 2, 'B', true, false),\n (35, 1, 3, 'C', false, false),\n (35, 1, 4, 'D', false, false),\n (35, 1, 5, 'E', fa...
sql
chosen
[ { "from": "human", "value": "Replace personaldata with mydata bundle\n" }, { "from": "gpt", "value": "UPDATE oskari_appsetup_bundles\n SET bundle_id = (select id from oskari_bundle where name='mydata'),\n bundleinstance = 'mydata'\n WHERE bundle_id = (select id from oskari_bundle where name=...
sql
chosen
[ { "from": "human", "value": "Fix last two tables that didn't have a proper default for their id\n" }, { "from": "gpt", "value": "# --- !Ups\n\nalter table linked_account alter column id set default nextval('linked_account_seq'::regclass);\nalter table users alter column id set default nextval('u...
sql
chosen
[ { "from": "human", "value": "KRACOEUS-5617: Add parameter to configure tab label for Proposal Summary title\n" }, { "from": "gpt", "value": "INSERT INTO KRCR_PARM_T (NMSPC_CD, CMPNT_CD, PARM_NM, OBJ_ID, VER_NBR, PARM_TYP_CD, VAL, PARM_DESC_TXT, EVAL_OPRTR_CD, APPL_ID)\r\nVALUES ('KC-PD', 'Docume...
sql
chosen
[ { "from": "human", "value": "Add the migration script for AWA 1.1\n" }, { "from": "gpt", "value": "/* File generated automatically by dynamo */\n/* */\nCREATE TABLE awa_wiki_content (\n /* the wiki page content identifier */\n `id` BIGINT NOT NULL,\n /* the wiki content creation date */\n `...
sql
chosen
[ { "from": "human", "value": "Remove logUrl from bundle config\n" }, { "from": "gpt", "value": "UPDATE portti_view_bundle_seq SET config = regexp_replace(config, '\"logUrl\"\\s?:\\s?\"[^\"]*\"', '') WHERE bundleinstance = 'statehandler' AND config::json->'logUrl' IS NOT NULL;\n" } ]
sql
chosen
[ { "from": "human", "value": "Add unique constraint with key, date column in index_values table\n" }, { "from": "gpt", "value": "DELETE FROM index_values\nWHERE id NOT IN (SELECT MIN(id)\n FROM index_values\n GROUP BY key, date, value);\n\nALTER TABLE index_values ...
sql
chosen
[ { "from": "human", "value": "Select with partition in subquery\n" }, { "from": "gpt", "value": "-- there is a table with test results from different tests\n-- need to select only the rows with the last test results for each test\n-- so one test result should be selected and it has to be the late...
sql
chosen
[ { "from": "human", "value": "Add sample file for .plsql extension" }, { "from": "gpt", "value": "create or replace package prime#\nis\n invalid_argument_error exception;\n\n function nth (\n i_num pls_integer\n ) return numbe...
sql
chosen
[ { "from": "human", "value": "Add myplaces3 to ol4 appsetup\n" }, { "from": "gpt", "value": "\n UPDATE portti_view_bundle_seq SET startup = '{\n\t\"metadata\": {\n\t\t\"Import-Bundle\": {\n\t\t\t\"maparcgis\": {\n\t\t\t\t\"bundlePath\": \"/Oskari/packages/mapping/ol3/\"\n\t\t\t},\n\t\t\t\"mapmodu...
sql
chosen
[ { "from": "human", "value": "Add query for domestic research (PostgreSQL only).\n" }, { "from": "gpt", "value": "with country_counted_publications as (\n\tselect p.id, count(distinct country) as countries from publication as p\n\tjoin affiliated_author as a on a.publication_id = p.id\n\tjoin in...
sql
chosen
[ { "from": "human", "value": "Add script to create the DB schema.\n" }, { "from": "gpt", "value": "-- Creates the SRCalc schema.\n--\n-- For now, this is HSQLDB. We'll find out what our actual database is later.\nCREATE TABLE SPECIALTY(ID INTEGER NOT NULL PRIMARY KEY,NAME VARCHAR(255));\n\n" } ...
sql
chosen
[ { "from": "human", "value": "OLMIS-2188: Add description to adminisrator role in bootstrap data\n" }, { "from": "gpt", "value": "UPDATE referencedata.roles\nSET description = 'System administrator.'\nWHERE id = 'a439c5de-b8aa-11e6-80f5-76304dec7eb7';" } ]
sql
chosen
[ { "from": "human", "value": "Create DB table for ClientElb Entry\n\nFor isolation of Orchestration and Execution environment in Flux,\nwe need to route client tasks based on events coming in to Flux\nOrchestratorto Execution Environment.\nCreated database table to store Client Elb details viz.Client Elb URL...
sql
chosen
[ { "from": "human", "value": "Add rasterization test SQL code\n" }, { "from": "gpt", "value": "CREATE TABLE extracttoraster_finlandIa AS\nSELECT ST_ExtractToRaster(\n ST_AddBand(ST_MakeEmptyRaster(rast_finlandIa), '32BF'::text, -9999, -9999), \n 'wdpa', \n 'wdpa_poly_geom...
sql
chosen
[ { "from": "human", "value": "Hide all but property_json from userlayers\n" }, { "from": "gpt", "value": "UPDATE portti_wfs_layer SET\nselected_feature_params = '{\n \"default\": [\"property_json\"]\n}'\n,feature_params_locales = '{\n \"fi\": [\"Ominaisuustiedot\"]\n}'\nWHERE layer_name = '...
sql
chosen
[ { "from": "human", "value": "Improve object size calculation script" }, { "from": "gpt", "value": "/*\n<documentation>\n <summary>Count size in bytes veiws, triggers, procedures and function in database.</summary>\n <returns>1 data set: RoutinType, SUM LENGTH of objects, SUM DATALENGTH.</retur...
sql
chosen
[ { "from": "human", "value": "Add curation status preliminary review done\n" }, { "from": "gpt", "value": "/*\n\n################################################################################\n\nMigration script to add the curation status 'Preliminary review done'\n\nauthor: Cinzia Malangone\nd...
sql
chosen
[ { "from": "human", "value": "Remove bad purchased_lot rows that were supposed to be items\n" }, { "from": "gpt", "value": "-- remove purchased_lot entries for items\nDELETE purchased_lot FROM item NATURAL JOIN purchased_lot;\n\n-- delete project transactions\nDELETE identified_entity, owned_enti...
sql
chosen
[ { "from": "human", "value": "Add extra attributes to the attribute table.\n\nNew attributes to be included in this release.\n" }, { "from": "gpt", "value": "-- Copyright [1999-2016] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute\n-- \n-- Licensed under the Apache ...
sql
chosen
[ { "from": "human", "value": "Add SQL for compressing redshift daily tables\n" }, { "from": "gpt", "value": "begin transaction;\n\n-- impression_stats_daily\ncreate temp table temp_imp_stats (like impression_stats_daily);\ninsert into temp_imp_stats (tile_id, date, position, enhanced, locale, co...
sql
chosen
[ { "from": "human", "value": "Add file of data base,Table User will be created and some users will be implemented\n" }, { "from": "gpt", "value": "CREATE TABLE Utilisateur {\n \tIdUser int NOT NULL AUTO_INCREMENT,\n\tUsername VARCHAR 100,\n\tPassword VARCHAR 100,\n\tEmail VARCHAR 100\n};\n\nINSER...
sql
chosen
[ { "from": "human", "value": "Add trigger to create borrower debarment\n" }, { "from": "gpt", "value": "DROP TRIGGER IF EXISTS autoKemnerSperring;\ndelimiter //\nCREATE TRIGGER autoKemnerSperring BEFORE UPDATE ON items\nFOR EACH ROW\nBEGIN\n IF NEW.itemlost = 12 AND (OLD.itemlost != 12 OR OLD.it...
sql
chosen
[ { "from": "system", "value": "Add some constrains to codecard datastore\n" }, { "from": "human", "value": "CREATE TABLE \"auth_entry\"(\n user_identifier VARCHAR(10) PRIMARY KEY,\n identity_id BIGINT NOT NULL,\n created_at BIGINT NOT NULL,\n last_card BIGINT\n)\n\nCREATE TABLE \"code\"(\n u...
sql
chosen
[ { "from": "human", "value": "Add script to update database schema\n" }, { "from": "gpt", "value": "-- create procedure\nDELIMITER $$\nDROP PROCEDURE IF EXISTS updateMSE$$\nCREATE PROCEDURE updateMSE()\nBEGIN\n DECLARE done INT DEFAULT FALSE;\n DECLARE p_testcase_id VARCHAR(125);\n DECLARE p_a...
sql
chosen
[ { "from": "system", "value": "Fix migration 923 again (integer unsigned vs unsigned integer)\n\nINTEGER[(M)] [UNSIGNED] [ZEROFILL]\nhttps://dev.mysql.com/doc/refman/5.7/en/numeric-type-overview.html\n" }, { "from": "human", "value": "-- Note: if the migration fails for you locally, remove the 'u...
sql
chosen
[ { "from": "human", "value": "Add an employee titles view\n" }, { "from": "gpt", "value": "CREATE OR REPLACE VIEW employee_titles AS\n SELECT e.emp_no, e.first_name, e.last_name, e.middle_name, t.title, t.from_date, t.to_date \n FROM employees e\n LEFT JOIN titles t ON e.emp_no = t.emp_no\...
sql
chosen
[ { "from": "human", "value": "KRACOEUS-5812: Implement Protocol Review Rescheduled notification\n" }, { "from": "gpt", "value": "UPDATE NOTIFICATION_TYPE SET MESSAGE='The IACUC protocol number <a title=\"\" target=\"_self\" href=\"{DOCUMENT_PREFIX}/kew/DocHandler.do?command=displayDocSearchView&a...
sql
chosen
[ { "from": "human", "value": "Extend size of value for parameter tables\n\nRequired migration for 2.2.0 -> 2.2.1" }, { "from": "gpt", "value": "-- Target version: v2.2.0\n-- SHOULD be executed when upgrading to SlipStream v2.2.1\n\nalter table MODULEPARAMETER alter column VALUE varchar(65536);\na...
sql
chosen
[ { "from": "human", "value": "Add hash column and auto-increment id to vocabulary table.\n" }, { "from": "gpt", "value": "ALTER TABLE `vocabulary` ADD `hash` BINARY(16) NOT NULL;\nUPDATE `vocabulary` SET `hash` = `id`;\nALTER TABLE `vocabulary` DROP PRIMARY KEY;\nUPDATE vocabulary SET id = 0;\nAL...
sql
chosen
[ { "from": "human", "value": "Add query for classification cleaning\n" }, { "from": "gpt", "value": "SELECT PrimaryClass, SecondaryClass, TertiaryClass, COUNT(*) as NumRecords, GROUP_CONCAT(DISTINCT ItemType)\nFROM Objects o GROUP BY PrimaryClass, SecondaryClass, TertiaryClass\nORDER BY PrimaryCl...
sql
chosen
[ { "from": "human", "value": "Add SQL to deactivate users who haven't been active for 120 days\n" }, { "from": "gpt", "value": "UPDATE cwd_user\n SET cwd_user.active = 0\n JOIN cwd_user_attributes ON cwd_user_attributes.user_id = cwd_user.id\n AND cwd_user_attributes.a...
sql
chosen
[ { "from": "human", "value": "Update column type for motif_name in motif_feature_variation\n" }, { "from": "gpt", "value": "# convert column of type text to varchar in motif_feature_variation table\n\nALTER TABLE motif_feature_variation MODIFY motif_name VARCHAR(60);\n\nINSERT INTO meta (species_...
sql
chosen
[ { "from": "human", "value": "Drop subsnp_id on failed_variation table\n" }, { "from": "gpt", "value": "# drop subsnp_id column on failed_variation\nALTER TABLE failed_variation DROP COLUMN subsnp_id;\n\n# patch identifier\nINSERT INTO meta (species_id, meta_key, meta_value) VALUES (NULL,'patch',...
sql
chosen
[ { "from": "human", "value": "Update SO terms in attrib table\n" }, { "from": "gpt", "value": "# update deprecated SO terms in attrib table\n\nUPDATE attrib SET value='non_coding_transcript_variant' WHERE value='nc_transcript_variant';\nUPDATE attrib SET value='non_coding_transcript_exon_variant'...
sql
chosen
[ { "from": "human", "value": "Store file types along with the files.\n" }, { "from": "gpt", "value": "-- Copyright [1999-2016] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute\n--\n-- Licensed under the Apache License, Version 2.0 (the \"License\");\n-- you may not u...
sql
chosen
[ { "from": "human", "value": "INFUND-5633: Add flyway migration for comp setup, application details screen\n\nFormer-commit-id: 1029719283b47aa905d93bcb5bf919b4e028996f" }, { "from": "gpt", "value": "ALTER TABLE `competition`\nADD COLUMN `use_project_title_question`bit(1) NOT NULL DEFAULT 1,\nADD...
sql
chosen
[ { "from": "human", "value": "Add the sql dump file\n" }, { "from": "gpt", "value": "SET client_encoding = 'UTF8';\n\nCREATE TABLE feeds (\n id integer NOT NULL,\n url text NOT NULL,\n title text NOT NULL,\n timedate timestamp NOT NULL,\n author integer NOT NULL,\n tags text NOT...
sql
chosen
[ { "from": "human", "value": "Add SQL script for SQL-based event store.\n\nSo folks don't have to reverse-engineer it from the code.\n" }, { "from": "gpt", "value": "USE [SomeDatabase]\nGO\n\n/****** Object: Table [dbo].[Events] Script Date: 03/28/2014 17:37:55 ******/\nSET ANSI_NULLS ON\nGO\...
sql
chosen
[ { "from": "human", "value": "Add the migration for scoping grid data\n" }, { "from": "gpt", "value": "BEGIN;\n\nALTER TABLE regions add column ScopeID char(36) not null default '00000000-0000-0000-0000-000000000000';\n\ncreate index ScopeID on regions(ScopeID);\n\nCOMMIT;\n" } ]
sql
chosen
[ { "from": "human", "value": "Update model modes to reflect updated seegSDM modes.\n" }, { "from": "gpt", "value": "-- Update model modes to reflect updated seegSDM modes.\n-- Copyright (c) 2016 University of Oxford\nUPDATE disease_group SET model_mode='Bhatt2013' WHERE model_mode='bhatt';\nUPDAT...
sql
chosen
[ { "from": "human", "value": "Add database migration for indexes and constraints\n" }, { "from": "gpt", "value": "-- create index\r\nALTER TABLE `users` ADD INDEX ( `list_id` );\r\n\r\n-- add constraint\r\nALTER TABLE `users` ADD FOREIGN KEY ( `list_id` ) \r\nREFERENCES `lists` ( `id` )\r\nON DEL...
sql
chosen
[ { "from": "human", "value": "Add Kev Riley VLF count script\n" }, { "from": "gpt", "value": "/*\nhttps://gallery.technet.microsoft.com/scriptcenter/SQL-Script-to-list-VLF-e6315249\nKev Riley\n*/\n\n--variables to hold each 'iteration' \ndeclare @query varchar(100) \ndeclare @dbname sysname \n...
sql
chosen
[ { "from": "human", "value": "Add SQL for modern procedure, partitioning decls\n\nThis adds an additional sql that can be loaded by SQLCommand\nto add partitioning and procedure declarations to a running\nTPC-C database. The file is not integrated anywhere - it\njust exists now for manual use.\n" }, { ...
sql
chosen
[ { "from": "human", "value": "Add query to report on images not in correct path\n" }, { "from": "gpt", "value": "SET GROUP_CONCAT_MAX_LEN = 1000000;\nSELECT ImageFilePath, count(*) as numRecords, group_concat(Accession_Full_ID SEPARATOR ', ') as AccessionNumbers, group_concat(ImageFileName SEPARA...
sql
chosen
[ { "from": "human", "value": "Upgrade script that also adds year, month and days for date_buy and date_sell in T_TRADE.\n" }, { "from": "gpt", "value": "/* Author: rockwolf\n * Date: 2012-07-31\n * Function: Adds year, month and day values to T_TRADE,\n * for easy searching and comparing of dates...
sql
chosen
[ { "from": "human", "value": "Clear leftover addon logs (which are only themes)\n" }, { "from": "gpt", "value": "-- We use log_activity_app for apps.\n-- What's left in here is for themes which we don't need anymore.\nDELETE FROM log_activity_user where activity_log_id in (SELECT activity_log_id ...
sql
chosen
[ { "from": "human", "value": "Add a column for giving info which tabulars to process.\n" }, { "from": "gpt", "value": "IF NOT EXISTS (\n select * from INFORMATION_SCHEMA.COLUMNS\n where TABLE_SCHEMA='dbo' and TABLE_NAME='tabularprocessing'\n and COLUMN_NAME='tabular'\n) BEGIN\n\nALTER TABLE db...
sql
chosen
[ { "from": "human", "value": "Add test for wrapping boolean compares\n" }, { "from": "gpt", "value": "SELECT table1.col1,\n table1.col2\n FROM table1\n JOIN table2\n ON ( table2.col1 = table1.col1\n AND table2.col2 = table1.col2\n AND table2.col3 = table1...
sql
chosen
[ { "from": "human", "value": "Add old Cassandra schema for posterity.\n" }, { "from": "gpt", "value": "// Keyspace\nDROP KEYSPACE IF EXISTS busshaming;\nCREATE KEYSPACE busshaming\n WITH replication = {'class': 'SimpleStrategy', 'replication_factor' : 1};\n\n\nUSE busshaming;\n\n//\nDROP TABLE...
sql
chosen
[ { "from": "human", "value": "Add update script for timestamps in server 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": "Enforce uniqueness of account/player in database\n\nThe following properties now have a UNIQUE constraint on them in the\ndatabase:\n\n* Account email\n* Hall of Fame name\n* Player ID (per game)\n* Player name (per game)\n\nThese need to be unique for the code to work properly,...
sql
chosen
[ { "from": "system", "value": "Put the condition in the join instead of a `where`\n" }, { "from": "human", "value": "BEGIN;\n\n -- Update user_id and is_team. See branch.py for doco.\n \\i update.sql\n\n\n -- Drop all Bitbucket accounts that aren't required for account access.\n\n DEL...
sql
chosen
[ { "from": "human", "value": "Modify spelling mistake in drug_allergies table\n" }, { "from": "gpt", "value": "/*\nMySQL Data Transfer\nSource Host: localhost\nSource Database: cs673\nTarget Host: localhost\nTarget Database: cs673\nDate: 2013/11/11 21:15:15\n*/\nUSE `cs673`;\n\nSET FOREIGN_KEY_CH...
sql
chosen
[ { "from": "human", "value": "Add migration of m_country and teacher\n" }, { "from": "gpt", "value": "-- +goose Up\n-- SQL in section 'Up' is executed when this migration is applied\nCREATE TABLE IF NOT EXISTS m_country (\n `id` SMALLINT unsigned NOT NULL,\n `name` varchar(255) NOT NULL,\n `na...
sql
chosen