conversations listlengths 2 3 | source stringclasses 1 value | stack stringclasses 1 value |
|---|---|---|
[
{
"from": "human",
"value": "Create indexes for tables with a FK to job.id\n\n\nFormer-commit-id: f099059b6d2936379e5619b9e3c79eb9b1a2151f"
},
{
"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_jo... | sql | chosen |
[
{
"from": "human",
"value": "Add function to return NFPA region based on the state.\n"
},
{
"from": "gpt",
"value": "CREATE OR REPLACE function nfpa_region(state varchar) returns varchar(2) AS $$\nBEGIN\n IF upper(state) in ('AL', 'AR', 'DC', 'DE', 'FL', 'GA', 'KY', 'LA', 'MD', 'MS', 'NC', 'OK'... | sql | chosen |
[
{
"from": "human",
"value": "Migrate db create table configs\n"
},
{
"from": "gpt",
"value": "\n-- +goose Up\n-- SQL in section 'Up' is executed when this migration is applied\nCREATE TABLE `configs` (\n `id` INT(11) NOT NULL AUTO_INCREMENT,\n `total_reward_threshold` INT(11) NOT NULL COMMENT ... | sql | chosen |
[
{
"from": "human",
"value": "Add mysql schema for dummy data and test\n"
},
{
"from": "gpt",
"value": "--\n-- Sample Database in MySql for unit testing demo\n--\n\nDROP TABLE IF EXISTS users CASCADE;\n\nCREATE TABLE users (\n id INT NOT NULL AUTO_INCREMENT,\n name VARCHAR (30) NOT NULL,\... | sql | chosen |
[
{
"from": "human",
"value": "Add first (failing) test SQL script\n"
},
{
"from": "gpt",
"value": "SELECT exp.line_num,\n exp.dist_line_num,\n row_number () OVER (\n PARTITION BY pol.po_id, exp.dist_line_num\n ORDER BY exp.pymnt_dt, exp.line_num, exp.invoice_id... | sql | chosen |
[
{
"from": "human",
"value": "Add a sql procedure for finding duplicate ids\n"
},
{
"from": "gpt",
"value": "WITH non_distinct_ac AS (\n\tSELECT\n\t\tcount(*) as num,\n\t\tac\n\tFROM load_rnacentral_all\n\tGROUP BY ac\n\tORDER BY count(*) DESC\n)\nSELECT *\nFROM load_rnacentral_all t, non_distinc... | sql | chosen |
[
{
"from": "human",
"value": "Remove duplicate views from API\n"
},
{
"from": "gpt",
"value": "IF EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'api.valos_suoritteet'))\nDROP VIEW api.valos_suoritteet;\nGO\n\nIF EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'api.valo... | sql | chosen |
[
{
"from": "human",
"value": "[FIX] Remove some hard-coded latin collation settings\n(corresponding change to tiki.sql etc went in with last commit, apologies)\n\ngit-svn-id: a7fabbc6a7c54ea5c67cbd16bd322330fd10cc35@20628 b456876b-0849-0410-b77d-98878d47e9d5\n"
},
{
"from": "gpt",
"value": "ALTER... | sql | chosen |
[
{
"from": "human",
"value": "Add procedure occurrence dimension with ICD-9-CM\n"
},
{
"from": "gpt",
"value": "/* Build procedure occurrence dimension table. This uses the ICD-9-CM\n * vocabulary. */\nINSERT INTO #dim\nSELECT\n cp.person_id,\n SUBSTRING(REPLACE(sm.source_code, '.', '') FRO... | sql | chosen |
[
{
"from": "human",
"value": "Update Dual Talent cost (10g from now on, as in the 4.x.x revision should be)\n"
},
{
"from": "gpt",
"value": "\n-- \"Dual talent specialization\" cost has been reduced since 4.x.x, from the original 1.000g to the new amount of 10g\nUPDATE gossip_menu_option SET box_... | sql | chosen |
[
{
"from": "human",
"value": "Migrate db add total income column to users\n"
},
{
"from": "gpt",
"value": "\n-- +goose Up\n-- SQL in section 'Up' is executed when this migration is applied\nALTER TABLE `users` ADD COLUMN `total_income` DECIMAL(32, 8) NOT NULL DEFAULT 0 COMMENT 'user total income'... | sql | chosen |
[
{
"from": "human",
"value": "Fix opening hours for GNIB queue\n"
},
{
"from": "gpt",
"value": "update queues_opening_hours set day_id = 1 where day_id = 2 and queue_id = 1;\nupdate queues_opening_hours set day_id = 2 where day_id = 3 and queue_id = 1;\nupdate queues_opening_hours set day_id = 3 ... | sql | chosen |
[
{
"from": "human",
"value": "Add script for reversing incorrectly-set project lat/long coordinates\n"
},
{
"from": "gpt",
"value": "-- Reverses project lat/long coordinates, as they were set in reversed order initially\n\nUPDATE\n civictechprojects_project\nSET\n project_location_coords = ... | sql | chosen |
[
{
"from": "human",
"value": "Change index to speed up queries on language pairs\n"
},
{
"from": "gpt",
"value": "-- Add composite index on languages to speed up queries on language pairs\nCREATE INDEX sentence_lang_translation_lang_idx\nON sentences_translations(sentence_lang, translation_lang);... | sql | chosen |
[
{
"from": "human",
"value": "Fix min lvl and Min, Max players on the TP and BG\n"
},
{
"from": "gpt",
"value": "-- Fix min lvl and Min, Max players on the TP and BG\nDELETE FROM `battleground_template` WHERE `id` IN (120,108);\nINSERT INTO `battleground_template` VALUES\n(108,10,10,81,85,1726,0... | sql | chosen |
[
{
"from": "human",
"value": "Change max planet construction, double exp\n\nGens changed from 100 to 25, Hangers from 100 to 85, Turrets unchanged.\nall experience per build doubled.\n"
},
{
"from": "gpt",
"value": "UPDATE planet_construction\nSET max_construction = 25, exp_gain = 90 WHERE constr... | sql | chosen |
[
{
"from": "human",
"value": "Fix not null requirement in membership message column.\n"
},
{
"from": "gpt",
"value": "\n-- +goose Up\n-- SQL in section 'Up' is executed when this migration is applied\nALTER TABLE memberships ALTER COLUMN message DROP NOT NULL;\n\n\n-- +goose Down\n-- SQL section ... | sql | chosen |
[
{
"from": "human",
"value": "Revert \"Issue IMCMS-335: New design to super admin page: categories tab - Revert\"\n\nThis reverts commit 2913233\n"
},
{
"from": "gpt",
"value": "SET @schema_version__major_new = 6;\nSET @schema_version__minor_new = 65;\n\nALTER TABLE category_types\n DROP COLUMN ... | sql | chosen |
[
{
"from": "human",
"value": "Add ohjauksen ala to view.\n"
},
{
"from": "gpt",
"value": "ALTER VIEW dw.v_virta_otp_55_suppea AS \nSELECT d1.organisaatio_koodi AS 'Oppilaitos Koodi'\n ,d1.organisaatio_fi AS 'Oppilaitos'\n\n ,d2.okmohjauksenala_koodi AS 'OKM Ohjauksen ala Koodi'\n ,d2.okmohjauk... | sql | chosen |
[
{
"from": "human",
"value": "Add migration for seo fields for links (extern, download)\n"
},
{
"from": "gpt",
"value": "ALTER TABLE `kwc_basic_downloadtag` ADD `open_type` ENUM('self', 'popup', 'blank') NOT NULL DEFAULT 'self' ;\nALTER TABLE `kwc_basic_downloadtag` ADD `width` MEDIUMINT NULL DEF... | sql | chosen |
[
{
"from": "human",
"value": "Add an argument for XML based tabular cubes to be processed.\n"
},
{
"from": "gpt",
"value": "-- DO NOTICE WE USE dbo SCHEMA HERE IN PURPOSE BECAUSE THIS\n-- PROCEDURE IS NOT DIRECTLY PART OF sa OR dw SCHEMAS\n\nALTER PROCEDURE [dbo].[run_tabular_process]\n @tabular... | sql | chosen |
[
{
"from": "human",
"value": "Add Create JOIN query between multiple tables dynamically script\n\nhttps://stackoverflow.com/a/34434292/2298061 thanks to Shnugo\n"
},
{
"from": "gpt",
"value": "/*\n<documentation>\n <author>Konstantin Taranov</author>\n <summary>Create JOIN query between multipl... | sql | chosen |
[
{
"from": "human",
"value": "Drop the GIN index on @graph,data and add a template for database migrations.\n"
},
{
"from": "gpt",
"value": "BEGIN;\n\nDO $$DECLARE\n -- THESE MUST BE CHANGED WHEN YOU COPY THE SCRIPT!\n \n -- The version you expect the database to have _before_ the migration... | sql | chosen |
[
{
"from": "human",
"value": "Add selectors in search questions table.\n"
},
{
"from": "gpt",
"value": "ALTER TABLE search_question ADD selectors VARCHAR(400) AFTER profile_id;\n\nUPDATE search_question SET selectors = 'cnae,bra' WHERE id = '1';\nUPDATE search_question SET selectors = 'cnae,bra' ... | sql | chosen |
[
{
"from": "human",
"value": "Create script to copy SQ grid in NEP2035"
},
{
"from": "gpt",
"value": "/*\nCopy SQ grid to NEP2035 scenario\n\n__copyright__ \t= \"Flensburg University of Applied Sciences, Centre for Sustainable Energy Systems\"\n__license__ \t= \"GNU Affero General Public License ... | sql | chosen |
[
{
"from": "human",
"value": "Improve full-text index to search items\n"
},
{
"from": "gpt",
"value": "/* Improve full-text index to search items */\n\nALTER TABLE item_detail_search\nDROP INDEX ids_all,\nADD FULLTEXT INDEX ids_all(isbn13, title, author, description, classification)\n;\n"
}
] | sql | chosen |
[
{
"from": "human",
"value": "Add some dummy data to allow access to the application. The username/password has been taken from the RBC1B database."
},
{
"from": "gpt",
"value": "-- Create dummy data to access the ROMS database\nuse ROMS;\n\ninsert into Person(Forename, Surname, Comments)\nvalues... | sql | chosen |
[
{
"from": "human",
"value": "Add sql for database creation."
},
{
"from": "gpt",
"value": "-- MySQL Workbench Forward Engineering\r\n\r\nSET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;\r\nSET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;\r\nSET @OLD_SQL_MODE=@@SQL_... | sql | chosen |
[
{
"from": "human",
"value": "[COLAB-2852] Add indexes to tracking db\n"
},
{
"from": "gpt",
"value": "CREATE INDEX xcolab_TrackedVisit_createDate_index ON xcolab_TrackedVisit (createDate DESC);\nCREATE INDEX xcolab_TrackedVisitor2User_createDate_index ON xcolab_TrackedVisitor2User (createDate DE... | sql | chosen |
[
{
"from": "human",
"value": "Add DB-migration for removing useless column.\n"
},
{
"from": "gpt",
"value": "BEGIN;\n\nDO $$DECLARE\n -- THESE MUST BE CHANGED WHEN YOU COPY THE SCRIPT!\n \n -- The version you expect the database to have _before_ the migration\n old_version numeric := 4;\n... | sql | chosen |
[
{
"from": "human",
"value": "Fix ohjauksenala -1 value loading\n"
},
{
"from": "gpt",
"value": "ALTER PROCEDURE dw.p_lataa_d_ohjauksenala AS\n\nif not exists (select * from dw.d_ohjauksenala where id=-1) begin\n set identity_insert dw.d_ohjauksenala on;\n insert into dw.d_ohjauksenala (\n i... | sql | chosen |
[
{
"from": "human",
"value": "Add patch for user_talk_attend table.\n"
},
{
"from": "gpt",
"value": "--\n-- Table structure for table `user_talk_attend`\n--\n\nDROP TABLE IF EXISTS `user_talk_attend`;\nCREATE TABLE `user_talk_attend` (\n `uid` int(11) NOT NULL,\n `tid` int(11) NOT NULL,\n `ID`... | sql | chosen |
[
{
"from": "human",
"value": "Set CreatedAt column default to 'now()'\n"
},
{
"from": "gpt",
"value": "\n-- +goose Up\nALTER TABLE School\n ALTER COLUMN CreatedAt SET DEFAULT 'now()';\n\nALTER TABLE Application\n ALTER COLUMN CreatedAt SET DEFAULT 'now()';\n\nALTER TABLE Users\n ALTER COLUMN C... | sql | chosen |
[
{
"from": "human",
"value": "Add an SQL file to create a super administrator\n"
},
{
"from": "gpt",
"value": "\nINSERT INTO `users` (`users_user_id`, `name`, `email`, `enabled`, `send_email`, `users_role_id`, `last_visited_on`, `created_by`, `created_on`, `modified_by`, `modified_on`, `locked_by... | sql | chosen |
[
{
"from": "human",
"value": "Make use of language support for pxweb\n"
},
{
"from": "gpt",
"value": "UPDATE oskari_statistical_datasource SET config='{\n\t\"url\": \"https://pxnet2.stat.fi/pxweb/api/v1/{language}/Kuntien_avainluvut/2018/kuntien_avainluvut_2018_aikasarja.px\",\n\t\"info\": {\n\t\... | sql | chosen |
[
{
"from": "human",
"value": "engine: Fix the description of two weight PolicyUnits\n\nThe description of Power Saving Weight policy unit and\nEven Distribution Weight policy unit was wrong.\n\nChange-Id: I2cbf1b4e1b959637293f45a4d19417f27c937bae\nBug-Url: https://bugzilla.redhat.com/1098591\nSigned-off-by: ... | sql | chosen |
[
{
"from": "human",
"value": "[COLAB-2733] Add mixed content migration script\n"
},
{
"from": "gpt",
"value": "update xcolab_ContentArticleVersion set content = replace(content,'http://climatecolab.org','https://www.climatecolab.org');\nupdate xcolab_ContentArticleVersion set content = replace(co... | sql | chosen |
[
{
"from": "human",
"value": "Add database setup file (sql)\n"
},
{
"from": "gpt",
"value": "CREATE TABLE users (\n id serial primary key,\n username varchar(32) NOT NULL,\n password varchar(32) NOT NULL,\n auth_token varchar(255),\n veri_token varchar(255),\n created_at timesta... | sql | chosen |
[
{
"from": "human",
"value": "Add original `ContentInfo` table schema\n"
},
{
"from": "gpt",
"value": "CREATE TABLE IF NOT EXISTS ContentInfo (\n PartititonKey text NOT NULL,\n RowKey text NOT NULL,\n \"Timestamp\" datetime NOT NULL,\n AbuseLevel integer NOT NULL,\n AttributionLink text,\n ... | sql | chosen |
[
{
"from": "human",
"value": "Add log and sef tables\n"
},
{
"from": "gpt",
"value": "/*\nMySQL Data Transfer\nSource Host: localhost\nSource Database: vzlom\nTarget Host: localhost\nTarget Database: vzlom\nDate: 26.01.2012 1:49:40\n*/\n\nSET FOREIGN_KEY_CHECKS=0;\n-- ----------------------------... | sql | chosen |
[
{
"from": "human",
"value": "Add SQL to generate xml\n"
},
{
"from": "gpt",
"value": "/*\n\tgenerate-table-xml.sql will document the Tables, Columns and Foreign keys from a database as an Xmldocument.\n*/\n\nselect \n\ttableXml\nfrom \n\t(\n\t\tselect \n\t\t\t'<Tables>' as [tableXml],\n\t\t\t'0.... | sql | chosen |
[
{
"from": "human",
"value": "Make the timestamps in server_keys_json bigints\n"
},
{
"from": "gpt",
"value": "/* Copyright 2015 OpenMarket Ltd\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You ma... | sql | chosen |
[
{
"from": "human",
"value": "Remove foreign keys in Postgres\n"
},
{
"from": "gpt",
"value": "ALTER TABLE ONLY accessgrants\n DROP CONSTRAINT accessgrants_groupid_fkey;\nALTER TABLE ONLY accessgrants\n DROP CONSTRAINT accessgrants_secretid_fkey;\nALTER TABLE ONLY memberships\n DROP CONS... | sql | chosen |
[
{
"from": "human",
"value": "Create a summary table of the extents of the hocr areas\n"
},
{
"from": "gpt",
"value": "/*\nWe're going to introduce some data quality here that needs to be\ncarried through when using this table:\n- text with less than 2 characters is skipped\n- images with x or y ... | sql | chosen |
[
{
"from": "human",
"value": "Add SQL_ASCII encoding test case\n"
},
{
"from": "gpt",
"value": "drop table computer_terms;\ncreate table computer_terms(term text, category text, comments char(16));\ncreate index computer_terms_index1 on computer_terms using btree(term);\ncreate index computer_ter... | sql | chosen |
[
{
"from": "human",
"value": "Add the ship changes script for current round.\n"
},
{
"from": "gpt",
"value": "UPDATE smr_new.ship_type SET cost = 12026598 WHERE ship_type_id = 21; -- Federal Warrant to 12,026,598 credits\nUPDATE smr_new.ship_type SET cost = 23675738 WHERE ship_type_id = 22; -- Fe... | sql | chosen |
[
{
"from": "human",
"value": "Add the SQL for the hello world example\n"
},
{
"from": "gpt",
"value": "CREATE TABLE HELLOWORLD (\n HELLO VARCHAR(15),\n WORLD VARCHAR(15),\n DIALECT VARCHAR(15) NOT NULL,\n PRIMARY KEY (DIALECT)\n);\nPARTITION TABLE HELLOWORLD ON COLUMN DIALECT;\n\nCREATE P... | sql | chosen |
[
{
"from": "human",
"value": "Add ITN roads view (roadlink with roadname and road.fid)\n"
},
{
"from": "gpt",
"value": "-- Lookup between road and roadlink on fid\nCREATE OR REPLACE VIEW osmm_itn.road_roadlink AS\nSELECT road_fid,\n replace(roadlink_fid, '#', '') AS roadlink_fid\nFROM\n (S... | sql | chosen |
[
{
"from": "human",
"value": "Add sql function for dropping all schema objects\n"
},
{
"from": "gpt",
"value": "set define off\n\ncreate or replace FUNCTION \"DROP_ALL_SCHEMA_OBJECTS\" RETURN NUMBER AS\nPRAGMA AUTONOMOUS_TRANSACTION;\ncursor c_get_objects is\n select object_type,'\"'||o... | sql | chosen |
[
{
"from": "human",
"value": "Add flightsystem connection creation script\n"
},
{
"from": "gpt",
"value": "CREATE USER flightsystem IDENTIFIED BY flightsystempass;\nGRANT CONNECT, RESOURCE, CREATE CLUSTER, QUERY REWRITE, CREATE PROCEDURE, CREATE SEQUENCE, CREATE SESSION, CREATE SYNONYM, CREATE TA... | sql | chosen |
[
{
"from": "human",
"value": "Create an index on FY in budgethistory table\n\nCreate an index on FY in budget history table to help with performance\n"
},
{
"from": "gpt",
"value": "-- Index: public.\"idx_budgethistory_FY\"\n\n-- DROP INDEX public.\"idx_budgethistory_FY\";\n\nCREATE INDEX \"idx_b... | sql | chosen |
[
{
"from": "human",
"value": "Add cascade to approvals for addon_id\n"
},
{
"from": "gpt",
"value": "SET FOREIGN_KEY_CHECKS=0;\nALTER TABLE `approvals`\n DROP FOREIGN KEY `approvals_ibfk_3`;\n\nALTER TABLE `approvals` ADD CONSTRAINT `approvals_ibfk_3`\n FOREIGN KEY `approvals_ibfk_3` (`addo... | sql | chosen |
[
{
"from": "human",
"value": "Add SQL file for adding year prefix to old cases\n"
},
{
"from": "gpt",
"value": "# See how many case numbers of what length there are\nselect count(*), o.name, LENGTH(case_number) c\nfrom \"case\" join meeting m on \"case\".meeting_id=m.id\njoin organization o on m.... | sql | chosen |
[
{
"from": "human",
"value": "Remove old files upload API, filter files by owner.\n\nSigned-off-by: Elliot Murphy <014ce8fab4ab9f8a957bfe9f974379093994de97@users.noreply.github.com>\n"
},
{
"from": "gpt",
"value": "-- remove put support from files view, only allow reading owned files\n\nCREATE OR... | sql | chosen |
[
{
"from": "human",
"value": "Add arcsde-sql dir and postgres xy file\n\nAdd arcsde-sql dir and postgres xy file\n"
},
{
"from": "gpt",
"value": "--PostGIS (ppg_geometry)\n-- http://www.postgis.org/docs/ST_GeomFromText.html\nDO \n$$DECLARE \n\tpt_curse CURSOR FOR SELECT x_coord, y_coord FROM sde... | sql | chosen |
[
{
"from": "human",
"value": "Add sql script to convert the DB model from MM1 to MM2\n"
},
{
"from": "gpt",
"value": "-- SQL Script to update the DB schema from MirrorManager1 to MirrorManager2\n\n-- Drop tables that we no longer use\nDROP TABLE \"group_permission\";\nDROP TABLE \"permission\";\n... | sql | chosen |
[
{
"from": "system",
"value": "Use COALESCE instead of IFNULL\n"
},
{
"from": "human",
"value": "CREATE OR REPLACE VIEW ISSUE_OUTLINE_VIEW AS\n SELECT\n A.USER_NAME,\n A.REPOSITORY_NAME,\n A.ISSUE_ID,\n IFNULL(B.COMMENT_COUNT, 0) + IFNULL(C.COMMENT_COUNT, 0) AS COMMENT_COUNT\n FROM ISSUE ... | sql | chosen |
[
{
"from": "human",
"value": "taskBoard: Add a migration script for its removal.\n"
},
{
"from": "gpt",
"value": "# --- !Ups\n\nDROP TABLE IF EXISTS task_board;\nDROP TABLE IF EXISTS task_comment;\nDROP TABLE IF EXISTS card;\nDROP TABLE IF EXISTS card_assignee;\nDROP TABLE IF EXISTS card_label;\n... | sql | chosen |
[
{
"from": "human",
"value": "Add SQL file with current db schema\n"
},
{
"from": "gpt",
"value": "CREATE TABLE Article (\n pmcId TEXT PRIMARY KEY NOT NULL,\n tittle TEXT\n);\n\nCREATE TABLE TraitTable (\n tableId TEXT PRIMARY KEY NOT NULL,\n numOfCol INTEGER NOT NULL,\n numOfRows INTE... | sql | chosen |
[
{
"from": "human",
"value": "Fix locales for 2 broken region sets\n"
},
{
"from": "gpt",
"value": "\nUPDATE oskari_maplayer\nSET locale = '{\"fi\": {\"name\": \"Pääkaupunkiseudun pienaluejako\"},\"en\": {\"name\": \"Helsinki Region Small Areas\"}, \"sv\": {\"name\": \"Helsingforsregionens småomr... | sql | chosen |
[
{
"from": "human",
"value": "Add migration for the disallow-thunderbird-and-seamonkey waffle switch\n"
},
{
"from": "gpt",
"value": "INSERT INTO waffle_switch (name, active, note, created, modified)\nVALUES ('disallow-thunderbird-and-seamonkey', 0, 'Reject submissions for add-ons that are not co... | sql | chosen |
[
{
"from": "human",
"value": "Test script for Niels' newly introduced code + bugs\n"
},
{
"from": "gpt",
"value": "SET auto_commit=true;\n\n-- the following statements should all fail\nROLLBACK;\n\nCOMMIT;\n\nSAVEPOINT failingsavepoint;\n\n-- this one is incorrect since the savepoint should not e... | sql | chosen |
[
{
"from": "human",
"value": "Add url column to source table\n"
},
{
"from": "gpt",
"value": "# add url column to source table\nALTER TABLE `source` ADD `url` varchar(255) NULL DEFAULT NULL AFTER `description`;\n\n\n# patch identifier\nINSERT INTO meta (species_id, meta_key, meta_value) VALUES (... | sql | chosen |
[
{
"from": "human",
"value": "Remove regulatory build entries from feature_set table, relink everything else.\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... | sql | chosen |
[
{
"from": "human",
"value": "Add text search configuration script.\n"
},
{
"from": "gpt",
"value": "CREATE TEXT SEARCH DICTIONARY ispell_ru (\n template = ispell,\n dictfile = ru,\n afffile = ru,\n stopwords = russian\n);\n\nCREATE TEXT SEARCH DICTIONARY ispell_en (\n template... | sql | chosen |
[
{
"from": "human",
"value": "Add sorting to time variable for TK datasource\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\... | sql | chosen |
[
{
"from": "human",
"value": "backend: Add template columns to vm_static\n\nAdd columns from templae table to vm_static table, in order to merge the\ntwo tables and get rid of the redundant template and sattelite tables.\n\nChange-Id: I7dea426c1275bd377b71b42931aa7985bad4d8b7\n"
},
{
"from": "gpt",
... | sql | chosen |
[
{
"from": "human",
"value": "Move 0.x crate schema sql to separate file\n"
},
{
"from": "gpt",
"value": "select \n 'Tables' as table_type,\n 'YES' as is_nullable, \n tables.schema_name as table_schema, \n tables.table_name as table_name, \n column_name, \n data_type \nfrom \n ... | sql | chosen |
[
{
"from": "human",
"value": "Migrate segments_union to plpgsql implementation\n"
},
{
"from": "gpt",
"value": "-- Implement segments_union(segment[], segment) in plpgsql. Remove the unused\n-- segments_union(segment[], segment[]).\n\n-- Fare thee well\ndrop function if exists segments_union(segm... | sql | chosen |
[
{
"from": "human",
"value": "ELMIS-911: Add database column for product category by program\n- Add a configuration setting to override category\n- add migration script to apply the currently selected category on the new pp column\n"
},
{
"from": "gpt",
"value": "-- create the new column for the ... | sql | chosen |
[
{
"from": "human",
"value": "8197: Add assertions about answer data\n"
},
{
"from": "gpt",
"value": "-- Exactly one root AnswerGroup per response_id\n-- Below should return no rows.\nselect response_id, count(*)\n from answers\n where parent_id is null and deleted_at is null\n group by respon... | sql | chosen |
[
{
"from": "system",
"value": "Update GPO OpenGENI to new hostname\n"
},
{
"from": "human",
"value": "-- -----------------------------------------------------------------\n-- Create the entry for BBN GRAM Starter Rack:\n--\n-- Execute as:\n--\n-- psql -U portal -h localhost -f add-gram-bbncam.... | sql | chosen |
[
{
"from": "human",
"value": "Synchronize schema changes for activity\n\nNon-critical\n"
},
{
"from": "gpt",
"value": "# --- !Ups\n\nCREATE INDEX \"authorize_activity_idx\" ON audit.\"authorize\" (\"audit_time\" DESC) WHERE \"audit_action\" IN ('add', 'change') AND \"site\" > 'NONE';\nCREATE INDE... | sql | chosen |
[
{
"from": "human",
"value": "Add migration for user data table\n"
},
{
"from": "gpt",
"value": "BEGIN;\n\nDO $$DECLARE\n -- THESE MUST BE CHANGED WHEN YOU COPY THE SCRIPT!\n\n -- The version you expect the database to have _before_ the migration\n old_version numeric := 19;\n -- The vers... | sql | chosen |
[
{
"from": "human",
"value": "Clean up the charset and engine on wiki_helpfulvote.\n"
},
{
"from": "gpt",
"value": "-- Fix the charset and engine of wiki_helpfulvote.\n\nALTER TABLE `wiki_helpfulvote`\n DROP INDEX `wiki_helpfulvote_2291b592`;\n\nALTER TABLE `wiki_helpfulvote`\n MODIFY COLUM... | sql | chosen |
[
{
"from": "human",
"value": "Remove deprecated columns for user indicator\n"
},
{
"from": "gpt",
"value": "-- These have been moved to oskari_user_indicator_data (category is no longer needed)\nALTER TABLE oskari_user_indicator DROP COLUMN year;\nALTER TABLE oskari_user_indicator DROP COLUMN dat... | sql | chosen |
[
{
"from": "human",
"value": "Add SQL for getting recent messages.\n"
},
{
"from": "gpt",
"value": "SELECT handle.id, message.text \n\tFROM message INNER JOIN handle \n\t\tON message.handle_id = handle.ROWID \n\tWHERE is_from_me=0 AND \n\tdatetime(message.date/1000000000 + strftime(\"%s\", \"2001... | sql | chosen |
[
{
"from": "human",
"value": "Delete all previously made agent jobs. Plans change...\n"
},
{
"from": "gpt",
"value": "USE msdb\n\n-- DELETE ALL PREVIOUSLY MADE AGENT JOBS. PLANS CHANGE...\nEXEC msdb.dbo.sp_delete_job @job_name=N'Tabular process AMK Talous', @delete_unused_schedule=1\nEXEC msdb.db... | sql | chosen |
[
{
"from": "human",
"value": "Add Sql DB File (Without Data)\n"
},
{
"from": "gpt",
"value": "-- ---------------------------------------------\n-- ------------- TestME Empty DB ---------------\n-- ---------------------------------------------\n\nCREATE TABLE IF NOT EXISTS `questions` (\n `id` in... | sql | chosen |
[
{
"from": "human",
"value": "Store precedure for insert data into bioassay_data_data_category\n\n\nSVN-Revision: 10184\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_D... | sql | chosen |
[
{
"from": "human",
"value": "Patch to add multi-species support\n"
},
{
"from": "gpt",
"value": "# Add coord_system_id column into the seq_region table\nALTER TABLE seq_region ADD COLUMN coord_system_id INT(10) UNSIGNED NOT NULL;\nALTER TABLE seq_region ADD KEY cs_idx (coord_system_id);\n# Updat... | sql | chosen |
[
{
"from": "human",
"value": "Add sql to create tables\n"
},
{
"from": "gpt",
"value": "-- Create syntax for TABLE 'article_tags'\nCREATE TABLE `article_tags` (\n `id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n `article_id` int(11) unsigned NOT NULL,\n `tag_id` int(11) unsigned NOT NULL,\n P... | sql | chosen |
[
{
"from": "human",
"value": "Add view for koulutusluokitus to API schema.\n"
},
{
"from": "gpt",
"value": "IF NOT EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'api.koulutusluokitus'))\nEXEC dbo.sp_executesql @statement = N'create view api.koulutusluokitus as select 1 as a'\nGO\n\... | sql | chosen |
[
{
"from": "human",
"value": "Add SQL script for associating people with orgs\n"
},
{
"from": "gpt",
"value": "/* \n*\n* A script that automatically generates org names from email\n* addresses, moves those orgs to their own table, and associates people\n* with orgs, instead of their \"upeople\" i... | sql | chosen |
[
{
"from": "human",
"value": "Add more recently appeared 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_julkaisut'\n and COLUMN_NAME='konferenssinNimi'\n) BEGIN\nALTER TABLE sa.sa_virta... | sql | chosen |
[
{
"from": "human",
"value": "Add database patch for Open Humans token\n"
},
{
"from": "gpt",
"value": "/*\n10 December 2014\n---------------\nAdds a column for the Open Humans access token to the ag_kit table.\n*/\nALTER TABLE ag.ag_kit ADD COLUMN open_humans_token varchar(64);\n\nCOMMENT ON COL... | sql | chosen |
[
{
"from": "human",
"value": "Add SQL script to get the size of all tables in a database\n\n"
},
{
"from": "gpt",
"value": "SELECT table_name AS \"Table Name\",\nROUND(((data_length + index_length) / 1024 / 1024), 2) AS \"Size in (MB)\"\nFROM information_schema.TABLES\nWHERE table_schema = \"ENTE... | sql | chosen |
[
{
"from": "human",
"value": "SELECT from dataversefacet showing displayorder per dataverse\n"
},
{
"from": "gpt",
"value": "select dataversefacet.id,title,name,datasetfield.id,dataversefacet.displayorder,dataverse_id from dataversefacet, datasetfield where dataversefacet.datasetfield_id = datase... | sql | chosen |
[
{
"from": "human",
"value": "Add DB Revision 12: Include Roaming Flag and Equipment Description\n"
},
{
"from": "gpt",
"value": "BEGIN;\n\nALTER TABLE subscribers RENAME TO sub;\ncreate table subscribers (\n id serial primary key,\n msisdn varchar,\n na... | sql | chosen |
[
{
"from": "human",
"value": "Add field for the last story found.\n\n\n"
},
{
"from": "gpt",
"value": "\n-- Add column to allow more active feeds to be downloaded more frequently.\nALTER TABLE feeds ADD COLUMN last_new_story_time timestamp without time zone;\nUPDATE feeds SET last_new_story_time ... | sql | chosen |
[
{
"from": "human",
"value": "Add tag-merging step for lines and stations\n"
},
{
"from": "gpt",
"value": "-- assign tags to stations missing them\nbegin;\ndrop table if exists osm_tags;\ncreate table osm_tags (\n osm_id varchar(64),\n tags hstore,\n primary key (osm_id)\n);\ncreate ta... | sql | chosen |
[
{
"from": "human",
"value": "Add script used to fill database\n"
},
{
"from": "gpt",
"value": "-- --------------------------------------------------------------\n-- fill_quizz.sql\n-- Used to fill 'question' table\n-- Use the following form for your insert clauses:\n-- INSERT question (q_quest, ... | sql | chosen |
[
{
"from": "human",
"value": "Add Database script for regimen summary report\n"
},
{
"from": "gpt",
"value": "\nDROP VIEW IF EXISTS vw_regimen_summary;\n\nCREATE OR REPLACE VIEW vw_regimen_summary AS\n SELECT DISTINCT r.programid, ps.id AS scheduleid, pp.id AS periodid, rg.id AS rgroupid, li.reg... | sql | chosen |
[
{
"from": "human",
"value": "Update KHR url to prod\n"
},
{
"from": "gpt",
"value": "-- update layer name\nUPDATE oskari_statistical_datasource set config='{\n \"url\" : \"https://khr.maanmittauslaitos.fi/tilastopalvelu/rest\",\n \"info\" : {\n \"url\" : \"https://khr.maanmittauslaitos.fi/\... | sql | chosen |
[
{
"from": "human",
"value": "Add DB patch to add cache columns for event talk/comment/tracks.\n"
},
{
"from": "gpt",
"value": "-- Add cache count columns for talks and tracks\n\nINSERT INTO patch_history SET patch_number = 46;\n\nALTER TABLE events ADD comment_count INT(10) DEFAULT 0, ADD talk_c... | sql | chosen |
[
{
"from": "human",
"value": "Add SQL for database tables.\n"
},
{
"from": "gpt",
"value": "CREATE TABLE IF NOT EXISTS `users` (\n\t`id` int(11) NOT NULL AUTO_INCREMENT,\n\t`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n\t`created_at` timestamp NOT NULL DE... | sql | chosen |
[
{
"from": "human",
"value": "Add SQL to insert a reading or ignore it if any data is already in the database\n"
},
{
"from": "gpt",
"value": "/* This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, Y... | sql | chosen |
[
{
"from": "human",
"value": "Add script to create baseline table\n"
},
{
"from": "gpt",
"value": "/* This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/... | sql | chosen |
[
{
"from": "human",
"value": "Add awesome database report script\n"
},
{
"from": "gpt",
"value": "-- https://stackoverflow.com/a/42508688/2298061\n\nIF OBJECT_ID('tempdb..#AllTables','U') IS NOT NULL DROP TABLE #AllTables;\n\nCREATE TABLE #AllTables(\n DBName SYSNAME\n , TableCou... | sql | chosen |
[
{
"from": "human",
"value": "Patch x which fixes missing autoincrements\n"
},
{
"from": "gpt",
"value": "-- Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute\n-- Copyright [2016-2018] EMBL-European Bioinformatics Institute\n-- Licensed under the... | sql | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.