conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "human", "value": "Update Sotkanet urls to https\n" }, { "from": "gpt", "value": "-- update layer name\nUPDATE oskari_statistical_datasource set config='{\n \"url\" : \"https://www.sotkanet.fi/rest\",\n \"info\" : {\n \"url\" : \"https://www.sotkanet.fi\"\n },\n \"hints\" : {\n ...
sql
chosen
[ { "from": "human", "value": "Add migration script for vaccine distribution status changes\n" }, { "from": "gpt", "value": "DROP TABLE IF EXISTS vaccine_distribution_status_changes;\n\nCREATE TABLE vaccine_distribution_status_changes\n(\n id serial NOT NULL,\n distributionid integer NOT NULL,\n...
sql
chosen
[ { "from": "human", "value": "Update script for 1.6.8 to 2.0.0 added\n\n\ngit-svn-id: 70ab0960c3db1cbf656efd6df54a8f3de72dc710@199 820eb932-12ee-0310-9ca8-eeb645f39767\n" }, { "from": "gpt", "value": "CREATE TABLE IF NOT EXISTS `blacklist_patterns` (\n `id` int(11) NOT NULL auto_increment,\n `t...
sql
chosen
[ { "from": "human", "value": "Add a database cleanup script\n" }, { "from": "gpt", "value": "-- Fix millisecond time stamps that have been generated by an early version until Jan. 2018\nupdate categories set created=created/1000 where created>1000000000000;\nupdate comments set created=created/10...
sql
chosen
[ { "from": "human", "value": "Add SQL migration script to create new column and migrate data.\n" }, { "from": "gpt", "value": "ALTER TABLE `message` ADD COLUMN `new_chat_members` TEXT COMMENT 'List of unique user identifiers, new member(s) were added to the group, information about them (one of t...
sql
chosen
[ { "from": "human", "value": "Create shipment lead time view\n" }, { "from": "gpt", "value": "DROP VIEW IF EXISTS dw_product_lead_time_vw;\n\nCREATE OR REPLACE VIEW dw_product_lead_time_vw AS\n\n SELECT dw_orders.programid, dw_orders.geographiczoneid, dw_orders.periodid,\n facilities.name,facili...
sql
chosen
[ { "from": "human", "value": "Vocabs: Add missing DDL to create tables for vocabs\n\nSomehow we managed to omit this.\n" }, { "from": "gpt", "value": "\nDROP TABLE IF EXISTS `related`;\nCREATE TABLE `related` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `type` varchar(45) DEFAULT NULL,\n `relat...
sql
chosen
[ { "from": "human", "value": "[Auth\\DB] Set default expansion to 2\n" }, { "from": "gpt", "value": "-- DB update 2016_11_19_00 -> 2017_08_19_00\nDROP PROCEDURE IF EXISTS `updateDb`;\nDELIMITER //\nCREATE PROCEDURE updateDb ()\nproc:BEGIN DECLARE OK VARCHAR(100) DEFAULT 'FALSE';\nSELECT COUNT(*) ...
sql
chosen
[ { "from": "human", "value": "Add migration to create assist data tables\n" }, { "from": "gpt", "value": "-- Schools table\n\nCREATE TABLE Schools(\n id INT NOT NULL AUTO_INCREMENT,\n time_created TIMESTAMP NOT NULL DEFAULT NOW(),\n last_updated TIMESTAMP NOT NULL DEFAULT...
sql
chosen
[ { "from": "human", "value": "Add migration: creation of columns for external authentication\n" }, { "from": "gpt", "value": "-- Target versions: pre v2.22\n-- SHOULD be executed when upgrading to SlipStream v2.22\n\nalter table \"USER\" add column \"CYCLONELOGIN\" varchar(255);\nalter table \"US...
sql
chosen
[ { "from": "human", "value": "Create utility procedure to use which generates login links\n\nMust be very careful with this procedure\n" }, { "from": "gpt", "value": "DROP PROCEDURE IF EXISTS selectResetLinks;\n\nDELIMITER $$\nCREATE PROCEDURE selectResetLinks(p_timeout_minutes SMALLINT UNSIGNED)...
sql
chosen
[ { "from": "human", "value": "Reduce write amplification on orders and balances\n" }, { "from": "gpt", "value": "-- TxBits - An open source Bitcoin and crypto currency exchange\n-- Copyright (C) 2014-2015 Viktor Stanchev & Kirk Zathey\n--\n-- This program is free software: you can redistribute i...
sql
chosen
[ { "from": "human", "value": "Add scripts to setup routing graph\n" }, { "from": "gpt", "value": "-- create extension pgrouting;\n\n-- select pgr_createtopology('tieviiva2',0.001,the_geom:='geom2d',id:='gid');\n\n-- select * from pgr_getTableName('tieviiva');\n\n-- alter table tieviiva2 add sour...
sql
chosen
[ { "from": "human", "value": "Add Cached Data Per Object in Memory script" }, { "from": "gpt", "value": "/*\n<documentation>\n <summary>List Cached Data Per Object in Memory</summary>\n <returns>1 data set: list Cached Data Per Object in Memory.</returns>\n <issues>No</issues>\n <author>Pinal...
sql
chosen
[ { "from": "system", "value": "Increase size of goods column for route_cache\n" }, { "from": "human", "value": "CREATE TABLE `smr_new`.`route_cache`\r\n(\r\n\t`game_id` INT UNSIGNED NOT NULL\r\n,\t`max_ports` INT NOT NULL\r\n,\t`goods_allowed` VARCHAR(100) NOT NULL\r\n,\t`races_allowed` VARCHAR(1...
sql
chosen
[ { "from": "human", "value": "Add indexes on OAuth token + consumer tables that should've been there\n\nA bit odd that we aren't enforcing uniqueness on tokens, nor using the\ntoken ID as the primary key for that table, but we'll have to look a bit\nmore closely to make those changes, and these should drasti...
sql
chosen
[ { "from": "human", "value": "IFS-2396: Fix issue with ati competitions by removing jes upload\n" }, { "from": "gpt", "value": "-- IFS-2396: As with the APC competition type, jes uploads are not currently required (although this may change)\n\nSET @ati_comp_template_id = (SELECT id FROM competiti...
sql
chosen
[ { "from": "human", "value": "Add script to populate database\n" }, { "from": "gpt", "value": "CREATE TABLE breeds (\n name varchar(30) UNIQUE,\n type varchar(30),\n lifeExpectancy INT,\n origin varchar(30)\n);\n\nINSERT INTO breeds VALUES ('poodle', 'sporting', 14, 'Germany');\n" } ]
sql
chosen
[ { "from": "human", "value": "Add database table for keeping track of labels on events\n" }, { "from": "gpt", "value": "/* Copyright 2019 The Matrix.org Foundation C.I.C.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance w...
sql
chosen
[ { "from": "human", "value": "Add calendar year dimension sql\n" }, { "from": "gpt", "value": "/* Build 'calendar year' dimension table. */\nCREATE TABLE #dim (\n person_id bigint,\n covariate_id bigint,\n covariate_count int\n);\n\nINSERT INTO #dim\nSELECT DISTINCT\n cp.person_id,\n ...
sql
chosen
[ { "from": "human", "value": "Add a groups table and a table to link users with groups\n" }, { "from": "gpt", "value": "# --- Create a groups table, and a table to link users and groups.\n# --- Also create an 'administrators' group, which always has ID 1.\n\n# ---!Ups\ncreate table groups(\n id ...
sql
chosen
[ { "from": "human", "value": "Update kunnat to more generic layer\n\nUpdate kunnat to more generic layer" }, { "from": "gpt", "value": "UPDATE oskari_maplayer SET name = 'tilastointialueet:kunta4500k' WHERE type = 'statslayer' AND name = 'tilastointialueet:kunta4500k_2017';\n" } ]
sql
chosen
[ { "from": "human", "value": "Correct a bad Herald migration\n\nSummary:\nOne of the migrations in rPa335004a91 (`20150730.herald.5.sql`) incorrectly swapped \"add\" and \"add blocking\" Differential Herald rules.\n\nSwap any rules last modified before this patch was applied back. This is the best we can do ...
sql
chosen
[ { "from": "human", "value": "Add SQL script to delete etalabot activities.\n" }, { "from": "gpt", "value": "create index idx_activity_user_id on activity (user_id);\ncreate index idx_activity_detail_activity_id on activity_detail (activity_id);\n\ndelete from activity_detail where activity_id in...
sql
chosen
[ { "from": "human", "value": "Add tables for event, venue venue-alias and song\n" }, { "from": "gpt", "value": "SET SQL_MODE=\"NO_AUTO_VALUE_ON_ZERO\";\n/*!40101 SET NAMES utf8 */;\n\nDROP TABLE IF EXISTS `denkmal_event`;\nDROP TABLE IF EXISTS `denkmal_venueAlias`;\nDROP TABLE IF EXISTS `denkmal_...
sql
chosen
[ { "from": "human", "value": "Add the tables to store reported comments\n" }, { "from": "gpt", "value": "-- create storage for reported comments\n\ncreate table reported_talk_comments(\n ID int auto_increment primary key,\n talk_comment_id int not null, \n reporting_user_id int not null,...
sql
chosen
[ { "from": "human", "value": "Add SQL for customers example\n" }, { "from": "gpt", "value": "-- phpMyAdmin SQL Dump\n-- version 4.2.7.1\n-- http://www.phpmyadmin.net\n--\n-- Host: localhost\n-- Generation Time: Aug 20, 2015 at 02:33 am\n-- Server version: 5.6.20\n-- PHP Version: 5.5.15\n\nSET SQL...
sql
chosen
[ { "from": "human", "value": "[NCL-6695] Add sql script to create tables in DB\n" }, { "from": "gpt", "value": "--\n-- JBoss, Home of Professional Open Source.\n-- Copyright 2014-2022 Red Hat, Inc., and individual contributors\n-- as indicated by the @author tags.\n--\n-- Licensed under the Apach...
sql
chosen
[ { "from": "human", "value": "Create dummy data scripts for gc's\n" }, { "from": "gpt", "value": "USE italian-workflow;\r\n\r\nINSERT INTO GiftCertificates (amount, sale_price, date_sold, issuer_id, memo) VALUES (25.00, 25.00, \"2017-2-25\", 1, \"Test this DB yeeeeeeee boy!\");\r\nINSERT INTO Gif...
sql
chosen
[ { "from": "human", "value": "Add SQL scripts for parcel relationships\n" }, { "from": "gpt", "value": "CREATE TABLE IF NOT EXISTS parcel_has_commodity (\n\tid INT (11) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,\n\tparcel_id INT(11) UNSIGNED,\n\tcommodity_id INT(11) UNSIGNED\n);\n\nCREATE TABL...
sql
chosen
[ { "from": "human", "value": "Add \"flag\" table for informing windows machine when to process tabulars.\n" }, { "from": "gpt", "value": "IF NOT EXISTS (select * from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='dbo' and TABLE_NAME='tabularprocessing') BEGIN\n\nCREATE TABLE dbo.tabularprocessing...
sql
chosen
[ { "from": "human", "value": "Update missing database scripts for MIFOSX-391\n" }, { "from": "gpt", "value": "ALTER TABLE `acc_accounting_rule`\n\tCHANGE COLUMN `debit_account_id` `debit_account_id` BIGINT(20) NULL DEFAULT NULL AFTER `office_id`,\n\tCHANGE COLUMN `credit_account_id` `credit_accou...
sql
chosen
[ { "from": "human", "value": "Add script for creating categories view\n" }, { "from": "gpt", "value": "CREATE VIEW `page_id_categories` AS (\nSELECT p.page_id, c.id, c.name\nFROM pages_categories p\nLEFT JOIN categories c\nON p.category_id = c.id\n);" } ]
sql
chosen
[ { "from": "human", "value": "ADD sql script file to create db structure to store game data\n" }, { "from": "gpt", "value": "-- phpMyAdmin SQL Dump\n-- version 3.5.8.1\n-- http://www.phpmyadmin.net\n--\n-- Host: dd15512.kasserver.com\n-- Generation Time: Jun 28, 2015 at 03:32 PM\n-- Server versio...
sql
chosen
[ { "from": "human", "value": "Add sql script to clean the db dump of sensitive info\n\nHeavily based off the RDS module in the dmaws directory.\n" }, { "from": "gpt", "value": "\\echo 'Update users'\nUPDATE users\nSET name = 'Test user',\n email_address = id || '@user.marketplace.team',\n p...
sql
chosen
[ { "from": "human", "value": "Define schema for Entry DB Table.\n" }, { "from": "gpt", "value": "\n--\n-- Definition of table `entry`\n--\n\nCREATE TABLE entry (\n id INTEGER NOT NULL PRIMARY KEY,\n title VARCHAR(255) NOT NULL,\n content TEXT NOT NULL,\n summary TEXT NULL,\n update...
sql
chosen
[ { "from": "human", "value": "Add migration for temporary accountplan table\n\n Temporary table to be used in automatic supplier creation on download incoming invoices page\n" }, { "from": "gpt", "value": "CREATE TABLE IF NOT EXISTS accountplantemp (\n AccountPlanID bigint(20) NOT NULL DEFAULT '...
sql
chosen
[ { "from": "human", "value": "Add 0.1 MySQL import file\n" }, { "from": "gpt", "value": "-- phpMyAdmin SQL Dump\n-- version 3.3.2deb1ubuntu1\n-- http://www.phpmyadmin.net\n--\n-- Host: localhost\n-- Generation Time: Aug 10, 2013 at 10:32 AM\n-- Server version: 5.1.70\n-- PHP Version: 5.3.2-1ubunt...
sql
chosen
[ { "from": "human", "value": "Add RDF bulk loader script\n" }, { "from": "gpt", "value": "--\n-- Bulk loading RDF graphs into Virtuoso Quad Store.\n--\n\nSET u{SRC_DIR} /tmp/share ;\nSET u{FILE_NAME} *.gz ;\nSET u{LOG_LEVEL} 2 ;\n\n-- delete named graph\n-- SPARQL CLEAR GRAPH <graph_uri> ;\n\n-- ...
sql
chosen
[ { "from": "human", "value": "Enforce product nesting level also for the API\n" }, { "from": "gpt", "value": "CREATE TRIGGER enfore_product_nesting_level BEFORE UPDATE ON products\nBEGIN\n\t-- Currently only 1 level is supported\n SELECT CASE WHEN((\n SELECT 1\n FROM products p\n...
sql
chosen
[ { "from": "human", "value": "Add upsert-like code used for updating audit opinions\n" }, { "from": "gpt", "value": "BEGIN;\n\nCREATE TEMPORARY TABLE audit_opinions_2015q4\n(\n demarcation_code TEXT,\n financial_year integer,\n opinion_code TEXT,\n opinion_label TEXT\n...
sql
chosen
[ { "from": "human", "value": "Reduce consequence_terms in motif_feature_variation and regulatory_feature_variation tables\n" }, { "from": "gpt", "value": "\n# Update consequence_types in motif_feature_variation and regulatory_feature_variation tables\n# Only store SO_terms that can be assigned to...
sql
chosen
[ { "from": "human", "value": "Add SQL file for initial data population\n" }, { "from": "gpt", "value": "-- CREATE TABLE \"manager_exercisecategory\" (\n-- \"id\" integer NOT NULL PRIMARY KEY,\n-- \"name\" varchar(100) NOT NULL\n-- );\nINSERT INTO \"manager_exercisecategory\" VALUES(1,'Arm...
sql
chosen
[ { "from": "human", "value": "Add search route II (route coord generation) (api)\n" }, { "from": "gpt", "value": "UPDATE routes AS nroute\n\tJOIN (\n\t\tSELECT route.id AS id, AVG(stop.lat) AS lat, AVG(stop.lng) AS lng FROM routes AS route\n\t\tJOIN trips AS trip ON trip.route_id = route.id\n\t\t...
sql
chosen
[ { "from": "human", "value": "Add Emails Template resources and navigation item\n" }, { "from": "gpt", "value": "\nINSERT INTO admin_resources SET name = 'Email Templates', hidden = 0, is_container = 0, is_allowed = 0, admin = 1, module = 'admin', controller = 'emailstemplates', parent_id = 60;\n...
sql
chosen
[ { "from": "human", "value": "CSCVIPUNEN-433: Create SA table for VIRTA-OTP ViisViis API.\n" }, { "from": "gpt", "value": "IF NOT EXISTS (\n select * from INFORMATION_SCHEMA.TABLES\n where TABLE_SCHEMA='sa' and TABLE_NAME='sa_virta_otp_viisviis'\n) BEGIN\n\nCREATE TABLE sa.sa_virta_otp_viisviis...
sql
chosen
[ { "from": "human", "value": "Fix myplaces borders with null -> '' trigger\n" }, { "from": "gpt", "value": "-- SLD assumes that the dasharray is empty instead of null\n-- with null border is ALWAYS dash\n-- with '' solid border AND dash works properly\n\nCREATE OR REPLACE FUNCTION procedure_categ...
sql
chosen
[ { "from": "human", "value": "Create the sql script to amend the open and briefing dates of the Photonics competitions.\n" }, { "from": "gpt", "value": "-- Temporary webtestdata fix. Should be removed when IFS-2986.\n\nSET @photonics_for_health_competition_id = (SELECT id\n\n ...
sql
chosen
[ { "from": "human", "value": "Add SQL script to install InnoDB if it is built as a dynamic plugin\n\nSuggested by:\tKen\n" }, { "from": "gpt", "value": "-- execute these to install InnoDB if it is built as a dynamic plugin\nINSTALL PLUGIN innodb SONAME 'ha_innodb.so';\nINSTALL PLUGIN innodb_trx S...
sql
chosen
[ { "from": "human", "value": "Add basic join create sql\n" }, { "from": "gpt", "value": "DROP TABLE IF EXISTS USER;\nCREATE TABLE USER (\n\tID VARCHAR(32),\n\tNAME VARCHAR(32) NOT NULL,\n\tPRIMARY KEY(ID)\n);\n\nDESC USER;\n\nINSERT INTO USER VALUES ('apple', 'honux'),('banana','crong'),('carrot'...
sql
chosen
[ { "from": "human", "value": "Rename employee last_name to suranme\n" }, { "from": "gpt", "value": "ALTER TABLE employees CHANGE last_name surname VARCHAR(16);\n\nALTER VIEW employee_titles AS\n SELECT e.emp_no, e.first_name, e.surname, e.middle_name, t.title, t.from_date, t.to_date \n FROM e...
sql
chosen
[ { "from": "human", "value": "Fix failing test (tables no longer recreated).\n" }, { "from": "gpt", "value": "\nDROP TABLE homepage_new_participants;\nDROP TABLE homepage_top_givers;\nDROP TABLE homepage_top_receivers;\nCREATE TABLE homepage_new_participants(username text, claimed_time timestamp ...
sql
chosen
[ { "from": "human", "value": "engine: Set management network in upgrade\n\nSet management network in upgrade (take 2).\n\nThe patch re-dones upgrade script 03_06_0840\nas the related configuration key was renamed in the pre-upgrade phase.\n\nChange-Id: I8c68c2bfe758beacb41a74912dacc2080cb621a6\nBug-Url: http...
sql
chosen
[ { "from": "human", "value": "Add right to view facility distribution\n" }, { "from": "gpt", "value": "delete from rights where name = 'MANAGE_FACILITY_DISTRIBUTION';\nINSERT INTO rights (name, rightType, displaynamekey, displayOrder, description) VALUES\n('MANAGE_FACILITY_DISTRIBUTION','REQUISIT...
sql
chosen
[ { "from": "human", "value": "Add SQL script to drop the crawl error column.\n" }, { "from": "gpt", "value": "BEGIN TRANSACTION;\nCREATE TABLE IF NOT EXISTS projects_new (id INTEGER PRIMARY KEY NOT NULL, name VARCHAR(60) NOT NULL, url VARCHAR(1024) NOT NULL, devops_json TEXT, creds TEXT, updated_...
sql
chosen
[ { "from": "human", "value": "Reduce the need for scripts\n" }, { "from": "gpt", "value": "-- The contents of this file are subject to the MonetDB Public License\n-- Version 1.1 (the \"License\"); you may not use this file except in\n-- compliance with the License. You may obtain a copy of the Li...
sql
chosen
[ { "from": "human", "value": "Add first vudimentary script to create table\n" }, { "from": "gpt", "value": "CREATE TABLE reviews (\n id serial PRIMARY KEY,\n author varchar(100) NOT NULL,\n created_at int,\n item varchar(100) NOT NULL,\n rating varchar(10...
sql
chosen
[ { "from": "human", "value": "Create new sql script with new product and order\n" }, { "from": "gpt", "value": "CREATE DATABASE IF NOT EXISTS springJTA\n CHARACTER SET utf8;\n\nUSE springJTA;\n\nDROP TABLE IF EXISTS order;\nDROP TABLE IF EXISTS product;\nDROP TABLE IF EXISTS user;\n\nCREATE TABL...
sql
chosen
[ { "from": "human", "value": "Add note for topic stats fix.\n" }, { "from": "gpt", "value": "/*\nThe following was used to test the source of a bug in aggretation.\nA group by was moved to the appropriate level.\n*/\n\nSELECT DISTINCT Trend.topic, DATE(Trend.timestamp) AS date, Trend.place_id\n ...
sql
chosen
[ { "from": "human", "value": "Add migration for online_sessions flag\n" }, { "from": "gpt", "value": "DO $$\n BEGIN\n BEGIN\n ALTER TABLE cd_dojos ADD COLUMN online_sessions smallint NOT NULL DEFAULT 0;\n EXCEPTION\n WHEN duplicate_column THEN RAISE NOTICE '...
sql
chosen
[ { "from": "human", "value": "Update script to add users_sentences table.\n" }, { "from": "gpt", "value": "DROP TABLE IF EXISTS `users_sentences`;\nCREATE TABLE `users_sentences` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `user_id` int(11) NOT NULL,\n `sentence_id` int(11) NOT NULL,\n `corre...
sql
chosen
[ { "from": "human", "value": "Reduce strength of PT relative to HPT\n\nThis change is intended to provide a bit more incentive to make peace\nwith the Human race, because the neutral PT was barely worse than the\nHPT (being only -5 damage).\n\nPhoton Torpedo => -1% accuracy\nHuman Photon Torpedo => +1% accur...
sql
chosen
[ { "from": "human", "value": "Add basic sql schema to create DB\n\n1. Make a basic table\n2. Insert a new row in this table\n" }, { "from": "gpt", "value": "drop table if exists prism_people;\ncreate table prism_people (\n id integer primary key autoincrement,\n name text not null,\n secret te...
sql
chosen
[ { "from": "human", "value": "Move ad table to site.\n\n\nsvn commit r24206\n" }, { "from": "gpt", "value": "create table Ad (\n\tid serial,\n\tshortname varchar(255),\n\ttitle varchar(255),\n\tcreatedate timestamp,\n\tdisplayorder int not null default 0,\n\ttotal_referrers int not null default 0...
sql
chosen
[ { "from": "human", "value": "Add schema for creating TABLE `char_info`\n" }, { "from": "gpt", "value": "CREATE TABLE IF NOT EXISTS char_info (\n serial INTEGER PRIMARY KEY,\n charname TEXT NOT NULL,\n hidden INTEGER NOT NULL DEFAULT 0,\n tabled INTEGER NOT NULL DEFAULT 0,\n displa...
sql
chosen
[ { "from": "human", "value": "Update to migration's unique key column data loss: fixing\n" }, { "from": "gpt", "value": "drop table if exists gh_ost_test;\ncreate table gh_ost_test (\n id int auto_increment,\n i int not null,\n primary key(id)\n) auto_increment=1;\n\ninsert into gh_ost_test va...
sql
chosen
[ { "from": "human", "value": "Add new indexes into concepts\n" }, { "from": "gpt", "value": "--\n-- CzechIdM 7.0 Flyway script \n-- BCV solutions s.r.o.\n--\n-- Add new indexes for IdmConceptRoleRequest\n\nCREATE INDEX idx_idm_conc_role_iden_rol\n ON idm_concept_role_request\n USING btree\n (i...
sql
chosen
[ { "from": "human", "value": "Add sample data to fill out the reservation table.\n" }, { "from": "gpt", "value": "\\set title 'Mr. & Mrs. Robert Shaw'\n\\set source 'Title|AddressLineOne|AddressLineTwo|AddressCity|AddressState|AddressZipCode'\n\\set lineone '12345 Street One'\n\\set linetwo 'Apt ...
sql
chosen
[ { "from": "human", "value": "Add published column to page_v table.\n" }, { "from": "gpt", "value": "-- //\n\nalter table page_v add published boolean default false;\ncreate index page_v_published_rid on page_v(publisheh, rid);\nupdate page_v inner join page on page_v.id = page.published_vid set ...
sql
chosen
[ { "from": "human", "value": "Add number of new members later active to campaign metrics\n" }, { "from": "gpt", "value": "-- Number of new members who are active at the moment\nINSERT INTO speakeasy_petition_metrics (activity, campaign_id, npeople)\n SELECT \n 'new_active_now', a.campaign_id,...
sql
chosen
[ { "from": "human", "value": "KRACOEUS-6002: Store sent notifications for tracking purposes\n" }, { "from": "gpt", "value": "CREATE TABLE IACUC_PROTOCOL_NOTIFICATION\r\n(\r\n NOTIFICATION_ID NUMBER(20)\r\n , NOTIFICATION_TYPE_ID NUMBER(6) NOT NULL\r\n , DOCUMENT_NUMBER VARCHAR2...
sql
chosen
[ { "from": "human", "value": "Create : 197 Rising Temperature\n" }, { "from": "gpt", "value": "SELECT\n w1.id AS Id\nFROM\n Weather AS w1\n INNER JOIN Weather AS w2\n ON TO_DAYS(w1.date) - TO_DAYS(w2.date) = 1\nWHERE\n w1.temperature > w2.temperature\n;\n" } ]
sql
chosen
[ { "from": "human", "value": "Add helper script to cleanup test data\n" }, { "from": "gpt", "value": "update users\n set deleted_at=now(), deleted_by_guid = created_by_guid\n where deleted_at is null\n and email like '%@test.apidoc.me';\n\nupdate organizations\n set deleted_at=now(), delete...
sql
chosen
[ { "from": "human", "value": "Add API for getting walk paths\n\n" }, { "from": "gpt", "value": "-- Function: public.get_walk_paths(text)\n--\n-- Sample function call:\n-- SELECT * FROM get_walk_paths();\n\n-- DROP FUNCTION public.get_walk_paths();\n\nCREATE OR REPLACE FUNCTION public.get_walk_pat...
sql
chosen
[ { "from": "human", "value": "Migrate wetlands to its own table\n" }, { "from": "gpt", "value": "CREATE TABLE \"lmv_bright\".\"wetlands\" (\n gid int primary key,\n type varchar(16),\n the_geom geometry\n);\n\nCREATE INDEX ON lmv_bright.wetlands USING GIST (the_geom);\n\ninsert into lmv_...
sql
chosen
[ { "from": "human", "value": "KCIAC-287: Implement IACUC notification for Admin Incomplete\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 procedure to load erikoistumiskoulutukset fact table\n" }, { "from": "gpt", "value": "USE [ANTERO]\nGO\n\nIF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dw].[p_lataa_f_virta_otp_erikoistumiskoulutukset]') AND type in (N'P', N'PC'))\nBE...
sql
chosen
[ { "from": "human", "value": "Revert \"Modified schema, changed sql reation script, moved all old scripts to db/old\"\n\nThis partially reverts commit 1856c2a941a1a8d759d1c85dcb7531d688011710.\nto restore pg-populate.sql script.\n" }, { "from": "gpt", "value": "INSERT INTO \"MACHINE_MODEL\".\"RU...
sql
chosen
[ { "from": "human", "value": "Add new function for creating admin superusers\n\nSigned-off-by: Michael Casadevall <6fe105eefab41990d7ec714c6c25ade3095cdb48@them.com>\n" }, { "from": "gpt", "value": "-- Makes a user a super administrator\n\nCREATE OR REPLACE FUNCTION admin.make_user_superadmin(_us...
sql
chosen
[ { "from": "human", "value": "Add TF \"International Journal of Pavement Engineering\"\n" }, { "from": "gpt", "value": "Title\tISSN\tEISSN\tField\tParent\tFormat\tDocumentation\nInternational Journal of Pavement Engineering\t1029-8436\t1477-268X\tengineering\ttaylor-and-francis-harvard-x\tauthor-...
sql
chosen
[ { "from": "human", "value": "Add migration file for rename from fat to lowfat\n\nExecute\n\n~~~\n$ sqlite3 db.sqlite3 < lowfat/migrations/0084.sql\n~~~\n" }, { "from": "gpt", "value": "UPDATE django_content_type SET app_label=\"lowfat\" WHERE app_label=\"fat\";\nALTER TABLE fat_blog RENAME TO lo...
sql
chosen
[ { "from": "human", "value": "Add a simple SQL script to insert some test data." }, { "from": "gpt", "value": "SELECT @admin_id:=`id` FROM users WHERE `username`='admin';\nSELECT @human_id:=`id` FROM species WHERE `name` = 'Human';\nSELECT @dodge_id:=`id` FROM talents WHERE name='Dodge';\nSELECT ...
sql
chosen
[ { "from": "human", "value": "Add update script to remove duplicate entries from cache_component_includes\n" }, { "from": "gpt", "value": "CREATE TABLE `cache_component_includes_temp` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `component_id` varchar(255) NOT NULL,\n `target_id` varchar(255) N...
sql
chosen
[ { "from": "human", "value": "Add query for getting flight operator statistics\n" }, { "from": "gpt", "value": "DECLARE @ClubKey nvarchar(10) = 'FGZO';\n\nSELECT CONCAT(Persons.Lastname, ' ', Persons.Firstname) AS Person, PlanningDays.Day\n, (SELECT COUNT(*) AS NumberOfReservations FROM Airc...
sql
chosen
[ { "from": "human", "value": "Add migration to remove duplicate emails\n\n- Move all relations to the github user record\n- Delete the learn user record\n" }, { "from": "gpt", "value": "--------------------------------------------------------------------------------\n-- For each relation, find al...
sql
chosen
[ { "from": "human", "value": "Correct new primary key sequence in the database.\n" }, { "from": "gpt", "value": "# Calendar schema\n\n# --- !Ups\n\nDROP SEQUENCE \"s_game_id\";\nCREATE SEQUENCE s_game_id\n INCREMENT 1\n MINVALUE 1\n MAXVALUE 9223372036854775807\n START 552\n CACHE 1;\n\n# --...
sql
chosen
[ { "from": "human", "value": "Add basic version of SQL script to update winners page\n" }, { "from": "gpt", "value": "/* insert new contentarticle version into table, created by cwoebker */\n\nINSERT INTO `xcolab_ContentArticleVersion` (`contentArticleId`, `folderId`, `authorId`, `createDate`, `t...
sql
chosen
[ { "from": "human", "value": "Add index to the pipeline name and id\n\nThis helps optimize one of the sub-select statements in the\n`getPipelinesForDashboard` SQL query\n" }, { "from": "gpt", "value": "\n--\n-- Copyright 2018 ThoughtWorks, Inc.\n--\n-- Licensed under the Apache License, Version 2...
sql
chosen
[ { "from": "human", "value": "Add Generate table definition to match query script\n" }, { "from": "gpt", "value": "/*\nAuthor: SQL Undercover\nSource link: https://sqlundercover.com/2017/08/21/undercover-toolbox-generate-a-temporary-table-definition-to-match-the-resultset-of-a-query/\n*/\n\nSET N...
sql
chosen
[ { "from": "human", "value": "Add recently appeared column emojulkaisunNimi.\n" }, { "from": "gpt", "value": "IF NOT EXISTS (\n select * from INFORMATION_SCHEMA.COLUMNS\n where TABLE_SCHEMA='sa' and TABLE_NAME='sa_virta_jtp_julkaisut'\n and COLUMN_NAME='emojulkaisunNimi'\n) BEGIN\n\nALTER TABL...
sql
chosen
[ { "from": "human", "value": "Prepare the migration from AWA 0.3 to 0.4\n\n" }, { "from": "gpt", "value": "ALTER TABLE awa_access_key CHANGE `expire_date` `expire_date` DATE NOT NULL;\nALTER TABLE awa_store_local CHANGE `expire_date` `expire_date` DATE NOT NULL;\n\n/* File generated automatically...
sql
chosen
[ { "from": "human", "value": "Update the sample age function.\n" }, { "from": "gpt", "value": "CREATE OR REPLACE FUNCTION ts.updatesampleage(_sampleageid integer,\n_age double precision DEFAULT NULL::double precision,\n_ageyounger double precision DEFAULT NULL::double precision,\n_ageolder double...
sql
chosen
[ { "from": "human", "value": "Add script to copy mapping to sequence regions\n" }, { "from": "gpt", "value": "insert into rnc_sequence_regions (\n\turs_taxid,\n\tregion_name,\n\tchromosome,\n\tstrand,\n\tregion_start,\n\tregion_stop,\n\tassembly_id,\n\twas_mapped,\n\tidentity,\n\tproviding_databa...
sql
chosen
[ { "from": "human", "value": "Localization: Add refactoring script for AS\n\ngit-svn-id: 4cd2d1688610a87757c9f4de95975a674329c79f@1532 b8ca103b-dd03-488c-9448-c80b36131af2\n" }, { "from": "gpt", "value": "ALTER TABLE \"as\".as_languages RENAME TO as_locale_languages;\r\n\r\n\r\nALTER TABLE \"as\...
sql
chosen
[ { "from": "human", "value": "Patch to update 68 schema to support DNAMethylationFeature in result_set, feature_type and input_set tables\n" }, { "from": "gpt", "value": "/** \n@header patch_68_69_b.sql - result_set.feature_class\n@desc add a feature_class field to result_set\n*/\n\n\n-- Move c...
sql
chosen
[ { "from": "human", "value": "Create SQL migration to support supply partners\n" }, { "from": "gpt", "value": "CREATE TABLE supply_partners\n(\n id SERIAL PRIMARY KEY,\n code varchar(10) NOT NULL UNIQUE,\n name varchar(50) NOT NULL UNIQUE,\n isActive BOOLEAN NOT NULL DEFAULT TRUE,\n\n creat...
sql
chosen
[ { "from": "human", "value": "Add missing sql script for the last commit\n" }, { "from": "gpt", "value": "ALTER TABLE shop_rates ADD CONSTRAINT fk_shop_rates_shops1_idx FOREIGN KEY (shop_id) REFERENCES shops(id);\nALTER TABLE shop_rates ADD CONSTRAINT fk_shop_rates_orders1_idx FOREIGN KEY (order_...
sql
chosen
[ { "from": "human", "value": "Create new sample table and update individual table. Copy individual data into new sample table.\n" }, { "from": "gpt", "value": "# create new table sample\nCREATE TABLE IF NOT EXISTS sample (\n sample_id int(10) unsigned NOT NULL AUTO_INCREMENT,\n individual_id in...
sql
chosen
[ { "from": "human", "value": "Add migration for missing fields in invoiceout for locked_at and locked_by\n" }, { "from": "gpt", "value": "ALTER TABLE invoiceout\nADD COLUMN UpdatedAt datetime DEFAULT NULL,\nADD COLUMN LockedAt datetime DEFAULT NULL,\nADD COLUMN LockedBy int(11) DEFAULT NULL;\nUPD...
sql
chosen
[ { "from": "human", "value": "Patch to apply a numeric primary key to caldav_data / calendar_item\nin order to attempt to resolve performance issues in non-POSIX collation.\n" }, { "from": "gpt", "value": "\n-- Add a numeric primary key link between caldav_data and calendar_item to\n-- provide mo...
sql
chosen