sql stringlengths 6 1.05M |
|---|
<gh_stars>100-1000
INSERT INTO log VALUES('idempotent 2'); |
<gh_stars>1-10
--TEST: [Merge Statement] Core file dumped when inserting data into the source table in a merge statement.
create table target(
col1 smallint primary key,
col2 string not null
);
insert into target values(100, 'aaa');
insert into target values(200, 'bbb');
create table source(
... |
<filename>openGaussBase/testcase/KEYWORDS/within/Opengauss_Function_Keyword_Within_Case0034.sql
-- @testpoint: opengauss关键字within(非保留),作为游标名,部分测试点合理报错
--前置条件
drop table if exists explain_test cascade;
create table explain_test(cid int,fid int);
--关键字不带引号-成功
start transaction;
cursor within for select * from explain_t... |
--Cross Join
--SELECT *
--FROM Country cross join State
--Inner Join
--SELECT *
--FROM Country AS c JOIN State AS s
--ON s.CountryID=c.CountryID
--Left Join
--SELECT *
--FROM Country AS c LEFT JOIN State AS s
--ON s.CountryID=c.CountryID
--Right Join
--SELECT *
--FROM Country AS c RIGHT JOIN State AS s
--ON s.Countr... |
<filename>queries/stackoverflow/q11/3431d1f2bc524dbe0fc29884ad9f02a3cd8e5731.sql
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 ('tex'))
AND (t... |
<filename>SQL/SQLPracticeProblems/Basic/SQLPP_Q1.sql<gh_stars>0
SELECT * FROM shippers;
|
CREATE TABLE "AirlineSentiment_1"(
"col_0" varchar(17) NOT NULL,
"col_1" varchar(14) NOT NULL
);
|
<filename>db/harviacode.sql
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Apr 25, 2016 at 02:06 AM
-- Server version: 10.1.8-MariaDB
-- PHP Version: 5.6.14
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SE... |
SELECT
datname
FROM pg_database
WHERE NOT datistemplate;
|
BEGIN;
DROP TABLE IF EXISTS `download_item`;
CREATE TABLE `download_item` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`name` VARCHAR(255) NOT NULL,
`filename` VARCHAR(255) NOT NULL,
`filesize` INT NOT NULL,
`archive_type` VARCHAR(16) NOT NULL,
`num_downloads` INT ... |
<reponame>C0n5t4ntK/unless<gh_stars>1-10
DROP TRIGGER delete_comment_and_log ON "user";
DROP TABLE "user"; |
CREATE TABLE `comment`
(
`cmnt_id` int(10) NOT NULL AUTO_INCREMENT,
`post_id` int(10) NOT NULL,
`user_id` int(10) NOT NULL,
`cmnt_auth` varchar(30) NOT NULL,
`cmnt_cont` varchar(255) NOT NULL,
`cmnt_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`cmnt_id`),
... |
<filename>test/integration/db/sessions.sql
CREATE TABLE cd_sessions (
id character varying NOT NULL,
name character varying,
description character varying,
event_id character varying,
status character varying
);
|
<gh_stars>1-10
CREATE VIEW invitation_view AS
SELECT
cast_to_bool(NOT pg.pending) AS confirmed,
pgu.project_group_id AS projectId,
pg.creator_id AS invitorId, -- client can figure this one out from the invitees list
/* invitees - will include self in this list */
JSON_ARRAYAGG(
JSON_OBJECT(
'id', pg... |
<gh_stars>0
ALTER TABLE IACUC_REVIEWER_ATTACHMENTS
MODIFY (UPDATE_USER VARCHAR2(60))
/
ALTER TABLE REVIEWER_ATTACHMENTS
MODIFY (UPDATE_USER VARCHAR2(60))
/
|
-- MySQL dump 10.16 Distrib 10.2.12-MariaDB, for debian-linux-gnu (x86_64)
--
-- Host: localhost Database: university_midterm
-- ------------------------------------------------------
-- Server version 10.2.12-MariaDB-10.2.12+maria~xenial
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 S... |
<reponame>vicb1/engineering-ambassadors-site-LAMP-stack
CREATE TABLE IF NOT EXISTS users
(
id INT NOT NULL AUTO_INCREMENT,
rcs_id VARCHAR(15) NOT NULL,
rin VARCHAR(9),
title VARCHAR(50) NOT NULL DEFAULT "Member",
year ENUM('Freshman','Sophomore','Junior','Senior','n/a') NOT NULL DEFAULT 'n/a',
major VARCHAR(50) NOT NUL... |
<reponame>silianpan/seal-spider-demo
/*
Navicat Premium Data Transfer
Source Server : localhost
Source Server Type : MySQL
Source Server Version : 80013
Source Host : localhost:3306
Source Schema : pkulaw_new
Target Server Type : MySQL
Target Server Version : 80013
File Encodi... |
<filename>EpiInfo.Database.EIWeb/dbo/Stored Procedures/usp_read_all_organization_for_user.sql
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[usp_read_all... |
/****** Object: Table [T_Archived_File_States] ******/
/****** RowCount: 3 ******/
SET IDENTITY_INSERT [T_Archived_File_States] ON
INSERT INTO [T_Archived_File_States] (Archived_File_State_ID, Archived_File_State, Description) VALUES (1,'original','Collection archived as it existed when uploaded to the database')
... |
WITH
values_of_things AS (
SELECT 'apple' AS value_col
UNION ALL
SELECT 'tractor' AS value_col
UNION ALL
SELECT 'zebra' AS value_col
)
SELECT {{ xdb.aggregate_strings('value_col', "','") }} AS value_col
FROM values_of_things
|
<filename>administrator/components/com_fabrik/sql/updates/mysql/3.0.6.sql<gh_stars>0
UPDATE `#__menu` SET `title` = 'com_fabrik_lists' WHERE `title` = 'Lists' AND `path` LIKE 'fabrik%';
UPDATE `#__menu` SET `title` = 'com_fabrik_forms' WHERE `title` = 'Forms' AND `path` LIKE 'fabrik%';
UPDATE `#__menu` SET `title` = ... |
<gh_stars>0
/*
Navicat MySQL Data Transfer
Source Server : OPPO
Source Server Version : 50505
Source Host : 127.0.0.1:3306
Source Database : zend3
Target Server Type : MYSQL
Target Server Version : 50505
File Encoding : 65001
Date: 2018-10-19 14:20:18
*/
SET FOREIGN_KEY_CHECKS=0;
... |
BACKUP DATABASE SoftUni
TO DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\Backup\softuni-backup.bak'
WITH NOFORMAT, NOINIT,
NAME = N'SoftUni-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10
GO
USE Bank
DROP DATABASE SoftUni
RESTORE DATABASE SoftUni
FROM DISK = N'C:\Program Fi... |
<filename>Service/createPlayer.sql<gh_stars>0
insert into Player (
ID
) values (
:ID_Player
) |
COPY species_lookup FROM 'inst/extdata/treedb/species_lookup.csv' (FORMAT 'csv', quote '"', delimiter ',', header 0);
COPY genus_lookup FROM 'inst/extdata/treedb/genus_lookup.csv' (FORMAT 'csv', quote '"', delimiter ',', header 0);
COPY common_name_lookup FROM 'inst/extdata/treedb/common_name_lookup.csv' (FORMAT 'csv',... |
<gh_stars>0
create table lohko (
lohko_id serial primary key,
lohko_nimi text,
lohkon_sarja_id integer references sarja (sarja_id)
);
create table lohko_joukkue (
lohkojoukkue_lohko_id integer references lohko (lohko_id),
lohkojoukkue_joukkue_id integer references joukkue (joukkue_id)
);
create t... |
<reponame>devLexSoftware/AWS
-- MySQL dump 10.13 Distrib 5.7.17, for Win64 (x86_64)
--
-- Host: 127.0.0.1 Database: workshopstudio
-- ------------------------------------------------------
-- Server version 5.5.5-10.1.29-MariaDB
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET ... |
-- DROP TABLE db.months;
CREATE TABLE db.months
(
ordinal INTEGER PRIMARY KEY NOT NULL,
name CHARACTER VARYING(16) UNIQUE NOT NULL,
abbreviation CHARACTER VARYING(3)
)
WITH (
OIDS = FALSE
);
COMMENT ON COLUMN db.months.ordinal IS
'is the month ordinal';
COMMENT ON COLUMN db.months.name IS
'is the full English n... |
<gh_stars>0
INSERT INTO Singers (SingerId, FirstName, LastName) VALUES (12, 'Melissa', 'Garcia');
INSERT INTO Singers (SingerId, FirstName, LastName) VALUES (13, 'Russell', 'Morales');
INSERT INTO Singers (SingerId, FirstName, LastName) VALUES (14, 'Jacqueline', 'Long');
INSERT INTO Singers (SingerId, FirstName, LastNa... |
CREATE PROCEDURE [internal].[start_execution_internal]
@project_id BIGINT, @execution_id BIGINT, @version_id BIGINT, @use32BitRuntime SMALLINT
AS EXTERNAL NAME [ISSERVER].[Microsoft.SqlServer.IntegrationServices.Server.ServerApi].[StartExecutionInternal]
|
<filename>SQL/03. Aggregation/005. Japan Population.sql<gh_stars>1-10
-- # Problem: https://www.hackerrank.com/challenges/japan-population/problem
-- # Score: 10
SELECT SUM(Population)
FROM City
WHERE CountryCode = 'JPN';
|
/*
SQLyog Ultimate v12.5.1 (64 bit)
MySQL - 5.7.29 : Database - codegen
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;
/*!40101 SET SQL_MODE=''*/;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_... |
Create Procedure [Reference].[usp_Maintain_Street]
as
if object_id('tempdb..#Street') is not null
begin
Drop Table #Street
end
;
CREATE TABLE #Street
(
[StreetSK_old] [int] NOT NULL,
[Street] [varchar](50) NOT NULL,
[StreetSK_new] int NOT NULL
)
;
-- Capture existing data and order
insert #Str... |
<filename>assets/database/absen.sql
-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jul 01, 2021 at 10:21 PM
-- Server version: 10.4.14-MariaDB
-- PHP Version: 7.2.33
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
... |
<reponame>lhzcm/TaskScheduler<filename>src/TaskSchedulerHost/TaskSchedulerHost/Migrations/initial.sql
IF OBJECT_ID(N'[__EFMigrationsHistory]') IS NULL
BEGIN
CREATE TABLE [__EFMigrationsHistory] (
[MigrationId] nvarchar(150) NOT NULL,
[ProductVersion] nvarchar(32) NOT NULL,
CONSTRAINT [... |
# Time: O((m + n)^2)
# Space: O(m + n)
SELECT project_id,
p1.employee_id
FROM project AS p1
INNER JOIN employee AS e1
ON p1.employee_id = e1.employee_id
WHERE ( project_id, experience_years ) IN (SELECT project_id,
Max(experience... |
do $$
declare catid integer;
begin
select id into catid from scoring_category where name = 'Качество жизни';
insert into scoring_factor (name, scoring_category, code) values('Удаление импланта',catid,'implant_uninstalled');
insert into scoring_factor (name, scoring_category, code) values('Вырезание импланта',catid,'im... |
IF EXISTS (SELECT * FROM sys.objects WHERE object_id
= OBJECT_ID(N'[dbo].[sp_AppointmentsModule_GetUnscheduledVisits]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].sp_AppointmentsModule_GetUnscheduledVisits
GO
create proc sp_AppointmentsModule_GetUnscheduledVisits as
begin
with onART as
(select distinct a.Pati... |
<reponame>Dhiren003/Visvesmruti2019-Backend<filename>vsdb.sql
-- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: Sep 17, 2019 at 03:52 AM
-- Server version: 10.2.25-MariaDB
-- PHP Version: 7.2.20
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT =... |
--Скрипт с созданием View для получения встреч с количеством подтвержденных заявок больше 0.
DROP VIEW IF EXISTS confirmed_app;
CREATE VIEW confirmed_app as
SELECT meeting_id, count(*) as count
FROM meetings_users
WHERE user_status = true
GROUP BY meeting_id;
--Получение списка всех встреч с количеством подтвердивших ... |
/*==============================================================*/
/* DBMS name: MySQL 5.0 */
/* Created on: 2017/10/12 10:21:59 */
/*==============================================================*/
drop table if exists ex_client;
drop table if exi... |
CREATE TABLE "REDIRECT"
( "REDIRECT_ID" NUMBER NOT NULL ENABLE,
"OLD_PATH" VARCHAR2(255 CHAR) NOT NULL ENABLE,
"NEW_PATH" VARCHAR2(255 CHAR) NOT NULL ENABLE
) |
CREATE DATABASE demo;
USE DATABASE demo;
-- Define v1 (version 1) tables
BEGIN;
CREATE TABLE company (
id BIGINT NOT NULL,
name TEXT NOT NULL,
hq_area TEXT NOT NULL,
num_employees INTEGER NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE merger_history (
id BIGINT NOT NULL,
merging_company_id BIGINT NOT NULL... |
update ZAVISNI_TROSKOVI
set status = 0
WHERE BROJ_DOK = 6418 AND VRSTA_DOK = 3 AND GODINA = 2009
/
update dokument
set status = -8
WHERE BROJ_DOK = 6418 AND VRSTA_DOK = 3 AND GODINA = 2009
/
commit
|
<gh_stars>0
-- phpMyAdmin SQL Dump
-- version 5.1.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Mar 18, 2022 at 07:09 AM
-- Server version: 10.4.22-MariaDB
-- PHP Version: 7.4.27
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARAC... |
ALTER TABLE EG_DEMAND_DETAILS ADD COLUMN version numeric default 0;
ALTER TABLE EGDM_COLLECTED_RECEIPTS ADD COLUMN version numeric default 0;
|
<reponame>bemiriq/inventory
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: May 03, 2016 at 08:37 AM
-- Server version: 10.1.13-MariaDB
-- PHP Version: 5.6.20
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_S... |
<gh_stars>0
-- phpMyAdmin SQL Dump
-- version 5.0.4
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 09-02-2021 a las 23:54:09
-- Versión del servidor: 10.4.17-MariaDB
-- Versión de PHP: 7.3.26
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40... |
<reponame>hnrazevedo/ORM<filename>examples/Schema.sql
DROP TABLE IF EXISTS user_address;
DROP TABLE IF EXISTS user;
DROP TABLE IF EXISTS address;
CREATE TABLE IF NOT EXISTS user(
id BIGINT(11) AUTO_INCREMENT,
name VARCHAR(50) NOT NULL UNIQUE,
password VARCHAR(60) NOT NULL,
birth DATE NOT NULL,
regi... |
<reponame>Orbisnetworkadmin/orbis-grcmanager
DROP TABLE status;
|
SELECT
B.*,
COALESCE(AVG(BR.rating), 0) as rating,
COALESCE(COUNT(BR.id), 0) as total_reviews
FROM
beers B
LEFT JOIN
beer_reviews BR
ON
BR.beer = B.id
GROUP BY
B.id
SELECT
BR.id,
BR.beer,
BR.review,
BR.rating,
U.first_name,
U.last_nam
FROM
beer_reviews BR
LEFT JOIN
user U... |
<reponame>xiewenhua/July
-- 仓库表
CREATE TABLE repositories(repo_id int NOT NULL AUTO_INCREMENT, repo_address char(50) NOT NULL, PRIMARY KEY(repo_id));
-- 门店表
CREATE TABLE stores(stor_id int NOT NULL AUTO_INCREMENT, stor_address char(50) NOT NULL, PRIMARY KEY(stor_id));
-- 商品表
CREATE TABLE goods(good_id int NOT NULL AU... |
create proc usp_AssignProject(@emloyeeId int, @projectID int) as
declare @projectsOfEmployee int;
set @projectsOfEmployee = (select count(*) as ProjectsCount from EmployeesProjects as ep where ep.EmployeeID = @emloyeeId)
begin tran
insert into EmployeesProjects(EmployeeID, ProjectID)
values (@emloyeeId, @projectID)
if ... |
CREATE TABLE "ne_50m_coastline" (
gid serial,
"scalerank" numeric(10,0),
"featurecla" varchar(32));
ALTER TABLE "ne_50m_coastline" ADD PRIMARY KEY (gid);
SELECT AddGeometryColumn('','ne_50m_coastline','the_geom','3857','MULTILINESTRING',2);
|
<gh_stars>1-10
-- Your SQL goes here
ALTER TABLE ONLY moment_service.moments ALTER COLUMN id SET DEFAULT nextval('moment_service.moments_id_seq'::regclass);
grant usage on schema moment_service_api to postgrest;
grant usage on schema moment_service to postgrest;
grant execute on function moment_service_api.track(jsonb)... |
USE `soft_uni`;
SELECT `name` FROM `towns`
ORDER BY `name`;
SELECT `name` FROM `departments`
ORDER BY `name`;
SELECT `first_name`, `last_name`, `job_title`, `salary` FROM `employees`
ORDER BY `salary` DESC;
|
SELECT COUNT(DISTINCT rating) FROM film;
SELECT first_name, last_name
FROM customer
ORDER BY first_name DESC, last_name ASC;
-- PostSQL allows you to search columns that are not in order by
SELECT first_name FROM customer
ORDER BY last_name;
-- get the customer id numbers for the top 10 highest payment amounts
SELE... |
<gh_stars>1-10
## 分页查找教辅数据
#macro($indexFind())
SELECT t.* FROM teachassist t WHERE t.del_status = 0
#end
## 查询教辅数据个数
#macro($indexDataCount())
SELECT count(id) FROM teachassist t WHERE t.del_status = 0
#end |
<filename>resources/sql/patches/136.sex.sql
ALTER TABLE `{$NAMESPACE}_user`.`user`
ADD `sex` char(1) COLLATE utf8_bin AFTER `email`;
|
+ /* see PROKIND_ categories below */
+ char prokind BKI_DEFAULT(f);
|
create or replace function get_member(member_id bigint)
returns setof member_summary
as $$
DECLARE
found_user membership.members;
parsed_logs json;
parsed_notes json;
parsed_roles json;
member_status varchar(50);
member_can_login bool;
member_is_admin bool;
BEGIN
if exists(select members.id from member... |
<reponame>opengauss-mirror/Yat
-- @testpoint:创建函数,添加参数NOT LEAKPROOF
drop FUNCTION if exists func_add_sql101;
CREATE FUNCTION func_add_sql101(integer, integer) RETURNS integer
AS 'select $1 + $2;'
LANGUAGE SQL
VOLATILE
not SHIPPABLE
NOT LEAKPROOF
RETURNS NULL ON NULL INPUT;
/
call func_add_sql... |
ALTER TABLE ONLY public.non_standard_durations DROP CONSTRAINT IF EXISTS non_standard_durations_pkey;
ALTER TABLE ONLY public.non_standard_durations
ADD COLUMN id bigint not null;
ALTER TABLE ONLY public.non_standard_durations
ADD CONSTRAINT non_standard_durations_pkey PRIMARY KEY (id);
ALTER TABLE ONLY publ... |
-- Table: public.user_vine
-- DROP TABLE public.user_vine;
CREATE TABLE public.user_cart
(
goods JSON,
user_id BIGINT NOT NULL,
created_at TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT use... |
DROP PROCEDURE IF EXISTS calculateRisksAll;
DELIMITER $$
CREATE PROCEDURE calculateRisksAll()
BEGIN
DECLARE percActivity FLOAT DEFAULT 0.25;
DECLARE percFunding FLOAT DEFAULT 0.3;
DECLARE percAge FLOAT DEFAULT 0.25;
DECLARE percHouseholds FLOAT DEFAULT 0.2;
DECLARE score FLOAT DEFAULT 0.0;
DECL... |
<select class="form-control input-lg" name="tipo_institucion">
'Seleccione el tipo de institucion'
insert into tipo_institucion ('nombre') values
('Corporaciones Privadas'),('Instituciones Públicas'),('Organizaciones Mixtas'),('Organismos Multilaterales'),('Organizaciones No Gubernamentales'),('Agencias Oficiale... |
<reponame>BlueDress/School
select Title, IsActive from Chats
where (IsActive = 0 and len(Title) < 5) or Title like '__tl%'
order by Title desc |
<reponame>eenabow/Top20_CO2
-- Exported from QuickDBD: https://www.quickdatabasediagrams.com/
-- NOTE! If you have used non-SQL datatypes in your design, you will have to change these here.
CREATE TABLE "carbon_dioxide_top20" (
"country_code" VARCHAR NOT NULL,
"country_name" VARCHAR NOT NULL,
"indicator... |
CREATE TABLE "customers" (
"id" SERIAL PRIMARY KEY,
"name" text NOT NULL,
"age" int NOT NULL,
"email" text NOT NULL,
"phone" int NOT NULL
);
CREATE TABLE "adresses" (
"id" SERIAL PRIMARY KEY,
"street" text NOT NULL,
"neighborhood" text NOT NULL,
"number" int NOT NULL,
"city" text NOT NULL
);
CREAT... |
BEGIN;
SELECT plan(2);
--
-- POPULATE DATA
--
INSERT INTO "public"."users_performers"("user_id", "artist_id") VALUES
('e2e04390-fe90-11eb-9a03-0242ac130001', 'artist1'),
('e2e04390-fe90-11eb-9a03-0242ac130002', 'artist1')
RETURNING "user_id", "artist_id";
INSERT INTO "public"."events_performers_temp"("event_id... |
DO $BODY$
DECLARE
name_var text;
file_content_var text;
line_var text;
values_var text[];
value_var text;
int_a_var int;
int_d_var int;
nrates_var int;
rev_year_var int;
BEGIN
name_var = 'test.cfg';
SELECT file_content FROM comtrade.cfg WHERE name=name_var
INTO file_content_var;
... |
<filename>src/test/resources/sql/insert/47d1a2f4.sql
-- file:triggers.sql ln:895 expect:true
INSERT INTO city_view(city_name, country_name) VALUES('Washington DC', 'USA') RETURNING *
|
-- CreateTable
CREATE TABLE "Image" (
"id" UUID NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
"url" TEXT NOT NULL,
"name" TEXT NOT NULL,
"path" TEXT NOT NULL,
"mimetype" TEXT NOT NULL,
"width" DOUBLE PRECISION NOT NULL,
"hei... |
<filename>server/sql/stickers.sql<gh_stars>1-10
-- Drop the table 'stickers'
DROP TABLE IF EXISTS stickers
CREATE TABLE stickers
(
id UNIQUEIDENTIFIER PRIMARY KEY NOT NULL,
userId UNIQUEIDENTIFIER NOT NULL,
name NVARCHAR(64),
src VARCHAR(4096),
weight BIGINT DEFAULT 0,
creatAt DATETIME2 DEFAULT... |
Solution to [Print Prime Numbers](https://www.hackerrank.com/challenges/print-prime-numbers/problem) |
<gh_stars>0
select c_integer, dense_rank() over(order by c_integer nulls first) from j1 order by 1, 2;
|
<filename>sentry-provider/sentry-provider-db/src/main/resources/001-SENTRY-327.oracle.sql
-- SENTRY-327
ALTER TABLE SENTRY_DB_PRIVILEGE ADD WITH_GRANT_OPTION CHAR(1) DEFAULT 'N' NOT NULL;
|
<gh_stars>0
-- -------------------------------------------------------------
-- TablePlus 3.5.3(314)
--
-- https://tableplus.com/
--
-- Database: project_c
-- Generation Time: 2020-05-31 13:30:43.9470
-- -------------------------------------------------------------
-- This script only contains the table creation stat... |
<reponame>SaelbenNoa/pgsql-performance
select indexrelname,round(100*cast(idx_blks_hit as numeric) /( idx_blks_hit + idx_blks_read),4)
as hit_pct,idx_blks_hit,idx_blks_read from pg_statio_user_indexes
where (idx_blks_hit +idx_blks_read)>0 order by hit_pct ; |
-- min_and_max_price_items_item_kits --
SET SESSION sql_mode="NO_AUTO_CREATE_USER";
ALTER TABLE `phppos_items` ADD `max_edit_price` decimal(23,10) NULL DEFAULT NULL,ADD `min_edit_price` decimal(23,10) NULL DEFAULT NULL;
ALTER TABLE `phppos_item_kits` ADD `max_edit_price` decimal(23,10) NULL DEFAULT NULL,ADD `min_edit_... |
#
# Table structure for table 'languages'
#
DROP TABLE IF EXISTS `languages`;
CREATE TABLE `languages` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`abbr` varchar(3) NOT NULL,
`name` varchar(50) NOT NULL,
`flag` varchar(50) NOT NULL,
`active` tinyint(1) NOT NULL,
PRIMARY KEY (`id`),
CONSTRAINT `uc_l... |
CREATE TABLE companies
(
companyId INTEGER,
companyName TEXT,
Address TEXT
);
CREATE TABLE users
(
name TEXT,
age INTEGER,
worksFor INTEGER
);
INSERT INTO companies (companyId, companyName, Address)
VALUES (1, 'Commentor', 'Visionsvej 21'),
(2, 'NetCompany', 'Havnen');
I... |
-- rambler up
create or replace function updated_at_trigger() returns trigger as $$
begin
new.updated_at = now();
return new;
end;
$$ language 'plpgsql';
create table users (
id serial not null primary key,
email varchar(500) not null unique,
password char(60) not null,
name varchar(500),
is_admin bool ... |
SET DEFINE OFF;
ALTER TABLE AFW_03_CLAS_INTER ADD (
CONSTRAINT AFW_03_CLAS_INTER_UK1
UNIQUE (REF_PRODT, CODE)
ENABLE VALIDATE)
/
|
<reponame>it-all/Spaghettify<gh_stars>1-10
--
-- PostgreSQL database dump
--
-- Dumped from database version 9.6.4
-- Dumped by pg_dump version 9.6.4
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET ch... |
-- create wrapper with validator and handler
CREATE OR REPLACE FUNCTION gofdw_validator (text[], oid)
RETURNS bool
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT;
CREATE OR REPLACE FUNCTION gofdw_handler ()
RETURNS fdw_handler
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT;
CREATE FOREIGN DATA WRAPPER gofdw
VALIDATOR gofdw_validator... |
<filename>internal/storage/migrations/0049_gateway_tags_metadata.up.sql
alter table gateway
add column tags hstore,
add column metadata hstore;
create index idx_gateway_tags on gateway using gin (tags); |
<reponame>CSCfi/antero
USE KOSKI_SA
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA='sa' and TABLE_NAME='sa_koski_opiskeluoikeus_aikajakso'
AND COLUMN_NAME ='majoitusetu')
BEGIN
ALTER TABLE [sa].[sa_koski_opiskeluoikeus_aikajakso] ADD [majoitusetu] int null
END
IF NOT EXISTS (SELECT * FR... |
CREATE TABLE [dbo].[Employee]
(
EmployeeID INT IDENTITY(1,1) NOT NULL,
LastName NVARCHAR(20) NOT NULL,
FirstName NVARCHAR(10) NOT NULL,
Title NVARCHAR(30) NULL,
TitleOfCourtesy NVARCHAR(25) NULL,
BirthDate DATE NULL,
HireDate DATE NULL,
Address NVARCHAR(60) NULL,
City NVARCHAR(1... |
<reponame>danieldiamond/gitlab-analytics<gh_stars>1-10
with zuora_subscription_intermediate as (
SELECT * FROM {{ ref ('zuora_subscription_intermediate')}}
), zuora_subscription_lineage as (
SELECT * FROM {{ ref ('zuora_subscription_lineage')}}
), zuora_subscription_parentage as (
SELECT * FROM {{ ref ... |
<reponame>EmergentSoftware/Date-Time-Number-Dimensions
--DROP TABLE IF EXISTS Dimension.Number;
/* Remove placement columns (Ones, Tens, ..., Quintillions) you will not need */
CREATE TABLE Dimension.Number (
[Number Key] BIGINT NOT NULL
,[Number Word] VARCHAR(500) NULL
,[Binary Numbe... |
<gh_stars>100-1000
-- +up
CREATE INDEX orders_symbol ON orders (exchange, symbol);
CREATE UNIQUE INDEX orders_order_id ON orders (order_id, exchange);
-- +down
DROP INDEX IF EXISTS orders_symbol;
DROP INDEX IF EXISTS orders_order_id;
|
-----------------------------------------------------
-----------------------------------------------------
--- TIPO_PERSONA DATOS EN DURO DE PANTALLA --- HECHO
-----------------------------------------------------
-----------------------------------------------------
INSERT INTO TIPO_PER... |
<reponame>muthunagu100/openshift-jasper
--Only run this script if you upgraded to JasperReports Server 4.7.0 from a 4.5.0 or 4.5.1 JRS using the js-upgrade-samedb script,
--fix to bug #28757
ALTER TABLE JIDataSnapshotContents ALTER COLUMN data varbinary(max) not null;
ALTER TABLE JIReportAlertToAddress DROP CONSTRA... |
ALTER TABLE `playercreateinfo_action`
DROP KEY `playercreateinfo_actions_index`,
ADD KEY `playercreateinfo_actions_index` (`createid`,`button`);
UPDATE `playercreateinfo_action`
SET `type` = `misc`;
UPDATE `playercreateinfo_action`
SET `misc` = '0';
UPDATE `character_action`
SET `type` = `misc`;
UPDATE `cha... |
<filename>Legacy ORM Cookbook/OrmCookbook/HR/Tables/Employee.sql<gh_stars>0
CREATE TABLE HR.Employee
(
EmployeeKey INT NOT NULL
IDENTITY(1000, 1)
CONSTRAINT PK_Employee PRIMARY KEY,
FirstName NVARCHAR(50) NOT NULL,
MiddleName NVARCHAR(50) NULL,
LastName NVARCHAR(50) NOT NULL,
Title NVARCHAR(100) NULL,
... |
<filename>sql/DuduShopping/stored procedures/sp_ChatRoomCreate.sql
ALTER PROCEDURE sp_ChatRoomCreate(
@ChatRoomName VARCHAR(50)
) AS
INSERT INTO ChatRooms(Name) VALUES (@ChatRoomName)
SELECT @@IDENTITY AS RoomId
|
<reponame>dbrtly/ra_data_warehouse<gh_stars>100-1000
{% if not var("enable_marketing_warehouse") or not var("ad_campaigns_only") %}
{{
config(
enabled=false
)
}}
{% else %}
{{
config(
alias='ad_performance_fact'
)
}}
{% endif %}
WITH
ad_performance AS
(
SELECT * from {{ ref('int_ad_per... |
INSERT INTO DimDataSet (label, loaddate, sampledate, filename)
SELECT title, loaddate, sampledate, filename
FROM dataset
INSERT INTO DimTime (label, SampleDate)
SELECT distinct FORMAT (sampledate, 'D', 'en-gb'), sampledate
FROM dataset
INSERT INTO DimTimePoint (label)
SELECT DISTINCT c.description
FROM condi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.