text stringlengths 1 1.05M |
|---|
/*
You'll now revisit the use of the AVG() function introduced in our Intro to SQL for Data Science course. You will use it in combination with left join to determine the average gross domestic product (GDP) per capita by region in 2010.
*/
/*
Instructions 1/3
Begin with a left join with the countries table on the lef... |
-- Could not auto-generate a down migration.
-- Please write an appropriate down migration for the SQL below:
-- CREATE OR REPLACE FUNCTION media_likes_count(media_row public.media)
-- RETURNS INT AS $$
-- SELECT COUNT(*)
-- FROM public.like L
-- WHERE L.media_id = media_row.id
-- ;
-- $$ LANGUAGE sql STABLE;
|
-- Copyright 2020 The Go Authors. All rights reserved.
-- Use of this source code is governed by a BSD-style
-- license that can be found in the LICENSE file.
BEGIN;
CREATE TABLE readmes (
path_id INTEGER NOT NULL PRIMARY KEY REFERENCES paths(id) ON DELETE CASCADE,
filename text NOT NULL,
contents text NO... |
IF NOT EXISTS (SELECT * FROM dbo.OrderStatus)
INSERT INTO dbo.OrderStatus(Id, [Name])
VALUES
(1, 'Complete'),
(2, 'Incomplete');
GO
|
/*
Navicat MySQL Data Transfer
Source Server : 本地
Source Server Type : MySQL
Source Server Version : 50726
Source Host : localhost:3306
Source Schema : grade
Target Server Type : MySQL
Target Server Version : 50726
File Encoding : 65001
Date: 07/03/2020 21:28:58
*/
... |
CREATE SCHEMA [Admin]
|
alter table "video"."EventVonageSession" alter column "layoutData" drop not null;
alter table "video"."EventVonageSession" add column "layoutData" jsonb;
|
-- SPDX-License-Identifier: Apache-2.0
-- Licensed to the Ed-Fi Alliance under one or more agreements.
-- The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
-- See the LICENSE and NOTICES files in the project root for more information.
PRINT N'Creating primary key [InternetAccessDescri... |
-- boundary2.test
--
-- db eval {
-- SELECT a FROM t1 WHERE r <= -129 ORDER BY x
-- }
SELECT a FROM t1 WHERE r <= -129 ORDER BY x |
-- Problems
DROP INDEX `idx_problems_public` ON Problems;
ALTER TABLE `Problems`
CHANGE COLUMN `public` `visibility` tinyint(1) NOT NULL DEFAULT '1' COMMENT '-1 banned, 0 private, 1 public, 2 recommended';
CREATE INDEX idx_problems_visibility ON Problems (`visibility`);
-- QualityNominations
CREATE TABLE IF NOT EX... |
CREATE OR REPLACE PROCEDURE pg_reset_all_table_sequences(
IN commit_mode BOOLEAN DEFAULT FALSE
, IN mask_in TEXT DEFAULT NULL
) AS
$$
DECLARE
sql_reset TEXT;
each_sec RECORD;
new_val TEXT;
BEGIN
sql_reset :=
$sql$
SELECT setval(pg_get_serial_sequence('%1$s.%2$s', '%3$s'), coalesce(max("%3$s") + 1, %4... |
-- CreateTable
CREATE TABLE "User" (
"id" SERIAL NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
"email" TEXT NOT NULL,
"hash" TEXT NOT NULL,
"hashedRt" TEXT,
CONSTRAINT "User_pkey" PRIMARY KEY ("id")
);
|
/*
Database: edsSQLChalls
Dataset: foot-moneyball
PUZZLE 7
Write a query that:
- Calculates the average score allowed by a "team" to "opponents" in 2012, in
their home stadium (location = 'H')
- Calculates the average score allowed by an "opponent" to "teams" in 2012, in
their home stadium (location = 'A')
- Selects ... |
INSERT INTO produto (codigo, descricao, preco) VALUES (1, 'Produto A do SQL', 800);
INSERT INTO produto (codigo, descricao, preco) VALUES (2, 'Produto B do SQL', 3800);
INSERT INTO produto (codigo, descricao, preco) VALUES (3, 'Produto C do SQL', 500);
INSERT INTO item_estoque (codigo_produto, qtd) VALUES (1, 5);
INSER... |
/*
* Creates the def, tag, and iov tables necessary to define a laser monitoring farm subrun
* Requires: create_run_core.sql
*/
/* laser monitoring farm tag */
CREATE TABLE lmf_run_tag (
tag_id NUMBER(10) NOT NULL,
gen_tag VARCHAR2(100) NOT NULL
);
CREATE SEQUENCE lmf_run_tag_sq INCREMENT BY 1 START WITH 1... |
--
-- Drop all tables;
--
DROP TABLE IF EXISTS `BANK_SEQUENCE`;
DROP TABLE IF EXISTS `ACCOUNT`;
DROP TABLE IF EXISTS `HOLDER`;
--
-- Create for table `HOLDER`
--
CREATE TABLE `HOLDER` (
`HLD_ID` bigint(20) NOT NULL,
`HLD_NO` bigint(20) NOT NULL,
`HLD_NAME` varchar(50) NOT NULL,
`HLD_OPTLOCK_VERSION` int(11) DE... |
alter table acs_attributes drop constraint acs_attributes_datatype_fk;
alter table acs_attributes add constraint acs_attributes_datatype_fk
foreign key (datatype)
references acs_datatypes(datatype) on update cascade;
|
REPLACE PROCEDURE dbt_test.dbt_drop_relation_if_exists(
IN relation_type VARCHAR(10),
IN full_name VARCHAR(256)
)
BEGIN
DECLARE sql_stmt VARCHAR(500) CHARACTER SET Unicode;
DECLARE msg VARCHAR(400) CHARACTER SET Unicode;
DECLARE exit HANDLER FOR SqlException
BEGIN
IF SqlCode = 3807 THEN SET msg = full... |
/* ==================== T_OPERACIONES ==================== */
set define off
declare
type t_clob is table of clob index by binary_integer;
l_clob t_clob;
type t_varchar2 is table of varchar2(64) index by binary_integer;
l_varchar2 t_varchar2;
begin
null;
-- start generation of records
----... |
use tekine
CREATE TABLE IF NOT EXISTS ITEMS (
name varchar(255) PRIMARY KEY,
count int,
owner varchar(255)
);
INSERT INTO ITEMS (name, count, owner) VALUES ('pen', 3, 'Bob');
INSERT INTO ITEMS (name, count, owner) VALUES ('book', 1, 'John');
INSERT INTO ITEMS (name, count, owner) VALUES ('cup', 3, 'Jully'... |
/*
vwTableInfo - Table Information View
This view display space and storage information for every table in a
SQL Server 2005 database.
Columns are:
Schema
Name
Owner (may be different from Schema)
Columns (count of the max number of columns ever used)
HasClusIdx 1 if table has a clu... |
DELETE FROM detection;
ALTER TABLE detection ADD rssi INTEGER NOT NULL;
ALTER TABLE detection ADD battery FLOAT NOT NULL;
ALTER TABLE detection ADD uptime_ms bigint NOT NULL;
ALTER TABLE detection ADD remote_id INTEGER NOT NULL; |
ALTER TABLE `users`
ADD COLUMN `sex` TINYINT NOT NULL DEFAULT 0 COMMENT '性别'; |
INSERT INTO `erp_permission_keys` (`id`, `permission_keys`) VALUES (NULL, 'material-add_new_material'), (NULL, 'material-delete_material');
INSERT INTO `erp_permission_keys` (`id`, `permission_keys`) VALUES (NULL, 'vendor-add_new_vendor'), (NULL, 'vendor-export_details');
INSERT INTO `erp_permission_keys` (`id`, `perm... |
{Source_to_Standard}
SELECT distinct SOURCE_CODE, TARGET_CONCEPT_ID
FROM CTE_VOCAB_MAP
WHERE lower(SOURCE_VOCABULARY_ID)='jnj_cprd_et_loinc' AND lower(TARGET_DOMAIN_ID)='measurement' AND (TARGET_INVALID_REASON is NULL or TARGET_INVALID_REASON = '') |
CREATE procedure [dbo].[CloseIncident](
@incident int, @close_description varchar(max) = null,
@responsible_id int = null,
@title varchar(400) = '',
@payment_method_id int = null,
@fund_value decimal(12,2) = 0)
as
begin
decla... |
SET DEFINE OFF;
create or replace package body afw_01_err_apex_pkg
is
gnu_versn_orcl number (3) default 102;
/*
Obtenir une erreur, toujours en ordre, selon la présence d'un occurence par :
1- Page, table/colonne/contrainte et erreur, par application;
2- Page et erreur, par application
3- Page, par appli... |
CREATE TABLE posts (
id SERIAL PRIMARY KEY,
title VARCHAR NOT NULL,
slug VARCHAR NOT NULL,
body TEXT NOT NULL,
published BOOLEAN NOT NULL DEFAULT 'f',
deleted BOOLEAN NOT NULL DEFAULT 'f'
) |
select employee_id as "java.lang.Integer"
from users
where employee_id > #{getEmployeeId}
order by employee_id
|
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
insert into Roles (Name,CreatedBy,CreatedDateTime) values ('Basic',0,SYSDATETIME());
GO |
CREATE TABLE blocks (
height BIGINT NOT NULL,
previous_block_header_hash TEXT,
block_header_hash TEXT,
nonce BIGINT NOT NULL,
time DATETIME NOT NULL,
merkle_root TEXT NOT NULL,
transactions TEXT NOT NULL,
PRIMARY KEY(height)
);
CREATE TABLE wallet_transfers (
id TEXT NOT NULL,
from_address TEXT,
... |
--
-- PostgreSQL database dump
--
-- Dumped from database version 12.2 (Debian 12.2-2.pgdg100+1)
-- Dumped by pg_dump version 12.2 (Debian 12.2-2.pgdg100+1)
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_st... |
--
-- ARRAYS
--
-- directory paths are passed to us in environment variables
\getenv abs_srcdir PG_ABS_SRCDIR
CREATE TABLE arrtest (
a int2[],
b int4[][][],
c name[],
d text[][],
e float8[],
f char(5)[],
g varchar(5)[]
);
CREATE TABLE array_op_test (
seqno int4,
i int4[],
t text[]
);... |
create table post (id integer primary key AUTOINCREMENT, title varchar(255) not null, content text not null);
insert into post(title, content) values('Post 1', 'Content 1');
insert into post(title, content) values('Post 2', 'Content 2');
insert into post(title, content) values('Post 3', 'Content 3');
insert into post(t... |
SELECT COUNT(*)
FROM
site as s,
so_user as u1,
question as q1,
answer as a1,
tag as t1,
tag_question as tq1,
badge as b,
account as acc
WHERE
s.site_id = q1.site_id
AND s.site_id = u1.site_id
AND s.site_id = a1.site_id
AND s.site_id = t1.site_id
AND s.site_id = tq1.site_id
AND s.site_id = b.site_id
AND q1.id = tq1.ques... |
CREATE DATABASE IF NOT EXISTS `llmm_main` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `llmm_main`;
-- MySQL dump 10.13 Distrib 5.6.17, for Win32 (x86)
--
-- Host: localhost Database: llmm_main
-- ------------------------------------------------------
-- Server version 5.6.20
/*!40101 SET @OLD_CHARACTER_SET_CLIENT... |
-- tkt2339.test
--
-- execsql {
-- SELECT * FROM (SELECT * FROM t1 LIMIT 2)
-- UNION
-- SELECT * FROM (SELECT * FROM t2 LIMIT 2)
-- }
SELECT * FROM (SELECT * FROM t1 LIMIT 2)
UNION
SELECT * FROM (SELECT * FROM t2 LIMIT 2) |
select u.user_id, cu.role, cm.course_id, cm.service_level, cm.row_status, cm.available_ind, cm.dtcreated, cm.dtmodified, cm.course_name
from course_main cm
inner join course_users cu on cm.pk1 = cu.crsmain_pk1
inner join users u on u.pk1 = cu.users_pk1
where cm.course_id = 'I3115-MEDN-60030-1201-1YR-040366' -- add Cou... |
INSERT INTO IIS.CATA_LIFER (
PK_CL_PRISON_NUMBER,
CL_INMATE_SURNAME,
LIFER_STATUS,
XIDBKEY,
KSQ_CL_SURNAME_ID,
KSQ_CATA_STATUS_ID
)
VALUES
('AB111111', '', 'LM', 12345, 12345, 12345);
|
-- Find all the customers who have an account at all the branches located in a specific city.
SELECT *
FROM BankCustomer BC
WHERE NOT EXISTS (
SELECT branchname
FROM Branch
WHERE
branchcity = 'DELHI' AND
(branchname) NOT IN (
SELECT BA.branchname
FROM Depositer D, BankAccount BA
... |
DELETE FROM LOGIN_HISTORIES
WHERE
LOGIN_COUNT = ?
AND USER_ID = ?
;
|
drop table if exists `{dbprefix}ruler`;
create table if not exists `{dbprefix}ruler`(
`rulerid` int(11) unsigned not null auto_increment comment 'ID',
`rulername` varchar(50) not null default '' comment '管理员账号',
`passwd` varchar(50) not null default '' comment '密码',
`realname` varchar(10) not null default '' commen... |
--
-- Creation table tag
--
CREATE TABLE `pj_opi` (
`cod_apo_pj` VARCHAR(5) NOT NULL COMMENT 'Code Apogée de la pièce',
`cod_opi` VARCHAR(10) NOT NULL COMMENT 'Code de l\'opi',
`id_candidat` INT(10) NOT NULL COMMENT 'Identifiant du candidat',
`id_fichier` INT(10) NOT NULL COMMENT 'Identifiant du fichier (non clé ét... |
-- Drop database
--DROP DATABASE job4j;
-- Create database
CREATE DATABASE job4j;
-- Roles
CREATE TABLE roles(
id SERIAL PRIMARY KEY,
role CHAR(100)
);
INSERT INTO roles(role) VALUES ('Admin');
INSERT INTO roles(role) VALUES ('User');
-- Rules
CREATE TABLE rules(
id SERIAL PRIMARY KEY,
rule CHAR(100)
);
INSE... |
-- This query should also parse in ANSI, but as a bigquery example
-- it probably lives here. In particular it has an un-bracketed
-- select clause within a function, and array notation which
-- makes it a useful test case.
WITH age_buckets_bit_array AS (
SELECT
bucket_id,
num_ranges,
min_... |
CREATE TABLE colors(color color);
-- INSERT different color values
INSERT INTO colors VALUES('000000'), ('FFFFFF'), ('FF0000'), ('00FF00'), ('0000FF');
-- Display INSERTed values
SELECT * FROM colors;
-- Try INSERTing invalid colors
INSERT INTO colors VALUES('0');
INSERT INTO colors VALUES('0000000');
INSERT INTO co... |
ALTER TABLE jq_dynamic_form
ADD COLUMN datasource_id VARCHAR(50) DEFAULT NULL AFTER form_type_id,
ADD COLUMN last_updated_by VARCHAR(500) DEFAULT NULL,
ADD COLUMN last_updated_ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP() ON UPDATE CURRENT_TIMESTAMP(),
ADD CONSTRAINT jq_dynamic_form_ibfk_1 FOREIGN KEY (datasource_id) REFER... |
-- Script to migrate Q Capture control tables from V9.1 to V9.5.
--
-- Prior to running this script, customize it to your existing
-- Q Capture server environment:
-- (1) Locate and change all occurrences of the string !capschema!
-- to the name of the Q Capture schema applicable to your
-- environment
--
-- ... |
-- Nice view of collection -> unit -> file
SELECT c.id AS "c.id",
c.properties -> 'film_date' AS "film_date",
c.properties -> 'kmedia_id' AS "kmedia",
c.type_id,
ccu.name AS "part",
cu.id AS "cu.id",
cu.type_i... |
CREATE TABLE scm_conversation(
seq BIGINT AUTO_INCREMENT PRIMARY KEY,
/**
* type: org.kyojo.schemaorg.m3n4.core.Container$About
* param: org.kyojo.schemaorg.m3n4.auto.Clazz$BusOrCoach
* org.kyojo.schemaorg.m3n4.auto.Clazz$CarUsageType
* org.kyojo.schemaorg.m3n4.auto.Clazz$Motorcycle
* ... |
-- Your SQL goes here
CREATE TABLE tournaments_admin
(
id SERIAL PRIMARY KEY,
tournament_id INT NOT NULL REFERENCES tournaments (id) ON DELETE NO ACTION,
admin_username VARCHAR NOT NULL REFERENCES users (username) ON DELETE NO ACTION
);
|
SELECT DISTINCT City
FROM Station
WHERE LEFT(City, 1) NOT IN ('A', 'E', 'I', 'O', 'U') OR
RIGHT(City, 1) NOT IN ('A', 'E', 'I', 'O', 'U', 'a', 'e', 'i', 'o', 'u');
|
---
--- Test Overflow with NO CYCLE
---
CREATE TABLE tmp_table (a int);
INSERT INTO tmp_table VALUES (0),(1),(2),(3);
-- Test execution of nextval on master with CACHE 1
CREATE SEQUENCE tmp_seq INCREMENT 1 MINVALUE 1 MAXVALUE 2 START 1 CACHE 1 NO CYCLE;
SELECT nextval('tmp_seq');
SELECT nextval('tmp_seq');
-- Fails be... |
-- Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
-- SPDX-License-Identifier: Apache-2.0
DROP ALL OBJECTS;
|
-- Technique for creating large sample test data from
-- http://www.sql-server-performance.com/jc_large_data_operations.asp
use [IBatisNet]
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ManyRecordsTest]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[ManyRecordsTest]
-- Crea... |
SET @sName = 'bx_messenger';
-- TABLES
CREATE TABLE IF NOT EXISTS `bx_messenger_videos_processed` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`profile_id` int(10) unsigned NOT NULL,
`remote_id` varchar(128) NOT NULL,
`path` varchar(255) NOT NULL,
`file_name` varchar(255) NOT NULL,
`mime_type` varchar(128) NOT... |
DELETE FROM job_running_instances; |
-----------------------------------------------------------------------------------
--Do not modify this file, instead use an alter proc to over-write the procedure.--
--Make sure you follow the same expected interface of parameters, and resultsets.--
-----------------------------------------------------------------... |
-- phpMyAdmin SQL Dump
-- version 4.6.5.2
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 01-05-2018 a las 02:27:32
-- Versión del servidor: 10.1.21-MariaDB
-- Versión de PHP: 5.6.30
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CL... |
-- phpMyAdmin SQL Dump
-- version 4.4.1.1
-- http://www.phpmyadmin.net
--
-- Host: localhost:8889
-- Generation Time: Oct 25, 2015 at 06:29 AM
-- Server version: 5.5.42
-- PHP Version: 5.6.7
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIEN... |
/*
SQLyog Professional v12.09 (64 bit)
MySQL - 5.7.13 : Database - ideatest
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;
/*!40101 SET SQL_MODE=''*/;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_C... |
CREATE TABLE DataLocation (
DataShard INTEGER NOT NULL,
PKey INTEGER NOT NULL
);
CREATE INDEX DataShardIndex ON DataLocation (DataShard);
|
INSERT INTO `renuncias` (dni,orgpolrenunciaop,aniorenunciaop) VALUES ('07509505','UNIÓN POR EL PERÚ' ,'2005');
INSERT INTO `renuncias` (dni,orgpolrenunciaop,aniorenunciaop) VALUES ('41692996','MOVIMIENTO REGIONAL O DEPARTAMENTAL MOVIMIENTO POPULAR KALLPA' ,'2014');
INSERT INTO `renuncias` (dni,orgpolrenunciaop,anior... |
--Test delete on superclass
create class t1 (name varchar(20), age integer);
create class sub_t1 as subclass of t1(gender char(1));
insert into t1 values('Jerry', 25);
insert into t1 values('Tom', 26);
insert into t1 values('Kitty', 27);
insert into t1 values('Cat', 23);
insert into sub_t1 values('Sun', 26, 'f');
i... |
CREATE TABLE [Sales].[OrderLines]
(
[OrderLineID] [int] NOT NULL CONSTRAINT [DF_Sales_OrderLines_OrderLineID] DEFAULT (NEXT VALUE FOR [Sequences].[OrderLineID]),
[OrderID] [int] NOT NULL,
[StockItemID] [int] NOT NULL,
[Description] [nvarchar] (100) NOT NULL,
[PackageTypeID] [int] NOT NULL,
[Quantity] [int] NOT NULL,
[U... |
-- @testpoint: 表名和列名同时出现关键字unique
drop table if exists "unique";
create table "unique"(
c_id int, c_int int, c_integer integer, c_bool int, c_boolean int, c_bigint integer,
c_real real, c_double real,
c_decimal decimal(38), c_number number(38), c_numeric numeric(38),
c_char char(50) default null, c_varchar varchar(... |
DROP FUNCTION IF EXISTS account.token_auto_expiry_trigger() CASCADE;
CREATE FUNCTION account.token_auto_expiry_trigger()
RETURNS trigger
AS
$$
BEGIN
UPDATE account.access_tokens
SET
revoked = true,
revoked_on = NOW()
WHERE ip_address = NEW.ip_address
AND user_agent = NEW.user_agent;
... |
-- interrupt.test
--
-- execsql {
-- SELECT name FROM sqlite_temp_master;
-- }
SELECT name FROM sqlite_temp_master; |
CREATE TABLE IF NOT EXISTS words
(
"word" TEXT NOT NULL,
"user_id" BIGINT NOT NULL,
"collection" TEXT NOT NULL,
"translation" TEXT NOT NULL,
"article" CHAR(3) NOT NULL,
PRIMARY KEY("word", "collection", "user_id")
);
INSERT OR REPLACE INTO words (
"article",
"word",
"translation",
... |
-- phpMyAdmin SQL Dump
-- version 4.7.0
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Sep 07, 2018 at 07:38 PM
-- Server version: 10.1.22-MariaDB
-- PHP Version: 7.1.4
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD... |
/*
Navicat Premium Data Transfer
Source Server : local
Source Server Type : MySQL
Source Server Version : 100411
Source Host : localhost:3306
Source Schema : sekolah
Target Server Type : MySQL
Target Server Version : 100411
File Encoding : 65001
Date: 04/11/2020 16:2... |
select Name from Towns
select Name from Departments
select FirstName, LastName, JobTitle, Salary from Employees |
-- Verify seattleflu/id3c-customizations:roles/assembly-exporter/create on pg
begin;
-- No real need to test that the user was created; the database would have
-- thrown an error if it wasn't.
rollback;
|
-- AlterTable
ALTER TABLE "Patrimony" ALTER COLUMN "description" DROP NOT NULL;
|
--
-- Copyright 2009-2021 the original author or authors.
--
-- 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
--
-- Unles... |
/*
Warnings:
- A unique constraint covering the columns `[guildId,name]` on the table `FavoriteQuery` will be added. If there are existing duplicate values, this will fail.
*/
-- DropIndex
DROP INDEX "FavoriteQuery_name_key";
-- CreateIndex
CREATE UNIQUE INDEX "FavoriteQuery_guildId_name_key" ON "FavoriteQuery"(... |
Header = struct {
/// Fixed header pattern
magic: u64le where magic => magic == 0x00ffffffffffff00u64,
/// Manufacturer ID
mfg_bytes: u16le,
/// Manufacturer product code
product_code: u16le,
/// Serial number
serial: u32le,
/// Week of manufacture. Week numbering is not consistent b... |
-- (Q11) Important Stock Identification Query
-- tables: tpch_partsupp, tpch_supplier, tpch_nation
SELECT
ps_partkey,
sum(ps_supplycost * ps_availqty) AS value
FROM
tpch_partsupp,
tpch_supplier,
tpch_nation
WHERE
ps_suppkey = s_suppkey
AND s_nationkey = n_nationkey
AND n_name = 'GERMANY'
GROUP BY
ps_... |
CREATE OR REPLACE LUA SET SCRIPT emit_rows(row_count DOUBLE, row_offset DOUBLE, row_step DOUBLE)
EMITS (rn DOUBLE)
AS
function run(ctx)
for i=ctx.row_offset, ctx.row_count-1, ctx.row_step do
ctx.emit(i)
end
end
;
CREATE OR REPLACE TABLE emit_base
(
rn DECIMAL(... |
-- =======================================================================================
-- Author: Stephen Quin
-- Create date: 24/05/12
-- Description: Gets the pricing band for a certain price plan on a given contract length
-- ================================================================================... |
-- This SQL code was generated by sklearn2sql (development version).
-- Copyright 2018
-- Model : CaretClassifier_cforest_pca
-- Dataset : BreastCancer
-- Database : db2
-- This SQL code can contain one or more statements, to be executed in the order they appear in this file.
-- Model deployment code
WITH "ADS_s... |
-- @testpoint: opengauss比较操作符>,比较类型:TINYINT
drop table if exists ts_zhparser;
CREATE TABLE ts_zhparser(id TINYINT, index TINYINT);
INSERT INTO ts_zhparser VALUES(100, 1);
select * from ts_zhparser where id > index;
drop table if exists ts_zhparser; |
-- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: Dec 13, 2019 at 12:31 PM
-- Server version: 10.3.13-MariaDB
-- PHP Version: 7.1.22
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SE... |
-- SPDX-License-Identifier: Apache-2.0
-- Licensed to the Ed-Fi Alliance under one or more agreements.
-- The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
-- See the LICENSE and NOTICES files in the project root for more information.
PRINT N'Creating primary key [StudentHomelessProgr... |
SET NAMES 'utf8';
USE github_subscriptions;
DROP TABLE IF EXISTS tasks;
CREATE TABLE tasks (
id int(11) NOT NULL AUTO_INCREMENT,
email varchar(128) NOT NULL,
started datetime NULL,
finished datetime NULL,
input json NULL,
result json NULL,
PRIMARY KEY (id),
INDEX idx_email (email)
)
ENGINE = INNODB
CH... |
UPDATE button SET recipe = '(12) (20) (20) (X) (X)' WHERE name = 'Largo';
|
-- SQL GPKG
CREATE TABLE gpkg_spatial_ref_sys (srs_name,srs_id,organization,organization_coordsys_id,definition,description);
INSERT INTO gpkg_spatial_ref_sys VALUES('OSGB 1936 / British National Grid',4327,'NONE',4327,'PROJCS["OSGB 1936 / British National Grid",GEOGCS["OSGB 1936",DATUM["OSGB_1936",SPHEROID["Airy_1830"... |
/*
Copyright 2021 Snowplow Analytics Ltd. All rights reserved.
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 a... |
-- @testpoint:opengauss关键字destroy(非保留),自定义数据类型名为destroy
--关键字destroy作为数据类型不带引号,创建成功
drop type if exists destroy;
CREATE TYPE destroy AS (f1 int, f2 text);
select typname from pg_type where typname ='destroy';
drop type destroy;
--关键字destroy作为数据类型名加双引号,创建成功
drop type if exists "destroy";
CREATE TYPE "destroy" AS (f1 ... |
/****** Object: StoredProcedure [dbo].[app_MGMatchingGame_GetRandomPlayItems] Script Date: 01/05/2015 14:43:21 ******/
CREATE PROCEDURE [dbo].[app_MGMatchingGame_GetRandomPlayItems] @MAGID INT,
@NumItems INT,
@Difficulty INT
AS
DECLARE @SQL VARCHAR(8000)
CREATE TABLE #Temp1 (
[ID] UNIQUEIDENTIFIER,
[MAGTID] ... |
-- Author : fanny agustiawan
-- Table m_payment_type
ALTER TABLE `m_payment_type` ADD `sub_gl` varchar(50) NOT NULL AFTER `description`; |
CREATE TABLE {$NAMESPACE}_phurl.phurl_urltransaction_comment (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
phid VARBINARY(64) NOT NULL,
transactionPHID VARBINARY(64) DEFAULT NULL,
authorPHID VARBINARY(64) NOT NULL,
viewPolicy VARBINARY(64) NOT NULL,
editPolicy VARBINARY(64) NOT NULL,
commentVersi... |
-- Drops the database if it already exists
DROP DATABASE IF EXISTS employees_db;
-- Create the DB "employee_db"
CREATE DATABASE employees_db;
-- Use the db for the rest of the script
USE employees_db;
-- Create table department
CREATE TABLE departments (
id int AUTO_INCREMENT NOT NULL,
name varchar(30) NOT N... |
--
-- Fill given extent with a rectangular coverage
--
-- @param ext Extent to fill. Only rectangles with center point falling
-- inside the extent (or at the lower or leftmost edge) will
-- be emitted. The returned hexagons will have the same SRID
-- as this extent.
--
-- @param width ... |
create unique index IDX_SYS_CATEGORY_UNIQ_NAME_ENTITY_TYPE on SYS_CATEGORY (NAME, ENTITY_TYPE, DELETE_TS); |
/*
--------------------------------- MIT License ---------------------------------
Copyright (c) 2019 jtsoya539
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including witho... |
/*
Select the latest date from the TAXON_OCCURRENCE, TAXON_DETERMINATION, SAMPLE and
SURVEY_EVENT tables. The latest data will be stuffed into the MAX_DATES table
along with the TAXON_OCCURRENCE_KEY. This date can be used to compare whether a
record has changed since last upload.
*/
set ansi_warnings o... |
CREATE TYPE [dbo].[IdentityServerClientList] AS TABLE
(
[Index] INT PRIMARY KEY DEFAULT 0,
[Id] INT NOT NULL DEFAULT 0,
[Name] NVARCHAR (255),
[Memo] NVARCHAR (1024),
[ClientId] NVARCHAR(255),
[ClientSecret] NVARCHAR(255)
)
|
{% import 'macros/security.macros' as SECLABEL %}
{% import 'macros/variable.macros' as VARIABLE %}
{% if 'rolname' in data %}
{% set rolname=data.rolname %}
ALTER ROLE {{ conn|qtIdent(role) }}
RENAME TO {{ conn|qtIdent(rolname) }};
{% else %}
{% set rolname=role %}
{% endif %}
{% if data|hasAny(alterKeys) %}
ALTER R... |
DROP TABLE "public"."o2_user";
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.