sql stringlengths 6 1.05M |
|---|
<gh_stars>1000+
ALTER TABLE "identity_verifiable_addresses" RENAME COLUMN "code" TO "_code_tmp"; |
--+ holdcas on;
set names utf8;
drop table if exists t1;
create table t1 (id int, col_binary varchar(10) collate binary, col_euckr varchar(10) collate euckr_bin, col_utf8 varchar(10) collate utf8_bin, col_iso varchar(10) collate iso88591_bin);
insert into t1 values(1, '문자열', '문자열', '문자열', 'ÀÏ');
insert into t1 values(2... |
<filename>openGaussBase/testcase/KEYWORDS/Fixed/Opengauss_Function_Keyword_Fixed_Case0032.sql<gh_stars>0
-- @testpoint:opengauss关键字fixed(非保留),作为用户名
--关键字fixed作为用户名不带引号,创建成功
drop user if exists fixed;
CREATE USER fixed PASSWORD '<PASSWORD>';
drop user fixed;
--关键字fixed作为用户名加双引号,创建成功
drop user if exists "fixed";
CREAT... |
REM if1.sql
REM Chapter 3, Oracle9i PL/SQL Programming by <NAME>
REM This block demonstrates an IF statement.
DECLARE
v_NumberSeats rooms.number_seats%TYPE;
v_Comment VARCHAR2(35);
BEGIN
/* Retrieve the number of seats in the room identified by ID 20008.
Store the result in v_NumberSeats. */
SELECT number... |
<gh_stars>0
-- MySQL dump 10.16 Distrib 10.1.16-MariaDB, for Win32 (AMD64)
--
-- Host: localhost Database: pttibd
-- ------------------------------------------------------
-- Server version 10.1.16-MariaDB
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@C... |
<reponame>handsome112/food_update
-- phpMyAdmin SQL Dump
-- version 5.1.0
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Aug 22, 2021 at 07:40 PM
-- Server version: 10.4.18-MariaDB
-- PHP Version: 7.4.16
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*... |
SELECT avg(hosp_stay.duration) as avg_hosp_stay_duration
FROM(
SELECT date_part('day', discharge_date - admission_d_inpat) as duration
FROM covidhm_dsl_v3.patient)
as hosp_stay;
|
<gh_stars>0
-- MySQL Workbench Forward Engineering
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_E... |
alter table cnaes add constraint pkcnaes primary key (cnpj,cnae);
create index i1cnaes on cnaes (cnae,cnpj);
alter table detalhe add constraint pkdetalhe primary key (cnpj);
create index i1detalhe on detalhe(razao_social,cnpj);
create index i2detalhe on detalhe(nome_fantasia,cnpj);
create index i3detalhe on detalhe(si... |
<filename>src/dbdiff/templates/joined_count.sql<gh_stars>0
SELECT COUNT(*)
FROM {{ joined_schema }}.{{ joined_table }}
WHERE (x_{{ column }} <=> y_{{ column }}) IS FALSE |
CREATE FUNCTION splitwaysbycrossings() RETURNS void
LANGUAGE plpgsql
AS $$
BEGIN
--Keep track of the splits to the ways network
CREATE TEMPORARY TABLE tmp (id integer, ln geometry(LineString, 27700));
RAISE NOTICE '1. Processing crossings';
--Split the ways network by the crossings
WITH x AS (
SELECT... |
select
t.table_name "table_name",
count(*) "qtd_columns",
max(pk.column_name) "pk_column",
MAX(CASE WHEN c.udt_name IN ('bytea', 'text') THEN 1 ELSE 0 END) "lob"
from information_schema.columns c
join information_schema.tables t
on t.table_catalog = c.table_catalog
and t.table_schema = c.table_schema
and ... |
<filename>datamining.sql
SELECT
substr(mac,1,15) AS mac_prefix,
location,
avg(`signal`) AS avgStr,
substr(freq,1,2) AS freq,
ssid, count(*) AS count
FROM aps
WHERE
freq < 5000 AND
ssid like 'Wavefront - %'
GROUP BY
location,
substr(freq,1,1),
substr(mac,1,15)
ORDER BY
mac_prefix,freq, avgStr desc,location... |
<reponame>smith750/kc<filename>coeus-db/coeus-db-sql/src/main/resources/org/kuali/coeus/coeus-sql/RELEASE-SCRIPTS/KC-RELEASE-4_0-SCRIPT/mysql/tables/KC_TBL_EPS_PROPOSAL.sql
DELIMITER /
ALTER TABLE
EPS_PROPOSAL
ADD
(
ANTICIPATED_AWARD_TYPE_CODE DECIMAL(3,0)
)
/
ALTER TABLE EPS_PROPOSAL ADD PROPOSALNUMBER... |
################################## Index Hint ##################################
select /*+FULL(t4)*/* from t4;
select /*+INDEX(t4 idx_t4_c2_c3)*/* from t4;
select /*+INDEX(t4 idx_t4_c2)*/* from t4;
select /*+INDEX(t4 idx_t4_c3)*/* from t4;
select /*+INDEX(t_pt t_pt_idx_1)*/* from t_pt where (c2,c1) > (300,200);
select... |
INSERT INTO cboard.dashboard_category (category_id,category_name,user_id) VALUES
(2,'bi','1')
; |
BEGIN;
SET FOREIGN_KEY_CHECKS = 0;
DROP TABLE IF EXISTS `acts`;
CREATE TABLE `acts` (
`act_id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`show_act` tinyint(4) DEFAULT NULL,
FOREIGN KEY (user_id) REFERENCES users (user_id),
PRIMARY KEY (... |
<reponame>Frog-kt/online-voting<filename>prisma/migrations/20210112141620_/migration.sql
/*
Warnings:
- You are about to drop the column `VoteId` on the `IsVoted` table. All the data in the column will be lost.
- Added the required column `voteId` to the `IsVoted` table without a default value. This is not possi... |
ALTER TABLE shorturls ADD COLUMN longurl_hash VARCHAR(64) DEFAULT '';
UPDATE shorturls SET longurl_hash=SHA2(longurl, 256);
ALTER TABLE shorturls ADD INDEX shorturl_existence_idx (
`longurl_hash`,
`enabled`,
`custom_shorturl`);
|
SET QUOTED_IDENTIFIER ON;
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[#__imageshow_source_profile]') AND type in (N'U'))
BEGIN
CREATE TABLE [#__imageshow_source_profile](
[external_source_profile_id] [int] IDENTITY(1,1) NOT NULL,
[external_source_id] [int] NULL,
CONSTRAINT [PK_#__imagesh... |
--Case where view merge is possible.
DROP TABLE IF EXISTS t_a, t_b;
CREATE TABLE t_a
(
col_a INT,
col_b INT
);
CREATE TABLE t_b
(
col_a INT,
col_b INT
);
INSERT INTO t_a
VALUES (1,1),(2,2),(3,3);
INSERT INTO t_b
VALUES (1,1),(2,2),(3,3);
--multiple join
SELECT /*+ recompile */ *
FROM (SE... |
\c pg_features_demo
SET ROLE TO demorole;
/*
Postgres has excellent text/string processing capabilities, including support for regular expressions.
Below some of the most useful functions and text handling techniques.
Things to note:
* As quotes can be used single quotes or dollar-dollar delimited freelu chosen l... |
-- smallint sum lots
SELECT vec_to_sum(smallints) FROM measurements WHERE sensor_id IN (1, 2, 3, 4);
-- smallint sum none
SELECT vec_to_sum(smallints) FROM measurements WHERE sensor_id = -1;
-- smallint sum one null
SELECT vec_to_sum(smallints) FROM measurements WHERE sensor_id = 1;
-- smallint sum array of nulls
SELEC... |
<gh_stars>0
CREATE TABLE [tester].[sqlwatch_long_query]
(
[date] datetime NOT NULL PRIMARY KEY
);
|
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600331',@CutoffDate = N'2017-09-30',@EPS = N'0.1062',@EPSDeduct = N'0',@Revenue = N'34.18亿',@RevenueYoy = N'29.56',@RevenueQoq = N'4.70',@Profit = N'2.16亿',@ProfitYoy = N'317.29',@ProfiltQoq = N'16.97',@NAVPerUnit = N'2.4278',@ROE = N'4.47',@CashPerUnit = N'-0.0630',@GrossProfitRate... |
<reponame>gnovaro/local-php-dashboard
CREATE TABLE task
(
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
content VARCHAR(255) NOT NULL,
created_at DATETIME NULL,
updated_at DATETIME NULL
);
|
<gh_stars>0
-- phpMyAdmin SQL Dump
-- version 5.0.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Sep 03, 2021 at 09:25 AM
-- Server version: 10.4.17-MariaDB
-- PHP Version: 8.0.0
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACT... |
<reponame>kubasikora/ZPR-Projekt<filename>db/createTableDevices.sql
CREATE TABLE public.devices
(
device_id bigserial NOT NULL,
serial_code character varying NOT NULL,
model character varying NOT NULL,
producer character varying NOT NULL,
unit character varying NOT NULL,
min_value double precisi... |
<reponame>pkgw/drorg
CREATE TABLE listitems (
listing_id INTEGER NOT NULL,
position INTEGER NOT NULL,
doc_id TEXT NOT NULL,
PRIMARY KEY (listing_id, position),
FOREIGN KEY (doc_id) REFERENCES docs(id)
);
|
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS "sensors_available" (
"sensormodule_id" INTEGER,
"sensor_module" TEXT NOT NULL,
UNIQUE("sensor_module"),
PRIMARY KEY("sensormodule_id" AUTOINCREMENT)
);
CREATE TABLE IF NOT EXISTS "data" (
"data_id" INTEGER NOT NULL,
"dtstamp" TEXT NOT NULL,
"value" REAL NOT NULL,
... |
<reponame>jdkoren/sqlite-parser
-- pragma.test
--
-- execsql {
-- ATTACH 'test2.db' AS aux;
-- SELECT * FROM aux.t1;
-- }
ATTACH 'test2.db' AS aux;
SELECT * FROM aux.t1; |
/****************************************************************************************
Guidelines to create migration scripts - https://github.com/microsoft/healthcare-shared-components/tree/master/src/Microsoft.Health.SqlServer/SqlSchemaScriptsGuidelines.md
This diff is broken up into several sections:
- The firs... |
/*
Table structure for table 'public.EmailTemplates'
*/
CREATE TABLE IF NOT EXISTS EmailTemplates (EmailTemplateId UUID NOT NULL,EmailTemplateInd BIGSERIAL NOT NULL,EmailTemplateName VARCHAR(200) ,EmailLabel VARCHAR(50) ,EmailSubject VARCHAR(500) ,EmailSenderEmail VARCHAR(50) ,EmailContent TEXT,EmailSignature VARCHAR... |
<gh_stars>10-100
-- SQL > Basic Select > Employee Names
-- Print employee names.
--
-- https://www.hackerrank.com/challenges/name-of-employees/problem
-- https://www.hackerrank.com/contests/simply-sql-the-sequel/challenges/name-of-employees
-- challenge id: 19629
--
SET NULL "NULL";
SET FEEDBACK OFF;
SET ECHO OFF;
SET... |
INSERT INTO @Roles([Index],[Code],[Name],[IsPublic]) VALUES
(0, N'Administrator', N'Administrator', 0),
(1, N'GeneralManager', N'General Manager', 0),
(2, N'FinanceManager', N'Finance Manager', 0),
(3, N'Comptroller', N'Comptroller', 0),
(4, N'Accountant', N'Accountant', 0),
(5, N'Cashier', N'Cashier', 0),
(6, N'Inter... |
select int8_1 from nulls2 where int8_1 = '30';
30
|
<gh_stars>10-100
CREATE OR REPLACE FUNCTION create_subject(VARCHAR, VARCHAR, VARCHAR, VARCHAR, VARCHAR ) RETURNS VOID AS
$create$
DECLARE
subject_name ALIAS FOR $1;
id_code ALIAS FOR $2;
issuer_code ALIAS FOR $3;
assigner_code ALIAS FOR $4;
typename ALIAS FOR $5;
party_id UUID;
BEGIN
-- create a party_ident... |
<filename>sql1_persediaan/persediaan_barang_sql2/persediaan_barang2_pertanian.sql
DROP VIEW IF EXISTS view_persediaan_barang2_pertanian;
CREATE VIEW view_persediaan_barang2_pertanian AS
SELECT
*,
sum(jumlah) OVER (PARTITION BY kode_barang ORDER BY serial, tanggal, id_persediaan) as pra_saldo
FROM
view_persediaan_ba... |
CREATE TABLE custom_ballot_ballot_responses (results_id BIGINT REFERENCES results (id) NOT NULL,
custom_ballot_id BIGINT,
ballot_response_id BIGINT,
sort_order INTEGER);
|
-- @testpoint: 匿名块中for loop 语句插入大量数据
declare
v_lang clob := 'charuhailiangzifu';
begin
raise notice '%',length(v_lang);
for i in 1 .. 1928 loop
v_lang := v_lang || 'charuhailiangzifu';
end loop;
raise notice '%',v_lang;
raise notice '%',length(v_lang);
end;
/
|
<reponame>eventEmitter/wpm-registry
CREATE TABLE wpm."userPasswordResetToken" (
id_user integer NOT NULL
, token character varying(128) NOT NULL
, created timestamp without time zone DEFAULT LOCALTIMESTAMP NOT NULL
, validated timestamp without time zone
, deleted timestamp without time zone
, CONS... |
-- --------------------------------------------------------
-- Host: 127.0.0.1
-- Server version: 10.1.13-MariaDB - mariadb.org binary distribution
-- Server OS: Win32
-- HeidiSQL Version: 9.4.0.5125
-- ------------------------------------------------... |
SELECT PERSON_NAME,MARKS,
(CASE WHEN MARKS >= 85 THEN 'Distinction'
WHEN MARKS < 35 THEN 'Fail'
ELSE 'Pass'
END) AS RESULTS
FROM PERSON;
SELECT PERSON_NAME,WEIGHT,
(CASE WHEN WEIGHT >=80 THEN 'Over Weight'
WHEN WEIGHT <= 50 THEN 'Under Weight'
ELSE 'NORMAL WEIGHT'
END
) AS WEIGHT_CHECK
FROM PERSON;
SELECT PERSON_NAME... |
-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 1172.16.31.10
-- Generation Time: Dec 24, 2020 at 05:01 AM
-- Server version: 10.4.11-MariaDB
-- PHP Version: 7.2.31
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_... |
-- phpMyAdmin SQL Dump
-- version 4.6.6deb5
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Sep 28, 2019 at 10:14 PM
-- Server version: 10.1.41-MariaDB-0ubuntu0.18.04.1
-- PHP Version: 7.2.19-0ubuntu0.18.04.2
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET... |
<reponame>oelkapmis/SQL
UPDATE employee
SET name = 'Oguzhan',
birthday = '1996-06-21',
email = '<EMAIL>'
WHERE id = 2;
SET name = 'Daniel',
birthday = '1970-11-14',
email = '<EMAIL>'
WHERE id = 15;
SET name = 'Katya',
birthday = '2001-05-02',
email = '<EMAIL>'
WHERE id = 9;
DELETE FROM employee
WHERE name =... |
<reponame>arisAlexis/microchatter
CREATE DATABASE microchatter;
DROP SCHEMA if exists production CASCADE;
DROP SCHEMA if exists test CASCADE;
DROP SCHEMA if exists public CASCADE;
DROP ROLE if exists tester;
DROP ROLE if exists microchatter;
CREATE SCHEMA production;
CREATE SCHEMA test;
create table production.users(... |
-- Domanda 1
-- Vincolo di integrità mancante CLIENTE.citta -> CITTA
CREATE TABLE CITTA (
codice INTEGER,
nome VARCHAR(30) NOT NULL,
PRIMARY KEY (codice)
);
CREATE TABLE CLIENTE(
codice INTEGER,
nome VARCHAR(30) NOT NULL,
cognome VARCHAR(30) NOT NULL,
nTelefono VARCHAR(14) NOT NULL,
ind... |
------------------START------------------
ALTER TABLE EGW_CONTRACTORBILL ADD COLUMN WORKORDERESTIMATE bigint;
ALTER TABLE EGW_CONTRACTORBILL ADD CONSTRAINT fk_egw_contractorbill_workorderestimate FOREIGN KEY (workorderestimate) REFERENCES egw_workorder_estimate (id);
-------------------END-------------------
--rollback... |
alter table users
drop column shared_secret,
drop column tfa_enabled
|
<filename>SQL_Scripts/Creation/Items.sql
USE [DB_111206_clicker]
GO
/****** Object: Table [dbo].[Items] Script Date: 3/4/2021 6:29:20 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Items](
[items_id] [int] NOT NULL,
[item_name] [nvarchar](50) NOT NULL,
[icon] [nvarchar](50) NO... |
--REVOKE SELECT ON bloomreader.TimePerMon_anycountry FROM bloomreaderuser;
--DROP VIEW bloomreader.TimePerMon_anycountry CASCADE;
CREATE OR REPLACE VIEW bloomreader.TimePerMon_anycountry AS
SELECT a.id,
CAST((a.timestamp AT TIME ZONE 'AEST') AS date) AS timedate,
b.country_name AS country
FROM (SELECT... |
<filename>sql/fixes/Character.sql<gh_stars>1-10
USE [MuOnline]
GO
ALTER TABLE [dbo].[Character]
ADD [BanChatTime] INT DEFAULT NULL
GO
ALTER TABLE [dbo].[Character]
ADD [BanCharTime] INT DEFAULT NULL
GO
ALTER TABLE [dbo].[Character]
ADD [BanPostTime] INT DEFAULT NULL
GO
ALTER TABLE [dbo].[Cha... |
-- RDCC-120
ALTER TABLE PROFESSIONAL_USER ADD COLUMN USER_IDENTIFIER VARCHAR(32);
ALTER TABLE PROFESSIONAL_USER ADD CONSTRAINT USER_IDENTIFIER_UQ UNIQUE (USER_IDENTIFIER);
-- RDCC-171 DML FOR ENUM TABLE
INSERT INTO PRD_ENUM (ENUM_CODE, ENUM_NAME, ENUM_TYPE, ENUM_DESC) VALUES (0, 'PUI_USER_MANAGER', 'PRD_ROLE', 'Manag... |
<gh_stars>10-100
CREATE TABLE subdivision_PL (id VARCHAR(6) NOT NULL, name VARCHAR(255), level VARCHAR(64) NOT NULL, PRIMARY KEY(id));
INSERT INTO "subdivision_PL" ("id", "name", "level") VALUES (E'PL-DS', E'Lower Silesian Voivodeship', E'voivodship');
INSERT INTO "subdivision_PL" ("id", "name", "level") VALUES (E'PL-... |
<filename>volume/docker-entrypoint-initdb.d/00_init_db.sql
CREATE TABLE IF NOT EXISTS items (
id SERIAL not null PRIMARY KEY,
name VARCHAR(500) not null,
house INTEGER not null,
meta JSON
);
CREATE TABLE IF NOT EXISTS measurements (
item_id INTEGER DEFAULT null references items(id),
... |
<gh_stars>10-100
-- file:foreign_data.sql ln:176 expect:true
ALTER SERVER s8 OPTIONS (foo '1')
|
<reponame>Shuttl-Tech/antlr_psql
-- file:enum.sql ln:195 expect:true
DROP DOMAIN rgb
|
DROP TABLE IF EXISTS "product";
DROP SEQUENCE IF EXISTS product_id_seq;
CREATE SEQUENCE product_id_seq INCREMENT 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1;
CREATE TABLE "public"."product"
(
"id" integer DEFAULT nextval('product_id_seq') NOT NULL,
"name" text ... |
USE SoftUni
--Problem-1
SELECT FirstName, LastName
FROM Employees
WHERE FirstName LIKE 'SA%'
--Problem-2
SELECT FirstName, LastName
FROM Employees
WHERE LastName LIKE '%ei%'
--Problem-3
SELECT FirstName
FROM Employees
WHERE LastName LIKE '%ei%'
--Problem-4
SELECT FirstName
FROM Employees
WHERE Department... |
CREATE INDEX CONCURRENTLY IF NOT EXISTS users_key_lower_wo_origin ON users (LOWER(username),LOWER(identity_zone_id));
|
-- Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
-- SPDX-License-Identifier: Apache-2.0
CREATE TABLE transaction_metering (
application_id NVARCHAR2(1000) NOT NULL,
action_count NUMBER NOT NULL,
metering_timestamp NUMBER NOT NULL,
ledger_offset VARCHA... |
INSERT INTO service_details (service_description,service_name,logo_uri,policy_uri,integration_environment,requester,protocol,group_id,tenant,country,website_url,aup_uri,organization_id)
VALUES (${service_description},${service_name},${logo_uri},${policy_uri},${integration_environment},${requester},${protocol},${group_i... |
<reponame>osm-codes/BR_IBGE<gh_stars>1-10
CREATE or replace FUNCTION jsonb_objslice(
key text, j jsonb, rename text default null
) RETURNS jsonb AS $f$
SELECT COALESCE( jsonb_build_object( COALESCE(rename,key) , j->key ), '{}'::jsonb )
$f$ LANGUAGE SQL IMMUTABLE; -- complement is f(key text[], j jsonb, renam... |
# --- !Ups
-- Add overpass_target_type to challenges
ALTER TABLE IF EXISTS challenges
ADD COLUMN overpass_target_type VARCHAR;;
-- Add additional_reviewer to task_review
ALTER TABLE IF EXISTS task_review
ADD COLUMN additional_reviewers INTEGER[];;
-- Add original_reviewer to task_review_history
ALTER TABLE IF EXI... |
<filename>migrations/migrations/default/1619468039211_alter_table_source_collector_activity_add_column_created_at/up.sql
alter table "source_collector"."activity" add column "created_at" timestamptz
null default now();
|
<reponame>Sunil2011/growsari1
SELECT s.name AS store_name,
a.username,
count(o.id) AS no_of_orders
FROM `store` s
JOIN store_warehouse_shipper sws ON sws.store_id = s.id
JOIN `order` o ON o.associate_id = sws.id
JOIN `account` a ON a.id = s.account_id
GROUP BY s.id
ORDER BY no_of_orders DESC LIMIT 10 |
-- @testpoint:创建函数,指定参数是INOUT模式,添加returns子句,返回数据类型与出参定义的数据类型一致
drop FUNCTION if EXISTS x2_testfun;
CREATE FUNCTION x2_testfun (c_int INOUT int ) returns text AS $$
BEGIN
RETURN (c_int);
END;
$$ LANGUAGE plpgsql;
/
call x2_testfun(8);
drop FUNCTION x2_testfun; |
<reponame>luciobenelli/survey-service-api<gh_stars>0
INSERT INTO RESPONDENT(ID, FIRST_NAME, LAST_NAME, EMAIL)
VALUES(1L, 'John', 'Doe', '<EMAIL>'); |
<reponame>superinka/sgctool
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Jan 10, 2017 at 11:42 AM
-- Server version: 10.1.19-MariaDB
-- PHP Version: 5.6.28
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_S... |
<gh_stars>0
-- calculates statistic in one pass
--
create type stat_t as (
count int,
sum double precision,
mean double precision,
m2 double precision,
var double precision,
std double precision,
first double precision,
last double precision,
min double precision,
max... |
-- Generated by MsBuild Step - DO NOT EDIT
:setvar DacVersion "
3.0.9.31262
"
|
<reponame>AMChierici/toia-dm
-- MySQL Script generated by MySQL Workbench
-- Sun Jun 13 11:00:16 2021
-- Model: New Model Version: 1.0
-- MySQL Workbench Forward Engineering
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_... |
-- MySQL dump 10.13 Distrib 5.7.17, for macos10.12 (x86_64)
--
-- Host: 127.0.0.1 Database: nock_job
-- ------------------------------------------------------
-- Server version 5.7.19
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS *... |
<filename>sampledb2.cql<gh_stars>1-10
//!!!!!!!!!!NOTE: You must add the APOC plugin to the db you plan to install this in.
// People/Person/Users are the highest level of independence in the db schema (at least at this moment) so they get created first
// Should there be a metadata log for who enters the enterers?... |
<filename>db/mysql/schema.sql
CREATE DATABASE IF NOT EXISTS petclinic;
ALTER DATABASE petclinic
DEFAULT CHARACTER SET utf8
DEFAULT COLLATE utf8_general_ci;
GRANT ALL PRIVILEGES ON petclinic.* TO pc@localhost IDENTIFIED BY 'pc';
USE petclinic;
CREATE TABLE IF NOT EXISTS vets (
id INT(4) UNSIGNED NOT NULL AUTO_... |
<reponame>pradeepkumarcm-egov/DIGIT-Dev<gh_stars>10-100
ALTER TABLE EG_WF_ACTIONS RENAME TO EG_WF_ACTION;
ALTER SEQUENCE EG_WF_ACTIONS_SEQ RENAME TO SEQ_EG_WF_ACTION;
ALTER TABLE EG_WF_ACTION RENAME COLUMN created_date TO createddate;
ALTER TABLE EG_WF_ACTION RENAME COLUMN created_by TO createdby;
ALTER TABLE EG_WF_ACT... |
/*
* Rename the phone field to phone_cell.
*
* This intentionally conflicts with 2_rename_phone_to_home.sql!
*/
ALTER TABLE employee RENAME phone TO phone_cell;
|
-- This script contains demo code for Module 3 of the Transact-SQL course
-- INNER joins
-- Implicit
SELECT p.ProductID, m.Name AS Model, p.Name AS Product
FROM SalesLT.Product AS p
JOIN SalesLT.ProductModel AS m
ON p.ProductModelID = m.ProductModelID
ORDER BY p.ProductID;
-- Explicit
SELECT p.ProductID, m.Name... |
<gh_stars>10-100
SELECT trafficSource.source , ( ( total_no_of_bounces / total_visits ) * 100 ) AS bounce_rate
FROM (
SELECT trafficSource.source , COUNT ( trafficSource.source ) AS total_visits, COUNT ( totals.bounces ) AS total_no_of_bounces
FROM TABLE_DATE_RANGE([{{GOOGLE_CLOUDSDK_CORE_PROJECT}}:{{GOOGLE_BIGQUER... |
<reponame>manishkumar1601/waifu-api<filename>schema.sql
create table uploads
(
uploaded datetime default CURRENT_TIMESTAMP not null,
id int auto_increment,
file varchar(64) not null,
md5 varchar(64) not null,
type varchar(16) ... |
-- http://sqlfiddle.com/#!18/c0701/1
-- https://stackoverflow.com/questions/32876744/ranking-teams-equal-on-points-in-a-pool-based-on-who-won-the-game-they-played
SELECT
HT.id AS id,
HT.name AS "Home Team",
M.hometeamscore AS "home Team Score",
M.awayteamscore AS "away Team Score",
... |
<gh_stars>1-10
UPDATE case_attachment
SET created_by=substring(created_by from 1 for position(';' in created_by) - 1)
where created_by like '%;%';
UPDATE case_management_system
SET created_by=substring(created_by from 1 for position(';' in created_by) - 1)
where created_by like '%;%';
UPDATE case_management_system
SE... |
<filename>DatabaseDesign/Work 5/views/CustomerOrderInfo.sql
CREATE VIEW CustomerOrder
AS
SELECT FullName, Address, Phone, Comment
from Customer
left join [Order] O on Customer.CustomerID = O.CustomerID
go |
--
-- Copyright 2015 <NAME> <<EMAIL>>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable ... |
-- Add new column
select fn_db_add_column('vds_groups', 'ha_reservation', 'boolean not null default false');
-- Insert new weight and balance methods
INSERT INTO policy_units (id, name, is_internal, custom_properties_regex, type, description) VALUES ('7f262d70-6cac-11e3-981f-0800200c9a66', 'OptimalForHaReservation', t... |
update goma_string_types set
id = :id
, text_columns = :text_columns
, tinytext_columns = :tinytext_columns
, mediumtext_columns = :mediumtext_columns
, longtext_columns = :longtext_columns
, char_columns = :char_columns
, varchar_columns = :varchar_columns
, enum_columns = :enum_columns
where
id... |
<gh_stars>1000+
{% macro test_array_results() %}
{% set sql %}
select ARRAY[1, 2, 3, 4] as mydata
{% endset %}
{% set result = run_query(sql) %}
{% set value = result.columns['mydata'][0] %}
{# This will be json-stringified #}
{% if value != "[1, 2, 3, 4]" %}
{% do exceptions... |
alter table "source_collector"."formatter" rename column "ConnectionId" to "connection_id";
|
alter table t_flexobject
add column txid numeric(16),
add column lastModified DATETIME not null default current_timestamp on update current_timestamp
alter table t_ids
add column txid numeric(16),
add column lastModified DATETIME not null default current_timestamp on update current_timestamp
alter table t_lis... |
CREATE TABLE person (
id SERIAL PRIMARY KEY,
original_id INTEGER NOT NULL,
active BOOLEAN NOT NULL,
full_name VARCHAR(54) NOT NULL,
email VARCHAR(40),
phone VARCHAR(15),
address VARCHAR(50),
created_by VARCHAR(50) ... |
ALTER TABLE Sections ADD COLUMN Visible boolean;
ALTER TABLE Sections ADD COLUMN CrnRestricted boolean;
|
<filename>Aggregation/min-max-avg-median.sql<gh_stars>1-10
-- When was the earliest order ever placed?
SELECT MIN(occurred_at)
FROM orders;
-- When did the most recent (latest) web_event occur?
SELECT MAX(occurred_at)
FROM web_events;
-- Find the mean (AVERAGE) amount spent per order on each paper type, as well as t... |
LOCK TABLES `chii_subject_revisions` WRITE;
REPLACE INTO `chii_subject_revisions`
VALUES (194043, 1, 26, 1, 0, 1392637720, '“文学少女”と死にたがりの道化 (ファミ通文庫)', '', '{{Infobox animanga/Book\n|中文名= \n|别名= {\n\n}\n|作者=野村 美月 \n|译者= \n|出版社=エンターブレイン \n|价格=¥ 588 \n|插图= \n|连载杂志= \n|发售日=2006-04-28 \n|页数=254 \n|话数= \n|ISBN=4757728069 \n... |
<reponame>narkhedegs/DistributedTransactions<filename>DistributedTransactions/Sql/northwest-medical-center.sql
USE [master]
GO
IF NOT EXISTS
(SELECT NAME
FROM sys.databases
WHERE NAME = N'NorthwestMedicalCenter') BEGIN
CREATE DATABASE [NorthwestMedicalCenter]
END
GO
USE [NorthwestM... |
<reponame>dram/metasfresh
-- 2019-10-11T10:59:50.816Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO t_alter_column values('dhl_shipper_config','AccountNumber','VARCHAR(255)',null,null)
;
-- 2019-10-11T11:01:17.590Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT... |
<reponame>Ed-Fi-Exchange-OSS/Ed-Fi-Clever-Integration<filename>OneRoster.Persistence/Database/MsSQL/Scripts/1onerosterv11.schema.sql
IF NOT EXISTS ( SELECT *
FROM sys.schemas
WHERE name = N'onerosterv11' )
EXEC('CREATE SCHEMA [onerosterv11]');
GO |
<filename>tiankx/sql/user_info.sql
create table if not exists user_info (
name string comment '姓名',
id string comment '编号'
)
; |
-- Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
-- Copyright [2016-2020] EMBL-European Bioinformatics Institute
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain... |
/* Copyright (c) 2006-2012 Regents of the University of Minnesota.
For licensing terms, see the file LICENSE. */
/* This script adds password salting and hashing and some functions to
manipulate passwords. */
begin transaction;
set constraints all deferred;
/* Return a random string for use as salt. Note that ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.