conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "human", "value": "Add ETL for expected delivery place. Nothing in new in reporting yet, though\n" }, { "from": "gpt", "value": "-- Copyright (C) 2007, 2008, 2009, 2010 The Collaborative Software Foundation\n--\n-- This file is part of TriSano.\n--\n-- TriSano is free software: you can...
sql
chosen
[ { "from": "human", "value": "Decrease Nuke/HHG accuracy from 35% -> 30%\n\nThis change brings these weapons more in line with the expected power\nlevel scaling. Efficiency should decrease with increasing power level,\nand this trend is consistent until power level 5, which had a higher\nefficiency than powe...
sql
chosen
[ { "from": "human", "value": "Add batch sccript to load pigQTLdb RDF graph into Virtuoso\n" }, { "from": "gpt", "value": "SPARQL CLEAR GRAPH <http://www.animalgenome.org/pigQTLdb>;\nDELETE FROM DB.DBA.load_list;\nld_dir('/tmp/share', 'pigQTLdb.ttl', 'http://www.animalgenome.org/pigQTLdb');\nSELEC...
sql
chosen
[ { "from": "human", "value": "Create table d varda tyotehtava\n" }, { "from": "gpt", "value": "USE [ANTERO]\nGO\n\n/****** Object: Table [sa].[d_varda_tyotehtava] Script Date: 30.7.2018 13:42:58 ******/\nSET ANSI_NULLS ON\nGO\n\nSET QUOTED_IDENTIFIER ON\nGO\n\nIF NOT EXISTS (SELECT * FROM sys...
sql
chosen
[ { "from": "human", "value": "Add SQL queries for multi-game events\n\n" }, { "from": "gpt", "value": "# Global, per-event leaderboard\nSELECT `groups`.`game_id`, `games`.`name`, `groups`.`group_id`, `groups`.`name`, `groups`.`state`, count(`assigned_locations`.`group_id`) AS `reached`, `groups`....
sql
chosen
[ { "from": "human", "value": "Change south africa country name\n" }, { "from": "gpt", "value": "-- +goose Up\n-- SQL in section 'Up' is executed when this migration is applied\nUPDATE m_country SET name_ja='南アフリカ' WHERE id = 710;\n\n-- +goose Down\n-- SQL section 'Down' is executed when this migr...
sql
chosen
[ { "from": "human", "value": "Add mysql configuration file at ./db_export\n" }, { "from": "gpt", "value": "-- phpMyAdmin SQL Dump\n-- version 3.5.8.2\n-- http://www.phpmyadmin.net\n--\n-- Host: localhost\n-- Generation Time: Jun 09, 2014 at 01:37 PM\n-- Server version: 5.5.37-MariaDB\n-- PHP Vers...
sql
chosen
[ { "from": "human", "value": "Add script for making executables bogus that works with cmsocial.\n" }, { "from": "gpt", "value": "-- This script will mark all executables as bogus, and then will delete\n-- all orphan fsobjects and large objects. Run it as follows:\n-- psql -tq -U username datab...
sql
chosen
[ { "from": "human", "value": "Insert the exact number of previously approved webextensions in addon approvals counter table\n\nPrevious migration was just setting the counter to 1 for each public add-on. This sets it to\nthe number of approved, non-deleted, listed webextensions versions, making the initial c...
sql
chosen
[ { "from": "human", "value": "Add db migration for netscan\n" }, { "from": "gpt", "value": "\n-- +goose Up\n-- SQL in section 'Up' is executed when this migration is applied\nCREATE TABLE `netscanqueue` (\n `nameID` bigint(20) unsigned DEFAULT NULL,\n `time` datetime DEFAULT NULL,\n PRIMARY KE...
sql
chosen
[ { "from": "human", "value": "Add db build cache script.\n" }, { "from": "gpt", "value": "DROP TABLE IF EXISTS pfamA_pfamseq;\n\nCREATE TABLE pfamA_pfamseq ( pfamseq_id VARCHAR(16), pfamA_acc VARCHAR(7), pfamseq_acc VARCHAR(10), has_pdb BOOLEAN NOT NULL DEFAULT 0)\nSELECT CONCAT(pfamseq.pfamseq_i...
sql
chosen
[ { "from": "human", "value": "Add SQL script used for generation of DB\n" }, { "from": "gpt", "value": "CREATE DATABASE IF NOT EXISTS IR;\nuse IR;\n\nDROP TABLE `IR_properties`;\nCREATE TABLE IF NOT EXISTS IR_properties(\n PropertyKey INT NOT NULL PRIMARY KEY AUTO_INCREMENT,\n DateCreated...
sql
chosen
[ { "from": "human", "value": "[FEATURE] Add Monitor Deadlocks with Extended Events script\n" }, { "from": "gpt", "value": "/*\r\nOriginal link: http://michaeljswart.com/2016/01/monitor_deadlocks/\r\nAuthor: Michael J. Swart\r\n*/\r\n\r\n/*\r\nCreate The Session\r\n - has five rollover files so th...
sql
chosen
[ { "from": "human", "value": "Solve problem 4 in postgres\n" }, { "from": "gpt", "value": "select max(a * b)\nfrom generate_series(100,999) gs1(a), generate_series(100,999) gs2(b)\nwhere (a * b)::varchar(255) = reverse((a * b)::varchar(255))\n" } ]
sql
chosen
[ { "from": "human", "value": "Add sql for floor points\n" }, { "from": "gpt", "value": "SELECT \n\tSUM(CASE WHEN (Floor = 1 AND Side = 'E') THEN TotalPoints ELSE 0 END) AS 'FloorE1',\n\tSUM(CASE WHEN (Floor = 2 AND Side = 'E') THEN TotalPoints ELSE 0 END) AS 'FloorE2',\n\tSUM(CASE WHEN (Floor = 3...
sql
chosen
[ { "from": "human", "value": "Create indexes for tables with a FK to job.id\n" }, { "from": "gpt", "value": "CREATE INDEX log_job_id on log (job_id);\n\nCREATE INDEX performance_job_id on performance (job_id);\n\nCREATE INDEX output_job_id on output (oq_job_id);\n" } ]
sql
chosen
[ { "from": "human", "value": "DB/BWL: Fix eggs being clickable and Grethok should yell when engaged\n" }, { "from": "gpt", "value": "INSERT INTO version_db_world (`sql_rev`) VALUES ('1518089572435453900');\n\n-- The eggs should not be clickable\nUPDATE `gameobject_template` SET `faction`='14' WHE...
sql
chosen
[ { "from": "human", "value": "Remove latest_version, sitespecific and is_listed columns from 'addons'\n\n(Those columns have already been removed in dev/stage/prod environments)\n" }, { "from": "gpt", "value": "DROP PROCEDURE IF EXISTS drop_addons_col_if_exists;\n\nDELIMITER ';;'\n\nCREATE PROCED...
sql
chosen
[ { "from": "human", "value": "Add sql for aggregating votes\n" }, { "from": "gpt", "value": "select to_char(statuses.created_at, 'YYYY-MM-DD') as date, count(votes.status_id) as count from votes join statuses on votes.status_id = statuses.id where votes.character_id = 21 group by date order by da...
sql
chosen
[ { "from": "human", "value": "Add sql code and comments about setting up the database initially\n" }, { "from": "gpt", "value": "/* See https://techviewleo.com/how-to-install-mysql-8-on-amazon-linux-2/\n\tfor a good guide on installing mysql 8.0\n*/\n\n/* Change 'password' */\ncreate user 'nodejs...
sql
chosen
[ { "from": "human", "value": "KCIRB-1788: Create parameter protocolProjectEndDateNumberOfYears for creating proposal development from IRB 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...
sql
chosen
[ { "from": "human", "value": "Add SQL script for initially populating the `categories` table\n" }, { "from": "gpt", "value": "-- Default set of categories as required by https://github.com/goodmap/goodmap-old\nINSERT OR IGNORE INTO categories (id, created, version, name) VALUES ('2cd00bebec0c48ba...
sql
chosen
[ { "from": "human", "value": "Fix world server crash when using the Atal'ai Statue (ID 148833) in Sunken Temple\n" }, { "from": "gpt", "value": "INSERT INTO version_db_world (`sql_rev`) VALUES ('1527544749488242746');\n\nUPDATE `smart_scripts` SET `target_type` = 7 WHERE `entryorguid` IN (148830,...
sql
chosen
[ { "from": "human", "value": "Improve indexing for the certificate table\n" }, { "from": "gpt", "value": "\n-- +goose Up\n-- SQL in section 'Up' is executed when this migration is applied\n\nALTER TABLE `ctdb`.`certificate` DROP INDEX `SerialIdx`;\nALTER TABLE `ctdb`.`certificate` DROP INDEX `Iss...
sql
chosen
[ { "from": "human", "value": "Change in alias name due to identifier too long exception in advanced query\n\n\nSVN-Revision: 3084\n" }, { "from": "gpt", "value": "/*Change in alias name due to identifier too long exception in advanced query*/\r\ninsert into CATISSUE_QUERY_TABLE_DATA ( TABLE_ID, ...
sql
chosen
[ { "from": "human", "value": "Fix quest 13956 \"Meeting a Great One\" (Children's Week)\n" }, { "from": "gpt", "value": "INSERT INTO version_db_world (`sql_rev`) VALUES ('1525438412721008951');\n\nUPDATE `creature_template` SET `scriptname` = 'npc_the_etymidian' WHERE `entry` = 28092;\nUPDATE `cr...
sql
chosen
[ { "from": "human", "value": "Add SQL script for adding test data\n\nWhen I reset the DB, this makes it really easy to get test data in\nthere. Yay automation!\n" }, { "from": "gpt", "value": "INSERT INTO category('text') VALUES ('category1');\nINSERT INTO category('text') VALUES ('category2');\n...
sql
chosen
[ { "from": "human", "value": "Add test for defining relations\n" }, { "from": "gpt", "value": "BEGIN;\n\nSELECT plan(2);\n\nSELECT relation_directory.define(\n 'A->B',\n $$SELECT 12 source_id, 22 target_id$$\n);\n\nSELECT has_table('relation'::name, 'A->B'::name, 'relation table should exis...
sql
chosen
[ { "from": "human", "value": "Add missing new .sql file\n" }, { "from": "gpt", "value": "UPDATE APP_DELEGATION AS APPDEL INNER JOIN (SELECT APP_UID, MAX(DEL_INDEX) AS MAX_DEL_INDEX FROM APP_DELEGATION GROUP BY APP_UID) AS SUBSQL\n ON SUBSQL.APP_UID = APPDEL.APP_UID AND SUBSQL.MAX_DEL_INDEX ...
sql
chosen
[ { "from": "human", "value": "Set fields correct for altinn fields\n" }, { "from": "gpt", "value": "UPDATE `salaryconfline`\nSET `MandatoryTaxSubtraction` = 1\nWHERE `SalaryDescription` LIKE 'elektroniskKommunikasjon'\nAND `MandatoryTaxSubtraction` != 1\n" } ]
sql
chosen
[ { "from": "human", "value": "IFS-3980: Add script to update terms and conditions table with reference to new template\n" }, { "from": "gpt", "value": "-- IFS-3980\n-- New version of site-wide terms and conditions to include GDPR notice\n\nSET @system_maintenance_user_id =\n(SELECT id FROM user W...
sql
chosen
[ { "from": "human", "value": "Add DB evolutions from jcdb\n" }, { "from": "gpt", "value": "# --- !Ups\n\r\nALTER TABLE person_at_meeting ADD COLUMN id serial;\n\nALTER TABLE \"case\" ALTER meeting_id SET NOT NULL;\nALTER TABLE \"case\" ADD COLUMN location VARCHAR(255) NOT NULL DEFAULT '';\nALTER ...
sql
chosen
[ { "from": "human", "value": "Add a function for creating a report of traffic from the database nicely consolated for us already\n\nSigned-off-by: Michael Casadevall <6fe105eefab41990d7ec714c6c25ade3095cdb48@them.com>\n" }, { "from": "gpt", "value": "CREATE OR REPLACE FUNCTION snort.report_traffi...
sql
chosen
[ { "from": "human", "value": "HADOOP-7930: Add hash index for execution url in db schema for Dr. Elephant\n" }, { "from": "gpt", "value": "# add/remove index on flow_exec_url\n\n# --- !Ups\n\ncreate index ix_job_result_flow_exec_url on job_result (flow_exec_url) using HASH;\n\n\n# --- !Downs\n\n\...
sql
chosen
[ { "from": "human", "value": "DB/Spells: Fix Portal/Teleport to Tol Barad\n" }, { "from": "gpt", "value": "-- Fix Mage's Tol barad Portals and Teleports\n\nUPDATE gameobject_template SET data0=88341 WHERE entry=206615; -- ally portal\nUPDATE gameobject_template SET data0=88339 WHERE entry=206616;...
sql
chosen
[ { "from": "human", "value": "Switch out some validator disease groups\n" }, { "from": "gpt", "value": "-- Update validator disease groups.\n--\n-- Copyright (c) 2014 University of Oxford\nUPDATE disease_group SET validator_disease_group_id=NULL WHERE validator_disease_group_id=(SELECT id FROM va...
sql
chosen
[ { "from": "human", "value": "Add function Register_Bank() to INSERT INTO Banks\n" }, { "from": "gpt", "value": "CREATE OR REPLACE FUNCTION Register_Bank(_BankID text, _Protocol text, _Host text, _Port integer, _Path text) RETURNS BOOLEAN AS $BODY$\nINSERT INTO Banks (BankID, Protocol, Host, Port...
sql
chosen
[ { "from": "human", "value": "Drop the mic, wait for bass drop\n" }, { "from": "gpt", "value": "USE [VipunenTK_DW]\n\nGO\n\nDROP TABLE VipunenTK_DW.dbo.[_sa_K3_9_Tutk_suor_osuus_aloittaneista_toinen_aste_nykytila]\n\nSelect top 0 * into VipunenTK_DW.dbo.[_sa_K3_9_Tutk_suor_osuus_aloittaneista_toi...
sql
chosen
[ { "from": "human", "value": "Add the SQL file structure for the database\n" }, { "from": "gpt", "value": "-- phpMyAdmin SQL Dump \n-- version 4.1.14 \n-- http://www.phpmyadmin.net \n-- \n-- Client : 127.0.0.1 \n-- Généré le : Mar 03 Mars 2015 à 10:41 \n-- Version du serveur : 5.6.17 \n-- Ver...
sql
chosen
[ { "from": "human", "value": "Load addresses and stops in PostgreSQL FreeTextSeach\n" }, { "from": "gpt", "value": "\ndrop materialized view geocoder_search;\ndrop view address_search;\ndrop table address;\ncreate table address(id text, rue text, numero text, localite text, codepostal text, coord...
sql
chosen
[ { "from": "human", "value": "KCIAC-340: Update NOTIFICATION_TYPE table to turn off default behavior for some IACUC notifications\n" }, { "from": "gpt", "value": "UPDATE NOTIFICATION_TYPE SET SEND_NOTIFICATION='N' WHERE MODULE_CODE='9' AND ACTION_CODE IN ('100','101','113','204','205','301','302'...
sql
chosen
[ { "from": "human", "value": "Install triggers to monitor DDL changes.\n" }, { "from": "gpt", "value": "-- Create schema for teleport tables teleport\nCREATE SCHEMA IF NOT EXISTS teleport;\n\n-- Define Event_kind type.\n-- ddl = schema changes\n-- dml = data manipulation changes\n-- outgoing even...
sql
chosen
[ { "from": "human", "value": "Add migration for invoice ha feature\n" }, { "from": "gpt", "value": "CREATE TABLE invoice_parent_children (\n record_id serial unique,\n id varchar(36) NOT NULL,\n parent_invoice_id varchar(36) NOT NULL,\n child_invoice_id varchar(36) NOT NULL,\n chil...
sql
chosen
[ { "from": "human", "value": "Update lukukausimaksukokeilu to lukukausimaksu (and translations)\n" }, { "from": "gpt", "value": "USE [VipunenTK_lisatiedot]\nGO\n\nIF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[rahoituslahde]') AND type in (N'U'))\n\nupdate [dbo].[rahoi...
sql
chosen
[ { "from": "human", "value": "Add db migration file for Spring Cloud\n" }, { "from": "gpt", "value": "insert into project values('spring-cloud','Spring Cloud','http://github.com/spring-projects/spring-cloud','incubator','http://projects.spring.io/spring-cloud','FALSE');\ninsert into project_relea...
sql
chosen
[ { "from": "human", "value": "Add script to clear all realtime data from the DB.\n" }, { "from": "gpt", "value": "# Destroy all realtime data (for reprocessing)\n# But keep the timetable content around.\n\nTRUNCATE busshaming_realtimeentry RESTART IDENTITY;\nTRUNCATE busshaming_realtimeprogress R...
sql
chosen
[ { "from": "human", "value": "Add sql solution for 196. Delete Duplicate Emails\n\n196. Delete Duplicate Emails: https://leetcode.com/problems/delete-duplicate-emails/\n" }, { "from": "gpt", "value": "DELETE `p1` FROM `Person` AS `p1`, `Person` AS `p2` WHERE `p1`.`Email` = `p2`.`Email` AND `p1`.`...
sql
chosen
[ { "from": "human", "value": "Add a complete v1 schema file to work around a bug in sql-file.\n" }, { "from": "gpt", "value": "-- version 0\n\nCREATE CACHED TABLE series (\n series_id INTEGER IDENTITY,\n series_name VARCHAR(128) NOT NULL\n);\n\nCREATE CACHED TABLE sample (\n ser...
sql
chosen
[ { "from": "human", "value": "Fix errors caused by c81c0b3.\n\n* Add missed 34.sql\n" }, { "from": "gpt", "value": "# --- !Ups\ncreate table issue_event (\n id bigint not null,\n created timestamp,\n sender_login_id varchar(255),\n issue_id ...
sql
chosen
[ { "from": "human", "value": "Fix stock card line item type enum entries\n\nFix entries to use debit and credit, vs. issue and receipt. Issue and receipt are more to do with transfers. Also capitalize enum entries to match Java constants code style.\n" }, { "from": "gpt", "value": "DO $$\n BEGIN...
sql
chosen
[ { "from": "human", "value": "db: Change foreigen key option of issue table\n\nIt can help to prevent organization deletion error.\n" }, { "from": "gpt", "value": "# --- !Ups\nALTER TABLE issue DROP FOREIGN KEY fk_issue_assignee_9;\nALTER TABLE issue ADD CONSTRAINT fk_issue_assignee_9 FOREIGN KEY...
sql
chosen
[ { "from": "human", "value": "Add issue/expire columns to text_products relation" }, { "from": "gpt", "value": "-- Storage of SPS issue and expire times\nALTER TABLE text_products add issue timestamptz;\nALTER TABLE text_products add expire timestamptz;\n\nCREATE INDEX text_products_issue_idx on ...
sql
chosen
[ { "from": "human", "value": "Add file documenting structure of Vlib schema\n\n\ngit-svn-id: 1006245cb1bdea2fd4c9095e50bc2ef3d167b18c@242398 13f79535-47bb-0310-9956-ffa450edef68\n" }, { "from": "gpt", "value": "CREATE TABLE PROP\r\n(\r\n NAME VARCHAR(32) NOT NULL,\r\n PROP_VALUE INTEGER NOT NUL...
sql
chosen
[ { "from": "human", "value": "Add temporary file with changes that need to be made to Amanda.\n\n\n" }, { "from": "gpt", "value": "ALTER TABLE downloads\n ALTER COLUMN extracted SET DEFAULT false,\n ALTER COLUMN extracted SET NOT NULL;\n\nALTER TABLE daily_words\n ALTER COLUM...
sql
chosen
[ { "from": "human", "value": "Include seed data for testing MySQL\n" }, { "from": "gpt", "value": "USE uncovery;\n\nINSERT INTO users (token) VALUES ('Archon');\nINSERT INTO users (token) VALUES ('Carrier');\nINSERT INTO users (token) VALUES ('Colossus');\nINSERT INTO users (token) VALUES ('Dark ...
sql
chosen
[ { "from": "human", "value": "Add college initial data sql." }, { "from": "gpt", "value": "/*\n-- Query: SELECT * FROM dormitory.college\nLIMIT 0, 1000\n\n-- Date: 2014-02-15 17:32\n*/\nINSERT INTO `college` (`id`,`city_id`,`name`,`latitude`,`longitude`,`status`,`create_time`,`update_time`) VALUE...
sql
chosen
[ { "from": "human", "value": "[FEATURE] Add Latch Stats script by Paul S. Randal\n" }, { "from": "gpt", "value": "/*\r\nAuthor: Paul S. Randal\r\nOriginal link: http://www.sqlskills.com/blogs/paul/most-common-latch-classes-and-what-they-mean/\r\n*/\r\nWITH [Latches] AS\r\n (SELECT\r\n [...
sql
chosen
[ { "from": "human", "value": "Fix for badges with null team_affiliation id\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 null team affiliation ...
sql
chosen
[ { "from": "human", "value": "Store precedure for insert data into bioassay_data_data_category\n\n\nSVN-Revision: 3444\n" }, { "from": "gpt", "value": "-- insert data into bioassay_data_data_category\ndeclare\n cursor c_bioassay_data_category is\nselect chara.NAME name, data.DERIVED_BIOASSAY_DA...
sql
chosen
[ { "from": "human", "value": "Index entry number for management manual search\n" }, { "from": "gpt", "value": "# --- !Ups\n\nDROP INDEX idx_entry_index;\nDROP MATERIALIZED VIEW entry_index;\n\nCREATE MATERIALIZED VIEW entry_index AS\nSELECT entry.id,\n chapter.organization_id,\n (to_t...
sql
chosen
[ { "from": "human", "value": "Add login failure extended event\n" }, { "from": "gpt", "value": "/*\nhttps://blogs.msdn.microsoft.com/sql_pfe_blog/2017/05/04/login-failed-for-xxx-whos-keeps-trying-to-connect-to-my-server/\n*/\n\nCREATE EVENT SESSION [LoginFailureTrace] ON SERVER \nADD EVENT sqlser...
sql
chosen
[ { "from": "human", "value": "Add query for subject list cleaning\n" }, { "from": "gpt", "value": "SELECT\n s.SubjectID,\n s.SubjectName,\n s.SubjectDescription,\n s.SubjectType,\n GROUP_CONCAT(DISTINCT o.ItemType) AS ObjectTypes,\n COUNT(o.PrimaryKey_Object_Table) AS...
sql
chosen
[ { "from": "human", "value": "Patch to change the column 'attrib_type_id' by 'attrib_id' in the table 'variation_attrib'\n" }, { "from": "gpt", "value": "\n# change the column attrib_type_id by attrib_id in the variation_attrib table\n##################\nALTER TABLE variation_attrib CHANGE attrib...
sql
chosen
[ { "from": "human", "value": "Add update-script to allow null-values for crop-data\n" }, { "from": "gpt", "value": "ALTER TABLE `kwc_basic_image` CHANGE `crop_x` `crop_x` INT( 11 ) NULL;\nALTER TABLE `kwc_basic_image` CHANGE `crop_y` `crop_y` INT( 11 ) NULL;\nALTER TABLE `kwc_basic_image` CHANGE ...
sql
chosen
[ { "from": "human", "value": "Remove obsolete coloumns from external_feature_file\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-- ...
sql
chosen
[ { "from": "human", "value": "Add a SQL script to track the number of stores opened and closed per day.\n" }, { "from": "gpt", "value": "declare @FirstSeen DateTime\ndeclare @LastSeen DateTime\n-- we had a lot of stores that first time we ran (obviously), so get the first date... and then the one...
sql
chosen
[ { "from": "human", "value": "Add fixture sql for load autonoums communites in spain\n" }, { "from": "gpt", "value": "/**\n * Autonomous Communities Spain\n * 14-03-2015\n * Source: http://www.ine.es/daco/daco42/codmun/cod_ccaa.htm\n */\n\nCREATE TABLE IF NOT EXISTS `autonomous_communities_spain`...
sql
chosen
[ { "from": "human", "value": "Purge queue tables for testing purposes" }, { "from": "gpt", "value": "DECLARE\n r_purge_options sys.dbms_aqadm.aq$_purge_options_t;\nBEGIN\n sys.dbms_aqadm.purge_queue_table(\n queue_table => 'REQUESTS_QT',\n purge_condition => '1=1',\n ...
sql
chosen
[ { "from": "human", "value": "Add SQL file to create required tables\n" }, { "from": "gpt", "value": "CREATE TABLE IF NOT EXISTS `Lectura` (\n `ID` int(11) NOT NULL AUTO_INCREMENT,\n `data` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\n `trasto_id` char(64) CHARACTER SET latin1 CO...
sql
chosen
[ { "from": "human", "value": "[ENH] Improve logging of tracker structural updates (and making sure they apply through all paths, not just the service utilities path)\n\ngit-svn-id: a7fabbc6a7c54ea5c67cbd16bd322330fd10cc35@46098 b456876b-0849-0410-b77d-98878d47e9d5\n" }, { "from": "gpt", "value": ...
sql
chosen
[ { "from": "human", "value": "Reduce the damage and cost of level 1 weapons by 30%\n\nThis was needed to bring the efficiency of these weapons into line\nwith the trend for all the other power levels. From levels 5 to 2,\nthe efficiency increased in a consistent way, but then there was a\nbig jump in efficie...
sql
chosen
[ { "from": "human", "value": "Add confirmation fields to the user table.\n" }, { "from": "gpt", "value": "# ---!Ups\nalter table users add column confirmed_at timestamp;\nalter table users add column confirmation_token varchar(36) not null;\n\n# ---!Downs\nalter table users drop column confirmed_...
sql
chosen
[ { "from": "human", "value": "Add sql solution for 626. Exchange Seats\n\n626. Exchange Seats: https://leetcode.com/problems/exchange-seats/\n" }, { "from": "gpt", "value": "SELECT IF(`id` = (SELECT MAX(`id`) FROM `seat`) AND (`id` & 1), `id`, IF(`id` & 1, `id` + 1, `id` - 1)) AS `id`, `student` ...
sql
chosen
[ { "from": "human", "value": "Add custom query script for selecting coursework for lecturer users\n" }, { "from": "gpt", "value": "SELECT Coursework.id AS id,\nCoursework.title AS title,\nCoursework.date_submitted AS dateSubmitted,\nCoursework.file AS file,\nCoursework.file_extension As fileExten...
sql
chosen
[ { "from": "human", "value": "Add view to associate teams with players count_\n" }, { "from": "gpt", "value": "\ncreate or replace view teams_with_players_count as\nselect\n t.*,\n coalesce(count(p.id)) as n_players\nfrom\n teams as t left join players as p\non\n p.team = t.id\ngroup by\n t....
sql
chosen
[ { "from": "human", "value": "Add sql to do a basic copy of data from stories to stories_restore\n\n" }, { "from": "gpt", "value": "ALTER TABLE stories_restore ADD PRIMARY KEY (stories_id);\n\nINSERT INTO stories_restore (select * from stories where stories_id > ( ( select max(stories_id) from st...
sql
chosen
[ { "from": "system", "value": "Add missing comma in SQL migration.\n" }, { "from": "human", "value": "CREATE TABLE `wiki_documentlink` (\n `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,\n `linked_from_id` integer NOT NULL,\n `linked_to_id` integer NOT NULL,\n `kind` varchar(16) NOT...
sql
chosen
[ { "from": "human", "value": "Add SQL for selecting all blog posts.\n" }, { "from": "gpt", "value": "SELECT\n `blog_post`.`post_id`,\n `blog_post`.`title`,\n `blog_post`.`body`,\n `blog_post`.`category`,\n `blog_post`.`created`,\n `blog_post`.`created_by`\nFROM\n `blog_post`;...
sql
chosen
[ { "from": "human", "value": "Add patch to force refresh of db_triggers.sql.\n" }, { "from": "gpt", "value": "-- This patch will force a re-apply of the triggers patch\n-- We need to re-apply the triggers because they have changed\n-- for the time sheet item / task actual start date bug.\nDELETE ...
sql
chosen
[ { "from": "human", "value": "Add the actual sql commands" }, { "from": "gpt", "value": "\n/*\nPolygons\n*/\n\nALTER TABLE osm_landuse_polygon RENAME TO osm_landuse_polygon_full;\nALTER TABLE osm_landuse_polygon_gen1 RENAME TO osm_landuse_polygon_gen1_full;\nALTER TABLE osm_landuse_polygon_gen0 R...
sql
chosen
[ { "from": "human", "value": "Remove unused columns in the experiment table\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 ma...
sql
chosen
[ { "from": "human", "value": "Add practice example for nesting\n" }, { "from": "gpt", "value": "SELECT DISTINCT\n visitId\n , totals.pageviews\n , totals.timeOnsite\n , trafficSource.source\n , device.browser\n , device.isMobile\n , h.page.pageTitle\nFROM \n `bigquery-public-data`.google_analyti...
sql
chosen
[ { "from": "human", "value": "Update the trigger to also mark the file_status as inline.\n\n" }, { "from": "gpt", "value": "CREATE OR REPLACE FUNCTION download_relative_file_path_trigger() RETURNS trigger AS \n$$\n DECLARE\n path_change boolean;\n BEGIN\n -- RAISE NOTICE 'BEGIN ';\n...
sql
chosen
[ { "from": "human", "value": "VIMS-291: Create migration script for logging IVD form status.\n" }, { "from": "gpt", "value": "CREATE TABLE vaccine_report_status_changes\n(\n id SERIAL PRIMARY KEY,\n reportId INTEGER NOT NULL REFERENCES vaccine_reports (id...
sql
chosen
[ { "from": "human", "value": "Add init database sql script.\n" }, { "from": "gpt", "value": "DROP DATABASE IF EXISTS sampledb;\nCREATE DATABASE sampledb DEFAULT CHARACTER SET utf8;\nUSE sampledb;\n\n##创建用户表\nCREATE TABLE t_user (\n user_id INT AUTO_INCREMENT PRIMARY KEY,\n user_name VARCHAR...
sql
chosen
[ { "from": "human", "value": "Create indexes for tables with a FK to job.id\n\n\nFormer-commit-id: bf71b6d71167281d966e2089da7f89256363168c [formerly bf71b6d71167281d966e2089da7f89256363168c [formerly f099059b6d2936379e5619b9e3c79eb9b1a2151f]]\nFormer-commit-id: f4cb979e1e22a820bb707fdbade14262daad4814\nForm...
sql
chosen
[ { "from": "human", "value": "Add level 3 curation done\n" }, { "from": "gpt", "value": "/*\n\n################################################################################\n\nMigration script to add the curation status 'Level 3 curation done'\n\nauthor: Cinzia Malangone\ndate: 18th Nov 201...
sql
chosen
[ { "from": "human", "value": "Add query to count the number of calls per genome.\n\nThis should be the very first QC step.\n" }, { "from": "gpt", "value": "# Count the number of calls per genome.\nSELECT\n call.call_set_name,\n COUNT(call.call_set_name) AS number_of_calls,\nFROM\n [_GENOME_CAL...
sql
chosen
[ { "from": "human", "value": "Create content table creation script\n" }, { "from": "gpt", "value": "CREATE TABLE IF NOT EXISTS content (\n id integer PRIMARY KEY,\n hashId text UNIQUE NOT NULL,\n url text UNIQUE NOT NULL,\n state text NOT NULL DEFAULT('initialized'),\n initializedAt datetime...
sql
chosen
[ { "from": "human", "value": "Create a sql to set up a new trumpdb in pg\n" }, { "from": "gpt", "value": "/* sudo -u postgres \n psql -f pgtrump.sql -v ua:$usrA -v uap:'$usrApass'\n -v ub:$usrB -v ubp:'$usrBpass'*/\n\nCREATE ROLE :ua WITH LOGIN PASSWORD :uap SUPERUSER CREA...
sql
chosen
[ { "from": "human", "value": "Fix immutable index functions in resto db schema\n\nChange-Id: Id573200cbff933b1c3ad70789b6fde2ba073ed60\n" }, { "from": "gpt", "value": "CREATE OR REPLACE FUNCTION f_unaccent(text)\n RETURNS text AS\n$func$\nSELECT public.unaccent('public.unaccent', $1) -- schema-...
sql
chosen
[ { "from": "human", "value": "Remove obsolete collections-related columns & tables\n" }, { "from": "gpt", "value": "DROP TABLE IF EXISTS `collection_subscriptions`;\nDROP TABLE IF EXISTS `collections_votes`;\nDROP TABLE IF EXISTS `stats_addons_collections_counts`;\nDROP TABLE IF EXISTS `stats_col...
sql
chosen
[ { "from": "human", "value": "Fix Forlorn Spirit (part of the \"Legend of Stalvan\" quest chain)\n" }, { "from": "gpt", "value": "INSERT INTO version_db_world (`sql_rev`) VALUES ('1525370516654001760');\n\nUPDATE `smart_scripts` SET `link` = 3, `target_type` = 21, `target_param1` = 30, `action_pa...
sql
chosen
[ { "from": "human", "value": "Add kuvaus and luontipaivamaara columns.\n" }, { "from": "gpt", "value": "IF NOT EXISTS (\n select * from INFORMATION_SCHEMA.COLUMNS\n where TABLE_SCHEMA='sa' and TABLE_NAME='sa_virta_jtp_yhteisjulkaisut_ristiriitaiset'\n and COLUMN_NAME='luontipaivamaara'\n) BEGI...
sql
chosen
[ { "from": "human", "value": "Add record cell_info to event (E4)\n" }, { "from": "gpt", "value": "\ninsert into cell_info values\n (35, 4, 1, 'A', true, false),\n (35, 4, 2, 'B', true, false),\n (35, 4, 3, 'C', false, false),\n (35, 4, 4, 'D', false, false),\n (35, 4, 5, 'E', false...
sql
chosen
[ { "from": "human", "value": "IFS-3088: Update photonics for all competition from webtestdata\n" }, { "from": "gpt", "value": "-- IFS-3088 - Temporarily modify test data to allow testing for backwards compatability for this feature\n-- Remove the new application team question from one example c...
sql
chosen
[ { "from": "human", "value": ":wrench: Add SQL for creating tables\n" }, { "from": "gpt", "value": "-----------------------------------------------------------------------------\nCREATE TABLE public.profesor ( --Tabla Profesores\n id SERIAL PRIMARY KEY,\n id_profesor integer NOT NULL,\n tipo_d...
sql
chosen
[ { "from": "human", "value": "Add stored procedure for post relations\n" }, { "from": "gpt", "value": "DROP PROCEDURE IF EXISTS `GET_POST_RELATIONS`;\r\nDELIMITER ;;\r\nCREATE DEFINER=`root`@`localhost` PROCEDURE `GET_POST_RELATIONS`(IN `_id` int)\r\nBEGIN\r\n IF (_id > 0) THEN\r\n SELE...
sql
chosen
[ { "from": "human", "value": "Correct cassandra storage table properties. Always enable the key cache, and disable all read_repairs.\n\nref: https://github.com/thelastpickle/cassandra-reaper/pull/257\n" }, { "from": "gpt", "value": "\n-- Optimal table properties\n\nALTER TABLE repair_unit_v1\n W...
sql
chosen
[ { "from": "human", "value": "Add INSERT/UPDATE triggers to auto intersect census tracts.\n" }, { "from": "gpt", "value": "\nCREATE OR REPLACE FUNCTION intersect_census_data(incidentaddress)\nRETURNS TABLE(bkgpidfp00 varchar, bkgpidfp10 varchar) AS $$\n SELECT ROW(\n (SELECT bg.bkgpidfp00\n ...
sql
chosen