sql stringlengths 6 1.05M |
|---|
{% macro max_abs_scaler(source_table,source_column, include_columns='*') %}
with aggregates as (
select max(abs({{ source_column }})) as max_abs_value
from {{ source_table }})
select
{% for column in include_columns %}
{{ source_table }}.{{ column }},
{% endfor %}
{{ source_column }} / max_abs_value AS {{ source_c... |
<filename>db-migrations/6_missing_constraints.up.sql
ALTER TABLE survey.survey ADD CONSTRAINT survey_reference_unique UNIQUE (surveyref);
ALTER TABLE survey.survey ADD CONSTRAINT survey_shortname_unique UNIQUE (shortname);
|
<reponame>harry2303/SQL-Script-4-BW-Consultants
/* Automatisiertes Löschen der DB-Tabellen des Demo Datenmodells
zur Schulung "SQL Script 4 BW Consultants"
per DDL CREATE Anweisungen */
-- <NAME>, 24.04.2020
DROP TABLE banks CASCADE;
DROP TABLE bp CASCADE;
DROP TABLE accounts CASCADE;
DROP TABLE saldos;
DROP TABLE tra... |
IF SERVERPROPERTY ('IsHadrEnabled') = 1
BEGIN
SELECT
AGC.name -- Availability Group
, RCS.replica_server_name -- SQL cluster node name
, ARS.role_desc -- Replica Role
, AGL.dns_name -- Listener Name
FROM
sys.availability_groups_cluster AS AGC
INNER JOIN sys.dm_hadr_availability_replica_cluster_states AS RCS
... |
<reponame>Amancham/v3_stable<filename>docs/upgrade20_step4.sql
-- --------------------------------------------------------
--
-- Table structure for table `fanfiction_authorfields`
--
CREATE TABLE `fanfiction_authorfields` (
`field_id` int(11) NOT NULL auto_increment,
`field_type` tinyint(4) NOT NULL ... |
<reponame>statisticsnorway/klass-subsets-setup<filename>init-db-and-user.sql
CREATE USER lds WITH PASSWORD '<PASSWORD>';
CREATE DATABASE lds;
GRANT ALL PRIVILEGES ON DATABASE lds TO lds;
CREATE USER sagalog WITH PASSWORD '<PASSWORD>';
CREATE DATABASE sagalog;
GRANT ALL PRIVILEGES ON DATABASE sagalog TO sagalog;
|
<reponame>arempe/twu-biblioteca-annarempe
INSERT INTO book (id, title)
VALUES (11, "The Pragmatic Programmer");
INSERT INTO member(id, name)
VALUES (43, "<NAME>");
INSERT INTO checkout_item (member_id, book_id)
VALUES (43, 11);
SELECT member.name
FROM member, checkout_item, book
WHERE checkout_item.book_id = book.... |
<reponame>PracticeEngine/GLIntegration<gh_stars>0
CREATE PROCEDURE [dbo].[pe_NL_MTD_Extract]
AS
DECLARE @MinRowVer binary(8)
DECLARE @MaxRowVer binary(8)
SELECT @MinRowVer = MaxRowVer FROM tblTranNominalMTDControl WHERE Id = 1
SET @MaxRowVer = MIN_ACTIVE_ROWVERSION()
INSERT INTO tblTranNominalMTD(DebtTranIndex, Pr... |
{# The default implementation returns 'string' which is not a supported type in Teradata #}
{# Here, we say 'LONG VARCHAR' as we do not know how the type will be used. In most scenarios #}
{# it is better to use VARCHAR of specific size rather than calling this macro #}
{%- macro teradata__type_string() -%}
LONG V... |
-- MySQL dump 10.13 Distrib 5.7.17, for macos10.12 (x86_64)
--
-- Host: apijson.cn Database: sys
-- ------------------------------------------------------
-- Server version 5.7.19-log
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS *... |
<gh_stars>10-100
{% macro result_value(single_column_query) %}
{% set results_list = [] %}
{% set query = single_column_query %}
{% if 'select' in query %}
{% set results = run_query(query) %}
{%- if results %}
{%- do results_list.append(results[0].values()[0]) %}
{% en... |
<reponame>cncf/clomonitor
-- Start transaction and plan tests
begin;
select plan(17);
-- Check expected extension exist
select has_extension('pgcrypto');
-- Check expected tables exist
select has_table('organization');
select has_table('project');
select has_table('report');
select has_table('repository');
-- Check ... |
<filename>t/sql/workalias.sql
SET client_min_messages TO 'warning';
INSERT INTO work (id, gid, name)
VALUES (1, '945c079d-374e-4436-9448-da92dedef3cf', 'Name'),
(2, '73371ea0-7217-11de-8a39-0800200c9a66', 'Empty Work'),
(3, '686cdcc0-7218-11de-8a39-0800200c9a66', 'Name');
INSERT INTO work_al... |
<reponame>loujine/musicbrainz-server<gh_stars>100-1000
\set ON_ERROR_STOP 1
BEGIN;
CREATE TABLE link_creditable_attribute_type (
attribute_type INT NOT NULL PRIMARY KEY
);
CREATE TABLE link_attribute_credit (
link INT NOT NULL, -- PK, references link.id
attribute_type INT NOT NULL, -- PK, references link_credi... |
<filename>openGaussBase/testcase/SQL/DDL/default_constraint/Opengauss_Function_DDL_Default_Case0018.sql
-- @testpoint: default含汉字
drop table if exists tbl_07;
--@testpoint:特殊字符
create table tbl_07(
id int,
c_varchar varchar(1025) not null default '汉字中国高斯汉字中国高斯汉字中国高斯汉字中国高斯汉字中国高斯汉字中国高斯汉字中国高斯汉字中国高斯汉字中国高斯汉字中国高斯汉字中国高斯汉字中国高... |
<reponame>opengauss-mirror/Yat
-- @testpoint:opengauss关键字excluding(非保留),作为用户名
--关键字excluding作为用户名不带引号,创建成功
drop user if exists excluding;
CREATE USER excluding PASSWORD '<PASSWORD>';
drop user excluding;
--关键字excluding作为用户名加双引号,创建成功
drop user if exists "excluding";
CREATE USER "excluding" PASSWORD '<PASSWORD>';
drop... |
<reponame>lol768/tabula
ALTER TABLE Department
ADD (
allowExtensionRequests number(1,0),
extensionGuidelineSummary nvarchar2(4000),
extensionGuidelineLink nvarchar2(255)
); |
<reponame>brennonatal/harvard-cs50x<gh_stars>0
SELECT m.title
FROM movies m
INNER JOIN stars s
ON s.movie_id = m.id
INNER JOIN people p
ON s.person_id = p.id
WHERE p.name LIKE '<NAME>' AND m.title IN(
SELECT m.title
FROM movies m
INNER JOIN stars s
ON s.movie_id = m.id
INNER JOIN people p
ON s.person_id... |
<reponame>danielbozieanu/CRM
-- phpMyAdmin SQL Dump
-- version 4.4.15.9
-- https://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Feb 13, 2017 at 10:24 AM
-- Server version: 5.5.50-MariaDB
-- PHP Version: 5.4.16
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACT... |
INSERT INTO `permissions` (`id`, `name`, `label`, `created_at`, `updated_at`) VALUES
(1, 'users', 'Menu Usuário', '2020-01-30 16:38:13', '2020-01-30 16:38:31'),
(2, 'create_user', 'Cadastrar Usuário', '2020-01-30 16:39:02', '2020-01-30 16:39:02'),
(3, 'update_user', 'Alterar Usuário', '2020-01-30 16:39:21', '2020-01-30... |
CREATE DATABASE IF NOT EXISTS `databasics` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */;
USE `databasics`;
-- MySQL dump 10.13 Distrib 8.0.22, for Linux (x86_64)
--
-- Host: localhost Database: databasics
-- ------------------------------------------------... |
<filename>db/seed.sql
USE burgers_db;
INSERT INTO burgers (burger_name) values ("Teddy's");
INSERT INTO burgers (burger_name) values ("Rain City Burgers");
INSERT INTO burgers (burger_name) values ("BurgerMaster");
INSERT INTO burgers (burger_name) values ("206 Burger");
INSERT INTO burgers (burger_name) values ("Litt... |
--
-- PostgreSQL database dump
--
-- Dumped from database version 12.4
-- Dumped by pg_dump version 13.3
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', fal... |
-- phpMyAdmin SQL Dump
-- version 4.0.10.7
-- http://www.phpmyadmin.net
--
-- Servidor: localhost
-- Tiempo de generación: 21-01-2015 a las 17:08:32
-- Versión del servidor: 5.5.40-cll
-- Versión de PHP: 5.4.23
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@... |
<reponame>utkarsh1097/COL362-Assignments<gh_stars>0
/*Need to verify the code once again, with some test cases*/
CREATE TABLE student(
student_id TEXT PRIMARY KEY,
name TEXT
);
CREATE TABLE course(
course_id TEXT PRIMARY KEY,
name TEXT
);
CREATE TABLE registers(
student_id TEXT references student(student_id) ... |
<reponame>jeffsteed/Sinatra_Shopping_List
INSERT INTO items (name, qty) VALUES ('Kraft Macaroni & Cheese', 2),
('Cream of Potato Soup', 1), ('Baguette', 1), ('Spaghetti Noodles', 1),
('Spaghetti Sauce', 2);
|
<gh_stars>1-10
CREATE TABLE [dbo].[Accreditations] (
[AccreditationId] UNIQUEIDENTIFIER NOT NULL,
[OrganizationId] UNIQUEIDENTIFIER NOT NULL,
[Type] VARCHAR (30) NOT NULL,
[Name] VARCHAR (30) NOT NULL,
[Description] VARCHAR (500) NOT NULL,
[Content] ... |
CREATE TABLE IF NOT EXISTS `app_user` (
`user_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unique, auto generated user identifier (primary key)',
`person_name` varchar(128) NOT NULL COMMENT 'The full name of the user',
`pwhash` varchar(128) NOT NULL COMMENT 'Hash of the users password (using php password... |
<reponame>BharathGithubUser/CollegeManagementSystem<gh_stars>1-10
-- phpMyAdmin SQL Dump
-- version 4.6.5.2
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Nov 24, 2017 at 11:59 AM
-- Server version: 10.1.21-MariaDB
-- PHP Version: 5.6.30
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone =... |
<filename>finance/egov/egov-collection/src/main/resources/db/migration/main/V20151216182503__collection_remove_roleaction_remitdishonor.sql<gh_stars>10-100
delete from eg_roleaction where roleid not in (SELECT id FROM eg_role WHERE name in ('Remitter','SYSTEM')) and actionid in (select id from eg_action where name in ... |
<filename>backend/postgres_db/postgres/sql/06_like_delete.sql
/*************************************************************************************
* like: DELETE function
* as in https://gitlab.multimedia.hs-augsburg.de/kowa/wk_account_postgres_01
*******************************************************************... |
-- phpMyAdmin SQL Dump
-- version 4.7.7
-- https://www.phpmyadmin.net/
--
-- Host: localhost:8889
-- Generation Time: Mar 18, 2019 at 01:41 AM
-- Server version: 5.6.38
-- PHP Version: 7.2.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
--
-- Database: `SpotifyFriend`
--
CREATE DATABASE IF NOT EXI... |
-- $ID$
-- TPC-H/TPC-R Potential Part Promotion Query (Q20)
-- Function Query Definition
-- Approved February 1998
select
s_name,
s_address
from
supplier,
nation
where
s_nationkey = n_nationkey
and n_name = 'ARGENTINA'
|
BEGIN;
DROP TRIGGER before_trigger_on_systems
ON systems;
DROP INDEX groups_group_id_deleted_at_key;
ALTER TABLE ONLY public.systems
DROP CONSTRAINT systems_g_id_groups_g_id_foreign;
ALTER TABLE public.systems
DROP COLUMN g_id;
ALTER TABLE ONLY public.groups
ADD CONSTRAINT groups_group_id_key UNIQUE... |
<filename>mybatis-plus-sample-enum/src/main/resources/db/data-h2.sql<gh_stars>0
DELETE
FROM userq;
INSERT INTO userq (id, name, age, email, grade, gender, user_state, str_enum)
VALUES (2, 'Jack', 3, '<EMAIL>', 1, 0, 1, 'one'),
(3, 'Tom', 1, '<EMAIL>', 2, 1, 1, 'one'),
(1, 'Billie', 2, '<EMAIL>', 3, null,... |
DROP TABLE IF EXISTS "withdrawal";
DROP TABLE IF EXISTS "pending_withdrawal";
DROP TABLE IF EXISTS "reward_balance";
DROP TABLE IF EXISTS "received_reward";
DROP TABLE IF EXISTS "chat_message";
DROP TABLE IF EXISTS "chat_user";
DROP TABLE IF EXISTS "document";
DROP TABLE IF EXISTS "disallowed_media";
DROP TABLE IF EXI... |
----------------------------------------------------------------------------------
-- View Name: [dbo].[vServerTopQueriesStore]
--
-- Desc: This view is built on top of [ServerTopQueriesStore] to extract the details of the top queries identified by the execution of [dbo].[ServerTopQueries]
--
-- [ReportID] BIGINT ... |
CREATE DATABASE IF NOT EXISTS default; |
SELECT DISTINCT customers.first_name, customers.last_name FROM customers
INNER JOIN purchases
ON customers.id = purchases.customer_id; |
<filename>mysqlCode/insertInto/insertIntoAmmo.sql
insert into Ammo (ammo_id, ammo_name, ammo_dmg_mod,
ammo_ap_mod,ammo_dmg_type1,ammo_dmg_type2, ammo_avail,
ammo_cost, ammo_notes)
values (UUID(),'Standard', 0, 0, 'P', '-', '2R', 20, 'Standard ammo');
select * from Ammo; |
<reponame>kalvinkrishna/baliradianceproject<gh_stars>0
-- phpMyAdmin SQL Dump
-- version 4.5.2
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Apr 06, 2017 at 02:50 PM
-- Server version: 10.1.19-MariaDB
-- PHP Version: 5.5.38
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*... |
<reponame>chinmaypatil2442/CatalogueManagementSystem
-- phpMyAdmin SQL Dump
-- version 4.9.5
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Nov 16, 2020 at 08:09 PM
-- Server version: 5.7.32
-- PHP Version: 7.3.6
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTI... |
-- --------------------------------------------------------
-- Host: localhost
-- Server version: 5.7.24 - MySQL Community Server (GPL)
-- Server OS: Win64
-- HeidiSQL Version: 9.5.0.5332
-- -------------------------------------------------------... |
INSERT INTO STUDENTS (ID, AGE, NAME)
VALUES
(1, 33, 'Pesho'),
(2, 23, 'Anna');
INSERT INTO COURSES (ID, NAME, ENABLED, PRICE)
VALUES
(1, 'Spring for dummies', 0, 50),
(2, 'Spring for pros', 1, 100);
INSERT INTO ORDERS (ID, COURSE_ID, STUDENT_ID)
VALUES
(1, 1, 1),
(2, 2, 1),
(3, 2, 2); |
<reponame>lgcarrier/AFW<filename>5.2.3/Database/Tables/AFW_12_HISTR_ACCES.sql
SET DEFINE OFF;
CREATE TABLE AFW_12_HISTR_ACCES
(
SEQNC NUMBER(10),
REF_UTILS NUMBER(10),
DATE_EVENM DATE,
REF_DV_TYPE_EVENM NUMBER(10),
DATE_CREAT DATE,
UTILS_CREAT VARCHAR2(123 BYTE)... |
<gh_stars>1-10
CREATE TYPE season_length AS STRUCT<season_id INT, episode_count INT> ;
CREATE TABLE titles (
id INT PRIMARY KEY,
title VARCHAR
) WITH (
KAFKA_TOPIC='titles',
VALUE_FORMAT='AVRO',
PARTITIONS=4
);
CREATE STREAM production_changes (
rowkey VARCHAR KEY,
uuid INT,
title_id I... |
<gh_stars>10-100
ALTER TABLE Project DROP COLUMN team;
|
<reponame>j-sieben/PIT<filename>PIT/jet/tables/oj_roles.sql
create table oj_roles(
ojro_id varchar2(50 byte),
ojro_display_name varchar2(200 byte),
ojro_sort_seq number(5,0),
ojro_active char(1 byte) default on null 'Y',
constraint pk_oj_roles primary key (ojro_id)
) organization index;
comment on ta... |
-- Create person node table
DROP TABLE IF EXISTS dbo.Person
DROP TABLE IF EXISTS dbo.friend
CREATE TABLE dbo.Person (ID integer PRIMARY KEY, name varchar(50)) AS NODE;
CREATE TABLE dbo.friend (start_date DATE) AS EDGE;
-- Insert into node table
INSERT INTO dbo.Person VALUES (1, 'Alice');
INSERT INTO dbo.Person VALUE... |
SET search_path = public,pg_catalog,web,account,stats;
CREATE TABLE IF NOT EXISTS public.mojo_migrations
(
name text NOT NULL,
version bigint NOT NULL,
CONSTRAINT mojo_migrations_version_check CHECK ((version >= 0)),
CONSTRAINT mojo_migrations_pkey PRIMARY KEY (name)
);
ALTER TABLE public.mojo_mi... |
<filename>06-24.sql
-- MySQL dump 10.13 Distrib 5.5.27, for Win32 (x86)
--
-- Host: localhost Database: fieldinspdb
-- ------------------------------------------------------
-- Server version 5.5.27
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTE... |
<filename>scripts/performance-related-issues/kill.sql
-- Kill a particular query that is causing the issue
SELECT pg_cancel_backend(pids); |
<reponame>EthanProg/ic-board-p<filename>src/main/resources/dv_mysql_new.sql
-----------------------------------------------------------------
/**
* 城市信息表
*/
CREATE TABLE T_CITIES (
CITY_ID VARCHAR(8) NOT NULL,
CITY_NAME VARCHAR(32) NOT NULL,
CITY_TYPE CHAR(1) NOT NULL,
PARENT_ID VARCHAR(8) NOT NULL
);
/**
... |
DROP VIEW IF EXISTS v_etf_etf0103;
CREATE OR REPLACE VIEW v_etf_etf0103
AS
SELECT
kw10000.item_code
, kw10000.item_name
, n0101.etf_type
, n0102.date_list
FROM
t_kw_kw10000 kw10000
, t_etf_n0101 n0101
, t_etf_n0102 n0102
WHERE 1 = 1
AND kw10000.item_code = n0101.item_code
AND kw10000.item_code = ... |
<filename>schema/revert/views/nrced.sql
-- Revert auth-c-and-e:views/nrced_view from pg
BEGIN;
drop view ams_nrced.nrced;
COMMIT;
|
<filename>sql/V7.0.02__constraint.sql
alter table price
drop constraint if exists price_shop_fk;
alter table price
drop constraint if exists price_corporation_fk;
alter table price
drop constraint if exists price_character_fk;
alter table price
add constraint price_shop_fk FOREIGN KEY (shop) REFERENCES shop_wallet ... |
# ---
# --- !Ups
alter table address add column comment text default '' not null;
# --- !Downs
alter table address drop column comment;
|
<reponame>Claude-at-Instaclustr/tree-sitter-cql
================================================================================
CREATE INDEX index_name ON keyspace.table (column);
================================================================================
CREATE INDEX index_name ON keyspace.table (column);
------... |
ALTER TABLE settings DROP CONSTRAINT has_subject;
ALTER TABLE settings ADD CONSTRAINT has_subject CHECK (org_id IS NOT NULL);
ALTER TABLE settings DROP COLUMN user_id;
|
<filename>septima-js-application/src/test/resources/entities/pets-public-parameters.sql
select * from pets p
where
:flag = true and
p.owner_id = :owner_id and
p.birthdate > :birthFrom and
p.name = :name
|
<filename>txcms.sql
/*
Navicat Premium Data Transfer
Source Server : localhost
Source Server Type : MySQL
Source Server Version : 50553
Source Host : localhost:3306
Source Schema : qipai
Target Server Type : MySQL
Target Server Version : 50553
File Encoding ... |
DROP TABLE IF EXISTS rollup;
CREATE TABLE rollup(a String, b Int32, s Int32) ENGINE = Memory;
INSERT INTO rollup VALUES ('a', 1, 10), ('a', 1, 15), ('a', 2, 20);
INSERT INTO rollup VALUES ('a', 2, 25), ('b', 1, 10), ('b', 1, 5);
INSERT INTO rollup VALUES ('b', 2, 20), ('b', 2, 15);
SELECT a, b, sum(s), count() from r... |
library "Test" version '1.0.0'
using "USCore" version '3.1.0'
context Patient
define QueryByGender:
["PatientProfile"] p where p.gender = 'M' |
<gh_stars>10-100
-- liquibase formatted sql logicalFilePath:ddl/auth_p3_mapping_rule
-- changeset SYS:20210406-0
CREATE TABLE "auth_p3_mapping_rule" ("mapping_rule_id" VARCHAR(36) NOT NULL, "p3_component_id" VARCHAR(36) NOT NULL, "mapping_type" VARCHAR(3) NOT NULL, "mapping_method" VARCHAR(3) NOT NULL, "mapping_impl" ... |
<gh_stars>10-100
#!/bin/bash
# This file has the .sql extension, but it is actually launched as a shell
# script. This contortion is necessary because pg_regress normally uses
# psql to run the input scripts, and requires them to have the .sql
# extension, but we use a custom launcher script that runs the scripts usin... |
-- phpMyAdmin SQL Dump
-- version 4.6.5.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: 2017-07-13 17:46:17
-- 服务器版本: 10.1.21-MariaDB
-- PHP Version: 5.6.30
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/... |
<reponame>haduart/yesql-webapp
-- name: select-all
SELECT name from test;
-- name: find-name
SELECT name from test where name = :name
|
---- ALTER TABLE ... CHANGE COLUMN
-- class attribute
-- type change from int
-- to short
create table t1 (d1 date shared date'2001-01-04', i2 int);
insert into t1 values (date'2001-01-04',1),(date'2001-01-04',2);
update t1 set t1.d1=date'2001-05-09';
select * from t1 order by 1,2;
show columns in t1;
alter tabl... |
ALTER TABLE task
ADD COLUMN modified_by_id BIGINT
COMMENT 'Автор последнего изменения'
AFTER created_at;
ALTER TABLE task ADD CONSTRAINT fk$task$account$modified_by FOREIGN KEY (modified_by_id) REFERENCES account (id);
ALTER TABLE task
ADD COLUMN modified_at DATETIME
COMMENT 'Время последнего изменения'
AFTER modified... |
<gh_stars>0
-- Deploy schemas/jwt_public/procedures/current_origin to pg
-- requires: schemas/jwt_public/schema
BEGIN;
CREATE FUNCTION jwt_public.current_origin()
RETURNS origin
AS $$
SELECT nullif(current_setting('jwt.claims.origin', true), '')::origin;
$$
LANGUAGE 'sql' STABLE;
COMMIT; |
<gh_stars>0
USE employees;
INSERT INTO department
(name)
VALUES
('Sales'),
('Engineering'),
('Business');
INSERT INTO role
(title, salary, department_id)
VALUES
('Sales Lead', 100000, 1),
('Salesperson', 80000, 1),
('Sales assistant', 60000, 1),
('Main Engineer', 120000, 2),
(... |
-- Revert schemas/app_jobs/procedures/release_scheduled_jobs from pg
BEGIN;
DROP FUNCTION app_jobs.release_scheduled_jobs;
COMMIT;
|
-- phpMyAdmin SQL Dump
-- version 4.4.14
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Jun 21, 2017 at 12:20 PM
-- Server version: 5.6.26
-- PHP Version: 5.6.12
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;... |
<filename>database/migrations/2015_04_26_202614_question_categories_add_moderation_status/up.sql
CREATE TYPE moderation_statuses AS ENUM (
'PENDING',
'APPROVED',
'REJECTED'
);
ALTER TABLE questions
ADD COLUMN moderation_status moderation_statuses NOT NULL DEFAULT 'PENDING';
ALTER TABLE categories
ADD COLUMN modera... |
<gh_stars>0
CREATE VIEW stock_current
AS
SELECT product_id, SUM(amount) AS amount, MIN(best_before_date) AS best_before_date
FROM stock
GROUP BY product_id
ORDER BY MIN(best_before_date) ASC
|
-- phpMyAdmin SQL Dump
-- version 5.0.1
-- https://www.phpmyadmin.net/
--
-- Host: 192.168.10.3:3306
-- Generation Time: May 05, 2020 at 03:19 AM
-- Server version: 10.3.22-MariaDB
-- PHP Version: 7.3.15
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00"... |
/*
Crie as tabelas de acordo com o diagrama em anexo.
Os domínios de cada atributo ficará a sua escolha, desde que utilize os mais adequados.
Nenhum atributo deverá ser "auto-incrementável".
A seguir, responda as questões abaixo:
*/
-- tabela titulo
CREATE TABLE titulo(
cod_titulo INT,
descr_titulo VARCHAR
);
--... |
DROP DATABASE IF EXISTS employees_db;
CREATE DATABASE employees_db;
USE employees_db;
CREATE TABLE departments (
id INT AUTO_INCREMENT NOT NULL,
name VARCHAR(30) NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE roles (
id INT AUTO_INCREMENT NOT NULL,
title VARCHAR(30) NOT NULL,
salary DECIMAL(15, 2),
... |
<filename>queries/mp/data.sql
-- this combines all views to get all features at all time points
--
DROP TABLE IF EXISTS mp_data CASCADE;
CREATE TABLE mp_data as
select
mp.subject_id, mp.hadm_id, mp.icustay_id
, mp.hr
-- vitals
, vi.HeartRate
, vi.SysBP
, vi.DiasBP
, vi.MeanBP
, vi.RespRate
, vi.TempC
... |
// Return the count of data repositories by database.
MATCH (tydc:TYPE {type:"schema:DataCatalog"})
MATCH (tycr:TYPE {type:"CodeRepository"})
MATCH (tydc)<-[:isType]-(odc:OBJECT)
MATCH (ocr:OBJECT)-[:isType]->(tycr)
MATCH (odc)<-[:Target]-(:ANNOTATION)-[:Target]->(ocr)
RETURN odc.name, COUNT(ocr.name)
// Return the co... |
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS "labels" (
"LabelName" TEXT,
"DisplayName" TEXT,
PRIMARY KEY("LabelName")
);
CREATE TABLE IF NOT EXISTS "trainable_labels" (
"LabelName" TEXT,
PRIMARY KEY("LabelName")
);
CREATE TABLE IF NOT EXISTS "open_images" (
"ImageID" TEXT,
"Subset" TEXT,
"OriginalURL" TEXT,
... |
CREATE DATABASE warehouse;
USE warehouse;
CREATE TABLE Customer (
Customer_Id Integer not null,
Customer_Name Varchar (20) not null,
Customer_Address Varchar (50) not null,
Delivery_item Varchar (50) not null,
Delivery_Id Integer not null,
Delivery_Time Varchar (10) not null,
Qu... |
alter table PROTOCOL_ACTIONS add FOLLOWUP_ACTION_CODE VARCHAR(3) ; |
UPDATE creature_template SET ScriptName='npc_deathstalker_erland' WHERE entry=1978;
|
<gh_stars>0
DROP DATABASE IF EXISTS crowdfund_db;
CREATE DATABASE crowdfund_db;
USE crowdfund_db; |
二〇一七年十一月十四日 11:07:27
ALTER TABLE `ts_shop`
CHANGE COLUMN `opening_hours` `start_time` time NOT NULL AFTER `phone`;
ALTER TABLE `ts_shop`
CHANGE COLUMN `opening_hours` `start_time` time NOT NULL AFTER `phone`;
ALTER TABLE `ts_shop`
ADD COLUMN `img` varchar(255) NOT NULL AFTER `end_time`;
ALTER TABLE `ts_order`
A... |
<reponame>hakan42/osm-mosques<gh_stars>1-10
ALTER TABLE `QA_PLACES` add `SCORE` double DEFAULT NULL;
|
<reponame>527088995/mblog
/*
Navicat MySQL Data Transfer
Source Server : 开发
Source Server Version : 50643
Source Host : 192.168.3.200:3306
Source Database : ds_money_02
Target Server Type : MYSQL
Target Server Version : 50643
File Encoding : 65001
Date: 2019-03-12 10:18:16
*/
SET ... |
<reponame>javaduke/camel-quarkus<gh_stars>100-1000
--
-- Licensed to the Apache Software Foundation (ASF) under one or more
-- contributor license agreements. See the NOTICE file distributed with
-- this work for additional information regarding copyright ownership.
-- The ASF licenses this file to You under the Apach... |
-- Copyright 2019, Oath Inc.
-- Licensed under the terms of the Apache License, Version 2.0. See LICENSE file for terms.
SET client_min_messages TO warning;
CREATE TABLE unused_az_ris
(
availabilityzone character varying(21) NOT NULL, -- region + 1
instancetype character varying(15) NOT NULL,... |
<filename>01_prep/barriers/06_misc/sql/gradient_barriers_passable.sql
DROP TABLE IF EXISTS bcfishpass.gradient_barriers_passable;
CREATE TABLE bcfishpass.gradient_barriers_passable
(blue_line_key integer,
downstream_route_measure double precision,
watershed_group_code text,
reviewer text,
notes text,
PRIMARY KEY (blue... |
-- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- Gazdă: 127.0.0.1:3306
-- Timp de generare: oct. 06, 2019 la 10:09 AM
-- Versiune server: 5.7.26
-- Versiune PHP: 7.2.18
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @O... |
alter table library
add column HASH_FILES boolean NOT NULL DEFAULT ${library-file-hashing};
alter table library
add column HASH_PAGES boolean NOT NULL DEFAULT 0;
alter table library
add column ANALYZE_DIMENSIONS boolean NOT NULL DEFAULT 1;
|
CREATE TABLE badminto_finalf.t_parteneri_adrese LIKE avban.t_parteneri_adrese;
ALTER TABLE badminto_finalf.t_parteneri_adrese CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
INSERT INTO badminto_finalf.t_parteneri_adrese SELECT * from avban.t_parteneri_adrese;
ALTER TABLE `badminto_finalf`.`t_parteneri_adr... |
<reponame>naveenkod22/MySQL
-- 13.5 prefix indexes
drop index idx_name on city;
create index idx_name on city(name(5));
-- no 4 is to data depedent, to find optimal number we should look at given data
select
count(distinct left(name, 1)),
count(distinct left(name, 2)),
count(distinct left(name, 3)),
co... |
USE upmorg;
CREATE TABLE IF NOT EXISTS `Committee` (
`CommitteeID` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`CommitteeHeadID` INT UNSIGNED NOT NULL,
`CommitteeName` VARCHAR(50) NOT NULL,
PRIMARY KEY (`CommitteeID`)
);
ALTER TABLE `Committee`
ADD CONSTRAINT FK_Committee_CommitteeHeadID
FOREIGN KEY (`Commi... |
-- Queries (SQL-analysis-of-employment-data)
-- NOTE run schema.sql code before running queries
--------------Query 1
-- Employee details (number, last name, first name, sex, and salary)
SELECT e.emp_no AS "Employee Number", e.last_name AS "Last Name",
e.first_name AS "First Name", e.sex AS "Sex",
s.salary ... |
create table passenger (
id bigserial not null,
first_name varchar(20) not null,
last_name varchar(20) not null,
email varchar(50) not null,
streetAddress varchar(20) not null,
city varchar(20) not null,
state varchar(20) not null,
zip varchar(20) not null,
phone_number varchar(20) not null,... |
<gh_stars>0
CREATE TABLE IF NOT EXISTS `toner` ( `toner_id` int(11) NOT NULL auto_increment, `device_id` int(11) NOT NULL default '0', `toner_index` int(11) NOT NULL, `toner_type` varchar(64) NOT NULL, `toner_oid` varchar(64) NOT NULL, `toner_descr` varchar(32) NOT NULL default '', `toner_capacity` int(11) NOT NULL def... |
<gh_stars>1-10
-- Fixes issue #014670: Embed relations are not removed when embed tag is
-- Affects all users that have used ezoe (image / file upload) from its early betas, rc's and 5.0.0
DELETE FROM ezcontentobject_link WHERE relation_type = 8 AND contentclassattribute_id = 0;
UPDATE ezcontentobject_link SET relatio... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.