sql stringlengths 6 1.05M |
|---|
create package body pck_a as -- {
function foo_bar_baz return varchar2 is -- {
v_unused number;
v_used varchar2(20);
begin
v_used := pck_c.func_c_01;
return c_foo||c_bar||c_baz||v_used;
end foo_bar_baz; -- }
end pck_a; -- }
/
show errors
|
-- MySQLShell dump 1.0.0 Distrib Ver 8.0.21 for Linux on x86_64 - for MySQL 8.0.21 (MySQL Community Server (GPL)), for Linux (x86_64)
--
-- Host: localhost Database: stackoverflow Table: Votes
-- ------------------------------------------------------
-- Server version 8.0.21
--
-- Table structure for table `Vot... |
<filename>grassroot-webapp/src/main/resources/db/scripts/script_171_minor_tweaks_rollback.sql
alter table campaign alter column description type varchar(512);
alter table campaign drop column default_language;
alter table event rename column special_form to importance;
update event set importance = 'SPECIAL' where imp... |
<reponame>digitalsatori/narrows<filename>migrations/sqls/20200514171303-addNarrationStyles-down.sql<gh_stars>100-1000
DROP TABLE narration_styles;
|
<reponame>Zhaojia2019/cubrid-testcases
autocommit off;
create table key_filter_test(s varchar(10), t varchar(10));
insert into key_filter_test values('a', 'a');
insert into key_filter_test values('z', 'z');
create index i_key_filter_test_s_t on key_filter_test(s, t);
--set optimization: level 257;
--set optimization: c... |
<gh_stars>0
-- @testpoint:删除函数添加CASCADE参数且添加函数参数
drop FUNCTION if EXISTS u_testfun76(c_int int)cascade;
CREATE FUNCTION u_testfun76 ( INOUT c_int int) RETURNS int AS $$
BEGIN
RETURN (c_int);
END;
$$ LANGUAGE plpgsql;
/
select proname from pg_proc where proname='u_testfun76';
--添加IF EXI... |
<gh_stars>0
CREATE PROCEDURE [report].[Task]
(
@From DATETIME = NULL,
@To DATETIME = NULL,
@TypID VARCHAR(MAX) = NULL,
@StavID VARCHAR(MAX) = NULL,
@ZmluvaID VARCHAR(MAX) = NULL,
@RiesitelID VARCHAR(MAX) = NULL,
@OrganizaciaID VARCHAR(MAX) = NULL,
@GroupBy1 VARCHAR(20) = NULL,
@GroupBy2 VARCHAR(20) = NULL
)
A... |
<gh_stars>0
INSERT INTO
OPERATION (
ACCOUNT_ID,
AMOUNT,
AMOUNT_PER_UNIT,
AT,
CATEGORY_ID,
COMMENTS,
GROUP_ID,
OPERATION_ID,
TYPE,
UNIT_COUNT
)
VALUES
(
${ account_id },
${ amount },
${ amount_per_unit },
NOW(),
${ category_id },
${ comments },
${... |
create function GetCategoryID(categoryname varchar(24))
returns tinyint unsigned
begin
if categoryname is null then
return null;
end if;
set categoryname = trim(categoryname);
if categoryname = '' then
return null;
elseif (select not exists(select id from categories where name=trim(categoryname) limit... |
<filename>src/content/modules/visitor_country/sql/up/001.sql
CREATE TABLE `{prefix}visitor_countries`
( `name` VARCHAR(100) NOT NULL ,
`value` INT NOT NULL DEFAULT '0' ,
PRIMARY KEY (`name`)) ENGINE = InnoDB; |
<reponame>paulovieira/cirac1
--select * from texts order by id desc;
--delete from texts where id >= 3
/*
1. READ
*/
DROP FUNCTION if exists shapes_climaticos_read(json);
CREATE OR REPLACE FUNCTION shapes_climaticos_read(options json DEFAULT '[{}]')
-- return table uses the definition of the texts table + extra... |
<gh_stars>0
delimiter $$
CREATE DATABASE `bangdu` /*!40100 DEFAULT CHARACTER SET utf8 */ /*!80016 DEFAULT ENCRYPTION='N' */$$
|
CREATE TYPE LocationType AS TABLE
(
Id UNIQUEIDENTIFIER NOT NULL,
Country_Code VARCHAR(MAX),
Country_Name VARCHAR(MAX),
Institution_Code VARCHAR(MAX),
Institution_Name VARCHAR(MAX),
LocalAuthority_Co... |
<reponame>4O4/crossforms-stdlib
CREATE OR REPLACE PACKAGE STD_TAB_PAGE_PROPS_PRIVATE IS
/*
* STDLIB for Oracle Forms 10g
* Copyright (c) 2017, <NAME>
* License: MIT
*/
------------------------------------------------------------------------------
-- Private namespace for Built-in Tab Page Properti... |
<filename>sqitch/deploy/initial-ddl.sql
-- Deploy prc:initial-ddl to sqlite
BEGIN;
CREATE TABLE IF NOT EXISTS user (
user_id INTEGER PRIMARY KEY,
create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
last_login_t... |
<reponame>Haili321/bill-splitter-website<filename>data.sql
DELETE FROM User;
DELETE FROM Bill_list;
DELETE FROM Bill_detail;
|
-- Create C_BPartner_Contact_QuickInput_Attributes Table and columns
-- 2021-06-14T12:27:47.882Z
-- URL zum Konzept
INSERT INTO AD_Table (AccessLevel,ACTriggerLength,AD_Client_ID,AD_Org_ID,AD_Table_ID,CopyColumnsFromTable,Created,CreatedBy,EntityType,ImportTable,IsActive,IsAutocomplete,IsChangeLog,IsDeleteable,IsDLM,Is... |
<reponame>abono/Kaya-CMS
select
web_site_id,
name,
domain_name,
set_up_complete,
create_date,
modify_date
from web_site
|
<reponame>zxb4221/blog<filename>data_backup/a0724115905.sql
-- phpMyAdmin SQL Dump
-- version 4.0.10.11
-- http://www.phpmyadmin.net
--
-- 主机: localhost
-- 生成日期: 2016-11-29 23:32:28
-- 服务器版本: 5.5.46
-- PHP 版本: 5.2.17
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CL... |
<reponame>bfpi/klarschiff-backend
-- @author <NAME>, BFPI GmbH (<EMAIL>
SET statement_timeout = 0;
SET client_encoding = 'UTF8';
DROP EXTENSION IF EXISTS postgis CASCADE;
CREATE EXTENSION postgis;
DROP TABLE IF EXISTS bewirtschaftung CASCADE;
CREATE TABLE bewirtschaftung (
id SERIAL PRIMARY KEY,
name CHARACTER V... |
<reponame>prime-space/old-marketplace
CREATE TABLE `yandex_output` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`cashout_id` INT(10) UNSIGNED NOT NULL,
`amount` DECIMAL(16,2) UNSIGNED NOT NULL,
`fee` DECIMAL(16,2) UNSIGNED NOT NULL,
`purse` VARCHAR(50) NOT NULL,
`created_ts` TIMESTAMP NOT NULL DEFAULT C... |
<reponame>CUBRID/cubrid-testcase
drop table if exists aa;
drop table if exists bb;
drop table if exists cc;
create table aa(a int primary key, b int);
create table bb(a int primary key, b int);
create table cc(a int primary key, b int);
insert into aa values(1,1);
insert into aa select a+(select count(*) from aa), 1 fr... |
<gh_stars>1-10
--create class with class attribute which is collection type and drop it
create class t1 class attribute(author set varchar(10))
(c1 int, c2 set date);
alter class t1 drop class author;
drop class t1; |
<filename>test/sql/indexes.sql
\set ECHO 0
\i sql/index_analyzer.sql
\set ECHO all
-- can't be executed in a trasaction because we need stats to be updated
-- create table with an indexes, fill it with enough data
CREATE TABLE test_table (col_a INT, col_b INT, col_c INT);
INSERT INTO test_table SELECT i, mod(i,20), m... |
<gh_stars>0
-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Хост: 127.0.0.1
-- Время создания: Фев 09 2021 г., 13:54
-- Версия сервера: 10.4.14-MariaDB
-- Версия PHP: 7.4.10
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_S... |
<filename>prisma/migrations/20220313001432_update_engagement_record/migration.sql
/*
Warnings:
- You are about to drop the column `replied` on the `EngagementRecord` table. All the data in the column will be lost.
- You are about to drop the column `withImage` on the `EngagementRecord` table. All the data in the... |
-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 1172.16.58.3
-- Generation Time: Feb 24, 2021 at 08:43 AM
-- Server version: 10.4.14-MariaDB
-- PHP Version: 7.4.10
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_C... |
-- phpMyAdmin SQL Dump
-- version 4.7.0
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 24-01-2018 a las 06:23:28
-- Versión del servidor: 10.1.22-MariaDB
-- Versión de PHP: 7.1.4
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
... |
<<<<<<< HEAD
select top 2 adventurerid, silver
from AdventurerBalance
order by silver
/* i need the top 2 adv. with the least silver
*/
=======
select top 2 adventurerid, silver
from AdventurerBalance
order by silver
/* i need the top 2 adv. with the least silver
*/
>>>>>>> 8cd8c143e180df3ffab4ad726999a391a6ed3646
|
ALTER TABLE kaka.saksdata
DROP COLUMN tema_id; |
-- MySQL dump 10.13 Distrib 5.7.19, for Linux (x86_64)
--
-- Host: 192.168.77.195 Database: zadmin_banco
-- ------------------------------------------------------
-- Server version 5.5.52-0+deb8u1
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_... |
<gh_stars>1-10
select employee.name
from employee
where 25<=employee.age and employee.age<=30
order by employee.id;
|
<gh_stars>1-10
CREATE TABLE `productbadge` (
`ProductBadgeID` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
`ProductID` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
`Title` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
`Description` varchar(255) CHARACTER S... |
<gh_stars>1-10
-- Deploy auctioneer-bot:updaterecipefk to pg
BEGIN;
ALTER TABLE recipes DROP CONSTRAINT fk_recipes_item_id;
ALTER TABLE recipes ADD CONSTRAINT fk_recipes_item_id FOREIGN KEY (item_id) REFERENCES items(id);
COMMIT;
|
-- phpMyAdmin SQL Dump
-- version 4.6.6deb5
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Jan 21, 2019 at 04:53 PM
-- Server version: 5.7.24-0ubuntu0.18.04.1
-- PHP Version: 7.2.14-1+ubuntu18.04.1+deb.sury.org+1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!4010... |
SELECT DISTINCT
t1.ARTICLE_DOI AS CITED_ARTICLE_DOI, t4.DOI AS CITING_ARTICLE_DOI, t5.CREATED AS CITING_ARTICLE_CREATED_DATE
FROM
BIORXIV_ALL_ARTICLES t1
INNER JOIN
SCOPUS_B_2018.ITEMS t2
ON
t1.ARTICLE_DOI = LOWER(t2.DOI)
INNER JOIN
SCOPUS_B_2018.CITINGITEMS t3
ON
t2.PK_ITEMS = t3.FK_ITEMS_CITED
INNER JOIN
... |
<reponame>BjornvdLaan/spring-boot-webflux-kotlin-postgresql-example
CREATE TABLE cat
(
id bigint IDENTITY PRIMARY KEY,
name varchar NOT NULL,
type varchar NOT NULL,
age int NOT NULL
); |
<reponame>sachinraja/trpc<gh_stars>1000+
/*
Warnings:
- You are about to drop the column `title` on the `Post` table. All the data in the column will be lost.
- Added the required column `name` to the `Post` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TA... |
alter table TicketAttachments ADD IsPending bit not null CONSTRAINT TicketAttachments_IsPending DEFAULT 0 WITH VALUES
go
alter table TicketAttachments DROP CONSTRAINT PK_TicketAttachments
go
alter table TicketAttachments ALTER COLUMN TicketId int null
go
alter table TicketAttachments ADD CONSTRAINT PK_TicketAttachm... |
<gh_stars>0
CREATE TABLE [dbo].[AspNetExtApiAuthenticationTokens] (
[ApiApplicationId] NVARCHAR (128) NOT NULL,
[BaseApiUserId] NVARCHAR (128) NOT NULL,
[RefreshToken] UNIQUEIDENTIFIER NOT NULL,
CONSTRAINT [PK_dbo.AspNetExtApiAuthenticationTokens] PRIMARY KEY CLUSTERED ([ApiApplicationId] AS... |
<gh_stars>0
-- phpMyAdmin SQL Dump
-- version 4.5.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: 30 Iul 2017 la 14:47
-- Versiune server: 5.7.11
-- PHP Version: 5.6.19
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_... |
/*
Enter your query here.
Please append a semicolon ";" at the end of the query and enter your query in a single line to avoid error.
*/
WITH GROUPTBL AS (
SELECT NODE , MAX(PARENT) AS PARENTNODE,COUNT(CHILD) AS CHILDS FROM(Select A.N AS NODE, A.P AS PARENT, B.N AS CHILD from BST A left join BST B on A.N=B.P) DETATILED... |
<gh_stars>1-10
SELECT * FROM (t1 LEFT JOIN t2 ON (t1.a = t2.a)) LEFT JOIN t3 ON (t2.b = t3.b OR t2.b IS NULL) |
<reponame>kantega/Flyt-cms<filename>modules/webapp/src/resources/META-INF/resources/WEB-INF/dbmigrate/oa/201601210925/sqlserver/extendremoteaddresslocationeventlog.sql<gh_stars>1-10
ALTER TABLE eventlog ALTER COLUMN RemoteAddress VARCHAR(4096);
ALTER TABLE eventlog ALTER COLUMN UserId VARCHAR(4096);
|
<gh_stars>1-10
--
-- POCOR-2489
--
-- security_functions
DELETE FROM `security_functions` WHERE `id` = '6008';
-- db_patches
DELETE FROM `db_patches` WHERE `issue` = 'POCOR-2489';
|
<reponame>IsabellaTorres100111/proyecto-sena-tg-Isabella-Torres<gh_stars>0
CREATE DATABASE BDESTRUCTURA;
USE BDESTRUCTURA;
CREATE TABLE Hardware(
IdHardware int primary key auto_increment,
DatosRelevaHardware Varchar (100) null,
IdRamFK int,
IdDDFK int,
IdUnidadCDFK int,
IdTLectorasFK int,
IdPuertosFK int,
IdMonitor... |
INSERT INTO department (name)
VALUES
('Human Resources'),
('Software Development'),
('Marketing'),
('Accounting'),
('Executive'),
('Physical Plant'),
('Sales'),
('Customer Service');
INSERT INTO role (title, salary, department_id)
VALUES
('HR Director', 250000, 1),
('Administrative Assistant', 45000, 1),
('HR Speciali... |
<filename>scripts/movies/filter_by_property.cql<gh_stars>0
// get all movies releaseed in 2003
match (m:Movie{released: 2003}) return m;
// query the database for all property keys
call db.propertyKeys;
// get all movies released in 2006 returning their titles
match (m:Movie{released: 2006}) return m.title;
// all m... |
<reponame>daiphuongngo/Home-Credit-Default-Risk-Analysis-on-Hadoop-platform
--Preprocess the datasets on HIVE:
/* Customized Tables:
application: (Application dataset)
| prev_id | curr_id | contract | amount | credit | down_payment | start_day | purpose | contract_status | payment_type | reject_reason | client | p... |
CREATE VIEW [dbo].[LogDetail]
AS SELECT Log.Id 'LogId',
Log.UserId,
CASE WHEN Item.FunnyName IS NOT NULL THEN Item.FunnyName
ELSE Item.Name END 'ItemName',
Log.Logged
FROM Log
JOIN Item ON Log.ItemId = Item.Id
|
<gh_stars>0
/******************************************************************************************************************/
/* Purpose: (1) Typecast transform & Generate Stratified, Unbalanced, Random Samples for each year for ingestion */
/* + (2) Union all the samples for the interim dataset for a... |
-- phpMyAdmin SQL Dump
-- version 4.9.1
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Creato il: Gen 01, 2020 alle 14:52
-- Versione del server: 10.4.8-MariaDB
-- Versione PHP: 7.3.11
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_... |
-- phpMyAdmin SQL Dump
-- version 4.8.4
-- https://www.phpmyadmin.net/
--
-- Host: 1172.16.58.3
-- Generation Time: Dec 18, 2021 at 07:30 AM
-- Server version: 10.1.37-MariaDB
-- PHP Version: 7.3.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @... |
<reponame>navikt/veilarbportefolje
ALTER TABLE AKTOERID_TO_PERSONID DROP CONSTRAINT UNIQUE_PERSONID;
|
<filename>src/DataTransfer/SQL_Commands/CREATE_BLANK_EXCEPTION_TABLE.sql
USE PerformanceData
GO
DROP TABLE IF EXISTS Exception_Data
CREATE TABLE Exception_Data (
"type" VARCHAR(MAX),
"timestamp" DATETIME,
"appId" int,
CONSTRAINT [FK_EXCEPTION_Session_ID] FOREIGN KEY ("appID") REFERENCES Session(id) ON DELETE CASCADE
) |
DROP DATABASE IF EXISTS registrar_db;
CREATE DATABASE registrar_db;
USE registrar_db;
CREATE TABLE instructors (
id INT NOT NULL,
first_name VARCHAR(30),
last_name VARCHAR(30),
PRIMARY KEY (id)
);
CREATE TABLE courses (
id INT,
course_title VARCHAR(30) NOT NULL,
instructors_id INT,
order_details TEXT... |
<gh_stars>1000+
-- 2019-01-15T11:13:14.906
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DDL_NoForeignKey,Description,EntityType,FieldLength,Help,IsActive,IsAdvancedText,... |
-- MySQL dump 10.13 Distrib 5.5.39, for osx10.6 (i386)
--
-- Host: localhost Database: betexter
-- ------------------------------------------------------
-- Server version 5.5.39
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*... |
/*Let's confirm some of this new knowledge with a few basic exercises. Write SQL queries to return:
1) The IDs and durations for all trips of duration greater than 500, ordered by duration.
2) Every column of the stations table for station id 84.
3) The min temperatures of all the occurrences of rain in zip 94301.
Save... |
/* Experiment population for the Value based onboarding-experiment
Same as Value Based onboard but here we are only looking at the Teachers
that got exposed before schools closed, i.e. June 1.
experiment_id: 609d25ab-b709-46a2-b4f9-219b8a2b0e86
*/
drop table if exists ab_platform.experiment_populations_609d... |
set max_threads = 16;
SELECT * FROM numbers_mt (3) where number > 5;
SELECT * FROM numbers_mt (3) where number > 1;
SELECT * FROM numbers_mt (3) where 1=2 AND (number between 1 AND 3);
SELECT * FROM numbers_mt (3) where 1=1 AND (number >= 5);
SELECT number as c1, (number+1) as c2 FROM numbers_mt (3) where number+1>1;
E... |
<reponame>handitan/HandiBugTracker<gh_stars>0
CREATE PROCEDURE [dbo].[spProductOS_GetAll]
AS
BEGIN
SET NOCOUNT ON;
SELECT Id,Name FROM dbo.ProductOS
END |
-- +goose Up
-- SQL in this section is executed when the migration is applied.
create table if not exists statistics
(
name text not null
constraint statistics_pkey
primary key,
value jsonb not null
)
;
-- +goose Down
-- SQL in this section is executed when the migration is rolled back.
drop table if exists sta... |
CREATE PROCEDURE dbo.CleanEventLog
AS
/* start logging */
DECLARE @CurrentEventLogID INT;
INSERT INTO [dbo].[EventLog]
(
[Object],
[Description],
[Started],
[Status]
)
VALUES
(OBJECT_NAME(@@PROCID), 'Execute Stored Procedure', GETDATE(), 'Running');
SET @CurrentEventLogID = SCOPE_IDENTITY();
BEGIN ... |
ALTER TABLE articles ADD UNIQUE (title);
ALTER TABLE articles ADD UNIQUE (slug);
|
ALTER DATABASE ADD STANDBY LOGFILE GROUP 4 ('C:\oracle\product\10.2.0\oradata\orcl\redo04.log') size 50M;
ALTER DATABASE ADD STANDBY LOGFILE GROUP 5 ('C:\oracle\product\10.2.0\oradata\orcl\redo05.log') size 50M;
ALTER DATABASE ADD STANDBY LOGFILE GROUP 6 ('C:\oracle\product\10.2.0\oradata\orcl\redo06.log') size 50M;
se... |
<reponame>FMendoza13/10-mysql<gh_stars>0
DROP DATABASE IF EXISTS bamazon;
CREATE DATABASE bamazon;
USE bamazon;
CREATE TABLE products (
item_id INT NOT NULL AUTO_INCREMENT,
product_name TEXT NOT NULL,
department_name TEXT NOT NULL,
price DECIMAL(10, 2) NOT NULL,
stock_quantity INT NOT NULL,
P... |
INSERT INTO `permission_profile` (`id`, `permission_id`, `profile_id`) VALUES
(1, 1, 2),
(2, 2, 2),
(3, 3, 2),
(4, 4, 2),
(5, 5, 2),
(6, 6, 2),
(7, 7, 2),
(8, 8, 2),
(9, 9, 2),
(10, 10, 2),
(11, 11, 2),
(12, 12, 2),
(13, 13, 2),
(14, 14, 2),
(15, 15, 2),
(16, 16, 2),
(17, 17, 2),
(18, 18, 2),
(19, 19, 2),
(21, 21, 2),
... |
<filename>Taller_Arquitectura/T1.4.2.Consultar_Datos.sql
db.Customer.aggregate(
[
{
$group :
{
_id : "$IdRegion",
count: { $sum: 1 }}
}
]
);
db.Customer.aggregate(
[
{
$group :
{
_id : {Region:"$IdRegion", Genero:"$IdSex"}, count:{ $s... |
SET search_path = tasker, pg_catalog ;
CREATE OR REPLACE FUNCTION initialize_admin (
a_username varchar,
a_full_name varchar,
a_email_address varchar,
a_password varchar )
RETURNS dml_ret
SECURITY DEFINER
-- Set a secure search_path
SET search_path = tasker, pg_catalog, pg_temp
LANGUAGE plpgsql
AS $$
D... |
# --- !Ups
alter table project_versions add column approved_at timestamp;
# --- !Downs
alter table project_versions drop column approved_at;
|
<filename>crowdsource-api/migrations/sql/20210506144927-modifyRewardsTable-up.sql
-- Replace with your SQL commands
ALTER TABLE rewards
ADD COLUMN milestone_id integer;
update rewards set milestone_id = rm.milestone_id
from reward_milestones rm where LOWER(rewards.language) = LOWER(rm.language)
and rewards.rewar... |
CREATE TABLE categories (
id numeric PRIMARY KEY,
name varchar
);
CREATE TABLE products (
id numeric PRIMARY KEY,
name varchar(50),
amount numeric,
price numeric(7,2),
id_categories numeric REFERENCES categories (id)
);
INSERT INTO categories (id, name)
VALUES
(1, 'wood'),
(2, ... |
<filename>src/main/resources/db/migration/primary/V1438824220__PRIMARY_MODEL_INSERT.sql
INSERT INTO PRIMARY_MODEL (ID, NAME) VALUES (PRIMARY_MODEL_SEQ_ID.NEXTVAL, 'Ericka');
INSERT INTO PRIMARY_MODEL (ID, NAME) VALUES (PRIMARY_MODEL_SEQ_ID.NEXTVAL, 'Emily');
INSERT INTO PRIMARY_MODEL (ID, NAME) VALUES (PRIMARY_MODEL_SE... |
CREATE SEQUENCE common_seq START WITH 100000;
CREATE TABLE users
(
id INTEGER GENERATED BY DEFAULT AS SEQUENCE common_seq PRIMARY KEY,
login VARCHAR(255) NOT NULL,
password VARCHAR(255) NOT NULL,
role VARCHAR(255) NOT NULL,
registered TIMESTAMP ... |
<reponame>TimYagan/stroom<gh_stars>1-10
ALTER TABLE IDX_VOL ADD COLUMN IDX_UUID varchar(255) default NULL;
UPDATE IDX_VOL iv SET iv.IDX_UUID = (SELECT i.UUID FROM IDX i WHERE i.ID = iv.FK_IDX_ID);
ALTER TABLE IDX_VOL DROP FOREIGN KEY VOL_FK_IDX_ID;
ALTER TABLE IDX_VOL DROP PRIMARY KEY, ADD PRIMARY KEY(FK_VOL_ID, IDX_UU... |
MATCH (n) DETACH DELETE n
MERGE (e:Node {name:'E'})
MERGE (f:Node {name:'F'})
MERGE (g:Node {name:'G'})
MERGE (h:Node {name:'H'})
MERGE (a:Node {name:'A'})
MERGE (b:Node {name:'B'})
MERGE (c:Node {name:'C'})
MERGE (d:Node {name:'D'})
MERGE (e)-[:REL]->(f)
MERGE (f)-[:REL]->(e)
MERGE (g)-[:REL]->(e)
MERGE (e)-[:REL]->... |
--Query to produce appendix 1: CPRD Test Table Read Codes Mapped to OMOP Concepts
SELECT count(*) as count_records,
m.read_code,
m.description,
e.code,
e.description,
e.data_fields,
c2.concept_id,
c2.concept_name,
c2.domain_id
FROM native.test t
JOIN native.en... |
<reponame>TrivadisPF/data-mesh-hackathon<filename>implementation/customer/hive/hive-customer.sql
DROP DATABASE IF EXISTS pub_ecomm_customer CASCADE;
CREATE DATABASE pub_ecomm_customer;
USE pub_ecomm_customer;
DROP TABLE IF EXISTS customer_state_t;
CREATE EXTERNAL TABLE customer_state_t
PARTITIONED BY (year string, m... |
/* ##################################### */
/* ####### MOVE SUBTREE AT INDEX ####### */
/* ##################################### */
DROP PROCEDURE IF EXISTS Baobab_GENERIC_MoveSubtreeAtIndex;
CREATE PROCEDURE Baobab_GENERIC_MoveSubtreeAtIndex(
IN node_id_to_move INTEGER UNSIGNED,
IN parent_id INTEGER U... |
<reponame>Nepxion/DiscoveryPlatform<filename>discovery-platform-application/src/main/resources/META-INF/schema-h2.sql
CREATE TABLE IF NOT EXISTS `sys_admin`
(
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
`login_mode` INT UNSIGNED ... |
CREATE TABLE user
(
id INTEGER NOT NULL PRIMARY KEY,
user_name VARCHAR(64) UNIQUE NOT NULL
);
CREATE TABLE credential
(
id INTEGER NOT NULL PRIMARY KEY,
user_id INTEGER NOT NULL REFERENCES user (id),
credential_kind INTEGER NOT NULL,
value TEXT ... |
<filename>migrations/0018.add_full_price_column.sql<gh_stars>0
alter table nlmkService.carriage add column full_price float; |
<reponame>Michace282/testApp
-- phpMyAdmin SQL Dump
-- version 5.0.4
-- https://www.phpmyadmin.net/
--
-- Хост: 127.0.0.1:3306
-- Время создания: Апр 21 2021 г., 13:13
-- Версия сервера: 5.7.29
-- Версия PHP: 7.1.33
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OL... |
-- Author: <NAME>
-- must create the 'insurance_claim' view first
-- must create the 'func_percentage' function first
-- Oracle settings
SET TERMOUT OFF
SET LINESIZE 84
SET PAGESIZE 100
ALTER SESSION SET NLS_DATE_FORMAT = 'DD/MM/YYYY';
SET TERMOUT ON
SET VERIFY OFF
-- Clear screen
cl scr
-- Report (Summary): Summar... |
<filename>db/collaborator.sql
CREATE TABLE collaborators(
id int(11) NOT NULL GENERATED ALWAYS AS IDENTITY,
collaborator_full_name varchar(50) NOT NULL,
collaborator_identity_number varchar(50) NOT NULL,
collaborator_individual_registration varchar(50) NOT NULL,
collaborator_mother_name varchar(50) NOT NULL,
col... |
CREATE TABLE "SystemUser" (
"systemUserId" bigint generated always as identity,
"login" varchar NOT NULL,
"password" varchar NOT NULL,
"fullName" varchar NULL
);
ALTER TABLE "SystemUser" ADD CONSTRAINT "pkSystemUser" PRIMARY KEY ("systemUserId");
CREATE TABLE "SystemGroup" (
"systemGroupId" bigint generated... |
<filename>queries/stackoverflow/q11/4b69a7d3b3c22661ad4f3bc07fe6186aa9f5064b.sql<gh_stars>0
SELECT COUNT(*)
FROM
tag as t,
site as s,
question as q,
tag_question as tq
WHERE
t.site_id = s.site_id
AND q.site_id = s.site_id
AND tq.site_id = s.site_id
AND tq.question_id = q.id
AND tq.tag_id = t.id
AND (s.site_name in ('db... |
CREATE TABLE `user` (
`id` int(100) NOT NULL,
`username` varchar(100) NOT NULL,
`password` varchar(100) NOT NULL,
`email` varchar(100) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DE... |
--NE - 6/17/2011
--Query to display recent Data and TLog file autogrowth and autoshrink events
--for all databases on the instance. Based on query used by the SSMS Standard
--Report named "Disk Usage" which has a section that displays this data. Data
--is retrieved from the default trace.
--Works for SQL 2005 and a... |
CREATE TABLE categories (
id SERIAL PRIMARY KEY,
description VARCHAR(100) NOT NULL
);
CREATE TABLE tasks (
id SERIAL PRIMARY KEY,
description VARCHAR(255) NOT NULL,
complete BOOLEAN NOT NULL DEFAULT 'No',
category_id INT REFERENCES "categories" DEFAULT "1"
);
-- Sample dataset
INSERT INTO categories (descriptio... |
SET DEFINE OFF;
ALTER TABLE AFW_25_ENGIN ADD (
CONSTRAINT AFW_25_ENGIN_FK1
FOREIGN KEY (REF_DV_FORMT_SORT)
REFERENCES AFW_14_DETL_DOMN_VALR (SEQNC)
ENABLE VALIDATE)
/
|
CREATE OR REPLACE PACKAGE STD_WINDOW_PROPS IS
/*
* STDLIB for Oracle Forms 10g
* Copyright (c) 2017, <NAME>
* License: MIT
*/
------------------------------------------------------------------------------
-- Public namespace for Built-in Window Properties
----------------------------------------... |
# Write your MySQL query statement below
select
player_id, min(event_date) as first_login
from
Activity
group by
player_id; |
-- Table: extra_misc.draft
-- the real NFL draft
-- DROP TABLE extra_misc.draft;
CREATE TABLE extra_misc.draft
(
draft_id serial NOT NULL,
nflcom_player_id character(10),
source character varying(50) NOT NULL,
source_player_id character varying,
source_player_name character varying(100) NOT NULL,
source_... |
-- ".mode line" is similar to MySQL \G option
-- ".timer on" will output the time cost of this query
-- Please comment out the following lines before submit.
-- .mode line
-- .timer on
select name from work_type order by name; |
<reponame>razzlefratz/MotleyTools<filename>php/spcdb/spcdb-balance.sql<gh_stars>1-10
# ====================================================================
# Context Commands;
# --------------------------------------------------------------------
USE spcdb;
# ====================================================... |
-- 菜单
create or replace view ea.dv_menu as
with recursive r as (
select m.id, m.name, m.label_cn, m.label_en,
m.id as root,
1 as path_level,
to_char(m.display_order, '09') as display_order
from ea.menu m
where array_length(regexp_split_to_array(m.id, E'\\.'), 1) = 1
union all
... |
@create_directory
@test_01
@test_02
@test_03_png
@drop_directory
|
GO
IF OBJECT_ID('[DOI].[spQueue_RenameStatistics]') IS NOT NULL
DROP PROCEDURE [DOI].[spQueue_RenameStatistics];
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE [DOI].[spQueue_RenameStatistics]
@DatabaseName NVARCHAR(128) = NULL,
@SchemaName NVARCHAR(128) = NULL,
@TableName NVARC... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.