conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "human", "value": "Add new view on derby\n" }, { "from": "gpt", "value": "SELECT \n obs.ObservationDTG AS ObservationDate,\n obs.Observer,\n obs.ConceptName,\n obs.Notes,\n obs.X AS XPixelInImage,\n obs.Y AS YPixelInImage,\n vf.TapeTimeCode,\n vf.RecordedDtg AS ...
sql
chosen
[ { "from": "human", "value": "Create table d varda toiminnallinenpainotus\n" }, { "from": "gpt", "value": "USE [ANTERO]\nGO\n\n/****** Object: Table [sa].[sa_varda_toiminnallinenpainotus] Script Date: 30.7.2018 13:42:58 ******/\nSET ANSI_NULLS ON\nGO\n\nSET QUOTED_IDENTIFIER ON\nGO\n\nIF NOT ...
sql
chosen
[ { "from": "human", "value": "Reduce index size to avoid error \"1071 (42000) at line 302: Specified key was too long; max key length is 1000 bytes\"\n" }, { "from": "gpt", "value": "/* Reduce index size to avoid error \"1071 (42000) at line 302: Specified key was too long; max key length is 1000...
sql
chosen
[ { "from": "human", "value": "Add upgrade to remove archive table\n" }, { "from": "gpt", "value": "-- In this upgrade I remove the archive table.\n--\n-- It became a mess because to check if I had an item I needed to look for it in\n-- both tables. Likewise for the newest publication date. Probab...
sql
chosen
[ { "from": "human", "value": "Add SQL script for deleting duplicate device data\n" }, { "from": "gpt", "value": "DELETE FROM device_data\nWHERE id IN (\n SELECT id\n FROM (\n SELECT id, row_number() OVER point AS row\n FROM device_data\n WINDOW point AS (PARTITION BY device_id, time)\n...
sql
chosen
[ { "from": "human", "value": "Add SQL to create example table\n" }, { "from": "gpt", "value": "CREATE TABLE `users` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `name` varchar(128) COLLATE utf8_unicode_ci NOT NULL,\n `birthday` date NOT NULL,\n PRIMARY KEY (`id`)\n) ENGINE=InnoDB DEFAULT CHAR...
sql
chosen
[ { "from": "human", "value": "Add script to create extensions installed by provisioning script to the pg_catalog making them available in the default search path\n" }, { "from": "gpt", "value": "CREATE EXTENSION IF NOT EXISTS pg_stat_statements SCHEMA pg_catalog;\n\nCREATE EXTENSION IF NOT EXISTS...
sql
chosen
[ { "from": "human", "value": "Add game duplication SQL script\n" }, { "from": "gpt", "value": "-- Replicates an existing game, duplicating all locations and moving existing codes\n\n-- Game variables\nSET @prev_game = 166;\nSET @next_game = 184;\n\n-- Duplicate clusters\nCREATE TEMPORARY TABLE `t...
sql
chosen
[ { "from": "human", "value": "Document application move of apidoc from gilt to bryzek\n" }, { "from": "gpt", "value": "create or replace function record_move(p_guid in uuid, p_application_key in varchar) returns void as $$\nbegin\n insert into application_moves\n (guid, application_guid, from_o...
sql
chosen
[ { "from": "human", "value": "IFS-3814: Add script to fix priority value for 'other funding' questions\n" }, { "from": "gpt", "value": "-- IFS-3814 Fixing priorities of 'Other funding' question broken by IFS-3088.\n-- 'Other funding' was incorrectly appearing ABOVE the 'Funding level' question on...
sql
chosen
[ { "from": "human", "value": "Add sql script for mysql\n\n\nSigned-off-by: Ivan Mishev <579d60dc4f4decfe5bddcb366c69afd3912785d3@gmail.com>\n" }, { "from": "gpt", "value": "-- --------------------------------------------------------\n-- Host: 127.0.0.1\n-- Server version: ...
sql
chosen
[ { "from": "human", "value": "Add a SQL file that can be used to fix busted PRMIS credentials\n" }, { "from": "gpt", "value": "-- Reset data fields that block automatic creation of PROMIS credentials\n\n-- These values need to be very plain. A URL in the homepage_contact_email field can easily ca...
sql
chosen
[ { "from": "human", "value": "Add migration to fix old personas themes with an empty name\n" }, { "from": "gpt", "value": "-- Find all addon name translations with an empty string, and update them to\n-- have \"Untitled\" instead. The subselect to find the translations is wrapped\n-- in a SELECT ...
sql
chosen
[ { "from": "human", "value": "Remove view definitions with old applications names\n" }, { "from": "gpt", "value": "DELETE FROM public.portti_view WHERE application='published-map'; \nDELETE FROM public.portti_view WHERE application='mapwfs2';\nDELETE FROM public.portti_view WHERE application='ser...
sql
chosen
[ { "from": "human", "value": "Split inserting users out into separate file\n" }, { "from": "gpt", "value": "\n/*Create a default admin user*/\n\nINSERT INTO users (user_ID, username, password, enabled, name, email, role)\nVALUES (1, 'admin', 'd033e22ae348aeb5660fc2140aec35850c4da997', TRUE, 'Adam...
sql
chosen
[ { "from": "human", "value": "Update seutukunta layer to a more sensible version\n" }, { "from": "gpt", "value": "-- update layer name\nUPDATE oskari_maplayer SET name='tilastointialueet:seutukunta4500k' where type = 'statslayer' and name = 'tilastointialueet:seutukunta1000k';\n-- update resource...
sql
chosen
[ { "from": "human", "value": "[FEATURE] Add who dropped database script\n" }, { "from": "gpt", "value": "/*\nAuthor: Jason Brimhall\nOriginal link: http://jasonbrimhall.info/2016/09/09/database-dropped/\n*/\n\nDECLARE @DBName sysname = 'AdventureWorks2014'\n ,@d1 DATETIME\n ,@diff I...
sql
chosen
[ { "from": "human", "value": "Test data for the dbtree\n" }, { "from": "gpt", "value": "-- test data for dbtree\nDELETE FROM dbtree;\nBEGIN;\nINSERT INTO dbtree VALUES( 1000, NULL, '001', NULL, '', 4, 3, NULL, TRUE );\nINSERT INTO dbtree VALUES( 1001, 1000, '001-001', NULL, '', 3, 2, NULL, TRUE )...
sql
chosen
[ { "from": "human", "value": "Remove maprotator bundle from user & default views\n" }, { "from": "gpt", "value": "-- Removes maprotator bundle from all user/default views\n\nDELETE FROM portti_view_bundle_seq s\nUSING portti_view v\nWHERE s.view_id = v.id AND\nv.type IN ('USER', 'DEFAULT') AND\ns...
sql
chosen
[ { "from": "system", "value": "Allow password to be null (to support alternate auth mechanisms like oauth.)\n" }, { "from": "human", "value": "CREATE TABLE `users` (\n `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,\n `email` VARCHAR(100) NOT NULL DEFAULT '',\n `password` VARCHAR(255) NOT NULL ...
sql
chosen
[ { "from": "human", "value": "Add script to setup database.\n" }, { "from": "gpt", "value": "create database stockCollector;\ncreate table stock (id serial not null, ticker varchar(255), account varchar(255),\n username varchar(255), sell numeric(14,2), rate numeric(14,2),\n ...
sql
chosen
[ { "from": "human", "value": "Add Weewx postgres database script.\n" }, { "from": "gpt", "value": "--\n-- PostgreSQL database initialization script\n--\n-- Execute it like this: psql -d <your_database> -f weewx_pg.sql\n--\n\nSET statement_timeout = 0;\nSET client_encoding = 'UTF8';\nSET standard...
sql
chosen
[ { "from": "human", "value": "Fix migration 016 for sqlite.\n\nSqlite doesn't support dropping a column from a table. The\ndowngrade path for migration 016 performed this. So this commit adds the\nsql file to perform the downgrade manually.\n\nChange-Id: I6aae263c3aab03a383c47fd29c46f0cc9b857549\n" }, { ...
sql
chosen
[ { "from": "human", "value": "Create user script for oracle\n\n\nSVN-Revision: 4128\n" }, { "from": "gpt", "value": "insert into catissue_department values(1,'@@first.admin.department@@');\r\ninsert into catissue_institution values(1,'@@first.admin.institution@@');\r\ninsert into catissue_cancer...
sql
chosen
[ { "from": "human", "value": "Add index to regulation tables\n" }, { "from": "gpt", "value": "\n-- Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute\n-- Copyright [2016-2017] EMBL-European Bioinformatics Institute\n-- \n-- Licensed under the Apac...
sql
chosen
[ { "from": "system", "value": "Fix (again) the backup_version drop migration\n" }, { "from": "human", "value": "ALTER TABLE\n `addons`\nDROP FOREIGN KEY\n `addons_ibfk_16`\n;\n\nALTER TABLE\n `addons`\nDROP COLUMN\n `backup_version`\n;\n" }, { "from": "gpt", "value": "# It...
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 trace flag 8602 Demo script\n\nGreat thanks Prince Kumar Rastogi http://www.sqlservergeeks.com/sql-server-trace-flag-8602/" }, { "from": "gpt", "value": "/*\nTrace Flag Demo: 8602\nFunction: This trace flag is used to ignore all the index hints specified in query...
sql
chosen
[ { "from": "human", "value": "Add a SQL file to create the database and add some data.\n" }, { "from": "gpt", "value": "/*\n Author: Adam Austin and Evan Yin\n\n A populate and build for the database for SkateSpots\n*/\n\ndrop table user;\ndrop table spot;\ndrop table tables_info;\ndrop table u...
sql
chosen
[ { "from": "human", "value": "Add table to tmp db. Needed for sorting.\n" }, { "from": "gpt", "value": "CREATE TABLE ancestral_alleles (\n ancestral_allele_id int(11) NOT NULL AUTO_INCREMENT,\n variation_id int(10) unsigned NOT NULL,\n ancestral_allele varchar(255) DEFAULT NULL,\n PRIMARY KEY...
sql
chosen
[ { "from": "human", "value": "Fix problem where matrix records lack a study_id value\n" }, { "from": "gpt", "value": "begin work;\n\n-- check to see how many matrices lack a study_id\nSELECT count(*) FROM matrix WHERE study_id IS NULL;\n\n-- for those matrices that lack a study_id, \n-- update th...
sql
chosen
[ { "from": "human", "value": "Add single SQL file for release procedures\n\nI think it will be easier to run release procedures if instead of 5\nseparate steps that have to be run in order we add a few sql scripts to\nrun. It is possibly too much to have a single script but I will try to\nstart with this app...
sql
chosen
[ { "from": "human", "value": "Add script with DB schema\n" }, { "from": "gpt", "value": "CREATE TABLE IF NOT EXISTS entries\n(\n title TEXT,\n content TEXT\n);\n\nCREATE TABLE IF NOT EXISTS tags\n(\n name TEXT\n);\n\nCREATE TABLE IF NOT EXISTS tags_entries\n(\n tag_id INTEGER,\n en...
sql
chosen
[ { "from": "human", "value": "Change LONGTEXT cache column to BINARY\n\nSee T4898. As it turns out, `latin1` LONGTEXT is not approximately equivalent\nto LONGBLOB.\n" }, { "from": "gpt", "value": "TRUNCATE {$NAMESPACE}_differential.differential_changeset_parse_cache;\n\nALTER TABLE {$NAMESPACE}_d...
sql
chosen
[ { "from": "human", "value": "Add facebook to dojo schema\n" }, { "from": "gpt", "value": "DO $$\n BEGIN\n BEGIN\n ALTER TABLE cd_dojos ADD facebook character varying;\n EXCEPTION WHEN OTHERS THEN\n\n RAISE NOTICE 'The transaction is in an uncommittable stat...
sql
chosen
[ { "from": "human", "value": "core: Add missing login priv to importer_exporter\n\nChange-Id: Ibba4aa0bd138fe831d463f63fb23d275e13c98c7\nBug-Url: https://bugzilla.redhat.com/1108153\nSigned-off-by: Allon Mureinik <abc9ddaceaf0c059a5d9bc2aed71f25cb5370dba@redhat.com>\n" }, { "from": "gpt", "value"...
sql
chosen
[ { "from": "human", "value": "Add voucher number code view\n" }, { "from": "gpt", "value": "DO $$\nBEGIN\nDROP VIEW IF EXISTS vw_vaccine_distribution_voucher_no_fields;\nCREATE OR REPLACE VIEW vw_vaccine_distribution_voucher_no_fields AS\nSELECT\n f.id AS facilityid,\n f.name AS failitynam...
sql
chosen
[ { "from": "human", "value": "core: Fix network name on default cluster\n\nThis patch renames the network name of default cluster from engine to\novirtmgmt, as a part of a previous patch-set, which missed this spot.\n\nChange-Id: If9d9d9f254f02c69f636cd63ea0b78afbc0076bd\n" }, { "from": "gpt", "v...
sql
chosen
[ { "from": "human", "value": "Add configurations for on time column\n" }, { "from": "gpt", "value": "delete from configuration_settings where key = 'DELIVERED_ON_TIME_CONFIG_NUMBER';\n\n\nINSERT INTO configuration_settings(\n key, value, name, description, groupname, displayorder, val...
sql
chosen
[ { "from": "human", "value": "Change country name to follow DMM Eikaiwa\n" }, { "from": "gpt", "value": "-- +goose Up\n-- SQL in section 'Up' is executed when this migration is applied\nBEGIN;\nUPDATE `m_country` SET name_ja='台湾(台湾省/中華民国)' WHERE id = 158;\nUPDATE `m_country` SET name_ja='中華人民共和国'...
sql
chosen
[ { "from": "human", "value": "Add configuration changes for timeliness report\n" }, { "from": "gpt", "value": "DELETE FROM configuration_settings WHERE key = ''DISTRICT_REPORTING_CUT_OFF_DATE'';\nINSERT INTO configuration_settings(key, value, name, description, groupname, valuetype)\nvalues(''DIS...
sql
chosen
[ { "from": "human", "value": "Add the DB upgrade script\n" }, { "from": "gpt", "value": "--\n-- personality_cluster_info\n--\nCREATE SEQUENCE pers_clst_info_seq;\n\nCREATE TABLE personality_cluster_info (\n\tid INTEGER, \n\tpersonality_id INTEGER, \n\tcluster_type VARCHAR(16 CHAR), \n\tcreation_d...
sql
chosen
[ { "from": "human", "value": "core: Insert valid graphics and display devices in HE VM\n\nUpdate imported manged hosted engine VMs with valid video and graphics\ndevices.\n\nChange-Id: I36e7b2acdf692abd1af7ad2a90e27797116498aa\nBug-Url: https://bugzilla.redhat.com/1326810\nBug-Url:https://bugzilla.redhat.com...
sql
chosen
[ { "from": "human", "value": "database: Define admin roles to import/export domains\n\nCreated two new roles: VmImporterExporter and TemplateImporterExporter and\nassigned ActionGroup.IMPORT_EXPORT_VM to these roles.\n\nChange-Id: I61837fdc2fe2eae50b486dad5fbfeeac42c472f0\nBug-Url: https://bugzilla.redhat.co...
sql
chosen
[ { "from": "human", "value": "Add rnr status details for rnr status report\n" }, { "from": "gpt", "value": "\n DROP VIEW IF EXISTS vw_rnr_status_details;\n\nCREATE OR REPLACE VIEW vw_rnr_status_details AS\n SELECT p.name AS programname, r.programid, r.periodid, ps.name AS periodname, rg.id AS r...
sql
chosen
[ { "from": "human", "value": "Add migration to drop unused colums\n\n- the details are stored in the application json field\n" }, { "from": "gpt", "value": "DO $$\n BEGIN\n BEGIN\n ALTER TABLE cd_dojoleads DROP online_sessions;\n EXCEPTION\n WHEN others THEN RAISE NOTIC...
sql
chosen
[ { "from": "human", "value": "Fix bug des sorties impossibles a entrées...\n" }, { "from": "gpt", "value": "/**\n * Author: darnuria\n * Created: Dec 18, 2020\n *\n * Bon c'était pas top top cette contrainte, façon le schema il est pas terrible.\n * Il en faut au moins un parmis les trois vu le ...
sql
chosen
[ { "from": "human", "value": "Create dumps from key X2 tables to better understand data\n" }, { "from": "gpt", "value": "SELECT * FROM student\n INTO OUTFILE \"E:/_BACKUP_MYSQL/CodeForAmerica/student_table.txt\"\n FIELDS TERMINATED BY ','\n ENCLOSED BY '\"'\n LINES TERMINATED BY '\\r\\n'\n\nS...
sql
chosen
[ { "from": "human", "value": "Add a migration to drop unwanted table from cruise 2.3.\n\nThe `preferred` table was introduced as a temp table to convert\n`USERS.NAME` column to a case-insensitive string.\n" }, { "from": "gpt", "value": "--\n-- Copyright 2018 ThoughtWorks, Inc.\n--\n-- Licensed un...
sql
chosen
[ { "from": "human", "value": "Change SA table to match API (at least new 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_latausraportit_virheet'\n and COLUMN_NAME='ilmoitusVuosi'\n) BEG...
sql
chosen
[ { "from": "human", "value": "Correct create table only for postgresql\n\ngit-svn-id: 7f0d99e15c3d719532f2b0716a1f95728c3076a0@137 a8e77078-a1c7-4fa5-b8fc-53c5178a176c\n" }, { "from": "gpt", "value": "CREATE TABLE SC_Forums_Forum \r\n(\r\n\tforumId\t\t\tint\t\tNOT NULL ,\r\n\tforumName\t\tvarchar...
sql
chosen
[ { "from": "system", "value": "Fix path error for load data command\n" }, { "from": "human", "value": "USE log_data;\nLOAD DATA INPATH '/statistics/log_data/apache.log' OVERWRITE INTO TABLE apache_log;\n" }, { "from": "gpt", "value": "USE log_data;\nLOAD DATA INPATH 'statistics/log_da...
sql
chosen
[ { "from": "human", "value": "Fix database column type of numeric_property.base\n" }, { "from": "gpt", "value": "ALTER TABLE numeric_property CHANGE COLUMN base base0 int;\nALTER TABLE numeric_property ADD COLUMN base varchar(5) not null default 'ATTO';\nUPDATE numeric_property set base = \"ATTO\...
sql
chosen
[ { "from": "human", "value": "Add migration script for devices with missing device type\n" }, { "from": "gpt", "value": "---\n-- #%L\n-- DeviceHive Dao RDBMS Implementation\n-- %%\n-- Copyright (C) 2016 DataArt\n-- %%\n-- Licensed under the Apache License, Version 2.0 (the \"License\");\n-- you m...
sql
chosen
[ { "from": "human", "value": "Test tile split line overlap\n\nIf the long segment fully contains the short segment, the short\nsegment may be eliminated.\n" }, { "from": "gpt", "value": "begin;\ndrop table if exists tile_split_lines;\ncreate table tile_split_lines (\n short_id integer,\n lo...
sql
chosen
[ { "from": "human", "value": "Add new table for storing pattern detectionsπ\n" }, { "from": "gpt", "value": "CREATE TABLE aircraftpatterns (\n mode_s_hex TEXT,\n report_location GEOGRAPHY(Point, 4326),\n longitude83 DOUBLE PRECISION,\n latitude83 DOUBLE PRECISION,\n report_epoc...
sql
chosen
[ { "from": "human", "value": "Add schema change file for is_guest flag\n" }, { "from": "gpt", "value": "/* Copyright 2016 OpenMarket Ltd\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtai...
sql
chosen
[ { "from": "human", "value": "Convert recently created tables default charset to utf8mb4\n" }, { "from": "gpt", "value": "ALTER TABLE `editor_subscriptions` COMMENT '';\n\nALTER TABLE `addons_reusedguid` CONVERT TO CHARACTER SET utf8mb4;\nALTER TABLE `addons_users_pending_confirmation` CONVERT TO...
sql
chosen
[ { "from": "human", "value": "Add database schema for new version of bot\n" }, { "from": "gpt", "value": "CREATE TABLE users(\n id INTEGER PRIMARY KEY,\n username TEXT UNIQUE\n);\n\nCREATE TABLE modmails(\n id INTEGER PRIMARY KEY,\n author INTEGER,\n time DATETIME,\n body TEXT,\n subreddit...
sql
chosen
[ { "from": "human", "value": "IFS-4459: Add new document types to new document config records\n" }, { "from": "gpt", "value": "-- IFS-4459 Add new document types to new document config records\n\nINSERT INTO `document_config_file_type`\n(`document_config_id`, `file_type_id`)\nSELECT `id` AS `docu...
sql
chosen
[ { "from": "human", "value": "Add query 5 for dbms problem 4\n" }, { "from": "gpt", "value": "-- Demonstrate how you increase the price of books published by a specific publisher by 10%.\n\nUPDATE Catalog \nSET price = (1.1) * price\nWHERE authorid = ( SELECT authorid\n\t\t\tFROM Author \n\t\t\t...
sql
chosen
[ { "from": "human", "value": "Patch to add variation_set ids to the variation feature table\n" }, { "from": "gpt", "value": "# Add a column for variation_set_ids to variation_feature\nALTER TABLE `variation_feature` ADD `variation_set_id` SET ('1','2','3','4','5','6','7','8','9','10','11','12','1...
sql
chosen
[ { "from": "human", "value": "Add onlineSessions to Dojo Lead\n" }, { "from": "gpt", "value": "DO $$\n BEGIN\n BEGIN\n ALTER TABLE cd_dojoleads ADD COLUMN online_sessions smallint NOT NULL DEFAULT 0;\n EXCEPTION\n WHEN duplicate_column THEN RAISE NOTICE 'col...
sql
chosen
[ { "from": "human", "value": "KCIAC-290: Implement IACUC notification for Lift Hold\n" }, { "from": "gpt", "value": "INSERT INTO NOTIFICATION_TYPE (NOTIFICATION_TYPE_ID, MODULE_CODE, ACTION_CODE, DESCRIPTION, SUBJECT, MESSAGE, PROMPT_USER, SEND_NOTIFICATION, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR...
sql
chosen
[ { "from": "human", "value": "KCCOI-280: Add coiadmin user to KcAdmin group to align it with irbadmin user, i.e. allow that user to manipulate Maintenance Documents.\n" }, { "from": "gpt", "value": "INSERT INTO KRIM_GRP_MBR_T (GRP_MBR_ID,VER_NBR,OBJ_ID,GRP_ID,MBR_ID,MBR_TYP_CD,ACTV_FRM_DT,ACTV_TO...
sql
chosen
[ { "from": "human", "value": "Add missing migration for media urls and foreign key\n" }, { "from": "gpt", "value": "-- Pick biggest size and use its url for the media.url\n-- thanks @dogl! You earned yourself that beer ;)\nUPDATE media m\nJOIN (SELECT m1.id, ms2.url FROM media m1\n JOIN (\n ...
sql
chosen
[ { "from": "human", "value": "KCIAC-312: Create notification for action \"Designated Review Approval\"\n" }, { "from": "gpt", "value": "INSERT INTO NOTIFICATION_TYPE (NOTIFICATION_TYPE_ID, MODULE_CODE, ACTION_CODE, DESCRIPTION, SUBJECT, MESSAGE, PROMPT_USER, SEND_NOTIFICATION, UPDATE_USER, UPDATE...
sql
chosen
[ { "from": "human", "value": "ovirt-engine: Add quota references to entities.\n\nAdd quota ID relation for consumable objects such as:\nvm_static - For indicating the quota id the VM consumes its resources\nwhen running.\nimages - For indicating the quota id the image consume its storage\nresources.\n\nAlso ...
sql
chosen
[ { "from": "human", "value": "Add updated_* columns to organizations table\n" }, { "from": "gpt", "value": "alter table organizations add updated_by_guid uuid;\nalter table organizations add updated_at timestamptz;\nalter table organizations alter column updated_at set default now();\n\nupdate or...
sql
chosen
[ { "from": "human", "value": "Patch for updating schema_version to 87.\n" }, { "from": "gpt", "value": "-- Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute\n-- Copyright [2016] EMBL-European Bioinformatics Institute\n-- \n-- Licensed under the A...
sql
chosen
[ { "from": "human", "value": "Add How long since you ran DBCC CHECKDB script\n" }, { "from": "gpt", "value": "/*\nAuthor: \nOriginal link: https://www.sqlserverscience.com/maintenance/check-dbcc-checkdb/\n*/\n\n\nSET NOCOUNT ON;\n\nDECLARE @MaxDaysWithoutCheckDB int = 1;\n\nIF OBJECT_ID(N'tempdb....
sql
chosen
[ { "from": "human", "value": "Change the unexpired table to use DATE columns to make for faster indicies\n" }, { "from": "gpt", "value": "\n-- +goose Up\n-- SQL in section 'Up' is executed when this migration is applied\n\nALTER TABLE `unexpired_certificate`\n CHANGE COLUMN `notBefore` `notBefor...
sql
chosen
[ { "from": "human", "value": "Add data merging example for CRM + GA dataset with customized queries\n\nPiperOrigin-RevId: 439203375\nChange-Id: Ib5eb0db5973eb5550148dccd040ad2363abe183e\n" }, { "from": "gpt", "value": "-- Copyright 2022 Google LLC\n--\n-- Licensed under the Apache License, Versio...
sql
chosen
[ { "from": "human", "value": "Create table with all the datas\n\nNeeds fixing with distinct provider ids\n" }, { "from": "gpt", "value": "DROP TABLE IF EXISTS ER_waits;\n\n\nCREATE TABLE ER_waits\n(PRIMARY KEY (provider_id))\nSELECT DISTINCT a.provider_id,\n a.hospital_name,\n ...
sql
chosen
[ { "from": "human", "value": "Create command for current mysql table\n" }, { "from": "gpt", "value": "CREATE TABLE `users` (\n `idusers` int(11) NOT NULL AUTO_INCREMENT,\n `email` varchar(254) NOT NULL,\n `first_name` varchar(45) NOT NULL,\n `last_name` varchar(45) NOT NULL,\n `password` var...
sql
chosen
[ { "from": "human", "value": "Add Find Not Used Legacy Tables script\n" }, { "from": "gpt", "value": "use [your db name here];\n \nSELECT qs.query_hash,\n qs.plan_handle,\n cast(null as xml) as query_plan\n INTO #myplans\n FROM sys.dm_exec_query_stats qs\n CROSS APPLY sys.dm_exec_pl...
sql
chosen
[ { "from": "human", "value": "Change Trade-Master to 7 speed, 345 holds.\n\nThis will keep it's trade power roughly the same whilst allowing it more\nmobility.\n" }, { "from": "gpt", "value": "-- Trade-Master to 7 speed, 345 holds.\nUPDATE smr_new.ship_type SET speed = 7 WHERE ship_type_id = 33;\...
sql
chosen
[ { "from": "human", "value": "Add migration for likely test column\n" }, { "from": "gpt", "value": "ALTER TABLE `order` MODIFY `likely_test` tinyint DEFAULT NULL;\n\n-- then this will run on a cron job\nUPDATE `order` O\nJOIN community ON community.id_community = O.id_community\nJOIN restaurant O...
sql
chosen
[ { "from": "human", "value": "Set start time for inactive games predating them\n" }, { "from": "gpt", "value": "-- For games that never had any turns taken, their last action time should be\n-- a reasonable approximation of the game start time.\nUPDATE game AS g\nSET g.start_time = g.last_action_...
sql
chosen
[ { "from": "human", "value": "Save batch details to db\n" }, { "from": "gpt", "value": "CREATE TABLE batch (\n id INTEGER PRIMARY KEY AUTO_INCREMENT\n , batchId VARCHAR(20) NOT NULL\n ,\trobot VARCHAR(20) NOT NULL\n ,\tpcrMachine VARCHAR(20) NOT NULL\n ,\ttemperature DECIMAL(...
sql
chosen
[ { "from": "human", "value": "KCIAC-291: Implement IACUC notification for Table\n" }, { "from": "gpt", "value": "INSERT INTO NOTIFICATION_TYPE (NOTIFICATION_TYPE_ID, MODULE_CODE, ACTION_CODE, DESCRIPTION, SUBJECT, MESSAGE, PROMPT_USER, SEND_NOTIFICATION, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OB...
sql
chosen
[ { "from": "human", "value": "Include an sql file containing data for initial testing\n" }, { "from": "gpt", "value": "INSERT INTO `user` (`id`, `created`, `updated`, `username`, `email`, `password`)\nVALUES\n ('6hKWplv05zVGyCp', NULL, NULL, 'player1', 'matt@basekit.com', NULL);\n\nINSERT INTO...
sql
chosen
[ { "from": "system", "value": "Add timestamps to waffle migration" }, { "from": "human", "value": "INSERT INTO `waffle_switch_mkt` (name, active, note)\n VALUES ('allow-b2g-paid-submission', 0,\n 'Enable this to allow paid apps in the submission process.');\n" }, { "from": "...
sql
chosen
[ { "from": "human", "value": "Add default value to game ID.\n" }, { "from": "gpt", "value": "# Calendar schema\n\n# --- !Ups\n\nalter table game alter column id set DEFAULT nextval('s_game_id'::regclass)\n\n# --- !Downs\n\nalter table game alter column id drop DEFAULT\n" } ]
sql
chosen
[ { "from": "human", "value": "Create database tables for XMLTV.\n\n" }, { "from": "gpt", "value": "CREATE TABLE `channel` (\n `idchannel` int(11) NOT NULL,\n `displayname` varchar(100) NOT NULL,\n `url` varchar(1000) NOT NULL,\n `iconurl` varchar(1000) DEFAULT NULL,\n PRIMARY KEY (`idchannel...
sql
chosen
[ { "from": "human", "value": "Add mysql trigger for autogenerating pickup number.\n\nAlso add 'pickupnumber' column to reserves and old_reserves\n" }, { "from": "gpt", "value": "-- hentenummer --\n\nCREATE TABLE IF NOT EXISTS `pickup_counter` (\n `counter` int(6) NOT NULL auto_increment,\n PRIM...
sql
chosen
[ { "from": "human", "value": "Change the type of the column description in the table study\n" }, { "from": "gpt", "value": "# Change the type of the column description in the table study.\n\nALTER TABLE study CHANGE description description TEXT DEFAULT NULL;\n\n# patch identifier\nINSERT INTO met...
sql
chosen
[ { "from": "human", "value": "Add basic database comparison script\n" }, { "from": "gpt", "value": "ATTACH 'content-production.sqlite3' AS DB1;\nATTACH 'zoomhub.sqlite3' AS DB2;\nSELECT * FROM DB1.content WHERE DB1.content.hashId NOT IN (SELECT DB2.content.hashId FROM DB2.content);\n" } ]
sql
chosen
[ { "from": "human", "value": "Add rollback script for schema V1.3\n" }, { "from": "gpt", "value": "-- revert record slug='archive' in table preferences_metadata to previous schema version 1.2\nbegin;\n\nupdate \"preferences_metadata\"\nset \"schema\" = 'object {\n boolean enabled;\n ...
sql
chosen
[ { "from": "human", "value": "Add indexes for commonly referenced columns\n" }, { "from": "gpt", "value": "\n-- +goose Up\n-- SQL in section 'Up' is executed when this migration is applied\nCREATE INDEX index_locations_on_region ON locations(region);\nCREATE INDEX index_locations_on_country ON lo...
sql
chosen
[ { "from": "human", "value": "Add self reference to ACCOUNTS table.\n" }, { "from": "gpt", "value": "ALTER TABLE \"PUBLIC\".\"ACCOUNTS\"\nADD COLUMN \"PARENT_ID\" BIGINT NULL\n;\nALTER TABLE \"PUBLIC\".\"ACCOUNTS\"\nADD CONSTRAINT FK_ACCOUNTS\nFOREIGN KEY (PARENT_ID)\nREFERENCES \"PUBLIC\".\"ACCO...
sql
chosen
[ { "from": "human", "value": "Add view to export object images\n" }, { "from": "gpt", "value": "CREATE OR REPLACE VIEW ObjectImagesExport AS\nSELECT\n o.ItemType,\n i.Accession_Full_ID,\n CONCAT_WS('/', REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(ImageFilePath, '\\\\', '/'), 'Y:/', '...
sql
chosen
[ { "from": "human", "value": "Add sql statement for importing user data\n" }, { "from": "gpt", "value": "-- custom input data\nINSERT INTO full_webuser_data (project,oauth_id,provider,import_date) VALUES ('{\n \"id\": \"This is a Table ID\",\n \"format\": \"Biological Observation Matrix 2.1...
sql
chosen
[ { "from": "human", "value": "fix(DB/creature): Update Old Blanchy Faction & Add Missing Text for Verna Furlbrow\n\n" }, { "from": "gpt", "value": "INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1613146762649566200');\n\n/* Add missing npc text for Verna Furlbrow npc=238\n Source: https:/...
sql
chosen
[ { "from": "human", "value": "Add change that creates a feed_error download state.\n\n\n" }, { "from": "gpt", "value": "ALTER TABLE downloads DROP CONSTRAINT downloads_feed_id_valid;\nalter table downloads add constraint downloads_feed_id_valid check ((feeds_id is not null) or ( type = ...
sql
chosen
[ { "from": "human", "value": "Add some system_settings to turn various menu options on/off . Add initial osdial_companies table.\n\n" }, { "from": "gpt", "value": "# 02/28/2010\n\nALTER TABLE system_settings ADD enable_lead_allocation ENUM('0','1') default '1';##|##\n ## Option to turn the Le...
sql
chosen
[ { "from": "human", "value": "core: Add login action group to NetworkUser role\n\nFor the sake of consistency with the other predefined roles, the\nNetworkUser is being extended with Login action group (code 1300).\n\nTherefore with this patch users with NetworkUser role only will be\ncapable to login into t...
sql
chosen
[ { "from": "human", "value": "Add pie chart migration routine\n" }, { "from": "gpt", "value": "\n-- Pie charts upgrade\n\n-- Moves 'series' to filter, then 'category' to 'series' and sets 'category' \n-- to null for pie charts\n\n-- Move 'series' to become a 'filter' when 'series' and 'category' ...
sql
chosen
[ { "from": "human", "value": "Add a SQL script for modifying the ID minter DB\n" }, { "from": "gpt", "value": "-- This patch is preliminary work for supporting items in the ID minter.\n--\n-- Because a single MIRO record becomes both a work and an item, we:\n--\n-- * Add an ontologyType field s...
sql
chosen
[ { "from": "human", "value": "Create simple sql script for setting up the database\n" }, { "from": "gpt", "value": "CREATE DATABASE CHat;\nUSE Chat;\nCREATE TABLE messages (\n id INT NOT NULL AUTO_INCREMENT,\n msg_author VARCHAR(20),\n msg_text TEXT,\n msg_timestamp TIMESTAMP,\n PRIMARY KEY ...
sql
chosen