conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Fix typos in monitoring examples.\n" }, { "from": "human", "value": "-- An example of monitoring pgBackRest from within PostgresSQL\n--\n-- Use copy to export data from the pgBackRest info command into the jsonb\n-- type so it can be queried directly by PostgresSQL....
sql
chosen
[ { "from": "system", "value": "Support for MySQL 5.5 and lower\n" }, { "from": "human", "value": "CREATE TABLE `logs` (\n\t`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,\n\t`level` VARCHAR(50) NOT NULL,\n\t`message` TEXT NOT NULL,\n\t`context` LONGTEXT NOT NULL,\n\t`datetime` DATETIME NOT NULL DEFAUL...
sql
chosen
[ { "from": "system", "value": "Add comment to drop ykval_getapikey.\n\n" }, { "from": "human", "value": "-- DROP DATABASE ykval;\nCREATE DATABASE ykval;\nUSE ykval;\n\nCREATE TABLE clients (\n id INT NOT NULL AUTO_INCREMENT,\n active BOOLEAN DEFAULT TRUE,\n created DATETIME NOT NULL,\n secret...
sql
chosen
[ { "from": "system", "value": "Trim output from sysprocesses since they're not variable length...variables. yea.\n" }, { "from": "human", "value": "SELECT spid SPID,\n sp.[status] Status,\n loginame [Login],\n hostname HostName,\n blocked BlockedBy,\n sd.name ...
sql
chosen
[ { "from": "system", "value": "Fix view sql v interventions\n" }, { "from": "human", "value": "CREATE OR REPLACE VIEW gestion.v_interventions AS (\n\tSELECT e.geom, i.*\n\tFROM maintenance_intervention AS i, core_topology AS e\n\tWHERE i.topology_id = e.id\n\tAND i.deleted = FALSE\n);\n\nCREATE O...
sql
chosen
[ { "from": "system", "value": "Make instance config value 1024 rather than 255\n\n\nsvn commit r33795\n" }, { "from": "human", "value": "create table InstanceConfigSetting (\n\tid serial,\n\tinstance integer not null references Instance(id),\n\tname varchar(255) not null,\n\tvalue varchar(255),\n...
sql
chosen
[ { "from": "system", "value": "Add index to measurements time_stamp.\n" }, { "from": "human", "value": "DROP TABLE measurements;\n\nCREATE TABLE measurements (\n id INT PRIMARY KEY NOT NULL AUTO_INCREMENT,\n time_stamp DATETIME,\n stroom_dal FLOAT,\n stroom_piek FLOAT,\n stroom_current FLOAT...
sql
chosen
[ { "from": "system", "value": "Change version function from IMMUTABLE to STABLE\n\nThese functions' results will change when the extension\nis updated.\n" }, { "from": "human", "value": "-- Version number of the extension release\nCREATE OR REPLACE FUNCTION cdb_crankshaft_version()\nRETURNS text ...
sql
chosen
[ { "from": "system", "value": "Fix query to count apprenticeships with missing email addresses \n\n" }, { "from": "human", "value": "CREATE VIEW [DashboardReporting].[ApprenticeshipsWithNoEmail]\n\tAS \nSELECT \n\tC.EmployerAndProviderApprovedOn AS ApprovedOn,\n\tA.Id AS ApprenticeshipId\nFROM A...
sql
chosen
[ { "from": "system", "value": "Fix server_configs.user_email's type in the setup SQL.\n" }, { "from": "human", "value": "CREATE EXTENSION hstore;\n\nCREATE TABLE users (\n email text PRIMARY KEY\n);\n\nCREATE TABLE identities (\n id integer PRIMARY KEY,\n token text UNIQUE\n);\n\nCREATE ...
sql
chosen
[ { "from": "system", "value": "Remove kv table from postgres ddl script\n" }, { "from": "human", "value": "-- Sample database schema for tourbillon\nCREATE TABLE IF NOT EXISTS jobs (\n id VARCHAR PRIMARY KEY,\n data TEXT\n);\n\nCREATE TABLE IF NOT EXISTS workflows (\n id VARCHAR PRIMARY ...
sql
chosen
[ { "from": "system", "value": "Optimize database table field lengths\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(11,8) NOT NULL,\r\n `longitude` decimal(11,...
sql
chosen
[ { "from": "system", "value": "Add UPDATE statement to fix broken data in preview table\n" }, { "from": "human", "value": "ALTER TABLE `previews`\n DROP FOREIGN KEY `previews_ibfk_1`,\n DROP FOREIGN KEY `previews_ibfk_2`,\n DROP INDEX `previews_ibfk_2`,\n CHANGE COLUMN `modified` `mod...
sql
chosen
[ { "from": "system", "value": "Update grants for new signatures\n" }, { "from": "human", "value": "GRANT EXECUTE ON FUNCTION cdb_dataservices_client._DST_PrepareTableOBS_GetMeasure(output_table_name text, function_name text, params json) TO publicuser;\nGRANT EXECUTE ON FUNCTION cdb_dataservices_...
sql
chosen
[ { "from": "system", "value": "Add more bases and toppings\n" }, { "from": "human", "value": "insert into Pizza_Base (id, name, description, active, price) VALUES (1, 'Thin', 'Thin and crispy base', 1, 3.75);\ninsert into Pizza_Base (id, name, description, active, price) VALUES (2, 'Big dough', '...
sql
chosen
[ { "from": "system", "value": "Simplify best end date query a little\n" }, { "from": "human", "value": "select\n min(\n ifsapp.work_time_calendar_api.get_end_date(\n wc.calendar_id,\n ifsapp.work_time_calendar_api.get_end_time(\n wc.calendar_id,\n greatest(\n ...
sql
chosen
[ { "from": "system", "value": "Update script to allow use with integers without a cast\n" }, { "from": "human", "value": "-- complain if script is sourced in psql, rather than via CREATE EXTENSION\n\\echo Use \"CREATE EXTENSION formatbase\" to load this file. \\quit\n\nCREATE FUNCTION to_base(val...
sql
chosen
[ { "from": "system", "value": "Include semester in query for all enrolled courses.\n" }, { "from": "human", "value": "select\n\tcourses.code as course_code,\n\tcourses.name as course_name,\n\tinstitutions.name as institution_name\nfrom course_enrolled_students\ninner join courses\n\ton course_enr...
sql
chosen
[ { "from": "system", "value": "Insert library label info into int table before dropping column\n" }, { "from": "human", "value": "ALTER TABLE `library` DROP FOREIGN KEY `Record`;||\nALTER TABLE `library` DROP INDEX `Label_idx`;||\nALTER TABLE `library` DROP COLUMN `labelid`;\n" }, { "from...
sql
chosen
[ { "from": "system", "value": "Add update to primary locations\n\nWe also need to run this update statement to compute all of the primary\nstart/end locations.\n" }, { "from": "human", "value": "SET work_mem TO '256MB';\n\nINSERT INTO rnacen.rnc_coordinates AS t1 (\n accession,\n name,\n local...
sql
chosen
[ { "from": "system", "value": "Add comment\n(just a test commit!)\n\ngit-svn-id: ad2a872dfb5accdcee22c80d0a136769e8f61d01@1194 e96eaf88-093e-0410-925f-862d53288611\n" }, { "from": "human", "value": "OPTIONS\r\ncompile yes\r\nmerge trees.all.pak\r\n" }, { "from": "gpt", "value": "OPTIO...
sql
chosen
[ { "from": "system", "value": "Feat: Add table schema for players and matches\n" }, { "from": "human", "value": "-- Table definitions for the tournament project.\n--\n-- Put your SQL 'create table' statements in this file; also 'create view'\n-- statements if you choose to use it.\n--\n-- You can...
sql
chosen
[ { "from": "system", "value": "Extend R/O privileges in PostgreSQL\n\n`amy_ro` read-only role requires SELECT privileges on sequences\nfor the backup to work.\n" }, { "from": "human", "value": "-- create database\nCREATE DATABASE amy WITH OWNER postgres;\n\n-- create database user (read/write)\nC...
sql
chosen
[ { "from": "system", "value": "Fix autoupdate create new table" }, { "from": "human", "value": "#2.5.0\n \nCREATE TABLE IF NOT EXISTS `#__improvemycity_timestamp` (\n `id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIME...
sql
chosen
[ { "from": "system", "value": "Use REPLACE INTO (maybe the new rows already exist)\nRemoved db specification.\n" }, { "from": "human", "value": "--\n-- Time Warsong Gulch\n--\nINSERT INTO `ascemu_world`.`worldstate_templates` (`map`, `zone`, `field`, `value`) VALUES (489, 3277, 4247, 1);\nINSERT ...
sql
chosen
[ { "from": "system", "value": "Add locale not empty contraint\n" }, { "from": "human", "value": "CREATE TABLE projects (\n id serial PRIMARY KEY,\n keys text[]\n);\n\nCREATE TABLE documents (\n id serial PRIMARY KEY,\n locale varchar(128),\n pairs hstore,\n project_id integer RE...
sql
chosen
[ { "from": "system", "value": "Fix \"null null\" user names during schema upgrade from 9 to 10\n\nA couple of commits back we fixed the OpenID account creator to\ncorrectly set the full_name to NULL if the first name and the\nlast name weren't supplied by the OpenID provider. However, a\nsite may have many ...
sql
chosen
[ { "from": "system", "value": "Add table for export profiles.\n" }, { "from": "human", "value": "CREATE TABLE IF NOT EXISTS lddb (\n id text not null unique primary key,\n data jsonb not null,\n collection text not null,\n changedIn text not null,\n changedBy text,\n checksum te...
sql
chosen
[ { "from": "system", "value": "Fix unique key for users_vocabulary\n\nWith the renaming of `vocabulary_id` into `hash`, the unique index was set on (user_id, hash) while it should have been on (user_id, vocabulary_id). This was preventing users from adding unexisting vocabulary to their list.\n" }, { ...
sql
chosen
[ { "from": "system", "value": "Change users table migration a bit\n" }, { "from": "human", "value": "CREATE TYPE role AS ENUM ('user', 'admin');\n\nCREATE TABLE users (\n id SERIAL PRIMARY KEY,\n email VARCHAR(255) NOT NULL,\n password_digest VARCHAR(255) NOT NULL,\n re...
sql
chosen
[ { "from": "system", "value": "Delete openids of expired users.\n" }, { "from": "human", "value": "-- run as a cronjob: psql packages -f tools/daily.sql -o /dev/null\ndelete from cookies where last_seen < now()-INTERVAL'1day';\ndelete from openid_sessions where expires < now();\ndelete from openi...
sql
chosen
[ { "from": "system", "value": "Fix a SQL syntax error\n\nAdd parentheses around \"now() at time zone 'UTC'\" in a column\ndefinition requires to avoid a SQL syntax error.\n" }, { "from": "human", "value": "-- avoid innocuous NOTICEs about automatic sequence creation\nset client_min_messages='WARN...
sql
chosen
[ { "from": "system", "value": "Change log level back to warning\n" }, { "from": "human", "value": "CREATE OR REPLACE FUNCTION ddl_tools.schema__drop(\n schema_name name\n) RETURNS void LANGUAGE plpgsql SET client_min_messages = 'DEBUG' AS $body$\nDECLARE\n prefix name;\nBEGIN\n FOREACH prefi...
sql
chosen
[ { "from": "system", "value": "Add update user photo sql function.\n" }, { "from": "human", "value": "-- :name create-profile :<! :1\n-- :doc Create a new user entry.\ninsert into users (id, fullname, username, email, password, metadata)\n values (:id, :fullname, :username, :email, :password, :m...
sql
chosen
[ { "from": "system", "value": "Fix the migration SQL script for Redshift\n\nClose #337\n\nSquashed commit of the following:\n\ncommit 64957592abd8c236f58f4dee20d24f338dd9078a\nAuthor: Nan Jiang <njiang028@gmail.com>\nDate: Mon Apr 4 20:27:20 2016 -0400\n\n Fix migration script for redshift\n" }, { ...
sql
chosen
[ { "from": "system", "value": "Update db schema and add new table for application tracing\n" }, { "from": "human", "value": "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";\n\nCREATE TABLE traces(\ntrace_uuid uuid PRIMARY KEY,\ntransaction_uuid uuid,\norigin_uuid uuid,\ntrace_name text,\nstart_time...
sql
chosen
[ { "from": "system", "value": "Use case-insensitive sorting for tags\n" }, { "from": "human", "value": "CREATE TABLE users (\n\tid INTEGER PRIMARY KEY,\n\tuser TEXT UNIQUE NOT NULL,\n\tmail TEXT,\n\tadmin INTEGER NOT NULL\n);\nCREATE TABLE images (\n\tid INTEGER PRIMARY KEY,\n\tlocation TEXT NOT ...
sql
chosen
[ { "from": "system", "value": "Add UUID to signages view" }, { "from": "human", "value": "CREATE VIEW {# geotrek.signage #}.v_signages AS (\n\tSELECT e.geom, e.id, t.*\n\tFROM signage_signage AS t, signage_signagetype AS b, core_topology AS e\n\tWHERE t.topo_object_id = e.id AND t.type_id = b.id\...
sql
chosen
[ { "from": "system", "value": "Make MySQL user passwords match\n" }, { "from": "human", "value": "# Create a MySQL user with limited privileges for backup purposes.\n# This isn't strictly necessary on a local machine - you could just use the root\n# MySQL user in the backup script.\n# ===========...
sql
chosen
[ { "from": "system", "value": "Simplify CSA 1.02 SQL query with UNNEST\n" }, { "from": "human", "value": "/*\n * Copyright 2022 Google LLC\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 obt...
sql
chosen
[ { "from": "system", "value": "Fix the Oracle upgrade script\n\nChange-Id: I06c65138dc4ead7ef7aa0183b6ef4212faaea0cd\n" }, { "from": "human", "value": "ALTER TABLE share ADD latency_threshold NUMBER(*,0);\n\nUPDATE share SET latency_threshold = 20;\nCOMMIT;\nQUIT;\n" }, { "from": "gpt", ...
sql
chosen
[ { "from": "system", "value": "Fix schema delta 15 on postgres in the very unlikley event that anyone upgrades to 15...\n" }, { "from": "human", "value": "-- Drop, copy & recreate pushers table to change unique key\n-- Also add access_token column at the same time\nCREATE TABLE IF NOT EXISTS push...
sql
chosen
[ { "from": "system", "value": "Use a single error per line.\n" }, { "from": "human", "value": "start transaction;\nCREATE TABLE my_copytest (\ncol1 INT,\ncol2 INT,\ncol3 INT,\ncol4 VARCHAR(1),\ncol5 VARCHAR(1)\n) ;\n\nCOPY 3 RECORDS INTO my_copytest FROM stdin USING DELIMITERS '|','\\n'\nNULL as ...
sql
chosen
[ { "from": "system", "value": "Add improvements to images tables (migrations).\n" }, { "from": "human", "value": "CREATE TABLE IF NOT EXISTS image_collections (\n id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),\n created_at timestamptz NOT NULL DEFAULT clock_timestamp(),\n modified_at timestam...
sql
chosen
[ { "from": "system", "value": "Add 'order by' to get the most recent job execution first\n" }, { "from": "human", "value": "select E.JOB_EXECUTION_ID, E.START_TIME, E.END_TIME, E.STATUS, E.EXIT_CODE, E.EXIT_MESSAGE, E.CREATE_TIME, E.LAST_UPDATED, E.VERSION, I.JOB_INSTANCE_ID, I.JOB_NAME, P.KEY_NA...
sql
chosen
[ { "from": "system", "value": "Fix Mastery commit typos. Thx to kraven5 for pointing out\n" }, { "from": "human", "value": "-- fix Mastery (thx Nevan)\n\nDELETE FROM spell_linked_spell where spell_trigger IN (86497, 86491, 86492, 86493, 86494, 86495, 86496, 86497, 86498, 86500);\nINSERT INTO spel...
sql
chosen
[ { "from": "system", "value": "Comment out unused endpoint for lexEVS 6.0.3." }, { "from": "human", "value": "/*L\r\n Copyright ScenPro Inc, SAIC-F\r\n\r\n Distributed under the OSI-approved BSD 3-Clause License.\r\n See http://ncip.github.com/cadsr-cdecurate/LICENSE.txt for details.\r\nL*/\r\...
sql
chosen
[ { "from": "system", "value": "Replace the implicit unique index with an explicit one.\n\nThis is functionally identical, but because we rely on this index we should make it explicit and named.\n\n(for example, if the unique constraint was dropped in the future we would still want the column[s] indexed.)\n" ...
sql
chosen
[ { "from": "system", "value": "mdb: Add file_to_album SQL index to speed up albums-with-person listings\n" }, { "from": "human", "value": "\nCREATE TABLE album_file\n ( album_id INTEGER NOT NULL\n , file_id INTEGER NOT NULL\n , PRIMARY KEY (album_id, file_id)\n , FOREIGN KEY (album...
sql
chosen
[ { "from": "system", "value": "Drop tables in correct order.\n\nDrop tables ordered to avoid dependency errors. Add 'if exists' clause\nso script can be run again. Suppress warnings. Stop on errors.\n" }, { "from": "human", "value": "-- -------------------\n-- Drop abac, identity, account, abac, ...
sql
chosen
[ { "from": "system", "value": "Remove \"Journal of Micropalaeontology\" from The Geological Society of London\n\nSee https://github.com/citation-style-language/journals/pull/60\n(journal moved to Copernicus)\n" }, { "from": "human", "value": "Title\tISSN\teISSN\nEngineering Geology Special Public...
sql
chosen
[ { "from": "system", "value": "Fix primary key in PDO example schema\n\nFixed primary key in refresh_tokens to use the correct column of\nrefresh_token\n" }, { "from": "human", "value": "SET SQL_MODE=\"NO_AUTO_VALUE_ON_ZERO\";\n\nCREATE TABLE `auth_codes` (\n `code` varchar(40) NOT NULL,\n `cli...
sql
chosen
[ { "from": "system", "value": "Fix format of utc timestamp default\n" }, { "from": "human", "value": "-- avoid innocuous NOTICEs about automatic sequence creation\nset client_min_messages='WARNING';\n\n-- Tell psql to stop on an error. Default behavior is to proceed.\n\\set ON_ERROR_STOP 1\n\nset...
sql
chosen
[ { "from": "system", "value": "Delete entire cohort including flexible employment data\n\n" }, { "from": "human", "value": "CREATE TABLE [dbo].ApprenticeshipFlexibleEmployment\n(\n\t[ApprenticeshipId] BIGINT NOT NULL,\n\t[EmploymentPrice] INT NULL,\n\t[EmploymentEndDate] DATETIME2 NULL,\n\tCONST...
sql
chosen
[ { "from": "system", "value": "Make the ID and RSVP CODE a composite primary key.\n" }, { "from": "human", "value": "CREATE TABLE IF NOT EXISTS reservation (\n id SERIAL,\n reservation_title VARCHAR(255) NOT NULL,\n address_line_one ...
sql
chosen
[ { "from": "system", "value": "Remove old and unused table\n\nThis is replaced by two columns in ip_net_pool table instead.\n" }, { "from": "human", "value": "\nDROP TABLE ip_net_plan;\nDROP TABLE ip_net_pool_def_prefix_len;\nDROP TABLE ip_net_pool;\nDROP TABLE ip_net_schema;\n\nDROP TYPE ip_net_...
sql
chosen
[ { "from": "system", "value": "Patch script changed to \"star\" from \"attend\".\n" }, { "from": "human", "value": "--\n-- Table structure for table `user_talk_attend`\n--\n\nDROP TABLE IF EXISTS `user_talk_attend`;\nCREATE TABLE `user_talk_attend` (\n `uid` int(11) NOT NULL,\n `tid` int(11) NO...
sql
chosen
[ { "from": "system", "value": "Rename \"universe\" to \"galaxy\" and create a galaxy table with referencial integrity for bodies.\n" }, { "from": "human", "value": "BEGIN;\n\nCREATE TYPE body_kind AS ENUM (\n 'star_white',\n 'star_yellow',\n 'star_red',\n 'planet_blue',\n 'planet_g...
sql
chosen
[ { "from": "system", "value": "Select fixed with variable, global constants\n" }, { "from": "human", "value": "--#SET TERMINATOR @\nSET CURRENT SCHEMA LOGGER @\n\n/**\n * Function that returns the value of the given key from the configuration\n * table.\n *\n * IN KEY\n * Identification of the k...
sql
chosen
[ { "from": "system", "value": "Migrate report from SQLite to PostgreSQL\n" }, { "from": "human", "value": "SELECT\n (\"http://zoomhub.net/\" || content.hashId) AS URL,\n content.numViews AS Views,\n ROUND(image.width * image.height / 1e6, 1) AS Megapixels\nFROM\n content, image\nWHERE\n cont...
sql
chosen
[ { "from": "system", "value": "Add index to search for AcceptedAnswers for Posts faster.\n" }, { "from": "human", "value": "-- hash index takes too long to create\nCREATE INDEX posts_post_type_id_idx on Posts USING btree (PostTypeId)\n WITH (FILLFACTOR = 100);\nCREATE INDEX posts_score_idx ...
sql
chosen
[ { "from": "system", "value": "Remove significant white space for string field.\n" }, { "from": "human", "value": "create table test1711251 (pre integer not null primary key, size integer not null,\nlevel smallint not null, kind smallint not null, prop char (32));\n\ncopy 3 records into test17112...
sql
chosen
[ { "from": "system", "value": "Index is too long on live server\n" }, { "from": "human", "value": "ALTER TABLE spreadsheet\n ADD filepath VARCHAR(500)\n;\n\nALTER TABLE spreadsheet\nADD CONSTRAINT uc_spreadsheet_filepath UNIQUE (filepath)\n;" }, { "from": "gpt", "value": "ALTER TAB...
sql
chosen
[ { "from": "system", "value": "Add null check for guest_id and guest_app\n" }, { "from": "human", "value": "DROP TYPE IF EXISTS app;\nCREATE TYPE app AS ENUM ('telegram', 'vk');\n\nCREATE TABLE IF NOT EXISTS rooms (\n id SERIAL PRIMARY KEY,\n owner_id BIGINT NOT NULL,\n owner_app app NOT NULL,...
sql
chosen
[ { "from": "system", "value": "Fix delimiter in sql script\n" }, { "from": "human", "value": "CREATE TABLE k3_result (\n pageURL text,\n pageRank int\n);\n\nCOPY k3_result FROM '/results/q1_1.csv' WITH DELIMITER ',';\nCOPY k3_result FROM '/results/q1_2.csv' WITH DELIMITER ',';\n" }, { "...
sql
chosen
[ { "from": "system", "value": "Apply syntax improvement on the legacy DDL aswell\n" }, { "from": "human", "value": "CREATE TABLE IF NOT EXISTS public.journal (\n ordering BIGSERIAL,\n persistence_id VARCHAR(255) NOT NULL,\n sequence_number BIGINT NOT NULL,\n deleted BOOLEAN DEFAULT FALSE NOT ...
sql
chosen
[ { "from": "system", "value": "Add missing SVN id keyword \n\ngit-svn-id: a7fabbc6a7c54ea5c67cbd16bd322330fd10cc35@46618 b456876b-0849-0410-b77d-98878d47e9d5\n" }, { "from": "human", "value": "-- tiki_myisam.sql is run after tiki.sql if MyISAM is being installed\nCREATE FULLTEXT INDEX ft ON tiki_...
sql
chosen
[ { "from": "system", "value": "Remove the duplicated entry \"route.all-resources\".\n\nIt is just a clean up; no impact to the system.\n" }, { "from": "human", "value": "#This contains all the db schema changes that are going to be applied every time the server is deployed\ndelete from ofProperty...
sql
chosen
[ { "from": "system", "value": "inventory_report: Add documentation about tables values\n\nCode readability improvement.\n\nChange-Id: Ia35ea91f812e9b9a2a564770c054abef2babc7bc\nSigned-off-by: Douglas Schilling Landgraf <cb5f9630225b7afa1e13760d30868c8ce876fc60@redhat.com>\n" }, { "from": "human", ...
sql
chosen
[ { "from": "system", "value": "Add table to map oskari users to roles\n" }, { "from": "human", "value": "DROP TABLE IF EXISTS oskari_users;\nDROP TABLE IF EXISTS oskari_roles;\n\nCREATE TABLE oskari_users (\n id serial NOT NULL,\n user_name character varying(25) NOT NULL,\n first_name characte...
sql
chosen
[ { "from": "system", "value": "Update DB schema for audit table\n" }, { "from": "human", "value": "--\n-- Database for gas-api\n--\n\n-- --------------------------------------------------------\n\n--\n-- Table structure for table `newusers`\n--\n\nCREATE TABLE `newusers` (\n `ID` int(11) NOT NU...
sql
chosen
[ { "from": "system", "value": "Create the external database user with a stored procedure\n\nUsing a stored procedure allows us to check if the external database user exists before we attempt to create it. This in turn avoids a red error from coming up during the `vagrant up` process.\n" }, { "from": ...
sql
chosen
[ { "from": "system", "value": "Make sql function PostgreSQL 9.1 compatible\n" }, { "from": "human", "value": "DROP FUNCTION IF EXISTS case_has_transactions_since_sync(text, text, timestamp with time zone);\n\nCREATE FUNCTION case_has_transactions_since_sync(p_case_id text, p_sync_log_id text, syn...
sql
chosen
[ { "from": "system", "value": "[JM-1315] Switch from ALTER COLUMN to CHANGE COLUMN.\n\n\ngit-svn-id: 2e83ce7f183c9abd424edb3952fab2cdab7acd7f@10182 b35dd754-fafc-0310-a699-88a17e54d16e\n" }, { "from": "human", "value": "# jiveRoster: Change jid column to varchar\nALTER TABLE jiveRoster ALTER COLU...
sql
chosen
[ { "from": "system", "value": "Add an index on AcceptedAnswerId.\n" }, { "from": "human", "value": "-- hash index takes too long to create\nCREATE INDEX posts_post_type_id_idx ON Posts USING btree (PostTypeId)\n WITH (FILLFACTOR = 100);\nCREATE INDEX posts_score_idx ON Posts USING btree (Sc...
sql
chosen
[ { "from": "system", "value": "Enlarge SQL fields to more comfortable sizes\n" }, { "from": "human", "value": "\nSET SQL_MODE = \"NO_AUTO_VALUE_ON_ZERO\";\nSET time_zone = \"+00:00\";\n\n/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;\n/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@C...
sql
chosen
[ { "from": "system", "value": "Add certificate generation data on user table\n\n" }, { "from": "human", "value": "-- phpMyAdmin SQL Dump\n-- version 4.7.1\n-- https://www.phpmyadmin.net/\n--\n-- Host: localhost\n-- Generation Time: Aug 23, 2017 at 08:05 AM\n-- Server version: 10.1.23-MariaDB-9+de...
sql
chosen
[ { "from": "system", "value": "Add new sql functions for work with project shares.\n" }, { "from": "human", "value": "-- :name create-project :<! :1\n-- :doc Create new project entry.\ninsert into projects (id, \"user\", name)\n values (:id, :user, :name)\n returning *;\n\n-- :name update-proje...
sql
chosen
[ { "from": "system", "value": "Update the clinical_significance SET in variation and variation_feature\n" }, { "from": "human", "value": "## Add clinical_significance to variation_feature (copied from variation)\nALTER TABLE variation_feature\nADD COLUMN clinical_significance\nSET('drug-response'...
sql
chosen
[ { "from": "system", "value": "Join on the module to allow the uuid matching condition.\n" }, { "from": "human", "value": "-- arguments: id:string; filename:string\nSELECT file\nFROM module_files as mf\nLEFT JOIN files f on mf.fileid = f.fileid\nWHERE mf.uuid = %(id)s AND mf.filename = %(filename...
sql
chosen
[ { "from": "system", "value": "Use a 64-bit integer for the JSON hash, for 64bit machines\n" }, { "from": "human", "value": "-- This is a naive, unoptimized way of checking two\n-- JSON objects for equality. It uses python's json\n-- module to load and re-dump the json object while\n-- sorting it...
sql
chosen
[ { "from": "system", "value": "Fix table name in SQL.\n" }, { "from": "human", "value": "CREATE TABLE `translations` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `domain` varchar(100) NOT NULL,\n `locale` varchar(5) NOT NULL,\n `singular` varchar(255) NOT NULL,\n `plural` varchar(255) DEFAULT...
sql
chosen
[ { "from": "system", "value": "Add relations table for responses. Also mark required values not null.\n" }, { "from": "human", "value": "CREATE TABLE CoffeePeople (\n Id serial PRIMARY KEY,\n Name varchar(50) not null,\n Lat double precision,\n Lng double precision\n);\n\nCREATE TABLE CoffeeT...
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,\n price\t\tint \t\t\tNULL)\n;\n\n" }, { "from": "gpt", "value": "ALTER TABLE SC_Classifieds_Classifie...
sql
chosen
[ { "from": "system", "value": "Fix the query and test insert Argomenti.\n" }, { "from": "human", "value": "#Create db 'des' (Database-Exercise-System)\nCREATE DATABASE IF NOT EXISTS des; \n\n#Create 'argomenti' table\nCREATE TABLE IF NOT EXISTS argomenti(\n\tid INT PRIMARY KEY AUTO_INCREMENT NOT ...
sql
chosen
[ { "from": "system", "value": "Move the event keeping the same event_id.\n" }, { "from": "human", "value": "SET @start_date := '2012-08-10 01:37:00';\nSET @end_date := '2012-08-13 12:33:00';\n\nDROP VIEW IF EXISTS events;\nCREATE VIEW events AS\nSELECT a.event_id as id,\n a.email,\n ...
sql
chosen
[ { "from": "system", "value": "Remove hardcoded reference of GCP_PROJECT\n" }, { "from": "human", "value": "SELECT\n asn as asn,\n ip as cidr_ip,\n ip_start as start_ip,\n ip_end as end_ip,\n NET.IPV4_TO_INT64(NET.IP_FROM_STRING(ip_start)) AS start_ip_int,\n NET.IPV4_TO_INT64(NE...
sql
chosen
[ { "from": "system", "value": "Check for empty urls when migration to custom basemaps\n\nWhen migrating to custom basemaps do not migrate empty urls.\n" }, { "from": "human", "value": "# --- !Ups\nCREATE TABLE IF NOT EXISTS user_basemaps(\n id SERIAL NOT NULL PRIMARY KEY,\n created timestamp wi...
sql
chosen
[ { "from": "system", "value": "Fix user ID in migration 32\n" }, { "from": "human", "value": "ALTER TABLE jam\nADD COLUMN jam_default_icon_url TEXT NULL AFTER jam_colors;\n\nUPDATE jam\nSET jam_default_icon_url = \"logo.png\";\n\nINSERT INTO config \n(config_lastedited, config_lasteditedby, confi...
sql
chosen
[ { "from": "system", "value": "Check if this make codacy happy\n" }, { "from": "human", "value": "CREATE TABLE IF NOT EXISTS `aircraft_owner` (\n `owner_id` int(11) NOT NULL AUTO_INCREMENT,\n `registration` varchar(20) NOT NULL,\n `base` varchar(255) DEFAULT NULL,\n `owner` varchar(255) NOT N...
sql
chosen
[ { "from": "system", "value": "Change field size and default. Add datestamp for when the item was last edited\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 VARCH...
sql
chosen
[ { "from": "system", "value": "Set db default collation & charset\n\nHopefully this will fix Travis errors which occur when loading fixtures, like\n```ruby\nActiveRecord::StatementInvalid: Mysql2::Error: Incorrect string value: '\\xCE\\x95\\xCE\\xBB\\xCE\\xBB...' for column 'name' at row 1: INSERT INTO `lang...
sql
chosen
[ { "from": "system", "value": "Fix wrong column names, '_' separated to camel case column names.\n" }, { "from": "human", "value": "-- add the name column, which was missing before\nalter table configurations\n\tadd name varchar(250) null;\n\n-- add the descriptions column\nalter table configurat...
sql
chosen
[ { "from": "system", "value": "Add primary key to scores table\n" }, { "from": "human", "value": "/*==LICENSE==\nThis file is part of Musec.\nCopyright (C) 2013 Florian Meißner\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public Li...
sql
chosen
[ { "from": "system", "value": "Add test of name in trend record\n" }, { "from": "human", "value": "BEGIN;\n\nSELECT plan(2);\n\nSELECT trend_directory.create_table_trend_store(\n 'test1',\n 'some_entity_type_name',\n '900',\n ARRAY[\n ('x', 'integer', 'some column with integer ...
sql
chosen
[ { "from": "system", "value": "Use WM_CONCAT - exists in Oracle < 11.2\n\ngit-svn-id: 410459702e6123a874d92574e1336b0959d85891@13526 2913f559-6b04-0410-9a09-c530ee9f5186\n" }, { "from": "human", "value": "set head off\nset newp none\nset recsep off\nset echo off\nset serveroutput off\nset tab off...
sql
chosen
[ { "from": "system", "value": "Fix issues with database script\n" }, { "from": "human", "value": "# Script to drop and recreate all databases and users\n\n# Do some dummy grants, which will create the user if it didn't already\n# exist, so that the following DROP USER won't give an error:\nGRANT ...
sql
chosen
[ { "from": "system", "value": "Change id column to msid\n" }, { "from": "human", "value": "-- Author: dan.leehr@nescent.org\n--\n\n-- Organizations\nCREATE SEQUENCE organization_seq;\nCREATE TABLE organization\n(\n organization_id INTEGER PRIMARY KEY not null default nextval('organization_seq'),...
sql
chosen
[ { "from": "system", "value": "Remove koji user privileges on cachito DB\n\nSigned-off-by: Athos Ribeiro <9cdfc39bfa10853bf9ad64090808d55fee7504ca@redhat.com>\n" }, { "from": "human", "value": "CREATE USER cachito WITH PASSWORD 'mypassword';\nCREATE DATABASE cachito;\nGRANT ALL PRIVILEGES ON DATA...
sql
chosen
[ { "from": "system", "value": "Add another composite index on Posts.\n\nThe index on OwnerUserId and CreationDate helps in queries which group\nor partition based on these attributes.\n" }, { "from": "human", "value": "-- hash index takes too long to create\nCREATE INDEX posts_post_type_id_idx on...
sql
chosen