sql stringlengths 6 1.05M |
|---|
<gh_stars>0
CREATE TABLE INTRANET_CLAIMS (
ID VARCHAR(45),
CLAIM_NUMBER VARCHAR(45),
CUSTOMER_NUMBER INTEGER,
NAMES VARCHAR(100),
LAST_NAMES VARCHAR(100),
IS_COMPANY CHAR(1),
IDENTIFICATION VARCHAR(45),
PASSPORT VARCHAR(45),
LEGAL_NAME VARCHAR(150),
RESIDENTIAL_PHONE VARCHAR(45),... |
SELECT order_date, sku, quan
FROM customers
INNER JOIN orders ON customers.cid = orders.cid
INNER JOIN items ON orders.oid = items.oid
WHERE (name,sku) IN (('Smith','1234'),('Jones','4567'),('Adams','6666'))
|
<reponame>lgcarrier/AFW
SET DEFINE OFF;
ALTER TABLE AFW_12_DEFNT_ACCES ADD (
CONSTRAINT AFW_12_DEFNT_ACCES_CK1
CHECK (( REF_GROUP_UTILS IS NOT NULL AND REF_UTILS IS NULL ) OR ( REF_GROUP_UTILS IS NULL AND REF_UTILS IS NOT NULL ))
ENABLE VALIDATE)
/
|
<reponame>nguillaumin/nabaztag-server
SET FOREIGN_KEY_CHECKS = 0;
DELETE FROM nathan_version WHERE version_author = 63643;
delete from user WHERE user_id in (97238, 90481);
delete from object WHERE object_id in (63643, 60463);
SET FOREIGN_KEY_CHECKS = 1; |
<filename>tests/database-init-scripts/create-gogreen-db.sql
create database gogreen;
grant all on gogreen.* to 'gogreen'@'%' identified by 'password';
flush privileges; |
<reponame>titimar16/KitBox
-- MySQL dump 10.13 Distrib 8.0.20, for Win64 (x86_64)
--
-- Host: 127.0.0.1 Database: kitbox
-- ------------------------------------------------------
-- Server version 8.0.20
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHA... |
DROP SCHEMA IF EXISTS $$database_app$$;
CREATE SCHEMA IF NOT EXISTS $$database_app$$ DEFAULT CHARACTER SET utf8;
DROP TABLE IF EXISTS $$database_app$$.`messenger_channels`;
CREATE TABLE IF NOT EXISTS $$database_app$$.`messenger_channels` (
`channel_id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`created_timestamp` TIME... |
--
-- pgwt.compose_request()
--
-------------------------------------------------------------------------------
CREATE OR REPLACE FUNCTION pgwt.compose_request(IN json, OUT _pgwt.request)
LANGUAGE plpgsql
AS $function$
BEGIN
$2.area = NULLIF($1->>'area', '');
$2.host = NULLIF($1->>'host', '');
$2.path = NULLIF... |
<reponame>Shuttl-Tech/antlr_psql
-- file:create_aggregate.sql ln:199 expect:true
CREATE FUNCTION float8mi_int(float8, float8) RETURNS int AS
$$ SELECT CAST($1 - $2 AS INT)
|
<filename>modules/boonex/shopify/updates/9.0.7_10.0.0/install/sql/install.sql
-- TABLES
ALTER TABLE `bx_shopify_entries` CHANGE `allow_view_to` `allow_view_to` VARCHAR(16) NOT NULL DEFAULT '3';
CREATE TABLE IF NOT EXISTS `bx_shopify_reactions` (
`object_id` int(11) NOT NULL default '0',
`reaction` varchar(32)... |
<reponame>forgottenlands/ForgottenCore406
INSERT INTO `quest_template` (`entry`, `Method`, `ZoneOrSort`, `SkillOrClassMask`, `MinLevel`, `MaxLevel`, `QuestLevel`, `Type`, `RequiredRaces`, `RequiredSkillValue`, `RepObjectiveFaction`, `RepObjectiveValue`, `RepObjectiveFaction2`, `RepObjectiveValue2`, `RequiredMinRepFacti... |
<filename>test/sql/mutation_delete.sql
begin;
create table account(
id serial primary key,
email varchar(255) not null
);
create function _echo_email(account)
returns text
language sql
as $$ select $1.email $$;
create table blog(
id serial primary key,
... |
<filename>conf/evolutions/default/1.sql
# --- Created by Ebean DDL
# To stop Ebean DDL generation, remove this comment and start using Evolutions
# --- !Ups
create table feed (
id varchar(40) not null,
phone varchar(255),
email varc... |
<gh_stars>0
use role SECURITYADMIN;
use database HRIS_DATA;
create role "TRANSFORMING_WAREHOUSE.HRIS_DATA.ICIMS.pii.reader.role";
create role "AIRFLOW_WAREHOUSE.HRIS_DATA.ICIMS.pii.writer.role";
create role "AIRFLOW_WAREHOUSE.HRIS_DATA.ICIMS.pii.owner.role";
create role "AIRFLOW_WAREHOUSE.HRIS_DATA.ICIMS.pii.service.... |
insert into users (id, cluster, email, email_private) values ('a2f82e0a-724c-4318-a8ef-38441f5205f6', 'test', '<EMAIL>', false); |
<reponame>jankytara2/dbt<filename>test/integration/065_postgres_index_tests/models-invalid/missing_columns.sql
{{
config(
materialized = "table",
indexes=[
{'unique': True},
]
)
}}
select 1 as column_a, 2 as column_b
|
<filename>postgresql/dbms/filter.sql
聚合函数筛选 filter
格式:aggregate() [filter(where values [...])]
该命令在聚合函数之后使用,如果不写,那么不会生效,写了会按照要求去筛选去计算聚合函数内容。但不符合的内容依然会出现。where不能省略。
--只有符合id=2的时候sum才会计算,但不符合要求的内容依然会被显示。
with a as (
select 1 id union all
select 1 id union all
select 1 id union all
select 2 id union ... |
<filename>vultr-vke/k8sdemo.sql
CREATE SCHEMA k8sdemo;
CREATE TABLE k8sdemo.cryptoquotes (tick TIMESTAMP, symbol VARCHAR, quote FLOAT);
\! wget https://raw.githubusercontent.com/bryanherger/vertica-eon-toolkit/master/vultr-vke/ethusd_28feb2022.csv
COPY k8sdemo.cryptoquotes FROM LOCAL 'ethusd_28feb2022.csv' DELIMITER ',... |
<gh_stars>1-10
ALTER TABLE `addons_addonapprovalscounter` ADD COLUMN `last_human_review` datetime(6);
|
<filename>src/main/plpgsql/so/glad/jueshop/payment_router.sql
CREATE SEQUENCE public.table_payment_router_id_seq
INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 9223372036854775807 CACHE 1;
ALTER SEQUENCE public.table_payment_router_id_seq
OWNER TO soglad;
-- Table: public.payment_router
-- DROP TABLE public.payment_router;
... |
<filename>sqlquery.sql
select concat(u.firstname, " ", u.lastname) as name, AVG(score) as mean_score, year from user_scores us inner join users u on u.id=us.user_id group by us.year, name order by mean_score desc;
|
<filename>schema.sql
DROP DATABASE IF EXISTS employeeDb;
CREATE database employeeDb;
USE employeeDb;
CREATE TABLE department
(
id INT NOT NULL
AUTO_INCREMENT,
name VARCHAR
(30),
PRIMARY KEY
(id)
);
CREATE TABLE role
(
id INT NOT NULL
AUTO_INCREMENT,
title VARCHAR
... |
USE APP_CONFIG
GO
IF OBJECT_ID('SP_XC_CLAIM_REJECTION_READ') IS NOT NULL
BEGIN
DROP PROCEDURE SP_XC_CLAIM_REJECTION_READ
PRINT '<< Procedure SP_XC_CLAIM_REJECTION_READ Dropped >>'
END
ELSE
PRINT '<< Procedure SP_XC_CLAIM_REJECTION_READ DOES NOT EXIST >>'
GO
/**************************************... |
---------------------------------------------------------------
-- view: vw_dashboard_usage_loansbyward
---------------------------------------------------------------
-- drop view vw_dashboard_usage_loansbyward;
create or replace view vw_dashboard_usage_loansbyward as
select
u.ward_name,
u.ward_code,
count(ch.u... |
<reponame>apostoldevel/db-platform
--------------------------------------------------------------------------------
-- Initialization --------------------------------------------------------------
--------------------------------------------------------------------------------
-----------------------------------------... |
<filename>src/main/resources/migrations/00002_create_table_service_gateway_accounts.sql
--liquibase formatted sql
--changeset uk.gov.pay:add_table-service_gateway_accounts
CREATE TABLE service_gateway_accounts (
id SERIAL PRIMARY KEY,
service_id INTEGER,
gateway_account_id VARCHAR(255) UNIQUE
);
--rollback... |
<reponame>banderous/ccd-definition-store-api
INSERT INTO public.complex_field (reference, label, security_classification, field_type_id, complex_field_type_id)
VALUES ('PrepopulateToUsersOrganisation', 'Prepopulate User Organisation', 'PUBLIC',
(select id from field_type where reference = 'YesOrNo' and version ... |
<filename>src/test/resources/sql/explain/afcaf58f.sql
-- file:join.sql ln:978 expect:true
explain (costs off)
select * from tenk1 a join tenk1 b on
(a.unique1 = 1 and b.unique1 = 2) or
((a.unique2 = 3 or a.unique2 = 7) and b.hundred = 4)
|
<reponame>Shuttl-Tech/antlr_psql<filename>src/test/resources/sql/create_table/f0cb0a46.sql
-- file:plpgsql.sql ln:25 expect:true
create table Room (
roomno char(8),
comment text
)
|
<reponame>Shuttl-Tech/antlr_psql
-- file:sequence.sql ln:142 expect:true
DROP SEQUENCE foo_seq_new
|
<reponame>jamiekt/TSQLCodeLibrary<gh_stars>10-100
CREATE PROC [conchango].[csp_ToolRenameObjects2005]
(
@pTableName SYSNAME = '%',
@pFK BIT = 1,
@pCheck BIT = 1,
@pIndexes BIT = 1,
@pPrintSQL BIT = 1,
@pExecuteSQL BIT = 0
) as
SET NOCOUNT ON
DECLARE @vTableName SYSNAME,
@vObjectCount TINYINT,
@vCurOb... |
DROP FUNCTION IF EXISTS getopeninvoices(numeric, numeric, character varying, numeric, timestamp WITHOUT TIME ZONE, numeric, numeric)
;
DROP VIEW IF EXISTS t_getopeninvoices
;
CREATE OR REPLACE VIEW t_getopeninvoices AS
SELECT NULL::numeric AS ad_org_id,
NULL::numeric AS ... |
CREATE OR REPLACE FUNCTION inline_0 () RETURNS integer AS $$
BEGIN
PERFORM acs_rel_type__create_type (
'blah_member_rel',
'Blah Membership Relationship',
'Blah Membership Relationships',
'membership_rel',
'blah_member_rels',
'rel_id',
'blah_member_rel',
'group',
null,
0... |
<filename>homework/domain/src/main/resources/db/migration/V1__Create_type_person_role.sql
CREATE TYPE IF NOT EXISTS person_role AS ENUM ('STUDENT', 'TEACHER'); |
<reponame>italabs/ITA.Common<filename>SOURCE/ITA.WizardsUITest/DemoDbWizard/MySql/Update/add_abc.sql
create table abc (a int, b int, c int); |
SELECT
productid,
productname,
unitsinstock,
unitsonorder,
reorderlevel
FROM
products
WHERE
(unitsinstock + unitsonorder) <= reorderlevel
AND discontinued = 0
ORDER BY
productid |
<gh_stars>10-100
ALTER TABLE t3 DROP CHECK IF EXISTS chk
|
<filename>MODEL/migration/src/main/resources/game-score/queries/game-store-procedure.sql
-- store procedure
delimiter $$
DROP function IF EXISTS `SPLIT_STR`$$
CREATE FUNCTION SPLIT_STR(
x VARCHAR(255),
delim VARCHAR(12),
pos INT
)
RETURNS VARCHAR(255)
RETURN TRIM(REPLACE(SUBSTRING(SUBSTRING_INDEX(x, delim, pos),... |
<gh_stars>1-10
ALTER TABLE GENOMIC_DATA_SOURCE_CONFIGURATION ADD COLUMN DNA_ANALYSIS_NUMBER_LEVEL_CALL INT AFTER DNA_ANALYSIS_USE_CGH_CALL;
UPDATE GENOMIC_DATA_SOURCE_CONFIGURATION SET DNA_ANALYSIS_NUMBER_LEVEL_CALL = '3'; |
-- to address additional sanity fails here - https://warwick.slack.com/archives/C0G854UCS/p1578595458017200
-- any cm1 migrated assignments should have single use marking workflows
update assignment set workflow_category = 'S' where cm1migration = true and cm2_workflow_id is not null;
-- 2 - workflows that were never... |
INSERT INTO
organizations (slug, title, description, hidden, protected)
VALUES
('org-tests-regular', 'Regular Organization', 'Sample organization for org testing.', false, false),
('org-tests-protected', 'Protected Organization', 'Sample organization for org testing.', false, true),
('org-tests-hidden',... |
<gh_stars>0
-- phpMyAdmin SQL Dump
-- version 4.9.5deb2
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Jan 21, 2022 at 09:46 AM
-- Server version: 10.3.32-MariaDB-0ubuntu0.20.04.1
-- PHP Version: 7.4.3
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET tim... |
INSERT INTO provas (id_disciplina,id_curso,ano_semestre,matricula_aluno,descricao,nota) VALUES ('16','16','2018.1','16','Prova 1','227'),
('97','97','2013.2','97','Prova 10','822'),
('0','0','2010.1','0','Prova 11','97'),
('9','9','2014.2','9','Prova 12','923'),
('4','4','2012.1','4','Prova 13','249'),
('13','13... |
/*
Object: dbo.Query_70
Transaction: IPA:NTN
*/
CREATE PROCEDURE [dbo].[Query_70]
@HeaderID AS bigint
AS
SET NOCOUNT ON;
DECLARE @SQL AS nvarchar(MAX) = N'
INSERT INTO ipi.IPNationality
(RowID, ID, TISN, TISNValidFrom, TISAN, TISANValidFrom, ValidFrom, ValidTo)
SELECT
A.RowID
, R.ID
, A.TISN
, A.TIS... |
<filename>Backend/migrations/sqls/20210602062152-seed-table-category-letter-up.sql
INSERT INTO category_letter ("letter", "path") VALUES('A','A');
INSERT INTO category_letter ("letter", "path") VALUES('B','B');
INSERT INTO category_letter ("letter", "path") VALUES('C','C');
INSERT INTO category_letter ("letter", "path"... |
-- phpMyAdmin SQL Dump
-- version 4.6.5.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: 14 Agu 2018 pada 07.20
-- Versi Server: 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_CL... |
-- --------------------------------------------------------
-- Host: localhost
-- Versión del servidor: 5.7.24 - MySQL Community Server (GPL)
-- SO del servidor: Win64
-- HeidiSQL Versión: 10.2.0.5599
-- --------------------------------------------------------
/... |
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET client_encoding = 'SQL_ASCII';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;
SET search_path = public, pg_catalog;
SET default_tablespace = '';
SET default... |
<reponame>RommelTJ/sql_and_postgresql_notes<filename>Section21/Section21.sql
-- Highest user id's exercise
SELECT id FROM users ORDER BY id DESC LIMIT 3;
-- Posts by a Particular User
-- Join users and posts table. Show username of user id 200 and captions of all posts they have created
SELECT username, caption FROM u... |
insert into `user_site_form_field_attribute`(`site_id`,`form_id`,`field_id`,`attribute_id`,`attribute`) values
(1,1,1,7,'e.g. <NAME>'),
(1,1,1,1,'50'),
(1,1,1,2,'255'),
(1,1,2,3,'50'),
(1,1,2,4,'4'),
(1,1,2,8,'e.g. This is pretty limited :)'),
(2,2,3,7,'e.g. <NAME>'),
(2,2,3,1,'50'),
... |
<gh_stars>10-100
TRUNCATE download;
ALTER TABLE download ADD COLUMN kid UUID NOT NULL; |
<filename>collect-core/unused/sql/derby/create-schema.sql
CREATE SCHEMA "collect"
GO
CREATE SEQUENCE "collect"."data_id_seq"
GO
CREATE SEQUENCE "collect"."record_id_seq"
GO
CREATE SEQUENCE "collect"."schema_definition_id_seq"
GO
CREATE SEQUENCE "collect"."survey_id_seq"
GO
CREATE SEQUENCE "collect".... |
<reponame>luisitbweb/php
-- Delete all records from order_detail table
DELETE FROM order_detail;
-- Delete all records from orders table
DELETE FROM orders;
-- Drop customer_name field from orders table
ALTER TABLE orders DROP COLUMN customer_name;
-- Drop shipping_address field from orders table
ALTER TABLE orders ... |
<reponame>Shuttl-Tech/antlr_psql
-- file:tsearch.sql ln:443 expect:true
SELECT ts_rewrite('bar & new & qq & foo & york', 'SELECT keyword, sample FROM test_tsquery'::text )
|
-- file:plpgsql.sql ln:3786 expect:false
BEGIN
arr := array[array['foo','bar'], array['baz', 'quux']]
|
-- file:rolenames.sql ln:349 expect:true
DROP USER MAPPING FOR nonexistent SERVER sv
|
<reponame>mattyschell/geodatabase-buildings-bbl-qa
insert into bbl_qa
(doitt_id
,base_bbl)
select
a.doitt_id
,a.base_bbl
from
building_evw a
join
tax_lot_polygon b
on
a.base_bbl = b.bbl
where
sdo_geom.relate(a.shape,'anyinteract',b.shape,.0005) <> 'TRUE'
and b.bbl not in (
sele... |
<reponame>SkyFire/CCDB406_PUBLIC
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET T... |
INSERT INTO departments (id, name)
VALUES
(1, 'Sales'),
(2, 'Marketing'),
(3, 'Finance'),
(4, 'Operations'),
(5, 'HR');
INSERT INTO roles (title, salary, department_id)
VALUES
('Singer', 1500, 1),
('Dancer', 1800, 3),
('Performer', 2000, 1),
('Comedian', 2300, 2),
('Actress', 5000, 4);
INSERT INT... |
#standardSQL
# 06_01: counts the local and hosted fonts
SELECT
client,
COUNTIF(NET.HOST(page) != NET.HOST(url)) AS hosted,
COUNTIF(NET.HOST(page) = NET.HOST(url)) AS local,
COUNT(0) AS total,
ROUND(COUNTIF(NET.HOST(page) != NET.HOST(url)) * 100 / COUNT(0), 2) AS pct_hosted,
ROUND(COUNTIF(NET.HOST(page) = NE... |
-- noinspection SqlNoDataSourceInspectionForFile
/*
* Copyright (c) 2013-2014 LabKey Corporation
*
* Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
*/
--we add 3 years to the approve date to get the expiration date
SELECT
p.protocol,
TIMESTAMPADD('SQL_TS... |
/*
* There must be actual changes made to previously published expression association refset components in order for them to appear in the current delta.
*/
insert into qa_result (runid, assertionuuid, concept_id, details)
select
<RUNID>,
'<ASSERTIONUUID>',
a.referencedcomponentid,
concat('ExpressionAssoc... |
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
--
-- Setup
--
\c :TEST_DBNAME :ROLE_CLUSTER_SUPERUSER
CREATE OR REPLACE FUNCTION ts_bgw_db_scheduler_test_run_and_wait_for_scheduler_f... |
<filename>steps/Solutions/solution-3/src/main/resources/data.sql
INSERT INTO SCHOOL_USER (name, role, password, enabled) VALUES
('admin', 'ADMIN', 'admin', true),
('tutor', 'SFEIR', 'sfeir', true),
('student', 'VISITOR', 'student', true),
('disabled_user', 'VISITOR', 'abc', false); |
-- DROP USER dcuser CASCADE;
-- CREATE USER dcuser IDENTIFIED BY "<PASSWORD>!";
-- GRANT UNLIMITED TABLESPACE TO dcuser;
-- GRANT CREATE SESSION to dcuser;
-- ALTER SESSION SET CURRENT_SCHEMA=dcuser;
BEGIN
EXECUTE IMMEDIATE 'DROP SEQUENCE vulnerability_seq';
EXCEPTION
WHEN OTHERS THEN
IF SQLCODE != -2289 TH... |
<reponame>svrakitin/x
DROP TABLE "selfservice_registration_requests" |
<reponame>bopopescu/peloton
ALTER TABLE task_runtime DROP version;
|
<reponame>faizol/timescaledb<filename>test/sql/lateral.sql
-- This file and its contents are licensed under the Apache License 2.0.
-- Please see the included NOTICE for copyright information and
-- LICENSE-APACHE for a copy of the license.
CREATE TABLE regular_table(name text, junk text);
CREATE TABLE ht(time timesta... |
<reponame>razvanradulescu/cubrid-testcases
--+ holdcas on;
drop table if exists t;
create table t(a int , b date default current_datetime on update current_datetime);
insert into t(a) values(1);
select if(b is not null,'ok','nok') from t;
update t set a=1;
select if(b is not null ,'ok','nok') from t;
alter table t m... |
# 1 - Create a query that count how many students have a scholarship
# Create a database
create database college
default character set utf8
default collate utf8_general_ci;
# Create tables Student and Scholarship
create table students(
id int auto_increment,
name varchar(30),
gender enum('M', 'F'),
born date,
national... |
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600327',@CutoffDate = N'2017-09-30',@EPS = N'0.371',@EPSDeduct = N'0',@Revenue = N'64.52亿',@RevenueYoy = N'-0.04',@RevenueQoq = N'11.06',@Profit = N'2.10亿',@ProfitYoy = N'21.10',@ProfiltQoq = N'-70.99',@NAVPerUnit = N'5.1188',@ROE = N'7.10',@CashPerUnit = N'0.1845',@GrossProfitRate ... |
/* leave this
l:see LICENSE file
g:utility
v:130612\s.zaglio: @out to null if error
v:130529\s.zaglio: added out to @out
v:120406\s.zaglio: replaced #blob with #spfrsblob
v:110921\s.zaglio: adapted to use of fn__ntext_to_lines
v:110316\s.zaglio: adapted to new sp__write_ntext_to_lines #blo... |
-- Table: public."Submission"
-- DROP TABLE public."Submission";
CREATE TABLE public."Submission"
(
"Id" uuid NOT NULL DEFAULT uuid_generate_v4(),
"SecureTokenId" uuid NOT NULL,
"SubmissionReference" text COLLATE pg_catalog."default" NOT NULL,
"OrganisationId" uuid NOT NULL,
"FunctionTyp... |
<reponame>samanderson4830/stock-app
DROP SCHEMA IF EXISTS StockApp;
CREATE SCHEMA StockApp;
USE `StockApp`;
# reset tables
DROP TABLE IF EXISTS `Users`;
DROP TABLE IF EXISTS `WatchList`;
CREATE TABLE IF NOT EXISTS `StockApp`.`Users`
(
`userID` INT NOT NULL AUTO_INCREMENT UNIQUE,
`email` VARCHAR(100)... |
<gh_stars>0
/*
Site: HackerRank
Type: Practice
Subdomain: Aggregation
Difficulty: Easy
Skill: SQL (MS Server)
Problem: Revising Aggregations - Averages
URL: https://www.hackerrank.com/challenges/revising-aggregations-the-average-function/problem
*/
-- SOLUTION:
SELECT AVG(population) AS avg_population
FROM city
WHER... |
SELECT *
FROM
${schemaname~}.${tablename~}
(CASE WHEN ${sortfield~} IS NOT NULL THEN ORDER BY ${sortfield~}
ELSE NULL
END)
OFFSET (CASE WHEN ${offset} IS NULL THEN 0
ELSE ${offset}
END)
LIMIT (CASE WHEN ${limit} IS NULL THEN 25
ELSE ${limit}
END); |
-- file:polymorphism.sql ln:783 expect:true
select dfunc('a'::text, 'b', false)
|
CREATE TABLE [dbo].[SavedSearchCriteria] (
[SavedSearchCriteriaId] INT IDENTITY (-1, -1) NOT FOR REPLICATION NOT NULL,
[CandidateId] INT NOT NULL,
[Name] NVARCHAR (50) NOT NULL,
[SearchType] INT NOT NULL,
[CountyId]... |
<gh_stars>1-10
with dat as (
select 1 as a, 'a' as b {{from_dual}}
union all
select 2 as a, 'b' as b {{from_dual}}
)
select a
from dat
where b in :b1
or a in :sub_lkp__b2
|
<gh_stars>1-10
UPDATE {{.Owner}}.DATASETS
SET LAST_MODIFIED_BY=:myuser,
LAST_MODIFICATION_DATE=:mydate,
DATASET_ACCESS_TYPE_ID = :dataset_access_type_id,
IS_DATASET_VALID = :is_dataset_valid
WHERE DATASET = :dataset
|
INSERT INTO IIS.STATE_CHANGE (
PKTS_STATE_CHANGE,
STATE_START_DATE,
STATE_START_TIME,
STATE_BAND,
STATE_VALUE,
STATE_END_DATE,
STATE_END_TIME,
XIDBKEY,
FK_PRISON_NUMBER)
VALUES
('1234561', '20010101', 123401, 3, '02 ', '20010102', 123401, 123451, 'AB111111'),
('1234562',... |
-------------------------------------------------------------------
-- List the following details of each employee: employee number, last name, first name, sex, and salary.
select e.emp_no, e.last_name, e.first_name, e.sex, s.salary
from employees e
join salaries s ON e.emp_no = s.emp_no ;
-- List first name, l... |
<gh_stars>10-100
/* ================================================
* Oracle XFiles Demonstration.
*
* Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation file... |
BEGIN;
SET search_path = alkis, public;
-- Sicht zur Darstellung der Grenzpunkte:
CREATE OR REPLACE VIEW alkis.lk_grenzpunkte AS
SELECT
o.gml_id,
o.beginnt AS o_beginnt,
o.endet AS o_endet,
p.beginnt AS p_beginnt,
p.endet AS p_endet,
o.punktkennung,
ltrim(to_char("substring"(o.punktken... |
<reponame>ctsoftvn/cts-w-1509-01
SELECT
*
FROM [MAServices]
WHERE
[LocaleCd] != @LocaleCd
AND [ServiceCd] = @ServiceCd |
<filename>src/main/resources/sql/V0.37__remove_constraint_cpp_copy.sql
alter table cloud_provider_params_copy drop constraint cloud_provider_params_copy_name_account_id_key; |
<gh_stars>0
ALTER TABLE library_mapping
DROP CONSTRAINT fk_library_mapping_ir_location;
ALTER TABLE library_mapping
DROP CONSTRAINT fk_library_mapping_central_server;
ALTER TABLE library_mapping
ADD CONSTRAINT fk_library_mapping_ir_location FOREIGN KEY (ir_location_id)
REFERENCES inn_reach_locatio... |
<reponame>FANsZL/hive
include src/test/queries/local/create_package3_include.sql
a.test(); |
<reponame>gitter-badger/summerb<filename>summerb_tests_db/postgre_init_scripts/s03_article-service.sql
CREATE SEQUENCE articles_seqa;
CREATE TABLE "articles" (
"id" INT CHECK ("id" > 0) NOT NULL DEFAULT NEXTVAL ('articles_seqa') ,
"article_key" VARCHAR(255) NOT NULL ,
"article_group" VARCHAR(255) NULL ,
"lang... |
SELECT E.Fname, E.Minit, E.Lname, E.address
FROM k_employee E join k_department D on E.dno = D.Dnumber
where D.Dname = "Research" |
USE [AIDE]
GO
/****** Object: StoredProcedure [dbo].[sp_GetAnnouncements] Script Date: 07/25/2019 9:59:13 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF EXISTS (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_GetAllDivision]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP ... |
<reponame>opengauss-mirror/Yat<gh_stars>0
-- @testpoint:opengauss关键字partition(非保留),自定义数据类型名为partition
--关键字partition作为数据类型不带引号,创建成功
drop type if exists partition;
CREATE TYPE partition AS (f1 int, f2 text);
select typname from pg_type where typname ='partition';
drop type partition;
--关键字partition作为数据类型加双引号,创建成功
dro... |
CREATE TABLE `products` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`price` json NOT NULL,
`description` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
|
<gh_stars>0
/*
Navicat MySQL Data Transfer
Source Server : localhost
Source Server Version : 50709
Source Host : localhost:3306
Source Database : easy_grouping
Target Server Type : MYSQL
Target Server Version : 50709
File Encoding : 65001
Date: 2017-09-14 11:24:33
*/
SET FOREIGN_K... |
-- OLD DB STRUCTURE
DROP DATABASE IF EXISTS mma_db;
CREATE DATABASE mma_db;
-- **** VERSION 3 ****
-- This one is only 3 tables
CREATE TABLE users (
id INT AUTO_INCREMENT,
memberStatus INT NOT NULL,
firstName VARCHAR (50) NOT NULL,
lastName VARCHAR (50) NOT NULL,
certLevel TINYINT NOT NULL,
ag... |
<reponame>indhuprogrammer/pickyourtrail
-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jul 01, 2021 at 09:27 AM
-- Server version: 10.4.13-MariaDB
-- PHP Version: 7.2.31
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00"... |
<reponame>kurt6783/3DprintShop<filename>SQLTable/3dprintshop.sql
-- phpMyAdmin SQL Dump
-- version 4.9.1
-- https://www.phpmyadmin.net/
--
-- 主機: 127.0.0.1
-- 產生時間: 2020-02-24 09:29:36
-- 伺服器版本: 10.4.8-MariaDB
-- PHP 版本: 7.3.10
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zon... |
INSERT INTO OrderEntity(Id, TotalSpent, UserId) VALUES (1, 200.25, 1);
INSERT INTO OrderEntity(Id, TotalSpent, UserId) VALUES (2, 200.25, 1);
INSERT INTO OrderEntity(Id, TotalSpent, UserId) VALUES (3, 300.00, 3);
INSERT INTO OrderEntity(Id, TotalSpent, UserId) VALUES (4, 100.00, 2);
INSERT INTO OrderEntity(Id, TotalSp... |
DELIMITER //
DROP TRIGGER IF EXISTS insertTrigger;
CREATE TRIGGER insertTrigger
BEFORE Insert ON Rating
FOR EACH ROW
BEGIN
IF new.Rating >= 80 THEN
SET new.Tag = "Excellent";
ELSEIF new.Rating >= 60 THEN
SET new.Tag = "Fair";
ELSE
SET new.Tag = "... |
-->-->-- C:/Users/nirvan/Desktop/mixerp/frapid/src/Frapid.Web/Areas/Frapid.Account/db/1.x/1.0/src/01.types-domains-tables-and-constraints/tables-and-constraints.sql --<--<--
DROP SCHEMA IF EXISTS account CASCADE;
CREATE SCHEMA account;
CREATE TABLE account.roles
(
role_id integer P... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.