sql stringlengths 6 1.05M |
|---|
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET search_path = public, pg_catalog;
--
-- Data for Name: BotTask; Type: TABLE DATA; Schema: public; Owner: scraper
-... |
-- It should truncate only a queue data
CREATE OR REPLACE FUNCTION fetchq_test.queue_truncate_01() RETURNS void
SET client_min_messages = error
AS $$
DECLARE
VAR_numDocs INTEGER;
VAR_r RECORD;
BEGIN
PERFORM fetchq.queue_create('foo');
-- create & drop the queue
PERFORM fetchq.doc_push('foo', 'a1', 0... |
<filename>exercicio-4-Alex-Ferreira-Santos/moda.sql<gh_stars>1-10
-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Tempo de geração: 20-Nov-2020 às 19:00
-- Versão do servidor: 10.4.11-MariaDB
-- versão do PHP: 7.4.5
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTI... |
; WITH Diffs AS
(
SELECT
VacationHours * 1. -
(
SELECT
SUM(VacationHours * 1.) / COUNT(VacationHours) AS Mean
FROM HumanResources.EmpCopy
) as Differences
FROM HumanResources.EmpCopy
WHERE VacationHours IS NOT NULL
)
SELECT SUM(Differences) FROM Diffs |
DECLARE @ThresholdTimeMin INT = 60
DECLARE @NumOfLocks INT
DECLARE @LocksTime INT
SELECT @NumOfLocks = COUNT(*), @LocksTime = MAX(DATEDIFF(mi,a.database_transaction_begin_time, SYSDATETIME())) FROM sys.dm_tran_database_transactions a
where a.database_transaction_begin_time is not NULL AND
DATEDIFF(mi,a.database... |
<filename>src/test/resources/randexpr1.test_664.sql
-- randexpr1.test
--
-- db eval {SELECT (select abs(case max(t1.b)-(min(17))* -count(distinct case when case t1.f when t1.b then case e when c then t1.c else c end else t1.b end>=t1.e then d else e end) | ~+count(distinct t1.c)-(abs( -count(*))- -max(c)) | count(dist... |
<reponame>vassdeniss/software-university-courses
GO
USE [SoftUni]
GO
CREATE VIEW [V_EmployeeNameJobTitle]
AS SELECT CONCAT (
[FirstName]
, ' '
, [MiddleName]
, ' '
, [LastName]
) AS [Full Name]
, [JobTitle]
FROM [Employees]
|
-- file:rangefuncs.sql ln:502 expect:true
select * from array_to_set(array['one', 'two'])
|
CREATE PARTITION SCHEME [PS_Date]
AS PARTITION [PF_Date]
ALL TO ([PRIMARY]);
|
<gh_stars>1-10
-- View a system error
INSERT INTO SalesLT.SalesOrderDetail (SalesOrderID, OrderQty, ProductID, UnitPrice, UnitPriceDiscount)
VALUES
(100000, 1, 680, 1431.50, 0.00);
-- Raise an error with RAISERROR
UPDATE SalesLT.Product
SET DiscontinuedDate = GETDATE()
WHERE ProductID = 0;
IF @@ROWCOUNT < 1
RAIS... |
DROP PROCEDURE sp_cliente_ver;
DELIMITER //
CREATE PROCEDURE sp_cliente_ver(
v_criterio TINYINT,
id_cliente INT
)
BEGIN
IF v_criterio = 1 THEN
SELECT * FROM tb_cliente;
END IF;
END //
DELIMITER ;
CALL sp_cliente_ver(1,1); |
<reponame>NizarHafizulllah/peesbook<filename>database/peesbookdb.sql
-- phpMyAdmin SQL Dump
-- version 3.5.2.2
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Mar 27, 2018 at 03:12 PM
-- Server version: 5.5.27
-- PHP Version: 5.4.7
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
... |
select tx_item, avg(tx_quantity) from store_txs tablesample system(10)
group by tx_item |
-- MySQL dump 10.13 Distrib 8.0.11, for Win64 (x86_64)
--
-- Host: 127.0.0.1 Database: tbike
-- ------------------------------------------------------
-- Server version 8.0.11
--
-- Table structure for table `ike_doc_document_file`
--
DROP TABLE IF EXISTS `ike_doc_document_file`;
CREATE TABLE `ike_doc_document_f... |
<gh_stars>1-10
-- FK, Index 는 별도 파일로 분리. 맨 마지막에 작업 예정
drop table if exists data_adjust_log cascade;
drop table if exists data_adjust_log_2020 cascade;
drop table if exists data_adjust_log_2021 cascade;
drop table if exists data_adjust_log_2022 cascade;
drop table if exists data_adjust_log_2023 cascade;
drop table if ex... |
SET FOREIGN_KEY_CHECKS = 0;
create index idx_core_operation_event_seq_no_1 on core_operation_event(event_seq_no);
create index idx_core_ru_proc_exec_binding_inst_id_1 on core_ru_proc_exec_binding(proc_inst_id);
delete from system_variables where id = 'system__global__CORE_ADDR';
SET FOREIGN_KEY_CHECKS = 1; |
--
-- OPR_SANITY
-- Sanity checks for common errors in making operator/procedure system tables:
-- pg_operator, pg_proc, pg_aggregate, pg_am, pg_amop, pg_amproc, pg_opclass.
--
-- None of the SELECTs here should ever find any matching entries,
-- so the expected output is easy to maintain ;-).
-- A test failure indicat... |
<gh_stars>0
DROP TABLE `mailing_lists`; |
package main
import (
"bytes"
"database/sql"
"fmt"
"math"
"net/url"
"strconv"
"time"
"reflect"
_ "github.com/go-sql-driver/mysql"
)
var NotFound = fmt.Errorf("Not found")
type Database struct {
sql *sql.DB
}
func (DB *Database) Init() error {
Log.Infof("Initing db")
_, err := DB.sql.Exec("DROP TABLE I... |
-- Started at Edgware Road (Circle Line)
-- Waited on platform at Edgware Road
INSERT INTO tube_diary VALUES('Circle', 'Edgware Road Circle', '2014-12-10 10:47:00', '2014-12-10 10:50:00', 'platform', 'floor', 1);
-- Started tube from Edgware Road counter-clockwise around the circle. Once done a loop, go off to the spu... |
DROP PROCEDURE IF EXISTS getcontact;
DELIMITER $$
CREATE PROCEDURE getcontact(p_contacts_id CHAR(36))
BEGIN
SELECT contacts.id AS contacts_id,contactdetails.id AS contactdetails_id,contacts.customers_id AS customers_id,contacts.loginemail,contacts.passwordhash,contacts.passwordsalt,contactdetails.name,contactdetails.c... |
<filename>java/spring/springinaction/src/main/resources/database/h2/schema.sql<gh_stars>0
create table `spring_user` (
`id` int identity,
`username` varchar not null default '',
`password` varchar not null default ''
); |
CREATE SEQUENCE order_status_timeline_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
CREATE TABLE order_status_timeline (
id integer NOT NULL DEFAULT nextval('order_status_timeline_id_seq'::regclass) PRIMARY KEY,
"order" uuid NOT NULL,
status order_status NOT NULL,
created_at ti... |
-- MySQL dump 10.13 Distrib 5.6.35, for osx10.9 (x86_64)
--
-- Host: localhost Database: laraclassified
-- ------------------------------------------------------
-- Server version 5.6.35
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULT... |
<gh_stars>0
USE Geography
-- Problem 12
SELECT mc.CountryCode,
m.MountainRange,
p.PeakName,
p.Elevation
FROM MountainsCountries AS mc
INNER JOIN Mountains AS m
ON mc.MountainId = m.Id
INNER JOIN Peaks AS p
ON m.Id = p.MountainId
WHERE mc.CountryCode = 'BG' AND p.Elevation > 2835
ORDER BY p.Elevat... |
<filename>Week3/phpwebsite v1.6/sql file/[v1.6]phplogin2.sql
-- phpMyAdmin SQL Dump
-- version 5.1.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Nov 27, 2021 at 05:20 PM
-- Server version: 10.4.21-MariaDB
-- PHP Version: 8.0.12
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET... |
CREATE TABLE [dbo].[EmployeeSkills]
(
[Id] INT NOT NULL PRIMARY KEY IDENTITY,
[EffectiveStartedOn] DATETIME NOT NULL,
[EffectiveStartedBy] INT NOT NULL,
[EffectiveModifiedOn] DATETIME NOT NULL,
[EffectiveModifiedBy] INT NOT NULL,
[EffectiveEndedOn] DATETIME NOT NULL,
[EffectiveEndedBy] INT NOT NULL, ... |
<reponame>AlissonSchel/GitC<gh_stars>0
select
A.Nome,
(N.Nota1+N.Nota2+N.Nota3+N.Nota4)/4 as 'Media',
IIF((N.Nota1+N.Nota2+N.Nota3+N.Nota4)/4 >= 7,'Aprovado','Reprovado') as 'Status Media',
IIF((SUM(CONVERT(money,F.Presenca)) / CONVERT(money,COUNT(F.Presenca)) * 100) >= 75,'Aprovado','Reprovado') a... |
<gh_stars>0
SELECT * FROM bamazon.products;
|
-- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Apr 24, 2019 at 08:06 PM
-- Server version: 10.1.28-MariaDB
-- PHP Version: 7.1.10
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OL... |
<gh_stars>1-10
CREATE DATABASE IF NOT EXISTS `spring`;
--SHOW CREATE DATABASE `data_dictionary`;
--DROP TABLE IF EXISTS `spring`.`operator`;
CREATE TABLE `spring`.`operator` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(255) DEFAULT NULL COMMENT '姓名',
`password` varchar(255) DEFAULT NULL COMMENT '... |
<gh_stars>1-10
CREATE View sqlparse.RepoObject_SqlModules_79_reference_union
As
Select
RepoObject_guid
, alias_QuoteName
, SysObject_fullname
, RepoObjectColumn_guid
, RepoObjectColumn_name
, source_RepoObject_guid
, source_SysObject_fullname
, source_RepoObjectColumn_guid
, source_RepoObjectColum... |
DBCC CHECKDB ([ZollData.StaticData]); |
<filename>torabot/db/migrate/add-email-table.0.2.2-13-g62c10c1.sql
-- add email table and fill main email
create table if not exists email (
id serial primary key,
text text unique not null,
label text,
activated boolean not null default FALSE,
ctime timestamp default (now() at time zone 'utc'),
... |
-- MySQL dump 10.17 Distrib 10.3.16-MariaDB, for Win64 (AMD64)
--
-- Host: 127.0.0.1 Database: sales_db
-- ------------------------------------------------------
-- Server version 10.4.17-MariaDB
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_S... |
<gh_stars>1-10
CREATE TABLE math (
student_index INT PRIMARY KEY NOT NULL,
school TEXT,
sex TEXT,
age INT,
address TEXT,
famsize TEXT,
Pstatus TEXT,
Medu INT,
Fedu INT,
Mjob TEXT,
Fjob TEXT,
reason TEXT,
guardian TEXT,
traveltime INT,
studytime INT,
failures INT,
schoolsup TEXT,
famsup TEXT,
paid TEX... |
<gh_stars>1-10
-- Isolation
IF NOT EXISTS (SELECT * FROM sys.sql_logins WHERE name = 'IsoUser')
BEGIN
CREATE LOGIN [IsoUser] WITH PASSWORD='<PASSWORD>'
END
;
IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = 'IsoUser')
BEGIN
CREATE USER [IsoUser] FOR LOGIN [IsoUser]
END
;
CREATE WORKLOAD GROUP ... |
<gh_stars>1000+
-- 2017-04-01T15:36:40.606
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Window_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-04-01 15:36:40','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Material Receipt Candidates' WHERE AD_Window_ID=540196 AND AD_Language='en_US'
;
... |
<filename>out/sql/up9.sql
ALTER TABLE posts ALTER COLUMN multihash TYPE VARCHAR(59);
ALTER TABLE thumbnails ALTER COLUMN multihash TYPE VARCHAR(59);
|
/*
* Copyright 2016 <NAME> <<EMAIL>>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agree... |
<filename>oauth.ddl
-- https://github.com/dsquier/oauth2-server-php-mysql
--
-- DDL to create MySQL oauth database and tables for PDO storage
-- support of https://github.com/bshaffer/oauth2-server-php.
-- Drop any old backups and create a new backup of tables to be created
DROP DATABASE IF EXISTS oauth_backup;
CREATE... |
<gh_stars>1-10
alter table job_provisioning add scope text not null default 'ci'; |
CREATE TABLE `team_users` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`team_id` int(10) unsigned NOT NULL,
`user_id` int(10) unsigned NOT NULL,
`status` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp DEFAUL... |
<filename>mariaDB4j-maven-plugin/src/it/mariadb4j-maven-plugin-test-basic/src/test/resources/foo-script.sql
CREATE TABLE `bar` (`bar_id` INTEGER AUTO_INCREMENT PRIMARY KEY, `baz` VARCHAR(127));
INSERT INTO `bar` (`baz`) VALUES ('gaw'); |
drop table cr_hybrid_part;
|
-- phpMyAdmin SQL Dump
-- version 4.6.5.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jul 17, 2017 at 05:56 PM
-- Server version: 10.1.21-MariaDB
-- PHP Version: 7.1.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET... |
CREATE SEQUENCE category_category_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
CREATE TABLE category (
category_id integer DEFAULT nextval('category_category_id_seq'::regclass) NOT NULL,
name text UNIQUE NOT NULL
);
CREATE SEQUENCE film_film_id_seq
START WITH 1
... |
<reponame>opengauss-mirror/Yat
-- @testpoint: opengauss关键字transform(非保留),作为游标名,部分测试点合理报错
--前置条件
drop table if exists explain_test cascade;
create table explain_test(cid int,fid int);
--关键字不带引号-成功
start transaction;
cursor transform for select * from explain_test order by 1;
close transform;
end;
--关键字带双引号-成功
start t... |
<filename>resources/cotations.sql<gh_stars>0
INSERT INTO `cotations` (`id`, `crypto_id`, `date`, `taux`) VALUES
(1, 1, '2019-03-02 00:00:00', '143.00'),
(2, 1, '2019-03-01 00:00:00', '144.00'),
(3, 1, '2019-02-28 00:00:00', '134.00'),
(4, 1, '2019-02-27 00:00:00', '134.00'),
(5, 1, '2019-02-26 00:00:00', '138.00'),
(6,... |
<filename>MEAL_PLAN/IngredientReference.sql
CREATE TABLE [dbo].[IngredientReference]
(
[Id] INT IDENTITY(1, 1) NOT NULL,
[Name] VARCHAR(1000) NOT NULL,
[PerAmount] DECIMAL(10,2) NOT NULL,
[UnitName] VARCHAR(255) NOT NULL,
[Protein] DECIMAL(10,2) NOT NULL,
[Fat] DECIMAL(10,2) NOT NULL,
[Carbs] DECIMAL(10,2) NOT ... |
<filename>config/src/main/resources/db/migration/soknadInnsendingDataSource/V1_19__faktumegenskap_fjernet_felt.sql
alter table faktumegenskap drop column faktumegenskap_id; |
<gh_stars>0
DROP DATABASE IF EXISTS access;
CREATE DATABASE access;
\c access;
CREATE EXTENSION IF NOT EXISTS pgcrypto;
CREATE EXTENSION IF NOT EXISTS citext;
-- DROP ROLE IF EXISTS dba;
CREATE ROLE dba
WITH SUPERUSER CREATEDB CREATEROLE
LOGIN ENCRYPTED PASSWORD '<PASSWORD>'
VALID UNTIL '2020-07-01';
CREATE SCHEM... |
<reponame>jariolaine/APEX-Blog<filename>Database/Views/BLOG_V_ALL_CATEGORIES.sql
--------------------------------------------------------
-- DDL for View BLOG_V_ALL_CATEGORIES
--------------------------------------------------------
CREATE OR REPLACE FORCE VIEW "BLOG_V_ALL_CATEGORIES" ("ID", "ROW_VERSION", "CREATED_ON... |
<gh_stars>0
INSERT INTO `{c2r-prefix}_modules` (`name`, `folder`, `code`) VALUES ("{c2r-mod-name}", "{c2r-mod-folder}", '{\r\n \"fa-icon\": \"fa-user\",\r\n \"img\": \"\",\r\n \"sub-items\": {},\r\n \"sidebar\": false,\r\n \"dropdown\": true\r\n}');
|
CREATE TABLE INTRANET_CLAIM_PARAM (
ID VARCHAR(45),
TYPE VARCHAR(45), -- CT = claim_types, DC = Distrubution Channles, VISA
CODE VARCHAR(45),
DESCRIPTION VARCHAR(255),
ES_NAME VARCHAR(500),
ES_DETAIL VARCHAR(500),
ES_DETAIL_2 VARCHAR(500),
EN_NAME VARCHAR(500),
EN_DETAIL VARCHAR(500... |
<gh_stars>0
/*
Navicat Premium Data Transfer
Source Server : Local
Source Server Type : SQL Server
Source Server Version : 15002000
Source Host : localhost:1433
Source Catalog : BAYUBUANA
Source Schema : dbo
Target Server Type : SQL Server
Target Server Versi... |
<reponame>ricardo1470/learn_PostgreSQL<gh_stars>0
Select
prestamo.id,
prestamo.usuario_id,
prestamo_detalle.libro_id,
DATE_PART('day', now()::timestamp - prestamo.fecha_devolucion::timestamp) as dias_morosidad,
case
when DATE_PART('day', now()::timestamp - prestamo.fecha_devolucion::timestamp) <= 50 THEN 'Morosidad Ba... |
create procedure [dbo].pNote_Fetch
(
@NoteId bigint
) AS
BEGIN
DECLARE @SearchResults dbo.IntSortedList;
IF @NoteId = 0
INSERT INTO
@SearchResults
SELECT
t.NoteId,
ROW_NUMBER() OVER(ORDER BY t.NoteId ASC)
FROM
[dbo].Note t;
ELSE
INSERT INTO
@SearchResults
SELECT
@NoteId,
0;
EXEC [... |
-- NB: Slow!
-- inner select: all sentences including "mamma" but excluding "!"
--select text from chunk as c join chunk_chunkfeat on c.id = chunk_chunkfeat.chunk_id join chunkfeat on chunkfeat.id = chunk_chunkfeat.chunkfeat_id where chunkfeat.value = 'mamma' and c.id not in (select chunk.id from chunk join chunk_chu... |
Update
Station_Instrument
set
EndDate = DateAdd(Second,-1,DateAdd(Day,1,EndDate))
where
(EndDate is not null) and
(DatePart(Hour,EndDate) = 0) and
(DatePart(Minute,EndDate) = 0) and
(DatePart(Second,EndDate) = 0)
Declare @Code VarChar(100) = '%-126929'
Select * from Instrument where code like @Code
Selec... |
CREATE TABLE LPR3_ACTIVE.KONTAKTPROCEDURE
(
ID char(16) for bit data PRIMARY KEY NOT NULL,
KONTAKT_ID char(16) for bit data NOT NULL,
CONSTRAINT FK__KONTAKTPROCEDURE_ID FOREIGN KEY (ID) REFERENCES PROCEDURE (ID),
CONSTRAINT FK__KONTAKTPROCEDURE_KONTAKT_ID FOREIGN KEY (KONTAKT_ID) REFERENCES KONTAKT (ID)... |
-- Shows codes for a game
SELECT `code_lookup`.`code`, `code_lookup`.`type`, `code_lookup`.`location_id`, `locations`.`internal_note`, `locations`.`is_start`, `locations`.`is_end` FROM `code_lookup` LEFT OUTER JOIN `locations` ON `code_lookup`.`game_id` = `locations`.`game_id` AND `code_lookup`.`location_id` = `locatio... |
create table config.tag_meta (
id serial,
tag_id integer not null,
name character varying(255)
);
alter table only config.tag_meta
add constraint tag_meta_tag_id_fkey foreign key (tag_id) references config.tag(id);
alter table only config.tag_meta
add constraint tag_meta_pkey primary key (id);
gr... |
<filename>migrations/2020-03-23-200928_mobile_shops/up.sql
CREATE TYPE delivery_status AS ENUM ('ON_TOUR', 'PARKED');
CREATE TABLE mobile_shops (
mobile_shop_id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
-- link to image of shop
image_url VARCHAR(1024),
-- Title of delivery to be displayed to custom... |
CREATE PROCEDURE [dbo].[uspGetLocalAuthorityGroupById]
@LocalAuthorityGroupID INT
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
SELECT [LocalAuthorityGroupID],
[CodeName],
[ShortNam... |
CREATE JAVA SCALAR SCRIPT
metadata_scalar_emit (...)
EMITS("v" VARCHAR(2000)) AS
class METADATA_SCALAR_EMIT {
static void run(ExaMetadata exa, ExaIterator ctx) throws Exception {
ctx.emit(Long.toString(exa.getInputColumnCount()));
for (int i = 0; i < exa.getInputColumnCount(); i++) {
ctx... |
<filename>src/03_github-user-classification/01_ctrs_extra.sql
-- this table combines the raw commits dat with the
-- users classified into valid country codes
CREATE TABLE gh.ctrs_extra AS (
SELECT A.login, email, company,
created_at, long, lat,
country_code, state, city, location,
cc_multiple, ... |
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!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 ... |
--Trabajamos con nuestra tabla "agenda".
--Eliminamos la tabla si existe:
if object_id('agenda') is not null
drop table agenda;
--Creamos la tabla:
create table agenda(
nombre varchar(30),
domicilio varchar(30),
telefono varchar(11)
);
--Ingresamos algunos registros:
insert into agenda
values('<NAME>'... |
CREATE DATABASE `vimbadmin`;
GRANT ALL ON `vimbadmin`.* TO `vimbadmin` IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
|
<reponame>coopersystem-fsd/server<gh_stars>10-100
DELIMITER $$
DROP FUNCTION IF EXISTS `calculate_rating_average`$$
CREATE FUNCTION `calculate_rating_average` (`default_rating` NUMERIC(3,2), `minimum_rating_threshold` INT, `limit` INT, `avatar_id` LONG)
RETURNS NUMERIC(3,2)
NOT DETERMINISTIC
BEGIN
DECLARE `rating_av... |
CREATE OR ALTER PROCEDURE dbo.InsertOrganization
(
@Name [nvarchar](150),
@Address [nvarchar](400),
@ContactName [nvarchar](120),
@ContactNumber [char](14),
@ContactEmail [nvarchar](100),
@loginName [varchar](100),
@loginSecretHash [varchar](100),
@recordID int output
)
AS
Declare @insertedValue ... |
<gh_stars>10-100
-- file:numeric.sql ln:156 expect:true
INSERT INTO num_exp_add VALUES (3,3,'8.62')
|
-- file:plpgsql.sql ln:2310 expect:false
loop
raise notice '%', _i
|
<gh_stars>1000+
/*
Author: <NAME>
Original link: http://www.sqlservercentral.com/articles/Agent+jobs/127346/
*/
--****************************************************************************************
-- This script returns a (graphical) timeline for all SQL jobs using google graph
--********************************... |
-- +goose Up
-- SQL in this section is executed when the migration is applied.
CREATE SCHEMA `new_schema` ;
CREATE TABLE `wagers` (
`id` BIGINT(20) NOT NULL AUTO_INCREMENT,
`total_wager_value` FLOAT,
`odds` INT NOT NULL,
`selling_percentage` INT NOT NULL,
`selling_price` DECIMAL(10,2) NOT NULL,
`current_se... |
/*
Navicat MySQL Data Transfer
Source Server : My
Source Server Version : 50720
Source Host : localhost:3306
Source Database : shanlin
Target Server Type : MYSQL
Target Server Version : 50720
File Encoding : 65001
Date: 2019-01-04 07:57:09
*/
SET FOREIGN_KEY_CHECKS=0;
-- --------... |
<reponame>Ed-Fi-Alliance-OSS/Ed-Fi-MigrationUtility
-- 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.... |
<filename>lc/0627_SwapSalary.sql
UPDATE Salary SET sex = (
CASE WHEN sex = 'f' THEN 'm' ELSE 'f' END
)
;
-- UPDATE salary SET sex = IF(sex = 'm', 'f', 'm');
|
SELECT * FROM READ_MARKS
ORDER BY INSERT_DATETIME %s;
|
<filename>Documentation/Extras/Auto_Infra_Query_Stmts.sql
BEGIN TRANSACTION;
COMMIT TRANSACTION;
USE [Auto_Infra]
GO
SELECT * FROM [dbo].[Auto_Infra_Main_Table]
GO
/**************** INSERT INTO TABLE*/
USE [Auto_Infra]
GO
INSERT INTO [dbo].[Auto_Infra_Main_Table]
([PK],[USER_NAME],[M... |
-- [er] create vclass using Constraints not null and default
create vclass t1 (
c1 int DEFAULT 9 not null
);
drop t1; |
DROP TABLE IF EXISTS employees;
DROP TABLE IF EXISTS department;
DROP TABLE IF EXISTS roles;
CREATE TABLE department (
id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(30) NOT NULL
);
CREATE TABLE roles (
id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(30) NOT NULL,
salar... |
-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, 2012 and Azure
-- --------------------------------------------------
-- Date Created: 05/01/2017 22:57:20
-- Generated from EDMX file: G:\Git\CMS-Models\src\CMS.Models\Model.edmx
-- --------------------------... |
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
CREATE TABLE account
(
id UUID PRIMARY KEY NOT NULL DEFAULT uuid_generate_v4(),
username TEXT NOT NULL UNIQUE,
password_hash TEXT NOT NULL,
role TEXT NOT NULL,
name TEXT NOT... |
CREATE DATABASE KERRIMOproj
use KERRIMOproj
CREATE TABLE tblLoginData
(
USERNAME varchar(32) NOT NULL,
[PASSWORD] varchar(32) NOT NULL,
[EMPLOYEE ID] varchar(50) NOT NULL,
[PRIVILEDGE LEVEL] [int] NOT NULL,
constraint PK_tblLoginData primary key ([EMPLOYEE ID]))
INSERT INTO tblLoginData VALUES('admin','admin','E-Admin... |
<gh_stars>0
select * from
(select first_name, last_name, cug_mobile, other_mobile_1, whatsapp_number, primary_email, d.zone_name from
contacts_contact a, contacts_individualcontactrolecenter b, contacts_center c, contacts_zone d
where a.id = b.contact_id and
c.zone_id = d.id and
b.center_id = c.id
union
select first_... |
select t1.player_id, player_name, num_wins, win_perc, num_loss, loss_perc, num_matches, num_matches_as_black, num_wins_as_black, win_perc_as_black, num_matches_as_white, num_wins_as_white, win_perc_as_white, most_common_opening, most_common_opening_as_black, most_common_opening_as_white, most_active_time from
(
select... |
<reponame>giselearaujos/RecodePro
create table pedido (
pedidoid int not null auto_increment,
nomeCliente varchar(60) not null,
endereco varchar(150),
telefone varchar(20),
nomeProduto varchar(15),
valorUnitario int,
quantidade int,
valorTotal decimal(8,2),
primary key (pedidoid)
)default charset = utf8;
insert into p... |
<gh_stars>0
IF EXISTS (SELECT NULL FROM INFORMATION_SCHEMA.ROUTINES WHERE Specific_Name = 'spMyProcedure')
DROP PROC spMyProcedure
GO
/*---------------------------------------------------------------------------------------
//
//
//---------------------------------------------------------------------------------... |
<reponame>geophile/sql-layer
SELECT items.* FROM customers INNER JOIN orders USING (cid) INNER JOIN items USING (oid) where customers.cid = ? AND orders.oid = ? AND items.iid = ? |
<gh_stars>1-10
###########################################################
### ###
### Panda3D Configuration File - User-Editable Portion ###
### ###
###########################################################
# Un... |
INSERT INTO CustomerReviews VALUES
(1, 'Me is very happy. Me likey this airline. Me good.', 10, 1, 1),
(2, 'Ja, Ja, Ja... Ja, Gut, Gut, Ja Gut! Sehr Gut!', 10, 1, 4),
(3, 'Meh...', 5, 4, 3),
(4, 'Well Ive seen better, but Ive certainly seen a lot worse...', 7, 3, 5)
INSERT INTO CustomerBankAccounts VALUES
(1, '123456... |
<reponame>micheledinanni/Psychometric-tools-benchmark
create table reporters_pr
select * from (
select pull_request_comments.user_id as id,group_concat(body)as content,commit_id from reporters inner join pull_request_comments
on pull_request_comments.pull_request_id=reporters.pull_request_id group by user_id)as x
inn... |
<filename>src/main/resources/db/migration/V5__brukernotificasjon.sql
CREATE TABLE brukernotifikasjon (
sykmelding_id VARCHAR PRIMARY KEY,
event_id VARCHAR NOT NULL,
pasient_fnr CHAR(11) NOT NULL,
timestamp TIMESTAMP with time zone
);
|
CREATE FUNCTION [dbo].[fn_GetChampWinRate]
(
@championId bigint = null
,@timeSlot int = null
)
RETURNS VARCHAR(10)
AS
BEGIN
DECLARE @results VARCHAR(10)
IF (@timeSlot IS NOT NULL)
BEGIN
SELECT @results = CAST(100.0*x.wins/NULLIF(x.total,0) as numeric(36,2))
FROM
(
SELECT
(
... |
<reponame>victoryw/LADE_Analysis<filename>dependence_api/conf/evolutions/default/2.sql
# --- !Ups
CREATE TABLE `Configure` (
`id` char(36) CHARACTER SET utf8 NOT NULL,
`type` char(128) COLLATE utf8mb4_unicode_ci NOT NULL,
`key` char(128) COLLATE utf8mb4_unicode_ci NOT NULL,
`value` char(128) COLLATE utf8mb4_un... |
<filename>Config/thelia.sql
# This is a fix for InnoDB in MySQL >= 4.1.x
# It "suspends judgement" for fkey relationships until are tables are set.
SET FOREIGN_KEY_CHECKS = 0;
-- ---------------------------------------------------------------------
-- elastic_product_indexation_queue
-- ------------------------------... |
SELECT
r.[Description]
,c.[Name] AS CategoryName
FROM Reports AS r
JOIN Categories AS c ON r.CategoryId = c.Id
WHERE r.CategoryId IS NOT NULL
ORDER BY r.[Description], c.[Name]
|
# Write your MySQL query statement below
# #Easy #Database #SQL_I_Day_8_Function #2022_06_03_Time_392_ms_(90.54%)_Space_0B_(100.00%)
select customer_number from orders group by customer_number order by count(customer_number) desc limit 1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.