conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Use actual start date if available.\n" }, { "from": "human", "value": "CREATE PROCEDURE [dbo].[ProcessFullyApprovedCohort]\n @cohortId BIGINT,\n @accountId BIGINT,\n @apprenticeshipEmployerType INT\nAS\nBEGIN\n UPDATE [dbo].[Commitment]\n SET Apprent...
sql
chosen
[ { "from": "system", "value": "Fix the trigger function to record the instruction type.\n" }, { "from": "human", "value": "-- The Postgres trigger function\n\nCREATE OR REPLACE FUNCTION pubsubpull_change_recorder() RETURNS TRIGGER AS $body$\nBEGIN\n IF (TG_OP = 'DELETE') THEN\n INSERT INTO pu...
sql
chosen
[ { "from": "system", "value": "Modify to match new column data for Coursework table\n" }, { "from": "human", "value": "insert into Coursework(title,date_submitted,file,student_user_id,class_id)\nvalues (?,now(),?,?,?);" }, { "from": "gpt", "value": "insert into Coursework(title,date_s...
sql
chosen
[ { "from": "system", "value": "Fix sorting order for food browsing\n" }, { "from": "human", "value": "SELECT code, description, coalesce(fl.local_description, flp.local_description) as local_description\nFROM foods_categories\n INNER JOIN foods_local_lists ON foods_categories.food_code = ...
sql
chosen
[ { "from": "system", "value": "Fix syntax error in migration 1206\n" }, { "from": "human", "value": "ALTER TABLE `previews`\n DROP INDEX `previews_caption_f5d9791a_fk_translations_id` (`caption`),\n DROP INDEX `previews_addon_id_320f2325_fk_addons_id` (`addon_id`);\n" }, { "from": "...
sql
chosen
[ { "from": "system", "value": "Use temp tables for migration.\n\nFixes #2080" }, { "from": "human", "value": "ALTER TABLE ${ohdsiSchema}.sec_permission ADD COLUMN for_role_id INTEGER;\n\nINSERT INTO ${ohdsiSchema}.sec_permission (id, value, for_role_id)\nSELECT nextval('${ohdsiSchema}.sec_permiss...
sql
chosen
[ { "from": "system", "value": "Change database schema for earned badges from TEXT to BLOB\n\nWe are now storing images directly in the database for ease of access and backups.\n" }, { "from": "human", "value": "-- Drop tables in reverse order of creation, otherwise\n-- we may run into foreign key...
sql
chosen
[ { "from": "system", "value": "Fix a bug in a query in txnid-selfcheck test app.\n\nRIDs are stored as negative numbers in the partitioned table. Querying to get\nthe last inserted RIDs should negate the values before taking the MAX.\n" }, { "from": "human", "value": "-- partitioned table\nCREATE...
sql
chosen
[ { "from": "system", "value": "Add compound index to results table\n" }, { "from": "human", "value": "CREATE DATABASE weather;\r\nUSE weather;\r\n\r\nCREATE TABLE `results` (\r\n `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\r\n `latitude` decimal(7,4) NOT NULL,\r\n `longitude` decimal(7,4) N...
sql
chosen
[ { "from": "system", "value": "Use write-ahead logging with SQLite.\n" }, { "from": "human", "value": "CREATE TABLE IF NOT EXISTS artist (id INTEGER PRIMARY KEY, name TEXT NOT NULL, playcount INTEGER, UNIQUE (name));\nCREATE TABLE IF NOT EXISTS venue (id INTEGER PRIMARY KEY, name TEXT NOT NULL, c...
sql
chosen
[ { "from": "system", "value": "Fix bug with null equivalence that led us to lose the first span.\n\nBug: 243667311\nChange-Id: I3c2c294989b54318400ce80b9418b57146b4784c" }, { "from": "human", "value": "--\n-- Copyright 2020 The Android Open Source Project\n--\n-- Licensed under the Apache License...
sql
chosen
[ { "from": "system", "value": "Change date datatype to one without TZ offset information. Dates are stored in UTC.\n\nsvn commit r54386\n" }, { "from": "human", "value": "create table Account (\n\tid int not null identity,\n\n\tinstance int null references Instance(id),\n\tfullnam...
sql
chosen
[ { "from": "system", "value": "Add index on (channel, nick) for faster nick: searches.\n" }, { "from": "human", "value": "DROP TABLE IF EXISTS `irclog`;\nCREATE TABLE `irclog` (\n id INT auto_increment,\n channel VARCHAR(30),\n nick VARCHAR(40),\n opcode VARCHAR(20),\n...
sql
chosen
[ { "from": "system", "value": "Add primary key to removals table\n" }, { "from": "human", "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 INTEG...
sql
chosen
[ { "from": "system", "value": "Fix for hierarchy to get the top level.\n" }, { "from": "human", "value": "CREATE OR REPLACE FUNCTION ti.gettaxonhierarchy(_taxonname character varying)\n RETURNS TABLE(taxonid integer, taxonname character varying, valid boolean, highertaxonid integer)\n LANGUAGE sq...
sql
chosen
[ { "from": "system", "value": "Add extra stop times index\n" }, { "from": "human", "value": "CREATE TABLE stop_times (\n id int NOT NULL IDENTITY(1,1) PRIMARY KEY,\n trip_id nvarchar(100) NOT NULL,\n arrival_time time(0) NOT NULL,\n departure_time time(0) NOT NULL,\n arrival_time_24 bit NOT ...
sql
chosen
[ { "from": "system", "value": "Change ISSUE_COMMENT.ACTION to NOT NULL.\n" }, { "from": "human", "value": "ALTER TABLE ACCOUNT ADD COLUMN IMAGE VARCHAR(100);\n\nALTER TABLE COMMENT ALTER COLUMN ACTION VARCHAR(20);\nUPDATE COMMENT SET ACTION = 'close_comment' WHERE ACTION = 'close';\nUPDATE COMME...
sql
chosen
[ { "from": "system", "value": "Fix MySQL syntax error in maillogs migration.\n\nupdate autoincrement -> auto_increment\r\nadd \";\" after drop table" }, { "from": "human", "value": "\n-- +goose Up\n-- SQL in section 'Up' is executed when this migration is applied\nCREATE TABLE IF NOT EXISTS \"mai...
sql
chosen
[ { "from": "system", "value": "Add new field for LastSuspendedDate to the user table\n" }, { "from": "human", "value": "CREATE TABLE dbo.[User] (\n\t[Id]\t\t\t\t\tvarchar(50)\t\tNOT NULL,\n\t[FirstName]\t\t\t\tnvarchar(50)\tNOT NULL,\n\t[LastName]\t\t\t\tnvarchar(50)\tNOT NULL,\n\t[Email]\t\t\t\t...
sql
chosen
[ { "from": "system", "value": "Raise database-level exception on schema name change.\n" }, { "from": "human", "value": "-- Trigger function that will, at the database level, prevent\n-- anyone changing the boardinghouse_schema.schema value for\n-- a saved schema.\n\nCREATE OR REPLACE FUNCTION rej...
sql
chosen
[ { "from": "system", "value": "Update table role for user" }, { "from": "human", "value": "CREATE DATABASE IF NOT EXISTS `application`\nUSE `application`;\n\nDROP TABLE IF EXISTS `tbl_employee`;\nCREATE TABLE `tbl_employee` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `name` varchar(255) NOT NU...
sql
chosen
[ { "from": "system", "value": "Set meta schema_version to 35 (not CVS keyword replacement version any more)\n" }, { "from": "human", "value": "# There were no schema changes on the core databases between release 34 and 35\n# :-)\n# Just updating the schema_version in the meta table\nUPDATE meta s...
sql
chosen
[ { "from": "system", "value": "Fix logic in new column backfill\n" }, { "from": "human", "value": "BEGIN;\n ALTER TABLE payments_for_open_source ADD COLUMN on_mailing_list bool NOT NULL DEFAULT TRUE;\n UPDATE payments_for_open_source SET on_mailing_list=true WHERE follow_up != 'never';\n ...
sql
chosen
[ { "from": "system", "value": "Add send_last_published_item configuration item to nodes table definition.\n\n--HG--\nextra : convert_revision : svn%3Ae60b0d31-0b1b-0410-851a-a02d0c527677/trunk%40239\n" }, { "from": "human", "value": "create table entities (\n id serial primary key,\n jid te...
sql
chosen
[ { "from": "system", "value": "Update documentation for new chat access scopes" }, { "from": "human", "value": "CREATE TABLE `pb_bot` (\n\t`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,\n\t`name` VARCHAR(64) NOT NULL COMMENT 'i.e. snusbot',\n\t`twitch_access_token` VARCHAR(64) NULL DEFAULT NULL C...
sql
chosen
[ { "from": "system", "value": "Add dpi to the dimension binding\n\n\nsvn commit r39013\n" }, { "from": "human", "value": "create table ImageDimensionBinding (\n\timage integer not null references Image(id) on delete cascade,\n\tdimension integer not null references ImageDimension(id) on delete ca...
sql
chosen
[ { "from": "system", "value": "Set engine to the more appropriate MyISAM for attribute and items tables\n" }, { "from": "human", "value": "\nCREATE TABLE IF NOT EXISTS search_count (id64 BIGINT UNSIGNED NOT NULL, ip VARCHAR(40) NOT NULL);\n\nCREATE TABLE IF NOT EXISTS profiles (id64 BIGINT UNSIGN...
sql
chosen
[ { "from": "system", "value": "Change database schema to take consideration of question level\n" }, { "from": "human", "value": "CREATE TABLE IF NOT EXISTS user\n (u_id INTEGER PRIMARY KEY AUTOINCREMENT ,\n u_pseudo VARCHAR(255) NOT NULL ,\n u_start DATETIME NOT NULL ,\n u_score INTEGER );\n...
sql
chosen
[ { "from": "system", "value": "Remove obsolete call\nWhen calling the script with SQLcl, the following is displayed:\nline 2: \"set tab off\" is Obsolete.\n\nAs such, removed that line\n" }, { "from": "human", "value": "set linesize 200\nset tab off\nset serveroutput on\n\nCOLUMN MY_USER FORMAT A...
sql
chosen
[ { "from": "system", "value": "Add error_types entries and fix wrong tagset class\n" }, { "from": "human", "value": "-- Create internal \"system\" user\n\nLOCK TABLES `users` WRITE;\n/*!40000 ALTER TABLE `users` DISABLE KEYS */;\nINSERT INTO `users` ( `id`, `name`, `password`, `admin` ) VALUES ( ...
sql
chosen
[ { "from": "system", "value": "Add indexes to speed up condition lookups\n" }, { "from": "human", "value": "ALTER TABLE Objects\nADD PRIMARY KEY (PrimaryKey_Object_Table),\nADD INDEX (Accession_Full_ID),\nADD INDEX (ItemType),\nADD INDEX (ItemName),\nADD INDEX (SourceName);\nALTER TABLE Sources\n...
sql
chosen
[ { "from": "system", "value": "Add a third column for email date. Make the hash the primary key.\n" }, { "from": "human", "value": "create database email_scraper_1;\nuse email_scraper_1;\ncreate table billing ( hash VARCHAR(128), billing DECIMAL(7,2) );\ncreate table last_email_read ( email_mess...
sql
chosen
[ { "from": "system", "value": "Change film functional tests to use 'genre' instead of 'category'.\n" }, { "from": "human", "value": "CREATE TABLE category (\n category_id SERIAL NOT NULL PRIMARY KEY,\n name VARCHAR(25) NOT NULL,\n last_update TIMESTAMP WITH TIME ZONE NOT NULL\n);\nCREATE...
sql
chosen
[ { "from": "system", "value": "Put index on the build_id\n" }, { "from": "human", "value": "CREATE TABLE builds (\n id SERIAL,\n created TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),\n\n key VARCHAR(100) NOT NULL\n);\n\nCREATE INDEX builds_idx_key ON builds (key);\n\n\nCREATE TABLE logs (\n...
sql
chosen
[ { "from": "system", "value": "Change timeout to 10 secs" }, { "from": "human", "value": "metadata :name => \"development manager\",\n :description => \"Manager which allows manipulation of nodes\",\n :author => \"Reactor8\",\n :license => \"\",...
sql
chosen
[ { "from": "system", "value": "[OWL-750] Fix patch of building host from existing NQM agent\n" }, { "from": "human", "value": "INSERT INTO `host`(hostname, ip, agent_version, plugin_version)\nSELECT nqm_agent.ag_hostname, INET_NTOA(CONV(HEX(ag_ip_address), 16, 10)), '', ''\nFROM nqm_agent\n\tLEFT...
sql
chosen
[ { "from": "system", "value": "Clean up temp precompute tables\n\nThese aren't needed outside of precompute, so remove them.\n" }, { "from": "human", "value": "vacuum (analyze, verbose);\n" }, { "from": "gpt", "value": "DROP TABLE load_qa_status;\nDROP TABLE load_precomputed;\nDROP TA...
sql
chosen
[ { "from": "system", "value": "Add area column to WOF neighbourhoods table\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 label_position geo...
sql
chosen
[ { "from": "system", "value": "Use foreign keys; fix to \"list of value_ids\"\n" }, { "from": "human", "value": "\n/** DB HPO INIT PY\n Initialize the SQLite DB for HPO\n See db-hpo-init.py for usage\n*/\n\n/* The main table, one row for each HPO instance\n The HPO ID is specified by the ...
sql
chosen
[ { "from": "system", "value": "Remove all foreign keys in history table\n" }, { "from": "human", "value": "ALTER TABLE `kwf_pages_history` DROP FOREIGN KEY `kwf_pages_history_ibfk_2` ;" }, { "from": "gpt", "value": "ALTER TABLE `kwf_pages_history` DROP FOREIGN KEY `kwf_pages_histo...
sql
chosen
[ { "from": "system", "value": "Fix substring -> substr in TPCH query set\n" }, { "from": "human", "value": "SELECT \n cntrycode, \n count(*) AS numcust, \n sum(acctbal) AS totacctbal\nFROM \n (\n SELECT \n substring(c.phone,1,2) AS cntrycode, \n c.acctbal\n FROM \n \"${da...
sql
chosen
[ { "from": "system", "value": "Add index for column 'service' and 'method'\n" }, { "from": "human", "value": "SET NAMES utf8;\nSET FOREIGN_KEY_CHECKS = 0;\n\nDROP TABLE IF EXISTS `dubbo_invoke`;\nCREATE TABLE `dubbo_invoke` (\n `id` varchar(255) NOT NULL DEFAULT '',\n `invoke_date` date NOT NUL...
sql
chosen
[ { "from": "system", "value": "Update query min max years of accomplishments: remove count\n" }, { "from": "human", "value": "SELECT\n v.research_entity as research_entity,\n rit.type as item_type,\n rit.key as item_key,\n count(a) as count,\n MIN(a.year) AS min,\n ...
sql
chosen
[ { "from": "system", "value": "Use NULL DEFAULT NULL instead of NULL for timestamps\n\nSigned-off-by: Ying Li <f39392f1e2d21dabc2bc5ab11d2bf832bde87b60@docker.com>\n" }, { "from": "human", "value": "-- This migrates initial.sql to tables that are needed for GORM\n\nALTER TABLE `tuf_files`\nADD CO...
sql
chosen
[ { "from": "system", "value": "Set optimize_trigger to same as optimize_constraint\n\ninstead of the default 4\n" }, { "from": "human", "value": "-- Deploy travis-logs:partman to pg\n-- requires: log_parts_created_at_not_null\n\nBEGIN;\n\n SET client_min_messages = WARNING;\n\n CREATE SCHEMA IF...
sql
chosen
[ { "from": "system", "value": "Make sure and update the subscriber ID serial sequence (auto increment)\nvalue after DB migration\n" }, { "from": "human", "value": "BEGIN;\n\nALTER TABLE subscribers RENAME TO sub;\ncreate table subscribers (\n id serial primary key,\n ms...
sql
chosen
[ { "from": "system", "value": "Make hosts table shard friendly." }, { "from": "human", "value": "CREATE TABLE hosts (\n id BIGSERIAL PRIMARY KEY NOT NULL,\n cluster_id bigint REFERENCES clusters (id) ON UPDATE CASCADE ON DELETE CASCADE,\n access_token_id bigint REFERENCES access_tokens (...
sql
chosen
[ { "from": "system", "value": "Update the SQL migration script\n\n" }, { "from": "human", "value": "ALTER TABLE awa_blog ADD COLUMN `url` VARCHAR(255) BINARY NOT NULL;\n\nALTER TABLE awa_post CHANGE `text` `text` TEXT NOT NULL;\nALTER TABLE awa_question CHANGE `description` `description` TEXT NOT...
sql
chosen
[ { "from": "system", "value": "Fix iam2 ldap upgrade sql\n\nResolves http://jira.zstack.io/browse/ZSTAC-21340\n\nSigned-off-by: AlanJager <7ba0221af525cfcc7adbf94f7fc6b46fa1dcb7c9@outlook.com>\n" }, { "from": "human", "value": "CREATE TABLE `zstack`.`LdapResourceRefVO` (\n `uuid` varchar(32)...
sql
chosen
[ { "from": "system", "value": "Remove invalid concept relationships when looking up mapped concepts.\n\nFixes #85\n" }, { "from": "human", "value": "select CONCEPT_ID, CONCEPT_NAME, ISNULL(STANDARD_CONCEPT,'N') STANDARD_CONCEPT, ISNULL(c.INVALID_REASON,'V') INVALID_REASON, CONCEPT_CODE, CONCEPT_C...
sql
chosen
[ { "from": "system", "value": "Set default now() for created_at field.\n" }, { "from": "human", "value": "create table \"job\" (\n \"id\" BIGSERIAL PRIMARY KEY,\n \"app_name\" TEXT NOT NULL,\n \"status\" TEXT NOT NULL,\n \"attributes\" JSONB NOT NULL,\n created_at TIMESTAMP WITHOUT TIME ZONE...
sql
chosen
[ { "from": "system", "value": "Add 'path' and 'level' columns\n" }, { "from": "human", "value": "\n-- --------------------------------------------------------\n\n--\n-- Table structure for table `categories`\n--\n\nCREATE TABLE `categories` (\n `categories_category_id` int(11) NOT NULL AUTO_INCR...
sql
chosen
[ { "from": "system", "value": "MAke sure we have a place to store instance IDs\n" }, { "from": "human", "value": "CREATE TABLE cluster (\n\tid INTEGER PRIMARY KEY AUTOINCREMENT,\n\tname TEXT,\n\towner TEXT,\n\tmetadata TEXT\n);\n\nCREATE TABLE machines (\n\tid INTEGER PRIMARY KEY AUTOINCREMENT,\n...
sql
chosen
[ { "from": "system", "value": "Add index for english fraction\n" }, { "from": "human", "value": "CREATE TABLE [employer_financial].[EnglishFraction]\n(\n\t[Id] BIGINT NOT NULL PRIMARY KEY IDENTITY, \n [DateCalculated] DATETIME NOT NULL, \n [Amount] DECIMAL(18, 5) NULL, \n [EmpRef] NVARC...
sql
chosen
[ { "from": "system", "value": "Add constraint to user for user_indicator\n" }, { "from": "human", "value": "ALTER TABLE oskari_user_indicator ADD PRIMARY KEY (id);" }, { "from": "gpt", "value": "ALTER TABLE oskari_user_indicator ADD PRIMARY KEY (id);\n\nALTER TABLE oskari_user_indicat...
sql
chosen
[ { "from": "system", "value": "Add NOT NULL constraint to type.\n" }, { "from": "human", "value": "# patch_42_43_b\n#\n# title: Add probe2transcript to type enum in unmapped_object\n#\n# description:\n# Add probe2transcript to type enum in unmapped_object\n\nALTER TABLE unmapped_object CHANGE COL...
sql
chosen
[ { "from": "system", "value": "Update stored procedure for Getting Balances\n\nAdded new value to be returned to say whether or not the user has paid\nany levy. New join on the levydeclaration table which then sums the\nLevy for that account, if its greater than 0 we say they have paid levy\n" }, { "...
sql
chosen
[ { "from": "system", "value": "Fix create index line for h2 because it doesn't understand 'using btree'" }, { "from": "human", "value": "\ncreate index if not exists source_dataset_version_log_source_dataset_version_id_create_time_idx on source_dataset_version_log using btree(source_dataset_versi...
sql
chosen
[ { "from": "system", "value": "Add events to aggregations table.\n\nAdd columns to the aggregations table to cover the fields that are in\nevent points.\n" }, { "from": "human", "value": "CREATE DATABASE IF NOT EXISTS aws;\nUSE aws;\nCREATE TABLE IF NOT EXISTS aws_aggregation (\n time TIMES...
sql
chosen
[ { "from": "system", "value": "Remove unused migration query separator\n" }, { "from": "human", "value": "CREATE TABLE `badge_advert` (\n `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,\n `remote_url` varchar(500) NOT NULL,\n `remote_id` varchar(255) NOT NULL,\n `remote_issuer_id` varchar(2...
sql
chosen
[ { "from": "system", "value": "Prepend C (for Chain?) to names to make them a little more unique\n" }, { "from": "human", "value": "-- complain if script is sourced in psql, rather than via CREATE EXTENSION\n\\echo Use \"CREATE EXTENSION pg_blkchain\" to load this file. \\quit\n\nCREATE FUNCTION ...
sql
chosen
[ { "from": "system", "value": "IFS-4110: Apply script to Photonics for RTO and Business. Just to help Val with manual testing.\n" }, { "from": "human", "value": "-- IFS-2123 - Temporarily modify test data to allow testing for backwards compatability for this feature\n-- Remove the new research ca...
sql
chosen
[ { "from": "system", "value": "CLOUDSTACK-9481: Convert MyISAM table to InnoDB for consistency\n\nSigned-off-by: Rohit Yadav <902b9eb5dd62819678163bd5e00fbf0cbc7c264b@shapeblue.com>\n" }, { "from": "human", "value": "-- Licensed to the Apache Software Foundation (ASF) under one\n-- or more contri...
sql
chosen
[ { "from": "system", "value": "Update get agreements procedure to ignore removed\n" }, { "from": "human", "value": "CREATE PROCEDURE [employer_account].[GetEmployerAgreementsLinkedToAccount]\n\t@accountId BIGINT\nAS\nBEGIN\n\tSET NOCOUNT ON;\n\n\tSELECT \n\tea.Id,\n\tea.StatusId AS [Status],\n\t...
sql
chosen
[ { "from": "system", "value": "Update test data insertion script\n" }, { "from": "human", "value": "USE `computer_shop`;\n\nINSERT INTO `component_type`\n(`id`, `name`)\nVALUES\n('1', 'Процессор'),\n('2', 'Материнская плата'),\n('3', 'Оперативная память'),\n('4', 'Видеокарта'),\n('5', 'Сетевая пл...
sql
chosen
[ { "from": "system", "value": "Clear the fact tables before loading\n" }, { "from": "human", "value": "/*\ntruncate table synth_ma.synth_cousub_stats;\ntruncate table synth_ma.synth_county_stats;\ntruncate table synth_ma.synth_cousub_facts;\ntruncate table synth_ma.synth_county_facts;\n\n*/\n" ...
sql
chosen
[ { "from": "system", "value": "Remove copy + paste nonsense.\n" }, { "from": "human", "value": "SELECT\n t1.end_period AS `Period`,\n t2.department AS `Department`,\n SUM(t1.cost * t1.run_time) AS `Total CPU Time Usage`,\n ref_cat_table.ref_category ...
sql
chosen
[ { "from": "system", "value": "CLOUDSTACK-9238: Increase URL fields to 2048 charachters from 255\n\n255 characters is to small for various URLs like S3 pre-signed URLs.\n\nThis causes one or more characters to be chopped of the end of the URL\nand this renders them useless.\n\nInternally in the code all URLs...
sql
chosen
[ { "from": "system", "value": "Remove cascade table dropping, currently unneeded.\n" }, { "from": "human", "value": "DROP TABLE IF EXISTS tweet CASCADE;\n\nCREATE TABLE tweet (\n\tid SERIAL PRIMARY KEY,\n\tnode_name VARCHAR(10) NOT NULL,\n\tcontent VARCHAR(500),\n\tpub_datetime TIMESTAMP WITH TIM...
sql
chosen
[ { "from": "system", "value": "Update sql query for removing a user follow\n" }, { "from": "human", "value": "/**\n* input\n* follower: user_id<Number>\n* target: user_id<Number>\n*\n* returns:\n* | followcount | togglefollow |\n* |-------------|--------------|\n* | number | boolean ...
sql
chosen
[ { "from": "system", "value": "Update view definition to match renamed access context group roles table\n" }, { "from": "human", "value": "CREATE OR REPLACE VIEW wf_ac_perms_v AS\nSELECT ac.ns_id, ac.group_id, gu.user_id, ac.role_id, rdas.doctype_id, rdas.docaction_id\nFROM wf_access_contexts ac\...
sql
chosen
[ { "from": "system", "value": "Update play partner creation to include user secret as well" }, { "from": "human", "value": "INSERT INTO partner (id, prefix, partner_name, admin_secret, description, status, created_at, updated_at)\nVALUES (-6, '-6', 'Play', MD5(CONV(SUBSTRING(RAND(), 3), 10, 36)),...
sql
chosen
[ { "from": "system", "value": "Update database password field to allow hash, with room to grow\n" }, { "from": "human", "value": "\nDROP TABLE IF EXISTS `users`;\n/*!40101 SET @saved_cs_client = @@character_set_client */;\n/*!40101 SET character_set_client = utf8 */;\nCREATE TABLE `users` (\n...
sql
chosen
[ { "from": "system", "value": "Remove debris from merge conflict\n" }, { "from": "human", "value": "<<<<<<< HEAD\nDROP TABLE IF EXISTS wnprc.on_call_calendars;\nCREATE TABLE wnprc.on_call_calendars\n(\n calendar_id VARCHAR(100),\n calendar_type VARCHAR(100),\n displ...
sql
chosen
[ { "from": "system", "value": "Add DB name to DB cleanup script for 510to511 upgrade.\n" }, { "from": "human", "value": "--;\n-- Schema cleanup from 5.1.0 to 5.1.1;\n--;\n\n-- Remove unused table async_job_journal\nDROP TABLE IF EXISTS async_job_journal;\n\n-- Remove unused table cluster_vsm_map\...
sql
chosen
[ { "from": "system", "value": "Add public printout method for testing\n" }, { "from": "human", "value": "set define off\n\ncreate or replace public class Upi\n{\n public static String getUpi( long id )\n {\n String str = Long.toHexString( id ).toUpperCase();\n return \"UPI0000000000\".s...
sql
chosen
[ { "from": "system", "value": "Add wi_gallery table for the image gallery." }, { "from": "human", "value": "-- phpMyAdmin SQL Dump\n-- version 3.1.3\n-- http://www.phpmyadmin.net\n--\n-- Machine: localhost\n-- Genereertijd: 28 Apr 2009 om 17:50\n-- Serverversie: 5.1.32\n-- PHP-Versie: 5.2.9\n\n--...
sql
chosen
[ { "from": "system", "value": "Set linux version to Trusty\n" }, { "from": "human", "value": "CREATE TABLE IF NOT EXISTS `HardCache` (\n `Id` varchar(255) NOT NULL,\n `Bucket` varchar(255) NOT NULL,\n `Value` longtext NOT NULL,\n `EndDate` datetime NOT NULL,\n `Created` datetime NO...
sql
chosen
[ { "from": "system", "value": "Fix email overlap check so it looks at cohorts with transfer sender (but not approved)\n" }, { "from": "human", "value": "CREATE PROCEDURE [dbo].[CheckForOverlappingEmailsForTable]\n\t@Emails [EmailCheckTable] READONLY,\n\t@CohortId BIGINT = NULL\nAS\nBEGIN\n\tSELEC...
sql
chosen
[ { "from": "system", "value": "Add `date` column to SQL script.\n" }, { "from": "human", "value": "CREATE TABLE `xsolla_standard_user` (\n `v1` VARCHAR(255) NOT NULL,\n `v2` VARCHAR(200) NULL DEFAULT NULL,\n `v3` VARCHAR(100) NULL DEFAULT NULL,\n PRIMARY KEY (`v1`))\n ENGINE = InnoDB\n DEFA...
sql
chosen
[ { "from": "system", "value": "Rename alias in challenges for csv query\n" }, { "from": "human", "value": "SELECT t1.name AS challenger, t2.name AS challengee, t1.open AS spotopen, t1.challengerspot AS challengerspot,\nt1.challengeespot AS challengeespot, t1.namenumber AS namenumberone, t2.namenu...
sql
chosen
[ { "from": "system", "value": "Add covering index for 'select change_num from changes' qry in stack migrator\n" }, { "from": "human", "value": "CREATE TABLE `CHANGES` (\r\n `CHANGE_NUM` bigint(20) NOT NULL AUTO_INCREMENT,\r\n `TIME_STAMP` TIMESTAMP NOT NULL,\r\n `OBJECT_ID` bigint(20) NOT NULL...
sql
chosen
[ { "from": "system", "value": "Use LONGBLOB for the value column in MySQL.\n" }, { "from": "human", "value": "-- $Id$\n\nCREATE TABLE IF NOT EXISTS `KV` (\n `kv_key` VARBINARY(767) NOT NULL,\n `kv_value` VARBINARY(767) NOT NULL,\n PRIMARY KEY(`kv_key`)\n) ENGINE=InnoDB default charset=utf8 ...
sql
chosen
[ { "from": "system", "value": "Revert \"Changed collation for SQL server to case-insensitive.\"\n\nThis reverts commit b7387a8c8c981fe1d158e51f551b4543d8b22eb6.\n" }, { "from": "human", "value": "#\n# replacer = \"${database}\"\n############################\n\nCREATE DATABASE ${database} COLLATE ...
sql
chosen
[ { "from": "system", "value": "Fix the schema upgrade script\n\nReviewed-By: Wesley Hertlein <ca32100e9f664971b15d1470ddc7f009d907efd3@morganstanley.com>\n" }, { "from": "human", "value": "ALTER TABLE disk ADD bootable INTEGER DEFAULT 0;\nUPDATE disk SET bootable = 1 WHERE device_name = 'sda' OR ...
sql
chosen
[ { "from": "system", "value": "Fix for DB2 upgrade script\n" }, { "from": "human", "value": "alter table ACT_RU_TASK\n\tadd FORM_KEY_ varchar(255);\n\t\nalter table ACT_RU_EXECUTION\n\tadd NAME_ varchar(255);\n\t\n\t\ncreate table ACT_EVT_LOG (\n LOG_NR_ bigint not null GENERATED ALWAYS AS IDE...
sql
chosen
[ { "from": "system", "value": "Make the test independent of others that might leave tables around\n" }, { "from": "human", "value": "CREATE FUNCTION degrees(r double)\nRETURNS double\nRETURN r*180/pi();\n\nCREATE FUNCTION fHtm(x float, y float, z float, radius float)\nRETURNS TABLE (\nHtmIDStart ...
sql
chosen
[ { "from": "system", "value": "Revert \"fixed up some invalid comment syntax - this is ANSI SQL\"\n\nThis reverts commit 6704ddddf227865de43c1fdd846b68f76f723fe6.\n" }, { "from": "human", "value": "-- SQL commands to update an 0.8.x version of Laconica\n-- to 0.9.x.\n\n--these are just comments\n...
sql
chosen
[ { "from": "system", "value": "[afu_onlinerisk_transfer] Fix für Konsultationsabstand in Untersuchungseinheit\n" }, { "from": "human", "value": "SELECT\n ue.id_untersuchungseinheit AS t_id,\n 'Point(' || ue.koordinate_x::text || ' ' || ue.koordinate_y::text || ')' AS geometrie,\n k.te...
sql
chosen
[ { "from": "system", "value": "Remove accidentally added ID column\n" }, { "from": "human", "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 may obtain ...
sql
chosen
[ { "from": "system", "value": "fix: Fix omitted semi-colon in sql\n" }, { "from": "human", "value": "# --- !Ups\ncreate unique index uq_n4user_1 on n4user (login_id);\ncreate index ix_notification_event_created on notification_event (created DESC)\ncreate index ix_watch_resource_id_resource_type ...
sql
chosen
[ { "from": "system", "value": "Add indices for all tables\n" }, { "from": "human", "value": "drop table if exists reminders;\ncreate table reminders (\n phonenumber varchar(100),\n event_id int,\n done boolean,\n time varchar(14)\n);\n\ndrop table if exists calls;\ncreate table calls (\n c...
sql
chosen
[ { "from": "system", "value": "Fix chlorophyll typo in GCOOS query\n" }, { "from": "human", "value": "--PARAMETERS\n--station_database_id\n--sensor_database_id \n--start_date\n\nSELECT\n a.observationDate as observation_time\n ,a.chlorphyll as observation_value\n ,b.verticalPosition as observ...
sql
chosen
[ { "from": "system", "value": "KCINFR-675: Set the cfda job to run every 2 hrs on intg to enable testing.\n" }, { "from": "human", "value": "update KRCR_PARM_T set VAL = 'ON' where parm_nm = 'FIN_SYSTEM_INTEGRATION_ON'\n/\nupdate KRCR_PARM_T set VAL = '2' where parm_nm = 'enable.award.FnA.validat...
sql
chosen
[ { "from": "system", "value": "Remove explicit install of uuid-ossp extension on migrations.\n" }, { "from": "human", "value": "CREATE EXTENSION \"uuid-ossp\";\n\n-- A table that will store the whole transaction log of the database.\nCREATE TABLE IF NOT EXISTS txlog (\n id uuid PRIMARY KEY DEFAU...
sql
chosen
[ { "from": "system", "value": "Make unique and not null constraints idempotent-ish\n" }, { "from": "human", "value": "/* Create table using jsonb for performance */\nCREATE TABLE IF NOT EXISTS statuses ( status jsonb );\n/* Create GIN index to allow efficient querying of JSON object */\nCREATE IN...
sql
chosen
[ { "from": "system", "value": "Add the new sitevars for swap warnings.\n" }, { "from": "human", "value": "-- MySQL dump 8.22\n--\n-- Host: localhost Database: tbdb\n---------------------------------------------------------\n-- Server version\t3.23.54-log\n\n--\n-- Dumping data for table 'sitev...
sql
chosen
[ { "from": "system", "value": "Use Kentucky instead of UKY on portal.\n" }, { "from": "human", "value": "-- -----------------------------------------------------------------\n-- Create the entry for the University of Kentucky InstaGENI FOAM aggregate:\n--\n-- Execute as:\n--\n-- psql -U portal...
sql
chosen
[ { "from": "system", "value": "Add update table query to add buildoutputchecksum\n" }, { "from": "human", "value": "--\n-- JBoss, Home of Professional Open Source.\n-- Copyright 2014-2019 Red Hat, Inc., and individual contributors\n-- as indicated by the @author tags.\n--\n-- Licensed under the A...
sql
chosen
[ { "from": "system", "value": "Add delete constraints for sub-objects for blocks.\n" }, { "from": "human", "value": "create table Block (\n\tid serial,\n\n\tcreatedate timestamp not null,\n\n\tdisplayorder integer not null default 0,\n\tattachment integer null references Attachment(id),\n\tmedia ...
sql
chosen