conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Change foreign key, don't kill entire table\n" }, { "from": "human", "value": "\n-- o/` Leave the past behind, just walk away o/`\n\nDROP TABLE IF EXISTS auth_user_groups;\nDROP TABLE IF EXISTS auth_user_user_permissions;\nDROP TABLE IF EXISTS django_admin_log;\nDRO...
sql
chosen
[ { "from": "system", "value": "Add queries for patents min max years\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 MIN(p.filing_year) AS min,\n MAX(p.filing_year) AS max\nFROM verif...
sql
chosen
[ { "from": "system", "value": "Add application foreign key to traces database representation\n" }, { "from": "human", "value": "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";\n\nCREATE TABLE applications(\nuuid uuid PRIMARY KEY DEFAULT uuid_generate_v4(), \nname text,\noriginal_name text\n);\n\nCR...
sql
chosen
[ { "from": "system", "value": "Adjust indentation on wrapped IN clause\n" }, { "from": "human", "value": "CREATE OR REPLACE FORCE VIEW db_dashboard.v_session_sys_stat (\n sid,\n name,\n value )\nAS\nSELECT stat.sid,\n s.name,\n stat.value\n FROM v$sesstat stat\n JOIN ...
sql
chosen
[ { "from": "system", "value": "Rename type - oprava SQL skriptu pro drop typu\n" }, { "from": "human", "value": "@&&run_dir_begin\n\nSET SERVEROUTPUT ON\n\nprompt Dropping types\nBEGIN\n FOR i IN (SELECT 'DROP TYPE '|| o.object_name ||' FORCE' sql_comm\n , o.* \n ...
sql
chosen
[ { "from": "system", "value": "Add v17 update script to schema creation script\n\nSigned-off-by: Carter Landis <84a516841ba77a5b4648de2cd0dfcb30ea46dbb4@carterlandis.com>\n" }, { "from": "human", "value": "-- Generate core schema\n\\i schema/generate/01-schema.sql\n\\i schema/generate/02-augur_da...
sql
chosen
[ { "from": "system", "value": "Add login_name to EducatorSectionAssignment export SQL\n" }, { "from": "human", "value": "use x2data\nSELECT\n 'local_id',\n 'course_number',\n 'school_local_id',\n 'section_number',\n 'term_local_id'\nUNION ALL\nSELECT\n STF_ID_LOCAL,\n CSK_COURSE_NUMBER,\n ...
sql
chosen
[ { "from": "system", "value": "Drop tables at end of test.\n" }, { "from": "human", "value": "create table table1 (col1 int,col2 int);\ncreate table table2 (col1 int,col2 int);\n\ninsert into table1 (col1,col2) values (1,10),(2,20),(3,30);\ninsert into table2 (col1,col2) values (1,100),(2,200);\n...
sql
chosen
[ { "from": "system", "value": "Fix jetInvoiceItem query to sum the total cost per Account.\n" }, { "from": "human", "value": "SELECT distinct\n ir.rowId as runId,\n replace(a.uw_udds, '-', '') as Department,\n a.uw_fund as Fund,\n '4' as Program,\n a.uw_account as Project,\n a.charge_grant...
sql
chosen
[ { "from": "system", "value": "Fix incorrect version 11 schema update script name\n\nSigned-off-by: Carter Landis <84a516841ba77a5b4648de2cd0dfcb30ea46dbb4@carterlandis.com>\n" }, { "from": "human", "value": "\\i schema/generate/1-schema.sql\n\\i schema/generate/2-augur_data.sql\n\\i schema/gener...
sql
chosen
[ { "from": "system", "value": "Add index on date to testjobs table\n" }, { "from": "human", "value": "DROP DATABASE IF EXISTS ouija;\n\nCREATE DATABASE ouija;\nUSE ouija;\n\nCREATE TABLE IF NOT EXISTS `testjobs` (\n `id` int(11) NOT NULL,\n `log` varchar(1024) NOT NULL,\n `slave` varchar(64) N...
sql
chosen
[ { "from": "system", "value": "Fix wowza_dvr in itv table\n" }, { "from": "human", "value": "--\n\nALTER TABLE `storages` ADD `wowza_dvr` tinyint default 0;\nALTER TABLE `storages` CHANGE `flussonic_server` `flussonic_dvr` tinyint default 0;\nALTER TABLE `itv` ADD `wowza_dvr` tinyint default 0;\n...
sql
chosen
[ { "from": "system", "value": "Format script for unique recipients\n" }, { "from": "human", "value": "insert into speakeasy_petition_metrics (activity, campaign_id , npeople) select 'unique_recipient', cp.id, count(Distinct contact_id) from civicrm_mailing m join civicrm_mailing_recipients r on r...
sql
chosen
[ { "from": "system", "value": "Fix the primary key uniqueness.\n\nA package can have multiple versions within the same distribution.\n" }, { "from": "human", "value": "create type distribution as enum('stable', 'testing', 'unstable', 'experimental');\ncreate type component as enum('main');\n\ncre...
sql
chosen
[ { "from": "system", "value": "Allow NULL album information in database\n" }, { "from": "human", "value": "CREATE TABLE scrobble (\n id SERIAL PRIMARY KEY\n, artist TEXT NOT NULL\n, album TEXT NOT NULL\n, track TEXT NOT NULL\n, scrobble_timestamp TIMESTAMPTZ NOT NULL\n);\n\nCOPY scrobble(artist,...
sql
chosen
[ { "from": "system", "value": "Update down migration for app certs\n" }, { "from": "human", "value": "ALTER TABLE module_config\nDROP COLUMN IF EXISTS certificate CASCADE,\nDROP COLUMN IF EXISTS private_key CASCADE,\nDROP COLUMN IF EXISTS expiration_ts CASCADE;\n\nDROP TABLE IF EXISTS app_certifi...
sql
chosen
[ { "from": "system", "value": "Remove link that does not work" }, { "from": "human", "value": "-- SQL to show number of records recorded earlier than tracking_start_date_time.\n-- Those records should be removed.\n-- https://lifewatch-inbo.cartodb.com/viz/5d42a40a-9951-11e3-8315-0ed66c7bc7f3/tabl...
sql
chosen
[ { "from": "system", "value": "Add semicolons to cql for easier copy-paste.\n" }, { "from": "human", "value": "CREATE KEYSPACE IF NOT EXISTS dev1 WITH replication = {'class': 'NetworkTopologyStrategy', 'dc1': '3', 'dc2': '3', 'dc3': '3'} AND durable_writes = true;\n\n//CassAstyanaxPlugin Plugin\...
sql
chosen
[ { "from": "system", "value": "Fix non-reentrant metadata\nam: e6b3c2f713\n\nChange-Id: Ia886484ec8754ce623a6e0ad44f6b6077b7589b1\n" }, { "from": "human", "value": "--\n-- Copyright 2019 The Android Open Source Project\n--\n-- Licensed under the Apache License, Version 2.0 (the \"License\");\n-- ...
sql
chosen
[ { "from": "system", "value": "Add user for \"anonymous\" (default user) in sample data\n" }, { "from": "human", "value": "INSERT INTO `users` (`username`) VALUES ('someuser'), ('anotheruser');\nINSERT INTO `teams` (`name`, `title`) VALUES ('sample', 'Sample');\nINSERT INTO `teammembers` (`teamId...
sql
chosen
[ { "from": "system", "value": "Add startnodeterm to knowledgeedges migration\n" }, { "from": "human", "value": "CREATE TABLE knowledgeedges (\n\tuserid INTEGER NOT NULL,\n\tstartnodeid INTEGER NOT NULL,\n\tendnodeid INTEGER NOT NULL,\n\tnodepath INTEGER ARRAY NOT NULL,\n\tconfidence INTEGER NOT N...
sql
chosen
[ { "from": "system", "value": "Change constraint from pair (userId, alias) to alias only, as there must not be two identical email adresses\n" }, { "from": "human", "value": "CREATE TABLE IF NOT EXISTS \"user_aliases\"(\n \"id\" VARCHAR NOT NULL,\n \"user_id\" VARCHAR NOT NULL,\n \"alias...
sql
chosen
[ { "from": "system", "value": "Update migrations to support empty down statements\n" }, { "from": "human", "value": "-- +migrate Up\nUPDATE users SET github_token = NULL\n\n-- +migrate Down\n\n" }, { "from": "gpt", "value": "-- +migrate Up\nUPDATE users SET github_token = NULL;\n\n-- ...
sql
chosen
[ { "from": "system", "value": "Fix syntax error in SQL script\n" }, { "from": "human", "value": "INSERT INTO media\n(\n title,\n uri,\n rating,\n viewed_at,\n created_at\n)\nVALUES\n('The Scorch Trials', 'http://www.imdb.com/title/tt4046784/', 1000, '2016-07-06', now()),\n('Heaven\\'s Door',...
sql
chosen
[ { "from": "system", "value": "Rearrange drop tables for uninstall\n" }, { "from": "human", "value": "DROP TABLE IF EXISTS `civicrm_sms_conversation`;\nDROP TABLE IF EXISTS `civicrm_sms_conversation_question`;\nDROP TABLE IF EXISTS `civicrm_sms_conversation_contact`;\nDROP TABLE IF EXISTS `civicr...
sql
chosen
[ { "from": "system", "value": "Remove blank images from directory listing\n" }, { "from": "human", "value": "DROP TABLE IF EXISTS MediaDirectoryListing;\nCREATE TABLE MediaDirectoryListing(\nFileName VARCHAR(255) NOT NULL PRIMARY KEY );\n\nLOAD DATA LOCAL INFILE 'source/media-list.txt' INTO TABLE...
sql
chosen
[ { "from": "system", "value": "Update credit service table definition\n" }, { "from": "human", "value": "CREATE DATABASE creditdb;\n\nUSE creditdb;\n\nCREATE TABLE `CUSTOMER_CREDIT` (\n `ID` int(11) NOT NULL AUTO_INCREMENT,\n `CUSTOMER_ID` varchar(45) DEFAULT NULL,\n `REFERENCE_NUMBER` varchar...
sql
chosen
[ { "from": "system", "value": "Make database setup resistant to multiple runs\n" }, { "from": "human", "value": "CREATE TABLE player (\n id serial PRIMARY KEY,\n name varchar(40) UNIQUE NOT NULL\n);\n\nCREATE TABLE game (\n id serial PRIMARY KEY,\n name varchar(40) UNIQUE ...
sql
chosen
[ { "from": "system", "value": "Fix a typo in comment\n" }, { "from": "human", "value": "-- UPDATE SCRIOT FOR CLIENT SCHEMA\n-- This script will set any null UpdateTimes to now\n-- and then explicitly set the UpdateTimes of \n-- future rows to update\n\nUPDATE JobRecords SET UpdateTime = CURRENT_T...
sql
chosen
[ { "from": "system", "value": "Fix client downgrade script problem\n" }, { "from": "human", "value": "--DO NOT MODIFY THIS FILE, IT IS GENERATED AUTOMATICALLY FROM SOURCES\n-- Complain if script is sourced in psql, rather than via CREATE EXTENSION\n\\echo Use \"ALTER EXTENSION cdb_dataservices_cl...
sql
chosen
[ { "from": "system", "value": "Create an index in the backpacks table during creation\n" }, { "from": "human", "value": "\nCREATE TABLE IF NOT EXISTS search_count (id64 BIGINT UNSIGNED, ip VARCHAR(200));\n\nCREATE TABLE IF NOT EXISTS profile_cache (id64 BIGINT UNSIGNED PRIMARY KEY, vanity TEXT, p...
sql
chosen
[ { "from": "system", "value": "Handle case where last_release is null\n" }, { "from": "human", "value": "drop table if exists :tablename;\n\ncreate table :tablename as\nselect distinct\n xref.upi\nfrom xref\nleft join rnc_rna_precomputed pre\non\n pre.upi = xref.upi\n and pre.taxid = xref.taxi...
sql
chosen
[ { "from": "system", "value": "Add function to parse WAL location.\n" }, { "from": "human", "value": "CREATE OR REPLACE FUNCTION public.column_names(namespace name, \"table\" name)\n\tRETURNS SETOF name\nAS $$\n\tSELECT a.attname\n\tFROM pg_catalog.pg_class c\n\tJOIN pg_catalog.pg_namespace n ON ...
sql
chosen
[ { "from": "system", "value": "Add field for email confirmation\n" }, { "from": "human", "value": "CREATE DATABASE notes;\n\nUSE notes;\n\nCREATE TABLE note_users (\n UserId VARCHAR(60) PRIMARY KEY,\n UserEmail VARCHAR(255),\n UserPassword VARCHAR(512),\n TagColor VARCHAR(6) DEFAULT '...
sql
chosen
[ { "from": "system", "value": "Fix that the script forgets to allow public access to pgpool_catalog.\n\nThe bug prevents inserting data into user tables if pgpool_catalog is\ncreated in native replication mode. The bug was there from day 1. I\nwonder why nobody noticed until today. Per [pgpool-general-jp: ...
sql
chosen
[ { "from": "system", "value": "Fix tests for PostgreSQL 10\n\nPreviously throwing an error like this:\nERROR: set-returning functions are not allowed in CASE\nLINE 8: ...HEN position('multiple_tables' in query) > 0 THEN unnest(ARR...\n ^\nHINT: Yo...
sql
chosen
[ { "from": "system", "value": "Add TODO item about using CDB_TableMetadata\n" }, { "from": "human", "value": "-- Function returning list of cartodb user tables\n--\n-- The optional argument restricts the result to tables\n-- of the specified access type.\n--\n-- Currently accepted permissions are...
sql
chosen
[ { "from": "system", "value": "Make flexible employment fields nullable in database\n\n" }, { "from": "human", "value": "CREATE TABLE [dbo].ApprenticeshipFlexibleEmployment\n(\n\t[ApprenticeshipId] BIGINT NOT NULL,\n\t[EmploymentPrice] INT NOT NULL,\n\t[EmploymentEndDate] DATETIME2 NOT NULL,\n ...
sql
chosen
[ { "from": "system", "value": "Add is_admin (cc jpdeplaix) for 500 internal error\n" }, { "from": "human", "value": "GRANT ALL PRIVILEGES ON DATABASE cumulus TO cumulus;\nSET client_encoding = 'UTF8';\n\nCREATE TABLE feeds (\n id integer NOT NULL,\n url text NOT NULL,\n title text NOT NU...
sql
chosen
[ { "from": "system", "value": "Add ColorTheme column for the user to save their chosen theme\n" }, { "from": "human", "value": "CREATE DATABASE notes;\n\nUSE notes;\n\nCREATE TABLE note_users (\n UserId CHAR(32) PRIMARY KEY,\n UserEmail VARCHAR(255),\n UserPassword VARCHAR(512),\n Ema...
sql
chosen
[ { "from": "system", "value": "Split date column into year and month\n" }, { "from": "human", "value": "CREATE VIRTUAL TABLE documents using fts4(title,text,from,to,date,tags,tokenize=porter);\n" }, { "from": "gpt", "value": "CREATE VIRTUAL TABLE documents USING fts4(id,title,scanned_...
sql
chosen
[ { "from": "system", "value": "Fix broken tests\n- a previous commit removed a user referenced in some tests" }, { "from": "human", "value": "-- Table: languages\r\ninsert into languages values (1,'es','ES',null);\r\ninsert into languages values (2,'en','UK',null);\r\ninsert into languages values...
sql
chosen
[ { "from": "system", "value": "Add minor comment to indexes\n" }, { "from": "human", "value": "CREATE INDEX events_instance_id_started_at_desc_idx ON events USING btree(instance_id, started_at DESC);\n\nCREATE INDEX jobs_instance_id_idx ON jobs USING btree(instance_id);\nCREATE INDEX jobs_busy_in...
sql
chosen
[ { "from": "system", "value": "Set default values for min_level and max_level fields.\n" }, { "from": "human", "value": "-- **********************************************************\n-- * *\n-- * IMPORTANT NOTE ...
sql
chosen
[ { "from": "system", "value": "Fix data types in db creation script\n" }, { "from": "human", "value": "DROP DATABASE IF EXISTS italian_workflow;\r\n\r\nCREATE DATABASE italian_workflow;\r\n\r\nUSE italian_workflow;\r\n\r\nCREATE TABLE Users (\r\n user_id INT UNSIGNED NOT NULL AUTO_INCREMENT,\r...
sql
chosen
[ { "from": "system", "value": "Fix get posts by view count\n" }, { "from": "human", "value": "DROP PROCEDURE IF EXISTS `GET_POSTS_BY_VIEW_COUNT`;\nDELIMITER ;;\nCREATE DEFINER=`root`@`localhost` PROCEDURE `GET_POSTS_BY_VIEW_COUNT`(IN `_limit` int, IN `_with_covers` tinyint)\nBEGIN\n\t\tIF _with_c...
sql
chosen
[ { "from": "system", "value": "Optimize member metrics for campaigns\n" }, { "from": "human", "value": "INSERT INTO speakeasy_petition_metrics\n(campaign_id, activity, is_opt_out, npeople)\n SELECT\n campaign_id AS campaign_id,\n status AS activity,\n is_opt_out AS is_opt_out,\n COUN...
sql
chosen
[ { "from": "system", "value": "Add files table in database template\n" }, { "from": "human", "value": "drop table if exists users;\ncreate table users (\n userid text primary key not null,\n username text not null,\n email text not null,\n passwordhash not null\n);\ndrop table if exis...
sql
chosen
[ { "from": "system", "value": "Index size added to i4:invalid indexes report\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 anyt...
sql
chosen
[ { "from": "system", "value": "Set proper EduLevelID based on TitleSuffix, clear TitleSuffix GH-398\n" }, { "from": "human", "value": "-- NOTE: To manually execute this script, you must replace {databaseOwner} and {objectQualifier} with real values:\n-- defaults is \"dbo.\" for {databaseOwner} a...
sql
chosen
[ { "from": "system", "value": "Add CPU time to submission data\n" }, { "from": "human", "value": "drop table if exists users;\ncreate table users (\n userid text primary key not null,\n username text not null,\n email text not null,\n passwordhash not null\n);\ndrop table if exists su...
sql
chosen
[ { "from": "system", "value": "Create blog_prost_selector association table and remove foreign of Post to subjects.\n" }, { "from": "human", "value": "create table blog_post_subject(\n post_id int UNSIGNED NOT NULL, \n subject_id int UNSIGNED NOT NULL,\n CONSTRAINT pk_ps PRIMARY KEY(post...
sql
chosen
[ { "from": "system", "value": "Update MySQL init script with more comments.\n" }, { "from": "human", "value": "CREATE TABLE IF NOT EXISTS `KV` (\n -- MySQL InnoDB indexes are limited to 767 bytes\n -- You can go up to 3072 bytes if you set innodb_large_prefix \n -- See: http://dev.mysql....
sql
chosen
[ { "from": "system", "value": "Add two test projects to start with\n" }, { "from": "human", "value": "-- Create the tables.\nCREATE TABLE users (\n name NVARCHAR(320) PRIMARY KEY, -- 320 is the maximum email length.\n salt CHAR(256),\n password CHAR(256) -- Password is salted and encrypt...
sql
chosen
[ { "from": "system", "value": "Clarify a comment about COALESCE" }, { "from": "human", "value": "-- Coalesce returns the first non-null value\nSELECT\n meter_id, reading, read_timestamp\nFROM readings\nWHERE meter_id = ${meterID}\n AND read_timestamp BETWEEN\n COALESCE(${startDate}, DATE '19...
sql
chosen
[ { "from": "system", "value": "Remove the orphan entries in mixeval_question_descs\n" }, { "from": "human", "value": "-- There are differences between upgrading from a iPeer v2.x installation\n-- and upgrading from an iPeer v3.0.x installation. \n\n-- This file contains queries specific to upgrad...
sql
chosen
[ { "from": "system", "value": "Revert \"Revert \"fixed up some invalid comment syntax - this is ANSI SQL\"\"\n\nThis reverts commit c0eca0e59b1b9bb74d4457348d1e310e18cc082f.\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...
sql
chosen
[ { "from": "system", "value": "Update DB schema to contain table with branches per commit\n" }, { "from": "human", "value": "--drop table products;\n--drop table repos;\n--drop table gitlog;\n\ncreate table products (\n id integer primary key asc,\n name text\n);\n\ncrea...
sql
chosen
[ { "from": "system", "value": "Fix the bad sql instruction for Oracle\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_Classifi...
sql
chosen
[ { "from": "system", "value": "Change Location table to use Auto Increment key.\n" }, { "from": "human", "value": "CREATE TABLE IF NOT EXISTS `locations` (\n `locid` mediumint(8) unsigned NOT NULL,\n `latitude` float(8,4) NOT NULL,\n `longitude` float(8,4) NOT NULL,\n `ipcount` int(10) unsign...
sql
chosen
[ { "from": "system", "value": "Use COALESCE on autobarcode trigger to avoid writing NULL\n" }, { "from": "human", "value": "-- trigger for å øke eksemplarnummer på biblios automatisk\n-- bruker coalesce for å defaulte til 1 hvis ingen eksemplarer fra før\n-- legger også på strekkode inkrementert ...
sql
chosen
[ { "from": "system", "value": "Fix group by query by having correct columns.\n" }, { "from": "human", "value": "ALTER PROCEDURE dw.p_lataa_f_virta_otp_55_suppea AS\n\nTRUNCATE TABLE dw.f_virta_otp_55_suppea\n\nINSERT INTO dw.f_virta_otp_55_suppea (\n d_organisaatio_id,\n d_koulutusluokitus_id,\...
sql
chosen
[ { "from": "system", "value": "Set default replication_factor to 2\n" }, { "from": "human", "value": "CREATE KEYSPACE IF NOT EXISTS unifiedpush_server WITH replication = {'class': 'SimpleStrategy', 'replication_factor' : 3};" }, { "from": "gpt", "value": "CREATE KEYSPACE IF NOT EXISTS...
sql
chosen
[ { "from": "system", "value": "Put version number in version table" }, { "from": "human", "value": "CREATE TABLE sample_list LIKE patient_list;\nINSERT sample_list SELECT * FROM patient_list;\nCREATE TABLE sample_list_list LIKE patient_list_list;\nINSERT sample_list_list SELECT * FROM patient_lis...
sql
chosen
[ { "from": "system", "value": "Make sure iso codes column has the same name across countries and regions\n" }, { "from": "human", "value": "SELECT c.id,\n name,\n iso_3,\n COALESCE(percentage_pa_land_cover,0) AS percentage_pa_land_cover,\n COALESCE(percentage_pa_marine_cover,0) AS percentage_...
sql
chosen
[ { "from": "system", "value": "Fix issue with oracle upgrade script\n" }, { "from": "human", "value": "alter table ACT_HI_TASKINST add TASK_INSTANCE_ID_ NVARCHAR2(255);\n" }, { "from": "gpt", "value": "alter table ACT_HI_TASKINST add PROPAGATED_STAGE_INST_ID_ NVARCHAR2(255);\n" } ]
sql
chosen
[ { "from": "system", "value": "Fix typographical error in SQL script\n" }, { "from": "human", "value": "INSERT INTO media\n(\n title,\n uri,\n rating,\n viewed_at,\n created_at\n)\nVALUES\n('Agent Code Banks 2: Destination London', 'http://www.imdb.com/title/tt0358349/', 1000, '2016-06-29', ...
sql
chosen
[ { "from": "system", "value": "Drop assembly and sp before create\n" }, { "from": "human", "value": "USE [master]\nGO\n\n-- enable 'TRUSTWORTHY'\n-- required for 'external access' of clr code (-> sending tcp packets).\nALTER DATABASE [master] SET TRUSTWORTHY ON;\nGO\n\n-- enable clr code\nEXEC sp...
sql
chosen
[ { "from": "system", "value": "Fix typo in SQL script\n" }, { "from": "human", "value": "BEGIN;\n\n-- Rename the status_usage view to use v_XXXXXX naming convention\nALTER VIEW IF EXISTS stats_usage RENAME TO v_stats_usage;\nALTER VIEW IF EXISTS active_move_requests RENAME TO v_active_move_reques...
sql
chosen
[ { "from": "system", "value": "Add UNIQUE constraint to oskari_maplayer_externalid.externalid\n" }, { "from": "human", "value": "BEGIN;\n\nSELECT id AS maplayerid, externalid\nINTO oskari_maplayer_externalid\nFROM oskari_maplayer\nWHERE externalid <> '';\n\nALTER TABLE oskari_maplayer_externalid ...
sql
chosen
[ { "from": "system", "value": "Change to UPDATE command to be compliant with AC's guidelines" }, { "from": "human", "value": "INSERT INTO version_db_world (`sql_rev`) VALUES ('1527682153565076000');\n\nDELETE FROM `smart_scripts` WHERE `entryorguid` = 177385;\nINSERT INTO `smart_scripts` (`entryo...
sql
chosen
[ { "from": "system", "value": "Sort the problem of some queries referencing the database name" }, { "from": "human", "value": "#Theres already an unsed table relating to this, drop it\nDROP TABLE talk_link_types;\n#switch talks to innodb so FKs work\nALTER TABLE `joindin`.`talks` ENGINE=INNODB;\n...
sql
chosen
[ { "from": "system", "value": "Add missing photo field on users table.\n" }, { "from": "human", "value": "CREATE TABLE IF NOT EXISTS users (\n id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),\n created_at timestamptz NOT NULL DEFAULT clock_timestamp(),\n modified_at timestamptz NOT NULL DEFAULT...
sql
chosen
[ { "from": "system", "value": "Revert change in migration file" }, { "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 COMMENT 'Bot leve...
sql
chosen
[ { "from": "system", "value": "KRACOEUS-6384: Delete COI Annual Review Due date from table for now\n" }, { "from": "human", "value": "INSERT INTO KRCR_PARM_T (NMSPC_CD, CMPNT_CD, PARM_NM, OBJ_ID, VER_NBR, PARM_TYP_CD, VAL, PARM_DESC_TXT, EVAL_OPRTR_CD, APPL_ID)\nVALUES ('KC-COIDISCLOSURE', 'Docum...
sql
chosen
[ { "from": "system", "value": "Add primary key and constraints to roads\n" }, { "from": "human", "value": "DROP TABLE IF EXISTS roads;\n\nCREATE TABLE roads AS\n SELECT\n DISTINCT ON (osm_id)\n osm_id as id,\n name,\n CASE WHEN oneway = 'yes' THEN true ELSE false END AS oneway,\n wa...
sql
chosen
[ { "from": "system", "value": "Fix typos - extra comma\n\nThanks to francescovista https://github.com/AlexTitenko/sqlserver-kit/commit/02dece19c0bdc0b2db13adbc1ad762ec369951f8#commitcomment-23445800\n" }, { "from": "human", "value": "/*\nAuthor: Tim Ford\nOriginal link: http://sqlmag.com/database...
sql
chosen
[ { "from": "system", "value": "Remove keywords not compatible with PG 9.5\n" }, { "from": "human", "value": "CREATE SCHEMA IF NOT EXISTS cdb_crankshaft;\n\nCREATE OR REPLACE FUNCTION\n cdb_crankshaft.CDB_AreasOfInterestLocal(\n subquery TEXT,\n column_name TEXT,\n w_type TEXT,\n ...
sql
chosen
[ { "from": "system", "value": "Add banned field for channel in db\n" }, { "from": "human", "value": "CREATE TABLE IF NOT EXISTS minecord (\n id TINYINT(1) PRIMARY KEY CHECK (id = 0),\n version TINYINT(2) NOT NULL\n);\nINSERT INTO minecord (id, version)\n VALUES(0, 1);\nCREATE TABLE ...
sql
chosen
[ { "from": "system", "value": "Increase URL fields to 2048 charachters to match the VO\n" }, { "from": "human", "value": "--;\n-- Schema upgrade from 5.3.0 to 5.3.1;\n--;\n" }, { "from": "gpt", "value": "--;\n-- Schema upgrade from 5.3.0 to 5.3.1;\n--;\n\n-- Increase URL fields to 204...
sql
chosen
[ { "from": "system", "value": "Use decimal literal to avoid precision problems in TPCH Q6\n" }, { "from": "human", "value": "-- database: presto; groups: tpch,quarantine; tables: lineitem\nSELECT sum(l_extendedprice * l_discount) AS revenue\nFROM\n lineitem\nWHERE\n l_shipdate >= DATE '1994-01-...
sql
chosen
[ { "from": "system", "value": "Add new location and code query\n\n" }, { "from": "human", "value": "-- Shows codes for a game\nSELECT `code_lookup`.`code`, `code_lookup`.`type`, `code_lookup`.`location_id`, `locations`.`internal_note`, `locations`.`is_start`, `locations`.`is_end` FROM `code_looku...
sql
chosen
[ { "from": "system", "value": "Add IF NOT EXISTS modifiers to table defs\n" }, { "from": "human", "value": "-- Keyspace -------------------------------------------------------------------\n\nCREATE KEYSPACE uuuurrrrllll\nWITH replication = {\n -- 'class': 'NetworkTopologyStrategy', 'replicatio...
sql
chosen
[ { "from": "system", "value": "Add comment to stementor.sql file explaining the queries and test data\n" }, { "from": "human", "value": "-- Create tables\n\nCREATE TABLE mentors (\n id SERIAL PRIMARY KEY,\n first_name VARCHAR(100),\n last_name VARCHAR(100),\n email VARCHAR(100),\n company VA...
sql
chosen
[ { "from": "system", "value": "Revert \"Revert \"upgrade script for postgres\"\"\n\nThis reverts commit d72748eb8e71f81e7cddca610ec98a8910dd347f.\n\nConflicts:\n\n\tdb/08to09_pg.sql\n" }, { "from": "human", "value": "-- SQL commands to update an 0.8.x version of Laconica\n-- to 0.9.x.\n\n--these ...
sql
chosen
[ { "from": "system", "value": "Make lddb__dependencies.inCard default to false\n" }, { "from": "human", "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 :=...
sql
chosen
[ { "from": "system", "value": "Create table if not exist.\n" }, { "from": "human", "value": "begin;\n\ncreate table ncaa_sr.polls (\n\tyear\t\t\t\tinteger,\n\tschool_id\t\t\ttext,\n\tschool_name\t\t\ttext,\n\tweek\t\t\t\ttext,\n\trank\t\t\t\tinteger,\n\tprimary key (year,school_id,week)\n);\n\nco...
sql
chosen
[ { "from": "system", "value": "Change strings to integers in DEFAULT\n" }, { "from": "human", "value": "CREATE DATABASE notes;\n\nUSE notes;\n\nCREATE TABLE note_users (\n UserId CHAR(32) PRIMARY KEY,\n UserEmail VARCHAR(255),\n UserPassword VARCHAR(512),\n EmailConfirmation CHAR(32),...
sql
chosen
[ { "from": "system", "value": "Add code to record time user invoked an action in he system\n" }, { "from": "human", "value": "/* The function system_user_schema.util_get_user_state retuns the current state of the user\n* indicated by the _login parameter. If the submitted login doesn't correspond...
sql
chosen
[ { "from": "system", "value": "Add murmur_hash_V3 sql queries to database updates.\n" }, { "from": "human", "value": "ALTER table `sentences` ADD COLUMN `hash` BINARY(16) NOT NULL;" }, { "from": "gpt", "value": "ALTER table `sentences` ADD COLUMN `hash` BINARY(16) NOT NULL;\n\nUPDATE ...
sql
chosen
[ { "from": "system", "value": "[CON-84] Add balance payment transaction type to enable pulling Balancing payments into download transaction\n" }, { "from": "human", "value": "IF (NOT EXISTS(SELECT TransactionType FROM [employer_financial].[PaymentTransactionTypes] WHERE TransactionType = 1))\nBE...
sql
chosen
[ { "from": "system", "value": "MODIFY the mysql sentence for creating the cosmos_user table\n" }, { "from": "human", "value": "DROP DATABASE cosmos_gui;\nCREATE DATABASE cosmos_gui;\nUSE cosmos_gui;\n\nCREATE TABLE cosmos_user (idm_username VARCHAR(128) NOT NULL PRIMARY KEY UNIQUE, username TEXT ...
sql
chosen
[ { "from": "system", "value": "Comment out date field until date-is-blob problem gets resolved.\n" }, { "from": "human", "value": "-- import.sql for TicketManor project\n\ninsert into venues(id, name, streetAddress, city, provState, country, lat, lng) values(1, 'Carnegie Hall', '881 Seventh Avenu...
sql
chosen
[ { "from": "system", "value": "Add index to speed up tests\n" }, { "from": "human", "value": "alter table DOCUMENT_VERSION add column ID bigint;\nalter table DOCUMENT_VERSION add column NAME varchar(255);\n\nalter table ENTITY add column NAME varchar(255);\nalter table ENTITY_VERSION add column C...
sql
chosen
[ { "from": "system", "value": "Fix for Haiti LNSP conversion from Sang to Sang Total\n\nhttps://www.pivotaltracker.com/story/show/60636978\n" }, { "from": "human", "value": "update clinlims.test set description=replace(description, ' Total', '') where description like '%Sang Total%';\r\nupdate cl...
sql
chosen
[ { "from": "system", "value": "Fix bung upgrade in 29 where an extra \"synonyms_html =\" got through\nun-noticed until staging.\n" }, { "from": "human", "value": "\n-- version\nUPDATE db_version\nSET version = 30\nWHERE id = 1;\n" }, { "from": "gpt", "value": "update tree_element ute\...
sql
chosen
[ { "from": "system", "value": "Change column type from boolean to integer\n\nStill looking for a common denominator between SQLite and Postgres.\n" }, { "from": "human", "value": "-- +goose Up\nalter table post add column hidden boolean;\n\nupdate post set hidden=0;\n\nalter table post rename to ...
sql
chosen
[ { "from": "system", "value": "Update latest version history to filter out draft versions\n" }, { "from": "human", "value": "SELECT LatestVersionHistoryID\n\tFROM\n\t(\n\t\tSELECT MAX(VersionHistoryID) OVER (PARTITION BY DocumentID) AS LatestVersionHistoryID\n\t\t\tFROM CMS_VersionHistory\n\t) A...
sql
chosen
[ { "from": "system", "value": "Fix failing drop script on MySQL\n" }, { "from": "human", "value": "drop index ACT_IDX_HI_PRO_INST_END on ACT_HI_PROCINST;\r\ndrop index ACT_IDX_HI_PRO_I_BUSKEY on ACT_HI_PROCINST;\r\ndrop index ACT_IDX_HI_ACT_INST_START on ACT_HI_ACTINST;\r\ndrop index ACT_IDX_HI_A...
sql
chosen
[ { "from": "human", "value": "Add default admins: The cool guys\n" }, { "from": "gpt", "value": "INSERT INTO users (email, first_name, last_name, password, role, shipping_address)\nVALUES ('dj@gmail.com', 'Djidjely', 'Siclait', '1234', 0, 'nowhere');\n\nINSERT INTO users (email, first_name, last_...
sql
chosen