conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Use CDB_ColumnType and CDB_ColumnNames in bash tests\n" }, { "from": "human", "value": "SET SCHEMA 'cartodb';\n\\i scripts-available/CDB_Quota.sql\n\\i scripts-available/CDB_TableMetadata.sql\nSET SCHEMA 'public';" }, { "from": "gpt", "value": "SET SCHEM...
sql
chosen
[ { "from": "system", "value": "Rearrange mappings columns into a more logical order\n" }, { "from": "human", "value": "COPY (\n SELECT\n sites.abbr AS \"Abbreviation\",\n path AS \"Old Path\",\n new_url AS \"Redirect URL\",\n suggested_url AS \"Suggested URL\",\n archive_url AS \"...
sql
chosen
[ { "from": "system", "value": "Update all tables of a SQL database\n" }, { "from": "human", "value": "\"#Update from 1.5 to 1.6 \"\n\nALTER TABLE `projects_issues` ADD `duration` smallint(3) NOT NULL DEFAULT '100' AFTER `created_at`;\nALTER TABLE `projects` ADD `default_assignee` bigint(20) NULL ...
sql
chosen
[ { "from": "system", "value": "Insert aggregate geochron now has the proper defaults.\n" }, { "from": "human", "value": "CREATE OR REPLACE FUNCTION ts.insertaggregatechronology(_aggregatedatasetid integer,\n _agetypeid integer,\n _isdefault boolean,\n _chronologyname character varying,\n _age...
sql
chosen
[ { "from": "system", "value": "Use TEXT rather than VARCHAR\n\nWhile we're changing anyway\n" }, { "from": "human", "value": "/* Copyright 2017 Vector Creations Ltd\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with th...
sql
chosen
[ { "from": "system", "value": "Add PI to user details\n" }, { "from": "human", "value": "SELECT DISTINCT\r\n pc.value AS practice_code,\r\n d.value AS email_address\r\nFROM redcap6170_briccsext.redcap_data d\r\nINNER JOIN redcap6170_briccsext.redcap_data pc\r\n ON pc.project_id = d.pr...
sql
chosen
[ { "from": "system", "value": "migrations: Fix incorrect trigger due to 13 -> 14 migration\n\nThis is not meant to be backported, as the difference in the trigger is\nmostly for optimization purposes\nIn both case, the artist's nb_track and is_present fields won't be\nupdated for Unknown/Various artist.\n" ...
sql
chosen
[ { "from": "system", "value": "Add uuid-ossp extension to first migration.\n" }, { "from": "human", "value": "-- A table that will store the whole transaction log of the database.\nCREATE TABLE IF NOT EXISTS txlog (\n id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),\n created_at timestamptz DEFA...
sql
chosen
[ { "from": "system", "value": "Add missing not null props to user table fields.\n" }, { "from": "human", "value": "CREATE TABLE IF NOT EXISTS users (\n id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),\n created_at timestamptz DEFAULT current_timestamp,\n modified_at timestamptz DEFAULT current_...
sql
chosen
[ { "from": "system", "value": "Fix zoom from scale condition for NULL result\n\nAnd rewrite in cleaner form.\n" }, { "from": "human", "value": "-- Maximum supported zoom level\nCREATE OR REPLACE FUNCTION _CDB_MaxSupportedZoom()\nRETURNS int\nLANGUAGE SQL\nIMMUTABLE\nAS $$\n -- The maximum zoom l...
sql
chosen
[ { "from": "system", "value": "MOTECH-1411: Fix for postgresql V42 migration in MDS\n" }, { "from": "human", "value": "-- add support for java.time API\nINSERT INTO Type VALUES (21, \"mds.field.description.datetime\", \"mds.field.datetime8\", \"datetime\", \"java.time.LocalDateTime\");\nINSERT IN...
sql
chosen
[ { "from": "system", "value": "Increase counter after a succesful DB migration (11 in this case)\n" }, { "from": "human", "value": "BEGIN;\nALTER TABLE subscribers RENAME TO sub;\ncreate table subscribers (\n id serial primary key,\n msisdn varchar,\n na...
sql
chosen
[ { "from": "system", "value": "Update DB script to use upper case table name\n" }, { "from": "human", "value": "DROP TABLE `test`.`person`;\n\nCREATE TABLE `test`.`person` (\n `id` INT NULL AUTO_INCREMENT,\n `title` VARCHAR(45) NOT NULL,\n UNIQUE INDEX `id_UNIQUE` (`id` ASC))\nENGINE = InnoDB\...
sql
chosen
[ { "from": "system", "value": "Add user reference to post and comment\n" }, { "from": "human", "value": "/* ALTER TABLE posts\nADD user_id INT NOT NULL;\n\nALTER TABLE comments\nADD user_id INT NOT NULL;\n\nALTER TABLE posts\nADD FOREIGN KEY (user_id) REFERENCES users(id);\n\nALTER TABLE comments...
sql
chosen
[ { "from": "system", "value": "Fix mysql task service drop script\n" }, { "from": "human", "value": "drop index ACT_IDX_HI_TASK_SCOPE on ACT_RU_TASK;\ndrop index ACT_IDX_HI_TASK_SUB_SCOPE on ACT_RU_TASK;\ndrop index ACT_IDX_HI_TASK_SCOPE_DEF on ACT_RU_TASK;\n\ndrop table if exists ACT_HI_TASKINST...
sql
chosen
[ { "from": "system", "value": "Update db script to change timestamp to unix format(in seconds)\n" }, { "from": "human", "value": "CREATE DATABASE `SMS_Manager` CHARACTER SET utf8 COLLATE utf8_general_ci;\nUSE `SMS_Manager`;\n\n-- Create syntax for TABLE 'message'\nCREATE TABLE `message` (\n `id`...
sql
chosen
[ { "from": "system", "value": "Fix index for msg table.\n" }, { "from": "human", "value": "\nCREATE TABLE mq_server_msgs(\n id SERIAL NOT NULL PRIMARY KEY,\n msg_id VARCHAR(255) NOT NULL UNIQUE,\n priority INT NOT NULL,\n destination VARCHAR(255) NOT NULL,\n timestamp TIMESTAMP WIT...
sql
chosen
[ { "from": "system", "value": "Improve query Voci brevi senza avviso\n" }, { "from": "human", "value": "CONNECT itwiki_p itwiki.labsdb;\nSELECT IF( EXISTS(SELECT * FROM templatelinks WHERE tl_from=page_id AND tl_namespace=10 AND tl_title='S'),\n CONCAT('# [[', page_title, ']] - ', page_le...
sql
chosen
[ { "from": "system", "value": "Remove link that does not work" }, { "from": "human", "value": "-- SQL to show tracking days per device.\n-- A relatively low number of tracking days could indicate that the bird is dead.\n-- https://lifewatch-inbo.cartodb.com/viz/13fd195c-b45d-11e3-b989-0e230854a1c...
sql
chosen
[ { "from": "system", "value": "Update nos textos da view\n\nApenas mudanças nos textos que são exibidos com o objetivo de seguir uma padronização, a view continua a mesma.\n" }, { "from": "human", "value": "/* Todos os códigos das views serão adicionados aqui */\n/**\n * View para selecionar a qu...
sql
chosen
[ { "from": "system", "value": "Update description and hidden values for BuildEnvironments\n" }, { "from": "human", "value": "--\n-- JBoss, Home of Professional Open Source.\n-- Copyright 2014-2020 Red Hat, Inc., and individual contributors\n-- as indicated by the @author tags.\n--\n-- Licensed un...
sql
chosen
[ { "from": "system", "value": "Revert \"column type information for FTS4 literals table\"\n\nThis reverts commit 537bdead12457d739144bde8f122dbf2f4b35c4a.\n" }, { "from": "human", "value": "-- create text index for rdf literals\ncreate index literals_text_index on literals(text);\n\n-- create int...
sql
chosen
[ { "from": "system", "value": "Increase size of web_form_address and web_form_address2 in campaigns, lists, in-groups to 2000 characters.\n\n" }, { "from": "human", "value": "# 04/30/2010\n\nALTER TABLE osdial_hopper MODIFY status enum('READY','QUEUE','INCALL','DONE','HOLD','API') DEFAULT 'READY'...
sql
chosen
[ { "from": "system", "value": "Fix small SQL error in migrate_v4 script\n" }, { "from": "human", "value": "INSERT\n INTO objects (account, id, objectType, published, updated, _json)\n SELECT\n 1, id, objectType, published, updated, _json\n FROM objects_old;\n\nCREATE INDEX...
sql
chosen
[ { "from": "system", "value": "Change dbv revision file to set default status\n" }, { "from": "human", "value": "ALTER TABLE `contest` ADD `visibility` ENUM( 'Visible', 'Hidden' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'Hidden' AFTER `status`;\n\nUPDATE `contest` SET `st...
sql
chosen
[ { "from": "system", "value": "Drop the go annotation publications\n\nWe don't display them anyway.\n" }, { "from": "human", "value": "COPY (\nSELECT\njson_build_object(\n 'rna_id', anno.rna_id,\n 'go_annotations', array_agg(\n json_build_object(\n 'go_term_id', anno.ontology_term_id,\n...
sql
chosen
[ { "from": "system", "value": "Add email and certificate to slice table.\n" }, { "from": "human", "value": "\n-- avoid innocuous NOTICEs about automatic sequence creation\nset client_min_messages='WARNING';\n\n\n-- ----------------------------------------------------------------------\n--\n-- ---...
sql
chosen
[ { "from": "system", "value": "Drop and revert code added for invalid indexes\n" }, { "from": "human", "value": "-- List of invalid indexes\n\n-- Use it to see invalid indexes list\n\n-- This query doesn't need any additional extensions to be installed\n-- (except plpgsql), and doesn't create any...
sql
chosen
[ { "from": "system", "value": "Add roads count for partner leaderboards\n" }, { "from": "human", "value": "CREATE MATERIALIZED VIEW raw_hashtags_users AS\n SELECT *,\n rank() OVER (ORDER BY edits DESC) edits_rank,\n rank() OVER (ORDER BY buildings DESC) buildings_rank,\n rank() OVER (OR...
sql
chosen
[ { "from": "system", "value": "Return user id in has user stored procedure.\n" }, { "from": "human", "value": "IF OBJECT_ID(N'[Membership].[HasUser]', N'P') IS NULL \n\tEXEC('CREATE PROCEDURE [Membership].[HasUser] AS SELECT 1')\nGO\n\nALTER PROCEDURE [Membership].[HasUser]\n(\n\t@Email nvarchar...
sql
chosen
[ { "from": "system", "value": "Playlist: Fix & simplify insert/delete triggers\n\nWhen inserting, we just need to ensure the trigger won't modify the\nnewly inserted row. When deleting, we don't care about the old row since\nit's already gone when the trigger fires.\nWhat we always care about is the position...
sql
chosen
[ { "from": "system", "value": "Comment out the creation and removal of PostgreSQL index, because they require a PostgreSQL vacuum step.\n" }, { "from": "human", "value": "create index idx_activity_user_id on activity (user_id);\ncreate index idx_activity_detail_activity_id on activity_detail (act...
sql
chosen
[ { "from": "system", "value": "Use more appropriate cast to type 'name'\n" }, { "from": "human", "value": "BEGIN;\n\nSELECT plan(2);\n\nSELECT trend_directory.create_view_trend_store(\n 'test-source', 'test-type', '900',\n 'SELECT 1 x, 2 y'\n);\n\nSELECT\n is(x, 1)\nFROM trend.\"test-sou...
sql
chosen
[ { "from": "system", "value": "Support regional geoblocking (Ops), revise copyright header\n" }, { "from": "human", "value": "/*\n\tCopyright 2015 Cisco,\n\t\n\tLicensed under the Apache License, Version 2.0 (the \"License\");\n\tyou may not use this file except in compliance with the License.\n\...
sql
chosen
[ { "from": "system", "value": "Fix typos in migration 1211\n" }, { "from": "human", "value": "UPDATE TABLE `hero_primaryhero` SET `gradient_color`='#008787' WHERE `gradient_color`='#068989';\nUPDATE TABLE `hero_primaryhero` SET `gradient_color`='#C60084' WHERE `gradient_color`='#C60184';\nUPDATE ...
sql
chosen
[ { "from": "system", "value": "[FIX] Add insert_time field on f_cache table\n" }, { "from": "human", "value": "CREATE TABLE IF NOT EXISTS `f_cache` (\n`cache_key` int(11) NOT NULL ,\n`text_value` MEDIUMTEXT NOT NULL ,\nPRIMARY KEY ( `cache_key` )\n) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_b...
sql
chosen
[ { "from": "system", "value": "Convert all existing patch media in the DB to the new patch flag\n" }, { "from": "human", "value": "\n-- custom CSS\nALTER TABLE users ADD COLUMN customcss text NOT NULL DEFAULT '';\n\n-- patch flag\nALTER TABLE releases_rev ADD COLUMN patch BOOLEAN NOT NULL DEFAULT...
sql
chosen
[ { "from": "system", "value": "Patch to store file types along with the files.\n" }, { "from": "human", "value": "-- Copyright [1999-2016] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute\n--\n-- Licensed under the Apache License, Version 2.0 (the \"License\");\n-- y...
sql
chosen
[ { "from": "system", "value": "Drop existing table types if they already exist when creating\n" }, { "from": "human", "value": "/*\n\tSQL Server Generic Table Types\n\t\tMust be run on the database you're targeting before you use the generic table values\n\t\te.g. before parameters.AddWithValue(\...
sql
chosen
[ { "from": "system", "value": "Fix broken syntax by implementing rather than using comments.\n" }, { "from": "human", "value": "# --- !Ups\n\nALTER TABLE document ADD md_ark varchar(255);\nALTER TABLE document ADD d_ark varchar(255);\nALTER TABLE document ADD mets_d_ark varchar(255);\n\n# Likely ...
sql
chosen
[ { "from": "system", "value": "Fix migration 933 removing client_data: some envs have different FK names\n" }, { "from": "human", "value": "ALTER TABLE `reviews` DROP FOREIGN KEY `client_data_id_refs_id_c0e106c0`, DROP KEY `reviews_1446fb9b`, DROP COLUMN `client_data_id`;\nALTER TABLE `stats_cont...
sql
chosen
[ { "from": "system", "value": "Fix clashing function names between jsonb_plperl and jsonb_plperlu\n\nThis prevented them from being installed at the same time.\n\nAuthor: Dagfinn Ilmari Mannsåker <0d3738f0a1e296d69e2ea88ca6186c5669e4516e@ilmari.org>\n" }, { "from": "human", "value": "/* contrib/j...
sql
chosen
[ { "from": "system", "value": "Add COLLATE NOCASE to pages name index\n" }, { "from": "human", "value": "CREATE TABLE IF NOT EXISTS pages(\n id INTEGER PRIMARY KEY,\n name TEXT,\n popularity INTEGER\n);\n\n.mode csv\n.separator \"\\t\"\n.import /dev/stdin pages\n\nCREATE INDEX pages_name_popul...
sql
chosen
[ { "from": "system", "value": "Index also time columns in subjobs.\n" }, { "from": "human", "value": "CREATE TABLE jobs (\n\tid CHAR(80) PRIMARY KEY,\n\tname CHAR(128),\n\tuser CHAR(20),\n\tstatus CHAR(20),\n\tqueue CHAR(80),\n\tsubmit BIGINT,\n\tstart BIGINT,\n\tfinish BIGINT,\n\n\tmemory_second...
sql
chosen
[ { "from": "system", "value": "Modify migration script for HA to remove NON NULL constraints on start_date and target_date\n" }, { "from": "human", "value": "CREATE TABLE invoice_parent_children (\n record_id serial unique,\n id varchar(36) NOT NULL,\n parent_invoice_id varchar(36) NOT N...
sql
chosen
[ { "from": "system", "value": "Fix quote user table name for PG\n" }, { "from": "human", "value": "-- Convert schema '/root/GADS/share/migrations/_source/deploy/2/001-auto.yml' to '/root/GADS/share/migrations/_source/deploy/3/001-auto.yml':;\n\n;\nBEGIN;\n\n;\nALTER TABLE user ADD COLUMN styleshe...
sql
chosen
[ { "from": "system", "value": "Revert \"oops, tested this on the wrong mysql version\"\n\nThis reverts commit e66a040f5c7c7b6013b77463b437f6bf5143bafa.\n\nThis command is only available on mysql 5.7. We use 5.6 for zamboni.\n" }, { "from": "human", "value": "ALTER TABLE waffle_flag_mkt_users\n ...
sql
chosen
[ { "from": "system", "value": "Fix the sqlcoverage merge issue between the union and numeric functions changesets.\n" }, { "from": "human", "value": "-- Run the basic-template against the default tables using two table joins\n\n{@insert_vals = \"_value[id], _value[string], _value[int32], _value[f...
sql
chosen
[ { "from": "system", "value": "Update WOF tables to use primary keys\n" }, { "from": "human", "value": "CREATE TABLE wof_neighbourhood (\n wof_id BIGINT UNIQUE NOT NULL,\n placetype SMALLINT NOT NULL,\n name TEXT NOT NULL,\n hash TEXT NOT NULL,\n n_photos INTEGER,\n area BIGINT,\n label_po...
sql
chosen
[ { "from": "system", "value": "Remove comments of the migrations.\n" }, { "from": "human", "value": "-- ALTER TABLE account_user DROP image, DROP nickname, DROP bio, DROP website; \n\nALTER TABLE account_user ADD COLUMN profile varchar(50);\nALTER TABLE account_user ADD COLUMN institution varchar...
sql
chosen
[ { "from": "system", "value": "Comment out unnecessary SQL scripts\n" }, { "from": "human", "value": "# Display all entries that have the issue\nSELECT * FROM xcolab.members_Member WHERE members_Member.status IS NULL ;\n\n# Display entries without a createDate and the replacement createDate (Dry...
sql
chosen
[ { "from": "system", "value": "Remove TODO that no longer applies\n" }, { "from": "human", "value": "--\n-- Public geocoder API function\n--\n-- These are the only ones with permissions to publicuser role\n-- and should also be the only ones with SECURITY DEFINER\n\nCREATE OR REPLACE FUNCTION cdb...
sql
chosen
[ { "from": "system", "value": "Add region_id to fetch regions and countries from search\n" }, { "from": "human", "value": "SELECT c.id,\n name,\n iso_3 AS iso,\n COALESCE(percentage_pa_land_cover,0) AS percentage_pa_land_cover,\n COALESCE(percentage_pa_marine_cover,0) AS percentage_pa_marine_...
sql
chosen
[ { "from": "system", "value": "Add default image description for images that do not have a caption\n" }, { "from": "human", "value": "CREATE OR REPLACE VIEW ObjectsImagesExport AS\nSELECT\n NULLIF(TRIM(o.ItemType), '') AS ItemType,\n NULLIF(TRIM(i.Accession_Full...
sql
chosen
[ { "from": "system", "value": "Add column provides in accounts user table.\n" }, { "from": "human", "value": "-- ALTER TABLE account_user DROP image, DROP nickname, DROP bio, DROP website; \n\nALTER TABLE account_user ADD COLUMN profile varchar(50);\nALTER TABLE account_user ADD COLUMN institutio...
sql
chosen
[ { "from": "system", "value": "Fix typo on database creation script\n\nIssue #1\n" }, { "from": "human", "value": "CREATE TABLE sessions (\n\tid SERIAL PRIMARY KEY,\n\thost VARCHAR(255) NOT NULL,\n\tport INT NOT NULL,\n\tsession_id VARCHAR(255) NOT NULL,\n\tprotocol VARCHAR(64) NOT NULL,\n\ttitle...
sql
chosen
[ { "from": "system", "value": "Add refs to redshift doc\n" }, { "from": "human", "value": "CREATE OR REPLACE FUNCTION dw.f_sha256 (msg VARCHAR)\n returns varchar\nSTABLE\nAS $$\n import hashlib\n return hashlib.sha256(msg).hexdigest()\n$$ LANGUAGE plpythonu\n;\n\n/* TODO When...
sql
chosen
[ { "from": "system", "value": "Change mssql example data file\n" }, { "from": "human", "value": "/*\nNavicat SQL Server Data Transfer\n\nSource Server : localtest\nSource Server Version : 110000\nSource Host : localhost:1433\nSource Database : test\nSource Schema :...
sql
chosen
[ { "from": "system", "value": "Truncate activity log table before altering it\n" }, { "from": "human", "value": "UPDATE `settings` SET `cmumversion`='3.2.0', `dbversion`='3.2.0' WHERE `id`=1;\nALTER TABLE `groups` ADD `enabled` tinyint(1) NULL DEFAULT '1' AFTER `comment`;\nALTER TABLE `settings` ...
sql
chosen
[ { "from": "system", "value": "Change type to INT8 to fit all relevant timestamps, change column name, and put stamp as sort value for all items\n" }, { "from": "human", "value": "ALTER TABLE movies ADD COLUMN parent_id INT;\nALTER TABLE movies ADD COLUMN episode_sort_value INT;\nUPDATE movies SE...
sql
chosen
[ { "from": "system", "value": "Add index to new tag column in cache_component\n" }, { "from": "human", "value": "#tags: kwc\nALTER TABLE `cache_component` ADD `tag` VARCHAR( 255 ) CHARACTER SET ASCII COLLATE ascii_bin NOT NULL AFTER `value`;\n" }, { "from": "gpt", "value": "#tags: ...
sql
chosen
[ { "from": "system", "value": "Add indexes to series, token and expires columns for quicker select queries.\n" }, { "from": "human", "value": "--\n-- Table structure for table `auth_tokens`\n--\n\nCREATE TABLE `auth_tokens` (\n `id` int(11) NOT NULL,\n `user_id` int(11) NOT NULL,\n `series` va...
sql
chosen
[ { "from": "system", "value": "Use the JSON type for storing JSON\n" }, { "from": "human", "value": "--\n-- run with psql -U postgres -f dbschema.sql\n--\nDROP DATABASE IF EXISTS senecatest;\nCREATE DATABASE senecatest WITH ENCODING='UTF8' CONNECTION LIMIT=-1;\n\n-- DROP ROLE senecatest;\nCREATE ...
sql
chosen
[ { "from": "system", "value": "[db] Upgrade job.query to be medium text\n" }, { "from": "human", "value": "CREATE TABLE jobs (\n id SERIAL,\n query TEXT NOT NULL,\n user VARCHAR(127) NOT NULL,\n uuid VARCHAR(127) NOT NULL,\n queryStats TEXT,\n state ENUM('QUEUED', 'PLANNING', 'STARTING', 'R...
sql
chosen
[ { "from": "system", "value": "Tweak schema so that currentIssueId is nullable\n\nThis was just a business logic bug; current issues aren't required.\n" }, { "from": "human", "value": "RENAME TABLE `journal` TO `oldJournal`;\n\nCREATE TABLE `journal` (\n `journalId` bigint(20) NOT NULL AUTO_INCR...
sql
chosen
[ { "from": "system", "value": "Fix upper case for SQL reserved word.\n" }, { "from": "human", "value": "drop database if exists fizzbuzz_twitterbot;\ncreate database fizzbuzz_twitterbot character set = utf8;\nuse fizzbuzz_twitterbot;\n\ndrop table if exists fizzbuzz;\ncreate table fizzbuzz (\n i...
sql
chosen
[ { "from": "system", "value": "Change all open types from popup to blank for download tag\n" }, { "from": "human", "value": "ALTER TABLE `kwc_basic_downloadtag` CHANGE `open_type` `open_type` ENUM('self','blank') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'self';\nALTER TABLE `kw...
sql
chosen
[ { "from": "system", "value": "Add disabled column to handle\n" }, { "from": "human", "value": "CREATE USER liberator WITH ENCRYPTED PASSWORD 'imessage';\nCREATE DATABASE liberator OWNER liberator;\n\n\\connect liberator\n\nCREATE TABLE contact (\n id SERIAL PRIMARY KEY,\n imessage_id VARCHAR N...
sql
chosen
[ { "from": "system", "value": "Remove DB enum value that does not existing in the referenced table\n" }, { "from": "human", "value": "CREATE TABLE `SENT_MESSAGES` (\n `CHANGE_NUM` BIGINT DEFAULT NULL,\n `TIME_STAMP` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n `OBJEC...
sql
chosen
[ { "from": "system", "value": "Use existing sequence for new DB type ids.\n" }, { "from": "human", "value": "-- Water types\n\ninsert into band_type (band_type_id, band_type_name)\nvalues (50, 'WATER');\n\ninsert into public.band (band_id, sensor_id, band_name, band_type_id,\n ...
sql
chosen
[ { "from": "system", "value": "Make column definition that works on both dbs\n" }, { "from": "human", "value": "/* Copyright 2018 New Vector 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 m...
sql
chosen
[ { "from": "system", "value": "Add radar latitude / longitude to query results" }, { "from": "human", "value": "-- Aggregate bird_migration_altitude_profile data:\n-- - Aggregate on time frame (e.g. 20 min)\n-- - Aggregate on altitude band (e.g. 200-1600m, 1600+ m)\n-- - Average values\n\nWITH ag...
sql
chosen
[ { "from": "system", "value": "Simplify test table creation for S3\n" }, { "from": "human", "value": "CREATE EXTERNAL TABLE presto_test_s3 (\n t_bigint BIGINT,\n t_string STRING\n)\nCOMMENT 'Presto test S3 table'\nROW FORMAT DELIMITED FIELDS TERMINATED BY ','\nSTORED AS TEXTFILE\nLOCATION 's3:/...
sql
chosen
[ { "from": "system", "value": "Remove size specifier for database column\n\nPostgres doesn't support them like this.\n\nWe don't have a bool type in common between postgres and sqlite.\n" }, { "from": "human", "value": "/* Copyright 2015 OpenMarket Ltd\n *\n * Licensed under the Apache License, V...
sql
chosen
[ { "from": "system", "value": "Fix bug in migration to add hitl job status type\n" }, { "from": "human", "value": "-- Add a table for human-in-the-loop jobs\n\nCREATE TYPE public.hitl_job_status AS ENUM (\n 'NOTRUN',\n 'TORUN',\n 'RUNNING',\n 'RAN',\n 'FAILED'\n);\n\nALTER TYPE pub...
sql
chosen
[ { "from": "system", "value": "Fix changelog issues with mysql and existing state\n" }, { "from": "human", "value": "# Create new sms_alerts table\n\nCREATE TABLE sms_alerts\n(\n\tid \t\t\t\t\t\tINTEGER \t\tNOT NULL AUTO_INCREMENT PRIMARY KEY,\n citation_number \t\tVARCHAR(25),\n court_date...
sql
chosen
[ { "from": "system", "value": "Remove unique from email in schema\n" }, { "from": "human", "value": "CREATE TABLE dglusers(\n id SERIAL PRIMARY KEY,\n username TEXT UNIQUE NOT NULL,\n email TEXT UNIQUE NOT NULL,\n env TEXT,\n password TEXT NOT NULL,\n flags INT...
sql
chosen
[ { "from": "system", "value": "Change to use the installed package\n" }, { "from": "human", "value": "CREATE OR REPLACE\nFUNCTION geocode_admin0(search text, tx_id bigint, user_id name)\n RETURNS Geometry AS\n$$\n import logging\n from sys import path\n path.append( '/home/ubuntu/www/cartodb-...
sql
chosen
[ { "from": "system", "value": "Remove database constraint for simplicity.\n\n+ appease Bart.\n" }, { "from": "human", "value": "/**\n * This table stores representations of regions of sky. \n * centre_ra, centre_decl, and xtr_radius should all be in degrees.\n * x,y,z are the cartesian representa...
sql
chosen
[ { "from": "system", "value": "Add newline at end of file.\n" }, { "from": "human", "value": "START TRANSACTION;\nCREATE TABLE bug3512 (a VARCHAR(100) ) ;\n\nINSERT INTO bug3512 (a) VALUES ('9999') ; \nINSERT INTO bug3512 (a) VALUES ('32767') ; \nINSERT INTO bug3512 (a) VALUES ('32768') ; \nINSER...
sql
chosen
[ { "from": "system", "value": "Change comment in patch file.\n" }, { "from": "human", "value": "/* Ensure project short names are unique. */\n\nUPDATE project SET projectShortName = NULL WHERE projectShortName = '';\nALTER TABLE project add unique (projectShortName);\n" }, { "from": "gpt"...
sql
chosen
[ { "from": "system", "value": "OLMIS-5480: Remove constraint that was renamed, rename new constraint to be more descriptive.\n" }, { "from": "human", "value": "ALTER TABLE transfer_properties\n ADD transferType VARCHAR(50);\n\nUPDATE transfer_properties\n SET transferType = 'ORDER';\n\nALTE...
sql
chosen
[ { "from": "system", "value": "Fix the bad sql instruction for MSSQL\n" }, { "from": "human", "value": "ALTER TABLE SC_Classifieds_Classifieds\nADD description\tvarchar(4000)\tNULL,\nADD price\t\tint \t\t\tNULL\n;\n\n" }, { "from": "gpt", "value": "ALTER TABLE SC_Classifieds_Classifie...
sql
chosen
[ { "from": "system", "value": "Remove concurrent from create index.\n\n\n" }, { "from": "human", "value": "CREATE INDEX CONCURRENTLY relative_file_paths_to_verify on downloads( relative_file_path ) where file_status = 'tbd' and relative_file_path <> 'tbd' and relative_file_path <> 'error';\n" }...
sql
chosen
[ { "from": "system", "value": "Add a test user to allow authentication to succeed.\n" }, { "from": "human", "value": "INSERT INTO system_role (`name`,`description`) VALUES ('ROLE_USER','A basic user in the system');" }, { "from": "gpt", "value": "INSERT INTO system_role (`name`,`descr...
sql
chosen
[ { "from": "system", "value": "Remove extra SQL that was separated to another script\n" }, { "from": "human", "value": "IF NOT EXISTS (SELECT * FROM sys.types WHERE is_table_type = 1 AND name ='KI_TransformationNames')\n CREATE TYPE dbo.KI_TransformationNames AS TABLE(\n Transformation...
sql
chosen
[ { "from": "system", "value": "Create index to speed up games loading\n\nFixes #2.\n" }, { "from": "human", "value": "CREATE TABLE divisions (\n id bigint auto_increment,\n name varchar(8));\n\nCREATE TABLE teams (\n id bigint auto_increment,\n division_id bigint,\n name varchar(12...
sql
chosen
[ { "from": "system", "value": "[Appveyor] Create DB user before giving roles.\n" }, { "from": "human", "value": "CREATE DATABASE [activerecord_unittest];\nCREATE DATABASE [activerecord_unittest2];\nGO\nCREATE LOGIN [rails] WITH PASSWORD = '', CHECK_POLICY = OFF, DEFAULT_DATABASE = [activerecord_u...
sql
chosen
[ { "from": "system", "value": "Use SMALLINT to store high scores\n" }, { "from": "human", "value": "-- Store source for movies\nALTER TABLE `movie`\nADD `dateSearch` DATETIME NULL DEFAULT NULL,\nADD `searchCount` TINYINT UNSIGNED NOT NULL,\nADD `identity` TINYINT UNSIGNED NOT NULL,\nADD `quality`...
sql
chosen
[ { "from": "system", "value": "Add implicit grant type to sample client.\n" }, { "from": "human", "value": "INSERT INTO oauth_client_details (\n client_id,\n client_secret,\n scope,\n resource_ids,\n authorized_grant_types,\n authorities\n)\nVALUES (\n 'testClient',\n 'testClientSecret',\...
sql
chosen
[ { "from": "system", "value": "Update store_geometry_trigger to support null geometry\n" }, { "from": "human", "value": "--\n-- resto triggers\n--\n\n-- \n-- On INSERT resto.feature THEN\n--\n-- 1. Split resto.feature._geometry into part\n-- 2. Store parts within resto.geometry_part\n--\n...
sql
chosen
[ { "from": "system", "value": "Remove post deployment to re-add constraint\n" }, { "from": "human", "value": "/*\r\nPost-Deployment Script Template\t\t\t\t\t\t\t\r\n--------------------------------------------------------------------------------------\r\n This file contains SQL statements that w...
sql
chosen
[ { "from": "system", "value": "Update indexes for new search routine\n\n" }, { "from": "human", "value": "CREATE INDEX HPA_IDENT_SEARCH ON IIS.IIS_IDENTIFIER\n(\n PERSON_IDENT_TYPE_CODE,\n PERSON_IDENTIFIER_VALUE,\n FK_PERSON_IDENTIFIER\n) WITH(ONLINE=ON)\n\nCREATE INDEX HPA_IDENT_LOOKUP...
sql
chosen
[ { "from": "system", "value": "Change Support team assignee handling\n" }, { "from": "human", "value": "USE [Footprints]\nGO\nSET ANSI_NULLS ON\nGO\nSET QUOTED_IDENTIFIER ON\nGO\nALTER PROCEDURE [dbo].[cusip_UnhandledTickets]\nAS\nBEGIN\n\n\tSELECT \n\t\tCOUNT(*) AS Tickets \n\tFROM \n\t\tMASTER4...
sql
chosen
[ { "from": "system", "value": "Fix bug in remove organisation\n" }, { "from": "human", "value": "CREATE PROCEDURE [employer_account].[GetEmployerAgreementsToRemove_ByAccountId]\n\t@accountId BIGINT\nAS\nBEGIN\n\n\tSET NOCOUNT ON;\n\n\tSELECT\tISNULL(Signed.Id, Pending.Id) AS Id,\n\t\t\tALE.Name,...
sql
chosen
[ { "from": "system", "value": "inventory: Improve SQL query for vms pinned\n\nThe column dedicated_vm_for_vd from vm_static can contain a single\nhypervisor entry or multiple hypervisors (using delimiter comma).\nBased on that, we are extacting the hypervisors in the WITH statement\nand using it in the INNER...
sql
chosen
[ { "from": "system", "value": "Use 7 digits for IDs\n\nMay have in excess of 1 million tuples!\n" }, { "from": "human", "value": "CREATE TABLE Address (\n ID NUMBER(6) PRIMARY KEY,\n streetAddress VARCHAR2(60) NOT NULL,\n city VARCHAR2(30) NOT NULL,\n\n...
sql
chosen
[ { "from": "system", "value": "Delete dirty db record\nResolve ZSTAC-1334 ZSTACK-5103\n" }, { "from": "human", "value": "ALTER TABLE IdentityZoneVO CHANGE deleted closed varchar(1) DEFAULT NULL;" }, { "from": "gpt", "value": "ALTER TABLE IdentityZoneVO CHANGE deleted closed varchar(1)...
sql
chosen