sql stringlengths 6 1.05M |
|---|
DROP TABLE IF EXISTS `non_auth_route`;
CREATE TABLE `non_auth_route` (
`object_pkey` VARCHAR(254) NOT NULL,
`created_at` DATE NOT NULL,
PRIMARY KEY (`object_pkey`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
TRUNCATE version;
INSERT INTO version VALUES ('internals-1.96');
|
-- This cleanup shifts all the contact methods (email, phone, IM, etc) from the
-- contacts table into the more flexible contact_methods table. We'll be able
-- to add more and even make them customizable by Admins at some point.
CREATE TABLE `contacts_methods` (
`method_id` int(10) NOT NULL auto_increment,
`... |
/*Given the CITY and COUNTRY tables,
query the names of all the continents (COUNTRY.Continent)
and their respective average city populations (CITY.Population)
rounded down to the nearest integer.
Note: CITY.CountryCode and COUNTRY.Code are matching key columns.*/
select c2.continent, floor(avg(c1.population))
from... |
CREATE PROC [dbo].[uspUserOrganizationInsert]
@UserOrganizationID uniqueidentifier,
@UserID uniqueidentifier,
@OrganizationID uniqueidentifier,
@MemberStatus tinyint,
@Deleted bit,
@DeletedBy uniqueidentifier,
@DeletedOn datetime
AS
SET NOCOUNT ON
SET XACT_ABORT ON
-- Flag in cas... |
-- Query 1
SELECT
l_returnflag,
l_linestatus,
sum(l_quantity) as sum_qty,
sum(l_extendedprice) as sum_base_price,
sum(l_extendedprice * (1 - l_discount)) as sum_disc_price,
sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge,
avg(l_quantity) as avg_qty,
avg(l_extendedpri... |
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
CREATE TABLE `articles` (
`id` int(11) NOT NULL,
`title` varchar(60) CHARACTER SET utf8 NOT NULL,
`description` text CHARACTER SET utf8 NOT NULL,
`created_at` varchar(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
INS... |
<filename>queries/stackoverflow/q12/653ba649bfa98d0bad1bd8a19edb2c20d56073a3.sql
SELECT t1.name, count(*)
FROM
site as s,
so_user as u1,
question as q1,
answer as a1,
tag as t1,
tag_question as tq1
WHERE
q1.owner_user_id = u1.id
AND a1.question_id = q1.id
AND a1.owner_user_id = u1.id
AND s.site_id = q1.site_id
AND s.si... |
<filename>setupAssets/authenticator.sql<gh_stars>0
BEGIN;
CREATE TABLE domain (
id SERIAL PRIMARY KEY
);
CREATE TABLE user (
id SERIAL PRIMARY KEY
);
CREATE TABLE credentials (
id SERIAL PRIMARY KEY,
user NOT NULL REFERENCES(user.id),
effective TIMESTAMP DEFAULT NOW(),
version INTEGER NOT... |
create table if not exists scores(
id integer primary key,
post_id integer,
steam_id integer,
name text,
score integer,
timestamp datetime default current_timestamp
);
create table if not exists rosters(
steam_id integer,
clan_id integer,
clan_name text
timestamp datetime default current_timestamp
... |
<reponame>Bitluck/PL-SQL-labs<filename>chap04-fill-tables/fillTableRooms.sql<gh_stars>1-10
DELETE FROM Rooms;
INSERT INTO Rooms VALUES (706, 4, 3684.38, 'suite');
INSERT INTO Rooms VALUES (409, 2, 6666.66, 'suite');
INSERT INTO Rooms VALUES (802, 1, 1865.65, 'apartment');
INSERT INTO Rooms VALUES (103, 3, 480.46, 'stu... |
/*
This software has been released under the MIT license:
Copyright (c) 2009 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the r... |
-- This will alter the date time columns in certain tables
ALTER TABLE analysis_record ALTER COLUMN sim_date_time TYPE TIMESTAMPTZ USING sim_date_time::timestamp with time zone;
ALTER TABLE analysis_record ALTER COLUMN sim_date_time SET DEFAULT now();
ALTER TABLE user_details ALTER COLUMN last_submit_date TYPE TIMEST... |
use nflff;
drop table schedule_2018;
create table schedule_2018 (
GameNum int
,team1 varchar(5)
,team2 varchar(5)
,primary key (GameNum,team1)
);
-- load data local infile '/Users/briangoodwin/Documents/nfl_fantasyFootball_statHuzzah/data/schedule_2018.csv'
-- into table schedule_2018
-- fields termin... |
<reponame>octonion/baseball-public<filename>ncaa_pbp/loaders/load_team_summaries_fielding.sql
begin;
drop table if exists ncaa_pbp.team_summaries_fielding;
create table ncaa_pbp.team_summaries_fielding (
year integer,
year_id integer,
team_id integer,
team_name text,
... |
<reponame>Shuttl-Tech/antlr_psql
-- file:with.sql ln:543 expect:true
CREATE RULE r2 AS ON UPDATE TO x DO INSTEAD
WITH t AS (SELECT OLD.*) UPDATE y SET a = t.n FROM t
|
DROP DATABASE IF EXISTS employees_db;
CREATE DATABASE employees_db;
USE employees_db;
CREATE TABLE employee (
id INT NOT NULL AUTO_INCREMENT,
first_name VARCHAR(30) NOT NULL,
last_name VARCHAR(30) NOT NULL,
role_id INT NOT NULL,
manager_id INT NULL,
PRIMARY KEY (id)
);
CREATE TABLE roles (
... |
-- 2019-09-17T11:08:54.744Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,AD_Val_Rule_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAutocomplete,IsC... |
<filename>src/main/resources/db/migration/V2.8__insert_DetailCommandes_data.sql
insert into detail_commande (lignecmdid, numcmdid, prix_unitaire_sortie, prix_vente_total, produitid, quantite_sortie) values(1, 2, 229.99, 180.99, 2, 11000);
insert into detail_commande (lignecmdid, numcmdid, prix_unitaire_sortie, prix_ve... |
<gh_stars>0
----------------------------------------
-- Return function headers for packages
---------------------------------------
create or replace package doc
is
function get_proc_header (
proc_name in varchar2,
package_name in varchar2
) return varchar2;
function get_package_header (
packag... |
create table tb_order_0 (
`id` bigint(11) NOT NULL AUTO_INCREMENT COMMENT '编号',
`creater_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '创建人',
`create_time` datetime NOT NULL DEFAULT NOW() COMMENT '创建时间',
`updater_id` bigint(20) DEFAULT '0' COMMENT '更新人',
`update_time` datetime NOT NULL DEFAULT NOW() COMMENT '更新时间',
... |
SELECT
CounterID,
hits,
visits
FROM
(
SELECT
CounterID,
count() AS hits
FROM test.hits
GROUP BY CounterID
) ANY FULL OUTER JOIN
(
SELECT
CounterID,
sum(Sign) AS visits
FROM test.visits
GROUP BY CounterID
HAVING visits > 0
) USING CounterID
WHERE hi... |
/* ---------------------------------------------------- */
/* Generated by Enterprise Architect Version 13.0 */
/* Created On : 16-���-2018 7:40:40 */
/* DBMS : PostgreSQL */
/* ---------------------------------------------------- */
/* Drop Sequences for Autonumber Columns */
/* Drop Tables *... |
DROP TABLE IF EXISTS comments CASCADE;
DROP TRIGGER IF EXISTS comment_updated_at_trigger ON comments;
DROP FUNCTION IF EXISTS comment_updated;
DROP EXTENSION IF EXISTS citext CASCADE;
DROP EXTENSION IF EXISTS POSTGIS CASCADE;
DROP EXTENSION IF EXISTS pg_trgm CASCADE;
DROP EXTENSION IF EXISTS btree_gist CASCADE;
DROP EX... |
CREATE TABLE todo (
id bigint AUTO_INCREMENT PRIMARY KEY ,
owner VARCHAR(255) NOT NULL,
description VARCHAR(255) NOT NULL,
completed BOOLEAN NOT NULL DEFAULT false
);
CREATE TABLE MEMBER (
ID BIGINT NOT NULL,
USERNAME VARCHAR(50) NOT NULL,
PASSWORD VARCHAR(32) NOT NULL,... |
<filename>cinema/src/main/resources/db/scripts/002_add_init_data.sql<gh_stars>1-10
truncate table hall;
truncate table accounts;
INSERT INTO hall (row, seat, price)
VALUES (1, 1, 400),
(1, 2, 500),
(1, 3, 400),
(2, 1, 300),
(2, 2, 400),
(2, 3, 300),
(3, 1, 200),
(3, 2, ... |
/************************************************************************************************
The following are helper SP for hecleaner utility and are not exposed to the application DAOs
If you add a function here, drop it in hecleaner_sp_drop.sql
*****************************************************************... |
-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jul 12, 2021 at 10:19 AM
-- 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";
/*!40101 SET @OLD_CHARACTER_SET_CLIE... |
-- @testpoint:opengauss关键字exchange(非保留),作为外部数据源名
--关键字不带引号-成功
drop data source if exists exchange;
create data source exchange;
drop data source exchange;
--关键字带双引号-成功
drop data source if exists "exchange";
create data source "exchange";
drop data source "exchange";
--关键字带单引号-合理报错
drop data source if exists 'exchan... |
-- UPDATE wormholesystems_new SET statics='C247,U210,P060' WHERE solarsystemid=31002550;
-- UPDATE wormholesystems_new SET statics='J244,Z060' WHERE solarsystemid=31002514;
-- UPDATE wormholesystems_new SET statics='L005,C008,Q003' WHERE solarsystemid=31002587;
-- UPDATE wormholesystems_new SET statics='U210,K346... |
INSERT
INTO
entity
(entity_id, email_address, entity_name)
VALUES
(1, '<EMAIL>', 'cic');
INSERT
INTO
cic
(body, cic_id, cic_timestamp, cic_type, source_system, subject, entity_id)
VALUES
('Test Cic Body Content', '4455', null, 'Urgent', 'SMS', 'Test Cic', 1); |
-- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Nov 18, 2018 at 07:32 PM
-- Server version: 10.1.29-MariaDB
-- PHP Version: 7.2.0
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD... |
DROP DATABASE IF EXISTS resources_db;
CREATE DATABASE resources_db; |
<gh_stars>0
alter type party_type add value 'vendor';
create table vendors (
party_id uuid not null,
party_type party_type,
account_number varchar,
website varchar,
primary key (party_id, party_type),
foreign key (party_id, party_type)
references parties (party_id, party_type)... |
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600711',@CutoffDate = N'2017-09-30',@EPS = N'0.253',@EPSDeduct = N'0',@Revenue = N'127.18亿',@RevenueYoy = N'51.15',@RevenueQoq = N'23.65',@Profit = N'3.78亿',@ProfitYoy = N'223.10',@ProfiltQoq = N'22.20',@NAVPerUnit = N'2.9131',@ROE = N'9.01',@CashPerUnit = N'0.1993',@GrossProfitRate... |
SELECT name + '(' + LEFT(occupation, 1) + ')' FROM occupations
UNION
SELECT CONCAT('There are a total of ', COUNT(occupation), ' ', lower(occupation), 's.') FROM occupations
GROUP BY occupation; |
<reponame>vibhorkum/postgres_benchmark<gh_stars>0
DO $$
DECLARE
rec TEXT;
is_partition BOOLEAN;
BEGIN
SELECT CASE WHEN COUNT(1) > 1 THEN
TRUE
ELSE
FALSE
END INTO is_partition
FROM pg_class
... |
<filename>sap-real-estate-contract-sql-contract-object-assignment-data.sql
CREATE TABLE `sap_real_estate_contract_contract_object_assignment_data`
(
`InternalRealEstateNumber` varchar(13) NOT NULL,
`REStatusObjectSource` varchar(22) DEFAULT NULL,
`REObjectAssignmentType` varchar(2... |
<reponame>pirocorp/Databases-Basics-MS-SQL-Server
CREATE OR ALTER TRIGGER tr_DeleteProductReletion ON Products INSTEAD OF DELETE
AS
BEGIN
DELETE FROM ProductsIngredients WHERE ProductId IN (SELECT Id FROM deleted)
DELETE FROM Feedbacks WHERE ProductId IN (SELECT Id FROM deleted)
DELETE FROM Products WHERE Id... |
CREATE TABLE [dbo].[DepartmentalAdminRequests] (
[Id] VARCHAR (10) NOT NULL,
[FirstName] VARCHAR (50) NOT NULL,
[LastName] VARCHAR (50) NOT NULL,
[Email] VARCHAR (50) NOT NULL,
[PhoneNumber] VARCHAR (50) NULL,
[DepartmentSize] TINYINT NO... |
alter table egmrs_fee add column active boolean DEFAULT true NOT NULL;
alter table egmrs_document add column active boolean DEFAULT true NOT NULL; |
<reponame>vforgione/plenario
CREATE OR REPLACE FUNCTION point_from_loc(loc text)
RETURNS geometry(Point,4326)
AS
$$
SELECT ST_PointFromText('POINT(' || subq.longitude || ' ' || subq.latitude || ')', 4326)
FROM ( SELECT FLOAT8((regexp_matches($1, '\((.*),.*\)'))[1]) AS latitude,
FLOAT8((regexp_matches... |
RAISERROR('Create procedure: [dbo].[usp_reportHTMLBuildHealthCheck]', 10, 1) WITH NOWAIT
GO
IF EXISTS (
SELECT *
FROM sys.objects
WHERE object_id = OBJECT_ID(N'[dbo].[usp_reportHTMLBuildHealthCheck]')
AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[usp_reportHTMLBuildHealthCheck]
... |
<reponame>Shuttl-Tech/antlr_psql
-- file:create_function_3.sql ln:20 expect:true
CREATE FUNCTION functest_A_3() RETURNS bool LANGUAGE 'sql'
AS 'SELECT false'
|
<filename>CapsData/Create Scripts/Tables/Keys/FK_CapType_Shape.fkey.sql
ALTER TABLE [dbo].[CapType]
ADD CONSTRAINT [FK_CapType_Shape] FOREIGN KEY ([ShapeID]) REFERENCES [dbo].[Shape] ([ShapeID]) ON DELETE NO ACTION ON UPDATE NO ACTION;
|
DROP PROCEDURE IF EXISTS `sp_obj_perm_all_v2`;
DELIMITER //
CREATE PROCEDURE `sp_obj_perm_all_v2`(
IN p_group_id BIGINT UNSIGNED,
IN p_member_sql VARCHAR(4096),
IN p_objIDs MEDIUMTEXT,
IN p_symbolic_names BOOLEAN
)
READS SQL DATA
BEGIN
/*
* ::718604!
*
* Copyright(C) November 20, 2014 U.S. F... |
CREATE TABLE categoria (
id BIGINT NOT NULL AUTO_INCREMENT,
nome VARCHAR(160) NOT NULL,
data_cadastro DATETIME NOT NULL,
PRIMARY KEY (id)); |
CREATE TABLE [tdw].[fct_Enrollment_Pairs] (
[Enrollment_Pairs_Key] INT IDENTITY (1, 1) NOT NULL,
[Hash_Key_BK] VARBINARY (16) NOT NULL,
[Academic_Year_Key] INT NOT NULL,
[District_Key] INT NOT NULL,
[School_Key] ... |
WITH T AS (
SELECT
sum(CASE WHEN relkind IN ('r', 't', 'm') THEN pg_stat_get_numscans(oid) END) seq,
sum(CASE WHEN relkind = 'i' THEN pg_stat_get_numscans(oid) END) idx
FROM pg_class
WHERE relkind IN ('r', 't', 'm', 'i')
)
SELECT row_to_json(T)
FROM T
|
-- Version: 2 --
alter table contacts add column user_id integer references users on delete set null deferrable;
create index idx_contacts_user on contacts (user_id);
insert into roles (role_id,role) values (1,'Global Administrator');
insert into roles (role_id,role) values (2,'Institution Administrator');
insert into ... |
/****** Object: Table [dbo].[T_MgrState] ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[T_MgrState](
[MgrID] [int] NOT NULL,
[TypeID] [int] NOT NULL,
[Value] [varchar](128) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Last_Affected] [datetime] NULL,
CONSTRAINT [PK_T_MgrS... |
--
-- Add rev_deleted flag to revision table.
-- Deleted revisions can thus continue to be listed in history
-- and user contributions, and their text storage doesn't have
-- to be disturbed.
--
-- 2005-03-31
--
ALTER TABLE /*$wgDBprefix*/revision
ADD rev_deleted tinyint unsigned NOT NULL default '0';
|
create table tb (a int primary key, b int);
create index i_tb_all on tb(a,b) where b is not null;
create index i_tb_b on tb(b) where b is null;
insert into tb values (1,1);
insert into tb values (2,2);
insert into tb values (3,3);
insert into tb values (4,null);
SET OPTIMIZATION LEVEL 513;
select /*+ recompile */ * fro... |
<reponame>opengauss-mirror/Yat
-- @testpoint: opengauss关键字char(非保留),作为字段数据类型(部分测试点合理报错)
--step1:关键字不带引号; expect: 执行成功
drop table if exists char_test cascade;
create table char_test(id int,name char);
--step2:清理环境; expect: 执行成功
drop table if exists char_test cascade;
--step3:关键字带双引号; expect: 执行成功
create table char_te... |
-- DECLARE
-- @SEG01 AS VARCHAR(25) = '00.New Contacts'
-- , @SEG02 AS VARCHAR(25) = '01.Pledge Givers'
-- , @SEG03 AS VARCHAR(25) = '02.Major Donors'
-- , @SEG04 AS VARCHAR(25) = '03.Premium Donors'
-- , @SEG05 AS VARCHAR(25) = '04.High Value Donors'
-- , @SEG06 AS VARCHAR(25) = '05.General Donors'
-- , ... |
<filename>db/db_manaj.sql
-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Feb 03, 2021 at 07:57 PM
-- 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 S... |
-- phpMyAdmin SQL Dump
-- version 4.1.12
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Erstellungszeit: 15. Feb 2015 um 01:01
-- Server Version: 5.6.16
-- PHP-Version: 5.5.11
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*... |
CREATE VIEW SensorDynPropValuesNow AS
SELECT dyn_val.*,dyn.Name as Name,dyn.TypeProp FROM
.SensorDynPropValue dyn_val
JOIN SensorDynProp dyn ON dyn_val.FK_SensorDynProp = dyn.ID
where not exists (select * from SensorDynPropValue V2
where V2.FK_SensorDynProp = dyn_val.FK_SensorDynProp and V2.FK_Se... |
# cnpSharpSample.sql was originally generated by the autoSql program, which also
# generated cnpSharpSample.c and cnpSharpSample.h. This creates the database representation of
# an object which can be loaded and saved from RAM in a fairly
# automatic way.
#CNP sample data from Sharp lab
CREATE TABLE cnpSharpSample ... |
-- phpMyAdmin SQL Dump
-- version 3.4.10.1deb1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Feb 15, 2016 at 09:00 AM
-- Server version: 5.5.40
-- PHP Version: 5.3.10-1ubuntu3.15
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTE... |
ALTER TABLE reports DROP CONSTRAINT reports_reporter_fkey;
ALTER TABLE reports ADD FOREIGN KEY(reporter) REFERENCES users(username) |
-- Add column that links a new payment request to the older payment request it recalculated, if applicable.
ALTER TABLE payment_requests
ADD COLUMN recalculation_of_payment_request_id uuid
CONSTRAINT payment_requests_recalculation_of_payment_request_id_fkey REFERENCES payment_requests;
COMMENT ON COLUMN payment_req... |
UPDATE monsters SET sort_name = name WHERE sort_name = ""
|
<gh_stars>1-10
-- Fetches access methods
SELECT oid, amname
FROM pg_am |
grant select, update, insert on mytable to public
|
<filename>src/test/resources/data.sql
CREATE TABLE ANAGRAFICA
(
id INT PRIMARY KEY,
nome NCHAR(20),
cognome NCHAR(20),
codiceFiscale NCHAR(20)
);
CREATE TABLE POLIZZA
(
id INT PRIMARY KEY,
idContraente INT,
idAssicurato INT,
idBeneficiario INT
... |
-- 2019-04-25T13:12:07.286
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE C_DocType SET DocNoSequence_ID=555008,Updated=TO_TIMESTAMP('2019-04-25 13:12:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE C_DocType_ID=540972
;
|
insert into Conyuges (Cedula ,Nombre, Apellido,EmpleadoId) values (1727264515,'Lesly','Chamorro',1); |
DROP TABLE IF EXISTS `djtinue_course`;
CREATE TABLE `djtinue_course` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(255) NOT NULL,
`course_number` varchar(128) NOT NULL,
`abstract` longtext NOT NULL,
`credits` varchar(8) NOT NULL,
`audience` varchar(128) NOT NULL,
`fac_id` varchar(16) DEFAULT NUL... |
CREATE TABLE [dbo].[Enrollment] (
[EnrollmentID] INT IDENTITY (253000, 1) NOT NULL,
[ProjectEntryID] INT NOT NULL,
[PersonalID] INT NOT NULL,
[ProjectID] INT NO... |
alter session set `planner.filter.max_selectivity_estimate_factor` = 0.2;
explain plan including all attributes for select l.l_orderkey from lineitem l, orders o where l.l_orderkey < 10 and l.orderkey = o.orderkey and o.o_orderpriority < '5-LOW' and o.o_orderstatus = 'F' group by l.l_orderkey having l.l_orderkey < 50;... |
SELECT fn_db_rename_column('vm_dynamic', 'guest_agent_status', 'ovirt_guest_agent_status');
SELECT fn_db_add_column('vm_dynamic', 'qemu_guest_agent_status', 'INTEGER DEFAULT 0');
|
/*
A query for overall capacity usage
Example result:
capacity_gbytes | used_gbytes | free_gbytes |
----------------|-------------|-------------|
17827 | 10789 | 7037 |
----------------|-------------|-------------|
*/
select
sum(capacity) / 1024 as capacity_gbytes,
sum(used) / 1024 as us... |
-- --------------------------------------------------------
-- Host: 127.0.0.1
-- Server version: 5.5.28 - MySQL Community Server (GPL)
-- Server OS: Win64
-- HeidiSQL Version: 9.4.0.5125
-- --------------------------------------------------------
/*... |
<reponame>pdv-ru/ClickHouse
SELECT loyalty, count() AS c, bar(log(c + 1) * 1000, 0, log(6000) * 1000, 80) FROM (SELECT UserID, toInt8((yandex > google ? yandex / (yandex + google) : -google / (yandex + google)) * 10) AS loyalty FROM (SELECT UserID, sum(SearchEngineID = 2) AS yandex, sum(SearchEngineID = 3) AS google FR... |
<gh_stars>100-1000
CREATE TABLE IF NOT EXISTS PLUGINS (
ID VARCHAR(36) PRIMARY KEY,
NAME VARCHAR(100) NOT NULL,
SRC VARCHAR(100) NOT NULL,
CREATED_AT TIMESTAMP DEFAULT clock_timestamp() NOT NULL
);
CREATE TABLE IF NOT EXISTS METRICS_GROUPS (
ID VARCHAR(36) PRIMARY KEY,
NAME VARCHAR(100) NOT NULL,
WORKSPACE_ID V... |
create schema if not exists test;
create table if not exists test.messages (
id varchar(36) primary key not null,
message varchar(1024) null default (null)
); |
<reponame>akorvenr/mosquitto-auth-plug
DROP TABLE IF EXISTS users;
CREATE TABLE users (
username VARCHAR(25) NOT NULL,
password VARCHAR(128) NOT NULL,
super SMALLINT NOT NULL DEFAULT 0
);
CREATE UNIQUE INDEX users_username ON users (username);
INSERT INTO users (username, password) VALUES ('jj<PASSWORD>', '<PAS... |
-- @testpoint: opengauss关键字server非保留),作为索引名,部分测试点合理报错
--前置条件,创建一个表
drop table if exists explain_test;
create table explain_test(id int,name varchar(10));
--关键字不带引号-成功
drop index if exists server;
create index server on explain_test(id);
drop index server;
--关键字带双引号-成功
drop index if exists "server";
create index "ser... |
<filename>src/main/java/com/example/shopifycoding/ShopifyCodingChallenge/connection/marketplace.sql
-- MySQL Script generated by MySQL Workbench
-- Mon Jan 21 00:53:02 2019
-- Model: New Model Version: 1.0
-- MySQL Workbench Forward Engineering
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREI... |
<filename>aminiaio/db/schema.sql
CREATE TABLE problems (
problem_id SERIAL PRIMARY KEY,
name TEXT NOT NULL UNIQUE,
hardness TEXT NOT NULL,
description TEXT NOT NULL,
hints TEXT NULL,
solution TEXT NULL
);
CREATE TABLE students (
student_id SERIAL PRIMARY KEY,
name T... |
CREATE INDEX team_name ON box.boxer_teams (name);
DROP TYPE IF EXISTS team_data CASCADE;
CREATE TYPE team_data as (
team_id int,
team_name text,
team_description text,
members int,
won_battles int,
total_battles int,
win_percentage int
);
CREATE OR REPLACE FUNCTION full_boxe... |
-- for MYSQL 5.7
CREATE TABLE BEARER_TOKEN (
USER_ID int NOT NULL,
TOKEN_ID int NOT NULL AUTO_INCREMENT,
TOKEN_VALUE NVARCHAR(200) UNIQUE,
EXPIRY_TIME DATETIME,
PRIMARY KEY (TOKEN_ID),
FOREIGN KEY (USER_ID) REFERENCES USERS(id)
);
CREATE TABLE REFRESH_TOKEN (
USER_ID int NOT NULL,
T... |
-- Modify the datatype of tbltax.taxrate
alter table `tbltax` modify `taxrate` DECIMAL(10,3) NOT NULL default '0.000';
-- Modify the datatype of tblinvoices.taxrate
alter table `tblinvoices` modify `taxrate` DECIMAL(10,3) NOT NULL default '0.000';
-- Modify the datatype of tblinvoices.taxrate2
alter table `tblinvoice... |
USE [sqlclouddatabase]
GO
INSERT INTO [dbo].[People]([FirstName], [LastName], [Gender], [DateOfBirth], [Email], [PhoneNumber])
VALUES(N'Julio' ,N'Robles' ,N'M' ,N'1974/10/08' ,'<EMAIL>' ,'+57 (318) 552-6543')
GO
INSERT INTO [dbo].[People]([FirstName], [LastName], [Gender], [DateOfBirth], [Email], [PhoneNumber])
VAL... |
create table Students (
RollNo INT,
Name VARCHAR(50),
EmailId VARCHAR(50),
PrimaryPhone VARCHAR(50),
SecondaryPhone VARCHAR(50),
Gender VARCHAR(50),
ResidentialAddress VARCHAR(50),
About VARCHAR(50),
ProfilePicture VARCHAR(50),
PRIMARY KEY (RollNo)
);
/* Mock enteries for 30 students*/
INSERT INTO Student... |
<filename>schema/scripts/20140722-210656.sql<gh_stars>1-10
drop table if exists organization_metadata;
create table organization_metadata (
guid uuid primary key,
organization_guid uuid not null references organizations,
package_name text
);
select schema_evolution_manager.cr... |
DEFINE RECORD CDD$TOP.TV.TV_COMMER_SKED_INSTR
DESCRIPTION IS /*Commercial Schedule Instructions*/.
TV_COMMER_SKED_INSTR_CDD STRUCTURE.
/* Element = TV_FRMNUM
Description = Form Number */
FRMNUM DATATYPE IS TEXT SIZE IS 8.
/* Element =
Descript... |
<filename>restoranlaravel.sql
-- phpMyAdmin SQL Dump
-- version 4.7.7
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Mar 13, 2019 at 11:40 PM
-- Server version: 10.1.30-MariaDB
-- PHP Version: 7.2.2
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone =... |
CREATE TABLE `maintenances` (
`maintenanceid` bigint unsigned NOT NULL,
`name` varchar(128) DEFAULT '' NOT NULL,
`maintenance_type` integer DEFAULT '0' NOT NULL,
`description` text ... |
<gh_stars>1-10
/*
Fix slow query execution times by adding an index on mem_accounts2delegates ("dependentId")
Before index fix:
```
ripa_mainnet=> EXPLAIN (ANALYZE) UPDATE mem_accounts m
SET vote = (SELECT COALESCE(SUM(b.balance), 0) AS vote
FROM mem_accounts2delegates a, mem_accounts b
WHERE a.... |
<reponame>nitros12/genericbot-rs<filename>migrations/2018-03-31-011031_init_bot/down.sql
DROP TABLE IF EXISTS guild;
DROP TABLE IF EXISTS message;
DROP TABLE IF EXISTS "prefix";
DROP TABLE IF EXISTS reminder;
DROP TABLE IF EXISTS tag;
|
/*
Warnings:
- You are about to drop the column `userId` on the `questions` table. All the data in the column will be lost.
*/
-- DropForeignKey
ALTER TABLE "questions" DROP CONSTRAINT "questions_userId_fkey";
-- AlterTable
ALTER TABLE "questions" DROP COLUMN "userId";
|
/*[[
Show ash wait chains. Usage: @@NAME {[<sql_id>|<sid>|<event>|<plan_hash_value>|-f"<filter>"] [YYMMDDHH24MI] [YYMMDDHH24MI]}|{-snap [secs]} [-sid] [-dash] [-flat] [-t"<ash_dump_table>"]
Options:
-dash : source from dba_hist_active_session_history instead of gv$active_session_history
... |
INSERT INTO countries (id,name,iso3166_a2name) VALUES ('0084d910-d153-4bd4-86bf-f5e5a8492c7e','Burundi','BI');
INSERT INTO countries (id,name,iso3166_a2name) VALUES ('01ae3f21-2bc5-4889-8a34-1b14e18be24d','Latvia','LV');
INSERT INTO countries (id,name,iso3166_a2name) VALUES ('0319ecf4-acfe-4a80-8fc1-4cc39f060dca','Pal... |
-- Apr 8, 2013 3:19:13 PM SGT
-- IDEMPIERE-840 Improvement to Request model class
INSERT INTO AD_ModelValidator (SeqNo,AD_ModelValidator_ID,ModelValidationClass,EntityType,Name,AD_ModelValidator_UU,AD_Org_ID,Created,CreatedBy,Updated,UpdatedBy,IsActive,AD_Client_ID) VALUES (0,200003,'org.compiere.model.RequestValidator... |
<gh_stars>10-100
-- Add migration script here
INSERT INTO at (
claims_aud,
claims_exp,
claims_iat,
claims_iss,
claims_jti,
claims_nbf,
claims_sub,
header_typ,
header_alg,
header_cty,
header_jku,
header_kid,
header_x5... |
-- phpMyAdmin SQL Dump
-- version 5.1.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Tempo de geração: 31-Mar-2022 às 19:06
-- Versão do servidor: 10.4.22-MariaDB
-- versão do PHP: 8.1.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CL... |
<reponame>Shuttl-Tech/antlr_psql
-- file:json.sql ln:486 expect:true
SELECT js FROM json_populate_record(NULL::jsrec, '{"js": [123, "123", null, {"key": "value"}]}') q
|
-- file:tsdicts.sql ln:94 expect:true
SELECT ts_lexize('hunspell_num', 'footklubber')
|
<reponame>mischaguilty/esliwo
create table esliwo.failed_jobs
(
id bigint unsigned auto_increment
primary key,
uuid varchar(255) not null,
connection text not null,
queue text not null,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.