text stringlengths 6 9.38M |
|---|
Create Procedure mERP_sp_Get_CSOutletGroup(@SchemeID Int)
as
Begin
Select SG.GroupID,
(Select Top 1 Case QPS When 0 Then 'No' Else 'Yes' End as QPS From tbl_mERP_SchemeOutlet Where SchemeID = SG.SchemeID
And GroupID = Max(SG.SubGroupID))
From tbl_mERP_SchemeSubGroup SG
Where SG.SchemeID = @SchemeID Grou... |
-- phpMyAdmin SQL Dump
-- version 4.0.6deb1
-- http://www.phpmyadmin.net
--
-- Хост: localhost
-- Время создания: Дек 26 2013 г., 13:09
-- Версия сервера: 5.5.34-0ubuntu0.13.10.1
-- Версия PHP: 5.5.3-1ubuntu2.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@... |
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Jul 15, 2017 at 11:03 AM
-- Server version: 10.1.16-MariaDB
-- PHP Version: 5.6.24
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CL... |
--unrecoverable.sql
@ttitle 'Unrecoverable Report'
set line 200 trimspool on
set pagesize 100
col name format a80
alter session set nls_date_format = 'yyyy-mm-dd hh24:mi:ss';
select name, unrecoverable_time, unrecoverable_change#
from v$datafile
where unrecoverable_time is not null
and unrecoverable_change# ... |
/* Создание процедуры получения статистики по розыгрышу */
CREATE OR ALTER PROCEDURE /*PREFIX*/GET_LOTTERY_STATISTICS
(
TIRAGE_ID VARCHAR(32)
)
RETURNS
(
ALL_COUNT INTEGER,
USED_COUNT INTEGER,
NOT_USED_COUNT INTEGER,
PRIZE_SUM NUMERIC(15,2),
JACKPOT_SUM NUMERIC(15,2),
FIRST_ROUND_SUM NUMERIC(15,2),
SE... |
select code, count(*)
from prices
where max(ifnull(close, 0), ifnull(adj_close, 0)) < low or max(ifnull(close, 0), ifnull(adj_close, 0)) > high
and market_cap is not null
group by code
order by code;
select c.company, prices.*
from prices
join companies c on prices.code = c.code
where (max(ifnull(close, 0), ifnull... |
DROP TABLE IF EXISTS USER;
create table USER
(
ID bigint AUTO_INCREMENT primary key,
EMAIL varchar(50) not null,
NAME varchar(50) not null,
BIRTHDAY DATE not null
);
insert into USER (EMAIL, NAME, BIRTHDAY)
VALUES ('Ivanov@mail.ru', 'Ivanov', parsedatetime('01-01-2001', 'dd-MM-yyyy'));
ins... |
-- LEN
SELECT LEN('Hola soy un texto');
SELECT LEN('');
-- UPPER
SELECT UPPER('Hola a todos');
SELECT UPPER(Nombre) FROM Alumno;
-- LOWER
SELECT LOWER('ESTE ESTA EN MAYUSCULAS');
SELECT LOWER(Nombre) FROM Alumno;
-- CONCAT
SELECT CONCAT('Hola', '@gmail');
SELECT CONCAT(Nombre, ' ', Apellido) AS NombreCompleto FROM A... |
/* SUSHANT SINHA */
select distinct P1.Email
from Person as P1, Person as P2
where P1.Id != P2.Id and P1.Email = P2.Email
/* or can use this too */
select email from person group by email having count(id)>1; |
-- creates a table called first_table in the database hbtn_0c_0
-- first_table to have id INT, name VARCHAR(256)
CREATE TABLE IF NOT EXISTS first_table (id INT, name VARCHAR(256));
|
SELECT distinct
labels,
y.customer_id,
c.email,
y.product_id,
date_trunc('day',y.action_time) click_date_dt,
created_at assistly_created_at,
datediff(d,y.action_time,created_at)::numeric,
case_id
/*changed_at,
first_opened_at,
first_resolved_at,
y.visit_id,
y.clid,
*/
FROM analytics.yoda y
LEFT JOIN analytics... |
.mode column
.headers on
INSERT INTO utilisateur (pseudo, prenom, nom, date_naissance, mail, password) VALUES
('matru', 'Machin', 'Truc', '1987-12-12', 'machin@webmail.com', '00000000');
-- Update password
UPDATE utilisateur
SET password = 1111
WHERE id = 1;
-- Afficher les utilisateurs
SELECT * FROM utilisateur;
-... |
DROP FUNCTION IF EXISTS getprovinces;
DROP FUNCTION IF EXISTS getcantones;
DROP FUNCTION IF EXISTS getdistricts; |
UPDATE AD_Column SET AD_Reference_ID=28, AD_Reference_Value_ID=NULL,Updated=TO_DATE('2009-06-02 11:32:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=56347
;
|
use MyDB;
select *
from SuperOrders;
drop table SuperOrders;
create table member(
Id varchar(25) primary key,
Password varchar(100),
Name varchar(25),
Email varchar(100)
)engine=InnoDB default charset=utf8;
select *
from member;
create table score(
name varchar(20) primary key,
kor int,
... |
--- drop view r_inamts cascade
create or replace view r_inamts as select
alloctbl.shelfno_code_fm shelfno_code_fm ,
alloctbl.trngantt_processseq trngantt_processseq ,
alloctbl.shelfno_name_fm shelfno_name_fm ,
alloctbl.prjno_name prjno_name ,
alloctbl.unit_code unit_code ,
alloctbl.unit_name un... |
insert into User
values(1, 'danillo.mendonca@gmail.com', 'Danillo Mendonca', '123', '(48) 991852535');
insert into Video
values(1, 'Video 1', 'https://www.youtube.com/watch?v=MvTh8P9dAk4', 'MvTh8P9dAk4');
insert into Video
values(2, 'Video 2', 'https://www.youtube.com/watch?v=t2zFRaPequM', 't2zFRaPequM');
insert into V... |
SET IDENTITY_INSERT ArmorSet ON
INSERT INTO ArmorSet (ArmorSetID, Name) VALUES (1, 'Battle Armor')
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (1, 1, 1)
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (1, 2, 1)
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (1, 3, 1)
INSERT ... |
type GrosumImpl as object
( grow number
, fall number
, static function ODCIAggregateInitialize(sctx in out GrosumImpl) return number
, member function ODCIAggregateIterate(self in out GrosumImpl, value in number) return number
, member function ODCIAggregateTerminate(self in GrosumImpl, returnValue out number, flags i... |
CREATE PROCEDURE SP_RECEPCION_SKU_UPDATE
@SKU_QTY_REAL INT,
@SKU_FECHA_INICIO DATETIME,
@SKU_FECHA_FIN DATETIME,
@SKU_CODIGO VARCHAR(50),
@PROT_CODIGO INT,
@PRO_CODIGO INT,
@DOC_NUMERO INT,
@DOC_TIPO VARCHAR(100),
@BOD_CODIGO VARCHAR(50),
@EMP_CODIGO ... |
drop table if exists login;
CREATE TABLE IF NOT EXISTS Login(userID VARCHAR(255), pass VARCHAR(255) NOT NULL,
PRIMARY KEY (userID));
DROP TABLE if exists clientinfo;
CREATE TABLE IF NOT EXISTS ClientInfo(userID VARCHAR(255) NOT NULL, fullname CHAR(50),
address1 VARCHAR (100) NOT NULL, address2 VARCHAR (100), city CH... |
INSERT INTO public.adherent(
id, adresse, codepostal, datenaissance, email, nom, prenom, ville, cotisation_id)
VALUES
(101, '2 Lot Chanteperdrix', '80300', '1968-02-16', 'PARUCH@gamil.com', 'PARUCH', 'Armand', 'MEAULTE', null),
(102, '5 Rue du Jeu de Tamis', '80370', '1963-04-16', 'MACRON@gamil.com', 'MACRON'... |
/*
Navicat MySQL Data Transfer
Source Server : po
Source Server Version : 50525
Source Host : localhost:3306
Source Database : spruce
Target Server Type : MYSQL
Target Server Version : 50525
File Encoding : 65001
Date: 2013-05-09 10:23:58
*/
SET FOREIGN_KEY_CHECKS=0;
-- ---------... |
/*
Navicat SQLite Data Transfer
Source Server : localhost
Source Server Version : 30706
Source Host : :0
Target Server Type : SQLite
Target Server Version : 30706
File Encoding : 65001
Date: 2014-10-26 23:33:11
*/
PRAGMA foreign_keys = OFF;
-- ----------------------------
-- Table stru... |
/*
Name: Articles saved details
Data source: 4
Created By: Admin
Last Update At: 2016-04-14T18:24:25.906105+00:00
*/
SELECT v.post_prop20 AS Article,
a.title_long AS Title,
a.,
a.locale,
FROM
(SELECT post_prop20,
page_url,
FROM (TABLE_QUERY(djomniture:cipomniture_djmansionglobal,'CON... |
delete
from compra
where id = :id |
update events_list
set date = $1, event = $2, description = $3
where id = $4
returning * |
-- 字典表
create table dictionary (
id bigserial not null,
parent_id bigint not null,
tenant_id bigint not null default 0,
app_module VARCHAR(50),
type VARCHAR(50) not null,
item_name VARCHAR(100) not... |
-- SQL Query
-- 1. Tampilkan Kode,Nama, Gaji, Nama Departemen dari tabel karyawan
USE belajar_oop
SELECT
TK.kode AS 'Kode',
TK.nama AS 'Nama',
CONCAT('Rp. ', FORMAT(TK.gaji, '##,###0'), ',00') AS 'Gaji',
TD.nama AS 'Departemen'
FROM
tkaryawan TK INNER JOIN tdepartemen TD
ON
TK.departemen_id = TD.id;
-- 2.... |
CREATE PROCEDURE sp_ser_replace_Bank(@BANK_CODE NVARCHAR(50),
@ACCOUNT_NUMBER NVARCHAR(255),
@ServicechargePercentage Decimal(18,6),
@RealisationType int)
AS
UPDATE Bank SET RealisationType = @RealisationType,
ServicechargePercentage = @ServicechargePercentage
WHERE Ba... |
/*write a SQL query to list the names of all people who have directed a movie that received a rating of at least 9.0.
Your query should output a table with a single column for the name of each person.
If a person directed more than one movie that received a rating of at least 9.0, they should only appear in your result... |
SELECT * FROM streams
WHERE stream_id = $1; |
-- phpMyAdmin SQL Dump
-- version 4.7.9
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: Jul 21, 2018 at 05:27 PM
-- Server version: 5.7.21
-- PHP Version: 5.6.35
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CH... |
select NDV(urldomain)
from edb.edb_keyword
where search_event_date between 20181001 and 20181031
and captify_region = 'US'
and property_id not in (select property_id
from edb.edb_keyword
where search_event_date between 20180201 and 20180228
and captify_region = 'US') |
create table accounts.accounts (
user_name text primary key,
pass_word text
);
create table familytree.familytree (
person text primary key,
parent1 text,
parent2 text,
user_name text
);
select * from accounts.accounts;
select * from familytree.familytree; |
USE test;
DROP TABLE IF EXISTS part;
CREATE TABLE part (
id INT(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
name VARCHAR(100) NOT NULL,
essential BIT DEFAULT FALSE NOT NULL,
quantity INT(10)
)
ENGINE = InnoDB
DEFAULT CHARACT... |
-- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Mar 25, 2020 at 01:18 AM
-- Server version: 10.1.38-MariaDB
-- PHP Version: 7.3.2
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD... |
update DB_PROFILE_DATA2.dbo.TB_IMAGEM
set IMG_CAMINHO_ARQUIVO = '\\tbswww30\FILES\DROGASIL\'+ ltrim(rtrim(b.Diretorio))+'\',
IMG_URL_ARQUIVO = 'http://tbswww30/FILES/DROGASIL/imagem/'+ SUBSTRING(ltrim(rtrim(b.Diretorio)), 1, 6)+'/'+ SUBSTRING(ltrim(rtrim(b.Diretorio)),8,6) +'/',
IMG_FLAG_STATUS = 'A',
IMG_NOME_ARQUIVO... |
create database employee;
use employee;
|
CREATE OR REPLACE PROCEDURE "AddPatientRecommendation" (
"observationSpecName" IN VARCHAR2,
"frequencyName" IN VARCHAR2,
"threshold" IN INTEGER,
"patientSSN" IN VARCHAR2,
"recommendationId" OUT INTEGER)
AS
BEGIN
"AddGeneralRecommendation" ("obse... |
/*Retrieve customer information (all fields) where customer_id is 20*/
USE sakila;
SELECT * FROM customer WHERE customer_id = 20;
/*Retrieve customer information (all fields) where customer_id is BETWEEN 20 and 60*/
USE sakila;
SELECT * FROM customer WHERE customer_id BETWEEN 20 AND 60;
/*Retrieve customer informatio... |
-- phpMyAdmin SQL Dump
-- version 4.7.0
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Apr 03, 2018 at 09:17 AM
-- Server version: 10.1.25-MariaDB
-- PHP Version: 7.1.7
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD... |
SELECT id FROM posts WHERE thread = ? ORDER BY id LIMIT 1 |
-- archived_log_hist_matrix.sql
-- acquired from Patricia Shea @
/*
values of 0 are normal at the beginning and as there is likely no data
DAY DOW 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23
------------ ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -... |
--select
-- Items.ServerItem,
-- ItemVersions.Encoding
--into T#
--from
-- Items
-- inner join ItemVersions on ItemVersions.Item_Id = Items.Id
--group by
-- Items.ServerItem, ItemVersions.Encoding
--order by
-- Items.ServerItem
|
SELECT *
FROM report.purchase |
/*
Navicat Premium Data Transfer
Source Server : localmysql5.7
Source Server Type : MySQL
Source Server Version : 50724
Source Host : localhost:3306
Source Schema : jpa
Target Server Type : MySQL
Target Server Version : 50724
File Encoding : 65001
Date: 07/11/2019 16... |
SELECT * FROM turnos.turno;
CREATE TABLE `atendidos` (
`idatendido` int(11) NOT NULL AUTO_INCREMENT,
`idturno` int(11) NOT NULL,
`idTramite` int(11) NOT NULL,
`horaIn` datetime NOT NULL,
`horaOut` datetime NOT NULL,
PRIMARY KEY (`idatendido`),
KEY `idTramite` (`idTramite`),
CONSTRAINT `fk_idtramite` FOR... |
CREATE TABLE account (
id INTEGER PRIMARY KEY AUTOINCREMENT,
account varchar(16) NOT NULL,
balance NUMERIC NOT NULL default 0,
limitat NUMERIC NOT NULL default 0
);
CREATE INDEX account_account ON account(account);
CREATE TABLE service (
id INTEGER PRIMARY KEY AUTOINCREMENT,
service varchar(16) NOT... |
-- phpMyAdmin SQL Dump
-- version 4.7.7
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Sep 16, 2018 at 12:29 AM
-- Server version: 10.1.35-MariaDB-cll-lve
-- PHP Version: 5.6.30
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!... |
-- phpMyAdmin SQL Dump
-- version 4.9.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Dec 16, 2019 at 04:21 AM
-- Server version: 10.4.8-MariaDB
-- PHP Version: 7.3.11
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD... |
Begin Transaction;
Drop Table If Exists [regions];
CREATE TABLE [regions] (
[id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
[parent_id] INT NOT NULL,
[name] TEXT NOT NULL,
[notes] TEXT,
[basic_type_id] INT,
[level] INT,
[is_leaf] BOOLEAN,
[shoot_sequence_num] INT,
[standard_ir_file_name] TEX... |
SELECT A.Name Employee
FROM Employee A, Employee B
WHERE A.ManagerId = B.Id AND A.Salary > B.Salary
|
SET @dbName = 'name_of_database';
SELECT `TABLE_NAME`
FROM `information_schema`.`TABLES`
WHERE
`TABLE_SCHEMA` = @dbName
; |
declare
l_msg long;
l_status number;
begin
dbms_alert.register('WAITING');
for i in 1 .. 999999 loop
dbms_application_info.set_client_info( i );
dbms_alert.waitone('WAITING', l_msg, l_status, 0);
exit when l_status = 0;
for x in (select * from t order by 1, 2, 3, 4)
loop
null;
end ... |
-- MySQL dump 10.13 Distrib 5.7.17, for Win64 (x86_64)
--
-- Host: 127.0.0.1 Database: bd_pan
-- ------------------------------------------------------
-- Server version 5.5.5-10.4.6-MariaDB
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RE... |
--------------------------------------------------------
-- DDL for Table MOBILEUM_ASP_HOUR
--------------------------------------------------------
CREATE TABLE MOBILEUM_ASP_HOUR
( PAIS CHAR(3 CHAR),
FECHA DATE,
CNT_LLAMADAS NUMBER,
CNT_POLITICA_RESTRICCION NUMBER,
CNT_BOLQ_REL_TIPO_GEST NUMBER,
CNT_... |
'''
执行用时:246 ms, 在所有 MySQL 提交中击败了94.02% 的用户
内存消耗:0 B, 在所有 MySQL 提交中击败了100.00% 的用户
通过测试用例:15 / 15
'''
# Write your MySQL query statement below
select sell_date,
count(distinct product) as num_sold,
group_concat(distinct product order by product separator ',') as products
from activities
group by sell_date
order by sel... |
-- Question on 'The Pad'
SELECT CONCAT(name, '(', substring(occupation, 1, 1), ')') AS names
FROM occupations
ORDER BY name;
SELECT CONCAT('There are a total of ', COUNT(occupation), ' ', LOWER(occupation), 's.')
FROM occupations
GROUP BY occupation
ORDER BY COUNT(occupation);
-- Question on 'Occupation'
WITH main... |
CREATE USER "mundosde" WITH PASSWORD E'md5777935f8f1e4928ef6155b24be296eb9';
|
Create Procedure mERP_Sp_CountMargin
AS
Select Count(*) from tbl_mERP_MarginDetail MDet Inner Join tbl_mERP_MarginAbstract MAbs
On MAbs.marginID = MDet.MarginID
where dbo.StripTimefromDate(CreationDate) = DATEADD(D, 0, DATEDIFF(D, 0, GETDATE()))
and MAbs.ReceiveDocID <> 0
|
WITH
RECURSIVE PSE
(
------------EXPLOSION TRACKING----------------
LVL, PLINE, CLINE, MAST, MPLT, PRNT, COLD,
------------PROCUREMENT-----------------------
STAT, REPL,
------------ROUTING---------------------------
SEQ, DEP, RESC, OPC, REPP, REFF, XREFF,
------------BILL OF MATERIALS-----... |
CREATE TABLE IF NOT EXISTS extremum (
extremum_id int(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
name varchar(1000) NOT NULL
);
|
-- +migrate Up
ALTER TABLE instances ADD COLUMN refresh_token text;
-- +migrate Down
ALTER TABLE instances DROP COLUMN refresh_token;
|
BEGIN TRAN
select * from sysmnu
where prnt_id = 17475
where mnu_id = 1747
--where descr64 = 'Confirm Shipping'
--delete from sysmnu where mnu_id = 17479
select * from sysmnu where descr64 = 'WMS Pick Pack'
select * from sysmnu where descr64 = 'WMS Pick Tickets'
update sysmnu set seq_no = seq_no + 1 wh... |
CREATE SCHEMA demo AUTHORIZATION postgres;
CREATE TABLE IF NOT EXISTS demo.dates
(
id bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 9223372036854775807 CACHE 1 ),
date date NOT NULL,
CONSTRAINT dates_pkey PRIMARY KEY (id)
)
TABLESPACE pg_default;
ALTER TABLE dem... |
-- 185. 部门工资前三高的所有员工
-- Employee 表包含所有员工信息,每个员工有其对应的工号 Id,姓名 Name,工资 Salary 和部门编号 DepartmentId 。
--
-- +----+-------+--------+--------------+
-- | Id | Name | Salary | DepartmentId |
-- +----+-------+--------+--------------+
-- | 1 | Joe | 85000 | 1 |
-- | 2 | Henry | 80000 | 2 |
-- | 3 ... |
USE TelerikAcademy
INSERT INTO Users (Username, [Password], FullName)
SELECT LOWER(LEFT(FirstName, 3) + LastName),
LOWER(LEFT(FirstName, 3) + LastName),
FirstName + ' ' + LastName
FROM Employees |
-- +micrate Up
CREATE TABLE users (
id BIGSERIAL PRIMARY KEY,
email VARCHAR NOT NULL UNIQUE,
hashed_password VARCHAR NOT NULL,
-- This is a temporary column to be used to ensure we only have one user for now, until I implement
-- permission levels
singleton BOOL NOT NULL UNIQUE DEFAULT TRUE,
created_at TI... |
--配置表
create table sys_time (cur_year varchar2(4));
create materialized view log on sys_time nologging with rowid,sequence (cur_year) including new values;
insert into sys_time(cur_year) select to_char(sysdate,'yyyy') from dual;
commit;
begin
sys.dbms_scheduler.create_job(job_name => 'QYRK.JOB_UPDATE_CUR_... |
CREATE DATABASE SISTEMA;
USE SISTEMA;
CREATE TABLE USUARIOS
(
ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
NOME VARCHAR(80) NOT NULL,
-- VARCHAR OU ELE VAI OCUPAR A QUANTIDADE MAXIMA DENTRO DE SEU PARENTESES OU APENAS A QUANTIDADE EM QUE O USUARIO DIGITAR.
-- CHAR ELE VAI SEMPRE OCUPAR A QUANTIDADE DE CARACTERESES DE... |
INSERT INTO tbl_certificates (id, course_id, student_id, status)
VALUES (1, 1, 1, 'APROBADO'); |
-- Role: "Tourplaner_User"
-- DROP ROLE "Tourplaner_User";
CREATE ROLE "Tourplaner_User" WITH
LOGIN
NOSUPERUSER
INHERIT
NOCREATEDB
NOCREATEROLE
NOREPLICATION
ENCRYPTED PASSWORD 'SCRAM-SHA-256$4096:N9GV3cByrOql5A7g2tBihg==$k9u/FhDOf6BAYdFCzwnUESUxtkiCcSbqjlJpyHGt9Ns=:oPtyvR6qB+QWyCGA/WwCWOIgTU7preS4ilPh0G... |
SELECT * FROM repos r JOIN LATERAL (
SELECT * FROM issues i WHERE i.repo_id = r.id
) new_issues ON (true);
|
create table if not exists users (
user_id integer primary key autoincrement,
user_name text not null,
pwd text not null,
department text,
num text
);
create table if not exists assets(
asset_id text primary key,
asset_name text not null,
usage text not null
);
drop table if exists b... |
/* -*- coding: utf-8 -*- */
--
-- 部品表 (Bill of material)
--
-- 製品、部品
create table products (
id integer primary key
, name varchar(255) not null unique
);
insert into products (id, name)
values (201, '製品A')
, (202, '製品B')
, (301, '中間品E')
, (302, '中間品F')
, (401, '部品J')
, (... |
-- MySQL dump 10.13 Distrib 8.0.16, for Win64 (x86_64)
--
-- Host: localhost Database: marthagoshen
-- ------------------------------------------------------
-- Server version 5.7.24
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */... |
CREATE OR REPLACE VIEW Tids_In_Facility_View AS
SELECT
a.facility_id AS facility_id,
a.tid_id || ',' || i.id AS tid_id,
a.trans_seq AS trans_seq,
a.recv_seq AS recv_seq,
a.certified AS certified,
a.certified_recv AS certified_recv,
t.name || ' - ' || it.namelbl || ' ' || i.name AS tid
FROM
tid_facili... |
USE worldcup;
SELECT SUM(IF(isFrench == true,1,0))/COUNT(*) * 100 AS FrenchPercentage,
SUM(IF(isEnglish == true,1,0))/COUNT(*) * 100 AS EnglishPercentage, SUM(IF(isSpanish == true,1,0))/COUNT(*) * 100 AS SpanishPercentage
FROM logData
WHERE requestType = "GET" AND isHTML = true AND statusCode = 200; |
# 4/ Lister pour chaque contrôle, la moyenne de la classe que vous avez créé
SELECT C.name, ASS.matiere, AVG(G.mark) AS Moyenne
FROM assessment ASS, grade G, class C
WHERE G.assessment_id = ASS.id
AND ASS.class_id = C.id
GROUP BY ASS.matiere, C.name
HAVING AVG(G.mark); |
select * from
(select week(rtime),sum(carbs),sum(dynamic_carbs), sum(carbs) - sum(dynamic_carbs) as diff
from insulin_carb_smoothed
where year(rtime)=2017
group by week(rtime)) as T
order by diff desc;
select min(rtime),max(rtime)
from insulin_carb_smoothed
where year(rtime)=2017 an... |
/*
Unable to sync crowd user directory - query did not return a unique result
Scenario 2: duplicate row in cwd_user
link: https://confluence.atlassian.com/stashkb/unable-to-sync-crowd-user-directory-query-did-not-return-a-unique-result-664993976.html
*/
SELECT *
FROM cwd_user
WHERE external_id in
(SELECT ext... |
INSERT INTO burgers (burger_name, devoured)
VALUES ('Crispy Chicken', '1'),
VALUES ('Double Cheese', '0'),
VALUES ('Creamy Fish', '1'); |
ALTER TABLE task_records ADD COLUMN SCHEDULE_ID BIGINT;
CREATE TABLE TASK_PARAM (
ID BIGINT,
NAME VARCHAR(255),
TYPE VARCHAR(255),
VALUE VARCHAR(255),
DESCRIPTION VARCHAR(255),
SCHEDULE_ID BIGINT,
PRIMARY KEY (ID));
ALTER TABLE TASK_PARAM ADD CONSTRAINT FK_task_param_schedules FOREIGN KEY (SCHEDULE_ID)... |
--1.插入新记录
CREATE PROC supp_InsertSupplier
@SupplierID nvarchar(6),
@SupplierName nvarchar(80),
@SpellingCode nvarchar(20),
@Address nvarchar(80),
@ZipCode char(6),
@Tel nvarchar(20),
@Fax nvarchar(20),
@BankName nvarchar(40),
@BankAccount nvarchar(50),
@Contacter nvarchar(20),
@Email nvarchar(30)
as
insert TBL_Supplier... |
--
-- PostgreSQL database dump
--
-- Dumped from database version 9.6.1
-- Dumped by pg_dump version 9.6.1
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 check_function_bodies = false;
SET client_min... |
------------- CREATE USER -----------------------------------
SELECT * FROM master.sys.server_principals;
SELECT * FROM sysusers;
CREATE LOGIN student WITH PASSWORD = 'student';
CREATE USER student FOR LOGIN student;
USE parking GRANT ALL PRIVILEGES TO student;
EXECUTE AS USER = 'student';
SELECT * FROM f... |
-- phpMyAdmin SQL Dump
-- version 4.9.1
-- https://www.phpmyadmin.net/
--
-- Хост: 127.0.0.1
-- Время создания: Дек 04 2019 г., 17:32
-- Версия сервера: 10.4.8-MariaDB
-- Версия PHP: 7.3.11
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHAR... |
/*
Name: Plan_Cache_Queries.sql
Purpose: Find most resource-intensive queries in plan cache.
Date updated: 2015/04/03
Permissions needed to run: VIEW SERVER STATE
Notes:
Four options for sorting in WHERE clause.
Adapted from Troubleshooting SQL Server A Guide for the Accidental DBA http://www.red-gate.com/comm... |
--- Author: Francisco Munoz Alvarez
--- Date : 20/07/2013
--- Script: chapter7_examples.sql
--- Description: All examples done on chapter 7
SQL> SELECT type, records_total, records_used,con_id
2 FROM V$controlfile_record_section;
SQL> oradebug setmypid
> oradebug dump controlf 5
SQL> oradebug tracefile_name
... |
set hive.exec.dynamic.partition.mode=nonstrict;
SET hive.exec.max.dynamic.partitions=100000;
SET hive.exec.max.dynamic.partitions.pernode=100000;
#天模组
insert overwrite table T_HDRC_MODEL_DAY partition (day)
select BDID ,BDD1 ,BDD2 ,BDD3 ,BDD4 ,BDD5,(case when BDD5=1 then BDD2 else 0 end) as newmerchantNo,
... |
/*
SQLyog Ultimate v12.4.1 (64 bit)
MySQL - 5.7.18-log : Database - game_user
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;
/*!40101 SET SQL_MODE=''*/;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@S... |
Problem Statement:-
Order_Tbl has four columns namely ORDER_DAY, ORDER_ID, PRODUCT_ID, QUANTITY, and PRICE
PART A
Write a SQL query to get all the products that got sold on both the days and the number of times the product is sold.
PART B
Write a SQL query to get products that were ordered on 02-May-2015 but n... |
CREATE TABLE smses(
smsc TEXT,
tc TEXT,
destination TEXT,
source TEXT,
service TEXT,
url TEXT,
mask TEXT,
status TEXT,
boxc TEXT
); |
USE cap28_rtinder;
ALTER DATABASE cap28_rtinder CHARACTER SET utf8 COLLATE utf8_unicode_ci;
DROP TABLE IF EXISTS follow;
DROP TABLE IF EXISTS profile;
CREATE TABLE IF NOT EXISTS profile(
profileActivationToken CHAR(32),
profileAvatarCloudinaryId CHAR(32),
profileAvatarUrl VARCHAR(255),
profileEmail VARCHAR(128)... |
CREATE DATABASE mydb;
USE mydb;
CREATE USER myuser WITH PASSWORD 'mypassword';
ALTER DATABASE mydb OWNER TO myuser;
-- In under postgres user for mydb
CREATE EXTENSION postgis;
CREATE EXTENSION postgis_topology;
CREATE EXTENSION fuzzystrmatch;
CREATE EXTENSION postgis_tiger_geocoder;
|
-- phpMyAdmin SQL Dump
-- version 4.8.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Waktu pembuatan: 20 Agu 2018 pada 14.55
-- Versi server: 10.1.34-MariaDB
-- Versi PHP: 7.2.7
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARA... |
insert into player(team_no, back_no,country,name_kr,name_en,birthday,position,height,weight) values(2, 1,"스페인","케파 아리사발라가","Kepa Arrizabalaga","1994년 10월 03일","GK", 186, 85);
insert into player(team_no, back_no,country,name_kr,name_en,birthday,position,height,weight) values(2, 2,"독일","안토니오 뤼디거","Antonio Rüdiger","1... |
CREATE TABLE IF NOT EXISTS
"meteoeudb"."public".foi
(
oid bigserial NOT NULL,
id CHARACTER VARYING(256) NOT NULL,
geom geometry NOT NULL,
metadata jsonb,
PRIMARY KEY (oid),
CONSTRAINT foi_id_ix1 UNIQUE (id)
)
;
CREATE TABLE IF NOT EXISTS
"meteoeudb"."publi... |
select
'pr_auth,All' as repo_group,
round(count(distinct dup_user_login) / {{n}}, 2) as authors
from
gha_pull_requests
where
created_at >= '{{from}}'
and created_at < '{{to}}'
and (lower(dup_user_login) {{exclude_bots}})
union select sub.repo_group,
round(count(distinct sub.author) / {{n}}, 2) as authors
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.