sql stringlengths 6 1.05M |
|---|
PROMPT >> Removing Flows4APEX Database Objects
PROMPT >> ====================================
PROMPT >> Functions
drop function apex_error_handling;
PROMPT >> Packages
drop package flow_p0005_api;
drop package flow_p0006_api;
drop package flow_p0007_api;
drop package flow_logging;
drop package flow_plsql_runner_pkg;
... |
<reponame>Korn1699/bobsql<gh_stars>10-100
-- Add a target group containing server(s)
EXEC jobs.sp_add_target_group 'bwazuresqlgroup'
-- Add a server target member
EXEC jobs.sp_add_target_group_member
'bwazuresqlgroup',
@target_type = 'SqlServer',
@refresh_credential_name='mymastercred', --credential required to refres... |
<reponame>EmanueleMeazzo/SQL-Code-snippets
--https://www.red-gate.com/simple-talk/sql/database-devops-sql/but-the-database-worked-in-development-preventing-broken-constraints/
CREATE OR ALTER PROCEDURE #ListAllCheckConstraints
/**
Summary: >
This creates a JSON list of all the check constraints in the database.
... |
GRANT SELECT
ON SCHEMA::[dbo] TO [Reports];
|
<filename>db/seed.sql
USE cms_db;
INSERT INTO department (name) VALUES ("HR");
INSERT INTO department (name) VALUES ("Sales");
INSERT INTO department (name) VALUES ("Marketing");
INSERT INTO department (name) VALUES ("Evidence Shredding");
INSERT INTO department (name) VALUES ("Legal");
INSERT INTO department (name) ... |
CREATE TABLE B_DAV_LOCKS (
ID varchar(128) NOT NULL,
PATH varchar(255) NOT NULL,
EXPIRES int NOT NULL,
LOCK_OWNER varchar(255) NULL,
LOCK_DEPTH char(1) NOT NULL DEFAULT 'N',
LOCK_TYPE char(1) NOT NULL DEFAULT 'R',
LOCK_SCOPE char(1) NOT NULL DEFAULT 'S',
CREATED datetime NOT NULL,
MODIFIED datetime NOT NULL
)
... |
drop table staff;
drop table shop;
drop table result;
drop table result_detail;
create table shop (
id int,
name varchar(100),
primary key(id)
);
create table staff (
id int,
name varchar(100),
shop_id int,
primary key(id),
foreign key(shop_id) references shop(id)
);
create table result (
id int,
type_code i... |
<filename>nginx/web/public/quizapp/database/cee_db.sql
-- phpMyAdmin SQL Dump
-- version 4.9.0.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jan 05, 2020 at 04:19 AM
-- Server version: 10.4.6-MariaDB
-- PHP Version: 7.3.9
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TR... |
create table ACT_ID_GROUP (
ID_ nvarchar(64),
REV_ int,
NAME_ nvarchar(255),
TYPE_ nvarchar(255),
primary key (ID_)
);
create table ACT_ID_MEMBERSHIP (
USER_ID_ nvarchar(64),
GROUP_ID_ nvarchar(64),
primary key (USER_ID_, GROUP_ID_)
);
create table ACT_ID_USER (
ID_ ... |
#standardSQL
# 20.12 - Average number of HTTP/2 Pushed Resources and Average Bytes by Content type
SELECT
client,
content_type,
COUNT(DISTINCT page) AS num_pages,
ROUND(AVG(num_requests),2) AS avg_pushed_requests,
ROUND(AVG(kb_transfered),2) AS avg_kb_transfered
FROM (
SELECT
client,
page,
JSON... |
ALTER TABLE redcap_validation_types CHANGE COLUMN `data_type` `data_type` ENUM('date','datetime','datetime_seconds','email','integer','mrn','number','number_comma_decimal','phone','postal_code','ssn','text','time','char','subject_id') NULL;
INSERT INTO `redcap_validation_types` VALUES ('year_only','Four-digit year','^\... |
<filename>redis/redis-integration-test/src/test/resources/xpipe-crdt.sql<gh_stars>1000+
insert into CONFIG_TBL (`key`, sub_key, `value`, `desc`, `deleted`) VALUES ('LEASE', 'CROSS_DC_LEADER', 'jq', 'lease for cross dc leader', 0);
insert into organization_tbl(org_id, org_name) values (1, 'org-1');
insert into CLUSTER... |
<gh_stars>1000+
-- cast function
select '====CAST====';
set timezone='UTC';
select to_timestamp(1630320462000000);
select to_timestamp('2000-01-01 00:00:00');
set timezone='Asia/Shanghai'; -- Asia/Shanghai: +8:00
select to_timestamp(1630320462000000);
select to_timestamp('2000-01-01 12:00:00');
-- insert into table, se... |
CREATE OR REPLACE VIEW view_atl_108_awayan AS
SELECT
*
FROM
view_atl_108_kabupaten
WHERE
1 = 1 AND
id_skpd = 34;
GRANT ALL PRIVILEGES ON view_atl_108_awayan TO lap_awayan;
REVOKE INSERT, UPDATE, DELETE ON view_atl_108_awayan FROM lap_awayan;
GRANT ALL PRIVILEGES ON skpd, sub_skpd TO lap_awayan;
REVOKE INSERT, UPD... |
<filename>Data Base/segundamano_db2.sql<gh_stars>0
-- phpMyAdmin SQL Dump
-- version 4.6.5.2
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 08-06-2017 a las 20:41:02
-- Versión del servidor: 5.7.17-log
-- Versión de PHP: 7.1.2
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "... |
-- @testpoint:验证cast函数是否能将整型数据转换为time型
select cast(2008 as time) from;
|
<filename>OJ/LeetCode/leetcode/problems/now_coder_sql19.sql
# 题目描述
# 查找所有员工的last_name和first_name以及对应的dept_name,也包括暂时没有分配部门的员工
# CREATE TABLE `departments` (
# `dept_no` char(4) NOT NULL,
# `dept_name` varchar(40) NOT NULL,
# PRIMARY KEY (`dept_no`)
# );
# CREATE TABLE `dept_emp` (
# `emp_no` int(11) NOT... |
CREATE OR REPLACE FUNCTION message_store.message_store_version()
RETURNS varchar
AS $$
BEGIN
RETURN '1.1.5';
END;
$$ LANGUAGE plpgsql
VOLATILE;
|
-- 1. 商品テーブルから商品分類ごとの合計数を集計するビュー
CREATE VIEW ShohinSum (shohin_bunrui, cnt_shohin)
AS
SELECT shohin_bunrui, COUNT(*)
FROM Shohin
GROUP BY shohin_bunrui;
-- 2. ビューが作成されていることの確認
SELECT shohin_bunrui, cnt_shohin
FROM ShohinSum;
-- 上記1,2と同じことをサブクエリを使って表現する(ビュー定義のSELECT文をFROMに書く)
SELECT shohin_bunrui, cnt_shohin
FRO... |
-- MySQL dump 10.13 Distrib 5.7.16, for Linux (x86_64)
--
-- Host: localhost Database: mct
-- ------------------------------------------------------
-- Server version 5.7.16-0ubuntu0.16.04.1
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RE... |
<reponame>JmA515/Themed-eCommerce
--CREATE DATABASE BOOKS_E_COMMERCE;
CREATE TABLE Users (
Id int NOT NULL IDENTITY PRIMARY KEY,
FirstName varchar(255) NOT NULL,
LastName varchar(255) NOT NULL,
);
CREATE TABLE Roles (
Id int NOT NULL IDENTITY PRIMARY KEY,
RoleName varchar(255) NOT NULL,
);
CREATE... |
BEGIN;
CREATE TABLE public.versao(
code SMALLINT NOT NULL PRIMARY KEY,
nome VARCHAR(255) NOT NULL
);
INSERT INTO public.versao (code, nome) VALUES
(1, '1.0.0');
COMMIT; |
/* 既存のコード体系を新しい体系に変換して集計 */
CREATE TABLE PopTbl
(pref_name VARCHAR(32) PRIMARY KEY,
population INTEGER NOT NULL);
INSERT INTO PopTbl VALUES('徳島', 100);
INSERT INTO PopTbl VALUES('香川', 200);
INSERT INTO PopTbl VALUES('愛媛', 150);
INSERT INTO PopTbl VALUES('高知', 200);
INSERT INTO PopTbl VALUES('福岡', 300);
INSERT INTO Po... |
<filename>08-Advanced-SQL/homework/SQLQuery05.sql
-- find the average salary in the "Sales" department
USE TelerikAcademy
SELECT
AVG(Salary) AS [Average Salary]
,d.Name AS [Department]
FROM Employees e
INNER JOIN Departments d
ON e.DepartmentID = d.DepartmentID
WHERE d.Name = 'Sales'
GROUP BY d.Name |
CREATE TABLE nama.event (
id_event UUID NOT NULL CONSTRAINT pk_event PRIMARY KEY,
title varchar(100) NOT NULL,
description TEXT NULL,
start_date TIMESTAMP WITHOUT TIME ZONE NULL,
end_date TIMESTAMP WITHOUT TIME ZONE NULL,
modified TIMESTAMP WITH TIME ZONE NOT NULL,
previous_event_id UUID NULL,
CONSTRAINT fk_ev... |
insert into manufacturer (code, name ) values (1, 'Acura');
insert into manufacturer (code, name ) values (2, 'Honda');
insert into manufacturer (code, name ) values (3, 'Toyota'); |
<reponame>thilehoffer/Student-Assessment-Web
CREATE PROC dbo.usp_GetTeacherClasses (
@TeacherId INT
)
AS
BEGIN
SELECT
tc.Id ,
tc.TeacherId ,
tc.ClassName ,
tc.Active
FROM
dbo.TeacherClass tc
WHERE
tc.TeacherId = @TeacherId
END
GO
|
CREATE VIEW my_schema.my_view_name
--and
(
/* we */
column1,
column2,
/* can */
column3
)
-- put
WITH
/* comments */
/*even multiple ones */
-- and of various types
SCHEMABINDING,
-- everywhere
ENCRYPTION,
-- we
VIEW_METADATA
/* want*/
AS
/* because */
SELECT ... |
CREATE INDEX index_set_member_subjects_on_subject_set_id ON set_member_subjects
CREATE INDEX index_subject_sets_workflows_on_workflow_id ON subject_sets_workflows
CREATE TABLE subject_sets ( id integer NOT NULL, display_name character varying, project_id integer, created_at timestamp without time zone, updated_at tim... |
<filename>data/musicbrainz/cover_art/release_groups.sql
create temporary table t as
select distinct release_group, begin_date
from context
where cover_url is null and begin_date is not null
order by begin_date desc
;
\copy t to 'gid.tsv';
;
|
<reponame>Shuttl-Tech/antlr_psql
-- file:collate.linux.utf8.sql ln:25 expect:true
CREATE TABLE collate_test_fail (
a int,
b text COLLATE "foo"
)
|
INSERT INTO user(id,user_name) VALUES (1,'test1');
INSERT INTO user(id,user_name) VALUES (2,'test2');
INSERT INTO user(id,user_name) VALUES (3,'test3');
INSERT INTO user(id,user_name) VALUES (4,'test4'); |
/*
Inner join (3)
The ability to combine multiple joins in a single query is a powerful feature of SQL, e.g:
SELECT *
FROM left_table
INNER JOIN right_table
ON left_table.id = right_table.id
INNER JOIN another_table
ON left_table.id = another_table.id;
As you can see here it becomes tedious to continually write long ... |
<gh_stars>1-10
###############################################################
# $Author: $
# $Revision: $
# $Date: $
###############################################################
# ATTENTION: do not add other sql statements than the CREATE TABLE statement
CREATE TABLE plugin (
id INT(11) UNSIGNED NOT NULL AUTO_... |
<filename>src/main/resources/db/migration/postgresql/V2.2.5.20180212181325__cca-author.sql
ALTER TABLE ${ohdsiSchema}.cca
ADD COLUMN created_by VARCHAR(255),
ADD COLUMN modified_by VARCHAR(255); |
<gh_stars>10-100
CREATE TABLE public.t1 (
c1 integer
);
ALTER TABLE public.t1 OWNER TO botov_av;
REVOKE ALL(c1) ON TABLE public.t1 FROM PUBLIC;
REVOKE ALL(c1) ON TABLE public.t1 FROM botov_av;
GRANT ALL(c1) ON TABLE public.t1 TO maindb; |
/******************************************/
/* 数据库全名 = tesla_authproxy */
/* 表名称 = ta_permission_meta */
/******************************************/
CREATE TABLE `ta_permission_meta` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
`service_code` varchar(50) NOT NULL COMMENT 'Tesla服务标识、可以是... |
<gh_stars>1000+
SELECT count() FROM test.hits WHERE AdvEngineID != 0
|
<filename>spec/fixtures/permissions.ddl
CREATE TABLE `permissions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`track_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
|
-- phpMyAdmin SQL Dump
-- version 5.1.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Feb 08, 2022 at 01:49 AM
-- Server version: 10.4.20-MariaDB
-- PHP Version: 7.4.21
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIE... |
<filename>hotel_list.sql
-- MySQL dump 10.13 Distrib 5.7.22, for Linux (x86_64)
--
-- Host: localhost Database: test
-- ------------------------------------------------------
-- Server version 5.7.22-0ubuntu0.16.04.1
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_... |
<gh_stars>0
/*
* CREATE USER
*/
CREATE USER chipinadmin WITH ENCRYPTED PASSWORD '<PASSWORD>'; -- TODO: [Caution] Please set up your user name and password.
/*
* CREATE DATABASE
*/
CREATE DATABASE logdb WITH OWNER = chipinadmin ENCODING = 'UTF8';
/*
* CREATE TABLE
*/
\c logdb;
CREATE TABLE mess... |
SET foreign_key_checks = 0;
#
# TABLE STRUCTURE FOR: todo_lists
#
DROP TABLE IF EXISTS `todo_lists`;
CREATE TABLE `todo_lists` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`language_id` int(11) NOT NULL,
`subject` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`text... |
<reponame>15213222722/smart
/*
Navicat MySQL Data Transfer
Source Server : Local
Source Server Version : 50620
Source Host : localhost:3306
Source Database : smart-sso
Target Server Type : MYSQL
Target Server Version : 50620
File Encoding : 65001
Date: 2017-06-22 09:05:34
*/
SET F... |
<reponame>rajadileepkolli/Up-and-Running-with-jOOQ
DROP TABLE IF EXISTS product;
CREATE TABLE product (
product_id SERIAL NOT NULL,
product_name varchar(70) DEFAULT NULL,
quantity_in_stock int DEFAULT 0,
CONSTRAINT product_pk PRIMARY KEY (product_id)
) |
<reponame>odedindi/panterTodo<gh_stars>0
/*
Warnings:
- Added the required column `title` to the `TodoList` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "Todo" ALTER COLUMN "completed" SET DEFAULT false,
ALTER COLUMN "createdAt" SET DEFAULT CURRENT_TI... |
CREATE VIEW [dbo].[vStationDatasets]
AS
Select
Row_Number() over (order by StationCode, PhenomenonCode, OfferingCode, UnitOfMeasureCode) ID, s.*
from
(
Select
OrganisationID, OrganisationCode, OrganisationName, OrganisationDescription, OrganisationUrl,
ProgrammeID, ProgrammeCode, ProgrammeName, ProgrammeDescript... |
SELECT
wos_id,
issn,
doi,
title,
pubtype,
doctype,
volume,
issue,
pubyear,
pubmonth,
pubday,
source,
abstract
FROM
union_publications
WHERE
source IN ('ANTIPODE',
'AREA',
'CASE STUDIES IN THE ENVIRONMENT',
... |
<reponame>semangatbaru/beritadong<filename>tahu.sql
-- phpMyAdmin SQL Dump
-- version 4.9.0.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Aug 12, 2020 at 11:54 AM
-- Server version: 10.3.16-MariaDB
-- PHP Version: 7.1.30
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRA... |
/* SQL in this file will be executed in every environment, including production, as part of database deployment. */ |
SET DEFINE OFF;
CREATE OR REPLACE CONTEXT CTX_INFOR_SESN
USING AFW_07_POLC_PKG
/
|
select count(*) as pocet, d.rok
from apa_ziadosti_diely d
where d.custom_id = {custom_id}
group by d.rok
order by d.rok
|
<filename>src/main/sql/medium/TheMostRecentThreeOrders_1532.sql<gh_stars>1-10
-- #Table: Customers
-- #
-- #
-- #+---------------+---------+
-- #| Column Name | Type |
-- #+---------------+---------+
-- #| customer_id | int |
-- #| name | varchar |
-- #+---------------+---------+
-- #customer_id is... |
<gh_stars>1-10
use FingerprintsDb
GO
IF OBJECT_ID('sp_DeleteTrack','P') IS NOT NULL
DROP PROCEDURE sp_DeleteTrack
GO
CREATE PROCEDURE sp_DeleteTrack
@Id INT
AS
BEGIN
DELETE FROM Fingerprints WHERE Fingerprints.TrackId = @Id
DELETE HashTable_1 FROM HashTable_1 INNER JOIN SubFingerprints ON HashTable_1.SubFingerprint... |
<gh_stars>1-10
/*
We define an employee's total earnings to be their monthly salary x months worked, and the maximum total earnings to be the maximum total earnings for any employee in the Employee table. Write a query to find the maximum total earnings for all employees as well as the total number of employees who ha... |
SELECT cast(NOW() as TIMESTAMP) AS "COL";
|
CREATE SCHEMA [ZGWOptional]
AUTHORIZATION [dbo];
|
<gh_stars>10-100
CREATE TABLE c ();
|
with ce as
(
SELECT
ce.subject_id
, ce.stay_id
, ce.charttime
, itemid
-- TODO: clean
, value
, case
-- begin fio2 cleaning
when itemid = 223835
then
case
when valuenum >= 0.20 and valuenum <= 1
then valuenum * 100
... |
<filename>Practica 1 Obligatoria/practica_1.sql
-- phpMyAdmin SQL Dump
-- version 5.0.3
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 14-01-2021 a las 16:44:07
-- Versión del servidor: 10.4.14-MariaDB
-- Versión de PHP: 7.4.11
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTIO... |
<reponame>bhutchinson/rice
--
-- Copyright 2005-2015 The Kuali Foundation
--
-- Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php
... |
SET SCHEMA 'api';
CREATE VIEW attendee AS
SELECT * FROM model.attendee;
GRANT SELECT ON attendee TO read_access;
CREATE VIEW attendee_number AS
SELECT * FROM model.attendee_number;
GRANT SELECT ON attendee_number TO read_access;
CREATE FUNCTION create_attendee(id INTEGER, cid TEXT, name TEXT, nick TEXT DEF... |
-- 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.
IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.VIEWS... |
<reponame>ww20081120/framework
update
employee t
set
t.name = :#{#entity.name},
t.age = :#{#entity.age}
where
t.id = :#{#entity.id} |
<gh_stars>1000+
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements. See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership. The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "Li... |
SELECT name_city, count(buy.buy_id) as Количество
FROM city INNER JOIN client
ON client.city_id = city.city_id
INNER JOIN buy
ON buy.client_id = client.client_id
GROUP BY name_city
ORDER BY Количество DESC
|
-- Topics list ):
insert into “TOPICS” ("SUB", "MODULE", "TOPIC", "IMPORTANCE") values
('18CS51',1,'Meaning, nature and characteristics of management',2),
('18CS51',1,'Scope and Functional areas of management',1),
('18CS51',1,'Goals of management',3),
('18CS51',1,'Levels of management',2),
('18... |
<filename>section7/List1-6.sql
-- List1-6 商品テーブルにデータを登録するSQL文
BEGIN TRANSACTION;
INSERT INTO 商品 VALUES ('0001', 'Tシャツ', '衣服', 1000, 500, '2009-09-20');
INSERT INTO 商品 VALUES ('0002', '穴あけパンチ', '事務用品', 500, 320, '2009-09-11');
INSERT INTO 商品 VALUES ('0003', 'カッターシャツ', '衣服', 4000, 2800, NULL);
INSERT INTO 商品 VALUES ('00... |
<filename>datasets_with_query/datasets_with_query/14/populate_match.sql
-- Populate Match
DELETE FROM "Match";
INSERT INTO "Match" ("stadium", "date", "time", "home", "guest")
VALUES ('San Paolo', '2020-01-01', '5:00', 'Italia', 'Francia');
INSERT INTO "Match" ("stadium", "date", "time", "home", "guest")
VALUES ('S... |
CREATE TABLE [dbo].[systemEntity] (
[systemEntityId] UNIQUEIDENTIFIER CONSTRAINT [DF_systemEntity_systemEntityId] DEFAULT (newid()) NOT NULL,
[createtime] DATETIME CONSTRAINT [DF_systemEntity_createtime] DEFAULT (getdate()) NOT NULL,
[entityName] NVARCHAR (33) NOT NU... |
<filename>ejb/src/META-INF/sql/data.sql<gh_stars>0
INSERT INTO Topic (id, name) VALUES (1, 'Java EE'), (2, 'JavaScript'), (3, 'Version Control'), (4, 'Continuous Integration');
INSERT INTO Discussion (id, title, topic_id) VALUES (1, 'How do I start JBoss?', 1);
|
SET DEFINE OFF;
create or replace package body afw_01_javsc_pkg
as
procedure ajout_libr
is
begin
afw_07_util_pkg.ajout_libr_javsc ('afw_01_err');
end ajout_libr;
procedure ajout_scrip_charg
is
begin
afw_07_util_pkg.ajout_info_debug ('AFW 01 Messages - JavaScript au chargement');
--afw_07_util_p... |
DROP SCHEMA IF EXISTS data CASCADE; |
<filename>src/main/resources/migrations/00029_drop_index_transaction_gateway_account_id.sql<gh_stars>1-10
--liquibase formatted sql
--changeset uk.gov.pay:drop_index_transaction_gateway_account_id runInTransaction:false
DROP INDEX CONCURRENTLY IF EXISTS transaction_gateway_account_id_idx;
|
SELECT cus.name, ord.id
FROM customers cus
INNER JOIN orders ord ON cus.id = ord.id_customers
WHERE '2016-01-01' <= orders_date AND orders_date <= '2016-06-30'; |
<filename>_repository/upgrade/0.1.7-0.8.7/data/sql/MySQL/upgrade.sql
--
-- Author: <NAME> <<EMAIL>>
-- Copyright: (c) 2013-2019, <NAME>. All Rights Reserved.
-- License: MIT License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
--
ALTER TABLE pH7_Members ADD COLUMN height tinyint(3... |
<gh_stars>0
USE employee_tracker;
INSERT INTO department (name) VALUES('HR');
INSERT INTO department (name) VALUES('Accounts');
INSERT INTO role (title, salary,department_id) VALUES('Accountant', '5000', '1' );
INSERT INTO role (title, salary,department_id) VALUES('Accounts Manager', '6000', '1' );
INSERT INTO role (ti... |
<reponame>uk-gov-mirror/defra.water-abstraction-tactical-crm
drop table if exists crm.entity_association;
|
CREATE TABLE Tecnico
(
id_tecnico BIGINT PRIMARY KEY IDENTITY(1,1),
id_utilizador BIGINT NOT NULL,
nome NVARCHAR(60) NOT NULL,
telefone BIGINT NOT NULL
)
GO
ALTER TABLE Tecnico
ADD CONSTRAINT fk_T_Utilizador
FOREIGN KEY(id_utilizador)
REFERENCES Utilizador(id_utilizador) |
-- MySQL
CREATE TABLE customer (
customer_id BIGINT AUTO_INCREMENT,
id BINARY(16) NOT NULL,
name VARCHAR(100) NOT NULL,
email VARCHAR(100) NOT NULL,
PRIMARY KEY (customer_id),
CONSTRAINT id_unique UNIQUE (id),
CONSTRAINT email_unique UNIQUE (email)
);
CREATE TABLE product (
product_id BIGINT AUTO_INCR... |
CREATE TABLE OPTIONS (
TID INT NOT NULL,
KEY_ VARCHAR2(255) NOT NULL,
VALUE_ VARCHAR2(255) NOT NULL,
CONSTRAINT OPTIONS_PKEY PRIMARY KEY (TID, KEY_),
FOREIGN KEY (TID) REFERENCES TABLES (TID) ON DELETE CASCADE
) |
select count(*) from cast_tbl_1_v a, cast_tbl_2_v b where a.d18 = b.d9;
|
------ You can't allow the same area name and the same ancestry inside a space
ALTER TABLE areas ADD CONSTRAINT areas_name_space_id_path_unique UNIQUE(space_id,name,path);
------ For existing spaces in production, which dont have a default area, create one.
--
-- 1. Get all spaces which have an area under it with th... |
/*
* Copyright (c) 2017 LabKey Corporation
*
* 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... |
<reponame>luo2674661839/wolf<filename>game.sql
/*
Navicat MySQL Data Transfer
Source Server : localhost
Source Server Version : 50553
Source Host : localhost:3306
Source Database : game
Target Server Type : MYSQL
Target Server Version : 50553
File Encoding : 65001
Date: 2018-11-19 ... |
-- create a now() function for repeatable testing that always returns
-- the same timestamp. It needs to be marked STABLE
CREATE OR REPLACE FUNCTION now_s()
RETURNS timestamp LANGUAGE PLPGSQL STABLE AS
$BODY$
BEGIN
RAISE NOTICE 'Stable function now_s() called!';
RETURN '2017-08-22T10:00:00'::timestamp;
END;
$... |
CREATE TABLE IF NOT EXISTS `VIEW_SCOPE` (
`VIEW_ID` BIGINT NOT NULL,
`CONTAINER_ID` BIGINT NOT NULL,
PRIMARY KEY (`VIEW_ID`,`CONTAINER_ID`),
INDEX (`VIEW_ID`),
INDEX (`CONTAINER_ID`),
CONSTRAINT `VIEW_TYPE_FK` FOREIGN KEY (`VIEW_ID`) REFERENCES `VIEW_TYPE` (`VIEW_ID`) ON DELETE CASCADE
)
|
<reponame>percona/percona-xtradb-cluster-operator
GRANT SELECT, RELOAD, PROCESS, SUPER, REPLICATION CLIENT, SYSTEM_USER ON *.* TO 'monitor'@'%'
GRANT SELECT ON `performance_schema`.* TO 'monitor'@'%'
|
library DRCommunicationWithPhysicianManagingDiabetes version '9.2.000'
using QDM version '5.5'
include MATGlobalCommonFunctions version '5.0.000' called Global
codesystem "LOINC": 'urn:oid:2.16.840.1.113883.6.1'
codesystem "SNOMEDCT": 'urn:oid:2.16.840.1.113883.6.96'
valueset "Care Services in Long-Term Residential... |
<gh_stars>1000+
CREATE INDEX onek_two_idx ON onek USING lsm(two);
DROP INDEX onek_two_idx;
DROP INDEX onek_two_idx;
DROP INDEX IF EXISTS onek_two_idx;
--
-- Create index on existing table with data
--
CREATE TABLE index_test (col1 int, col2 int);
INSERT INTO index_test (col1, col2) VALUES (1, 100);
INSERT INTO inde... |
-- FUNCTION: public.Function2_$%{}[]()&*^!@"'`\/#()
-- DROP FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"();
CREATE OR REPLACE FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"(
)
RETURNS character varying
LANGUAGE 'plpgsql'
COST 100
VOLATILE PARALLEL UNSAFE
SET enable_sort='true'
AS $BODY$
beg... |
<filename>sql_2017/sql1_persediaan/gabungan_daftar_penerimaan.sql
DROP VIEW IF EXISTS view_daftar_penerimaan_awayan;
CREATE VIEW view_daftar_penerimaan_awayan AS
SELECT
*
FROM
view_daftar_penerimaan_kabupaten
WHERE
1 = 1 AND
id_skpd = 34;
GRANT ALL PRIVILEGES ON view_daftar_penerimaan_awayan, sub_skpd TO lap_away... |
<gh_stars>0
CREATE TABLE "Redfin2_3"(
"col_00" smallint NOT NULL,
"col_01" decimal(16, 15),
"col_02" float8,
"col_03" float8,
"col_04" varchar(31),
"col_05" integer,
"col_06" float8,
"col_07" float8,
"col_08" integer,
"col_09" float8,
"col_10" float8,
"col_11" decimal(5, 1),
"col_12" decimal(5, 1),
"col_13" decimal(5, ... |
BEGIN TRANSACTION;
DROP TABLE IF EXISTS global_player;
CREATE TABLE global_player (
user_id char(21) not null unique,
gender varchar(10),
age int(2),
personal_record TEXT,
personal_desc TEXT,
games int(2) default 0,
wins int(2) default 0
);
COMMIT;
|
<filename>01. Data Definition and Datatypes/14-CarRental-Database.sql<gh_stars>0
-- CREATE DATABASE CarRental
-- GO
-- USE CarRental
CREATE TABLE Categories (
Id int NOT NULL IDENTITY,
Category nvarchar(200) NOT NULL UNIQUE,
DailyRate money CHECK (DailyRate >= 0),
WeeklyRate money CHECK (WeeklyRate >= 0),
Mon... |
--
-- add user
--
-- use discs_calib;
delimiter ##
--
-- add user
--
drop procedure if exists add_user;
create procedure add_user(IN uniqueName VARCHAR(64), IN userName VARCHAR(64),
IN email VARCHAR(64), IN groupName VARCHAR(32))
begin
declare uid INT;
declare roleid INT;
declare groupid IN... |
use wos;
insert into wos.UIDs select x.UID, replace(upper(x.file), '.XML', '') as file, x.loaded, x.id from wos.rawXMLs x left join wos.UIDs u using(id) where u.id is null; commit;
select @maxIDx:=max(x.id) from wos.rawXMLs x ;
select @maxIDu:=max(u.id) from wos.UIDs u ;
select if(@maxIDx>@maxIDu, @maxmax:=@maxIDx+1,... |
# 04. Top Paid Employee
#
# Write a query to create a view that selects all information about the
# top paid employee from the “employees” table in the hospital database.
USE hospital;
CREATE VIEW v_top_payed_employee AS
SELECT *
FROM employees
ORDER BY salary DESC
LIMIT 1;
SELECT *
FROM v_top_payed_em... |
<reponame>varad-desai/RetailStoreManagementDatabase
-- use the database context
USE RetailStoreManagement_Team10;
-- 6. Insert rows into the customer table
-- customer(customer_id, first_name, last_name, customer_type, customer_password)
INSERT INTO dbo.[customer] VALUES (10001, 'Jerald', 'Kim', 'regular', ENCRYP... |
<reponame>SkaaYz/gsb_medecins
/* CREATE TABLE IF NOT EXISTSS (pays, departement, medecin, utilisateur, specialite_complementaire) */
CREATE TABLE IF NOT EXISTS pays(
id INT AUTO_INCREMENT PRIMARY KEY,
libelle VARCHAR(50) NULL
);
CREATE TABLE IF NOT EXISTS departement(
id INT AUTO_INCREMENT PRIMARY KEY,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.