text stringlengths 6 9.38M |
|---|
SELECT
r.team_id,
team_name,
short_name,
sum(win)+sum(lose)+sum(draw) as game_count,
sum(win) as win,
sum(lose)as lose,
sum(draw)as draw,
sum(win)/(sum(win)+sum(lose)) as percentage,
sum(win)*4+sum(lose)*1+sum(draw)*2 as points,
league_id,
ba.avg,
pa.era
FROM result r
inner join TEAM t on t.te... |
CREATE TABLE `survey_type_groups` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` VARCHAR(50) NOT NULL,
`created` DATETIME NULL DEFAULT NULL,
PRIMARY KEY (`id`)
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB;
ALTER TABLE `survey_questions`
ADD COLUMN `type_group_id` INT NULL DEFAULT NULL AFTER `type`;
ALTE... |
SELECT country FROM w3schools.customers
UNION
SELECT country FROM w3schools.suppliers
ORDER BY country
LIMIT 5;
|
--*************************************************************************************************************************************
--Created By: Brian Vander Plaats
--Create Date: 10/16/2015
--Description: Update Model record
--**************************************************************************************... |
select
*
from public.zone,
jsonb_to_record(zo_jsonb) as x (
cl_id int,
zo_zone text,
zo_corporatename text,
zo_tin text,
zo_immex text,
zo_name text,
zo_firstsurname text,
zo_secondsurname text,
zo_street text,
zo_streetnumber text,
zo_suitenumber text,
zo_neighbor... |
/*
* Copyright (c) 2017 Anzen Soluciones S.A. de C.V.
* Mexico D.F.
* All rights reserved.
*
* THIS SOFTWARE IS CONFIDENTIAL INFORMATION PROPIETARY OF ANZEN SOLUCIONES.
* THIS INFORMATION SHOULD NOT BE DISCLOSED AND MAY ONLY BE USED IN ACCORDANCE THE TERMS DETERMINED BY THE COMPANY ITSELF.
*/
-- this is the act... |
CREATE OR REPLACE VIEW results AS SELECT
t.id AS toto_id,
t.start_date AS start_date,
t.pot AS pot,
t.pool_deviation AS pool_deviation,
SUM(bi.money) AS bet,
SUM(bi.income) AS income,
AVG(bi.ev) AS ev,
AVG(bi.probability) AS probability,
MAX(bi.count_match) AS max_match,
bets.is_... |
CREATE TABLE address(
id INT PRIMARY KEY AUTO_INCREMENT NOT NULL,
user_id INT,
province VARCHAR(255),
city VARCHAR(255),
address VARCHAR(255),
FOREIGN KEY (user_id)
REFERENCES user(id)
)
|
create or replace trigger groupReqMsg
after insert on pendingGroupmembers
for each row
DECLARE
nmsgID varchar(20);
begin
IF :new.message IS NOT NULL
THEN
SELECT to_char(count(msgID) + 1) INTO nmsgID
FROM messages;
insert into messages (msgID, fromID, message, toGroupID, dateSent)
values (n... |
CREATE TABLE tbl_konto (
Kontonummer INTEGER UNIQUE
NOT NULL ON CONFLICT ROLLBACK,
Inhaber TEXT,
Bank TEXT NOT NULL,
Waehrung TEXT DEFAULT EUR
CHECK (Waehrung IN ('EUR', 'USD', 'GBP') ),
Typ TEXT CHECK (Typ IN ('Giro', 'S... |
SELECT c.custfirstname, c.custlastname, c.custemail,
o.orderid, o.orderdate, o.orderamount, o.orderstatus,
cpr.referencenumber, cpr.isActive,
tr.*
FROM store.dbo.sftransactionResponse tr WITH (NOLOCK)
join store.dbo.sforders o WITH (NOLOCK)
ON tr.trnsrsporderid = o.orderid
join store.dbo.sfcustomers c W... |
CREATE TABLE IF NOT EXISTS administrador
( id_administrador INT NOT NULL AUTO_INCREMENT , nombre VARCHAR(255) NOT NULL ,
psw_admin VARCHAR(255) NULL, email_admin VARCHAR(255) NOT NULL, telefono_admin DOUBLE NOT NULL,PRIMARY KEY (id_administrador))
ENGINE = InnoDB;
CREATE TABLE IF NOT EXISTS clientes
( id_... |
/*
Navicat MySQL Data Transfer
Source Server : JF
Source Server Version : 50133
Source Host : localhost:3306
Source Database : softwarecontact
Target Server Type : MYSQL
Target Server Version : 50133
File Encoding : 65001
Date: 2014-10-23 22:43:15
*/
SET FOREIGN_KEY... |
-- trdbhetd -> dev account
-- trdbhett -> test account
-- trdbhetp -> prod account
create user trdbhetd;
alter user trdbhetd with encrypted password '<pwd>';
grant het_application_proxy to trdbhetd;
|
INSERT_INTO icsbook.airports
(AirportId,
ident,
airportType,
airportName,
comm,
latitude,
longitude,
elevation,
continent,
country,
region,
muncipality,
scheduleFlights,
gpsCode,
IATACode,
localcode,
homeLink,
wikipediaLink,
keywords ) VALUES
(1,
1,
'',
'',
'',
1.1,
1.1... |
/*
* Example query 2: Exact-AND
* Inverted Index Toolkit <http://code.google.com/p/inverted-index/>
* Apache License 2.0, blah blah blah.
*
* This query will search for complete words in any order.
*/
SELECT a.*
FROM article a
INNER JOIN search_index i1 ON i1.id = a.article_id
INNER JOIN search_index ... |
/* Formatted on 21/07/2014 18:33:53 (QP5 v5.227.12220.39754) */
CREATE OR REPLACE FORCE VIEW MCRE_OWN.V_MCRE0_APP_GEST_GRAF
(
COD_SNDG,
COD_ABI_CARTOLARIZZATO,
COD_ABI_ISTITUTO,
DESC_ISTITUTO,
COD_NDG,
COD_COMPARTO,
COD_RAMO_CALCOLATO,
DESC_NOME_CONTROPARTE,
COD_GRUPPO_ECONOMICO,
VAL_ANA_G... |
REM indexrep.sql
undefine indexrep
clear screen
set autotrace off lines 200 trimspool on verify off long 1000 head on pages 999 echo off
break on table_name on index_name skip 1
column owner format a12
column table_owner format a10 heading 'Table|Owner'
column index_owner format a10 heading 'Index|Owner'
column table_... |
# --- !Ups
ALTER TABLE Caisse ADD linkLabel varchar(255);
ALTER TABLE Caisse ADD linkUrl varchar(255);
# --- !Downs
ALTER TABLE Caisse DROP linkUrl;
ALTER TABLE Caisse DROP linkLabel;
|
Aggregate Functions
Write an SQL query that returns a result table with the name of each device in
our database together with the number of parts for that device.
SELECT devices.name AS "device name",
count(parts.id) AS "number of parts"
FROM devices INNER JOIN parts
ON devices.id = parts.device_id
GRO... |
SELECT
prod_codigo,
prod_detalle,
MAX(item_precio) AS precio_maximo,
MIN(item_precio) AS precio_minimo,
(MAX(item_precio) - MIN(item_precio)) / MAX(item_precio) * 100 AS diferencia_porcentual
FROM
Producto
JOIN Item_Factura ON prod_codigo = item_producto
JOIN STOCK ON prod_codigo = stoc_... |
-- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Apr 23, 2019 at 07:53 AM
-- Server version: 10.1.36-MariaDB
-- PHP Version: 7.3.3
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD... |
create table department
(
id serial ,
dept_no varchar,
dept_name varchar,
primary key (dept_no)
);
select * from department;
create table Department_Employee
(
id serial primary key,
emp_no int,
dept_no varchar,
FOREIGN KEY (dept_no) references department(dept_no)
);
select * from department_employee;
crea... |
CREATE DATABASE photos_posts WITH
ENCODING='UTF8'
TEMPLATE = template0;
CREATE USER drovito WITH password 'drovito';
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO "drovito";
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO "drovito";
create table "lincks"(
posts_id bigint UNIQUE,
li... |
2
INSERT INTO ingredientCouples (parentId, ingredientId) VALUES (1, 2);
INSERT INTO ingredientCouples (parentId, ingredientId) VALUES (1, 3);
INSERT INTO ingredientCouples (parentId, ingredientId) VALUES (1, 4);
INSERT INTO ingredientCouples (parentId, ingredientId) VALUES (1, 5);
INSERT INTO ingredientCouples (parentI... |
SELECT FirstName, LastName, Salary
FROM Employees
WHERE Salary <= (
SELECT MIN(Salary)*1.1 FROM Employees)
ORDER BY Salary DESC |
select a.value, s.username, s.sid, s.serial#
from v$sesstat a, v$statname b, v$session s
where a.statistic# = b.statistic# and s.sid=a.sid
and b.name = 'opened cursors current'
select sum(a.value) total_cur, avg(a.value) avg_cur, max(a.value) max_cur,
s.username, s.machine
from v$sesstat a, v$statname b, v$session s... |
CREATE TABLE Usuario (
id_trabajador TEXT primary key not null,
nombre TEXT not null,
puesto TEXT,
usuario TEXT not null UNIQUE,
password TEXT not null,
hrEntrada TEXT not null,
hrSalida TEXT not null,
hrComida TEXT not null,
CONSTRAINT AK_0 UNIQUE (usuario)
);
CREATE TABLE Cita ... |
-- 1. Overview (обзор ключевых метрик):
-- Total Sales - доход
-- Total Profit - прибыль
-- Profit Ratio - коэффициент прибыли %
-- Avg. Discount - средний размер скидки %
SELECT ROUND(SUM(sales)) total_sales,
ROUND(SUM(profit)) total_profit,
ROUND(SUM(profit) / SU... |
DROP TABLE tcr_credits_detail;
DROP TABLE tcr_credits;
DROP TABLE tcr_payments;
DROP TABLE tcr_customers;
DROP TABLE tcr_payment_period;
DROP TABLE tcr_products;
DROP TABLE tcr_brands;
DROP TABLE tcr_products_type;
DROP TABLE tcr_owners;
DROP TABLE tcr_persons;
DROP TABLE tcr_users;
CREATE TABLE tcr_users (
CDUSER... |
ALTER TABLE users ALTER COLUMN email VARCHAR(512);
|
def fl_detect ([last_time, size], [tin]):
delta = 5;
if (tin - last_time > delta) { emit(); size = 1; }
else { size = size + 1; }
last_time = tin
def flsum ([sum], []):
sum = sum + 1
R1 = groupby(T, [srcip, dstip, srcport, dstport, proto, switch], fl_detect);
R2 = map(R1, [size_index], [size/128])... |
CREATE PROC ERP.Usp_Upd_GuiaRemision_Reversar
@IdGuiaRemision INT
AS
BEGIN
EXEC [ERP].[Usp_Upd_GuiaRemision_Anular] @IdGuiaRemision
UPDATE ERP.GuiaRemision SET IdGuiaRemisionEstado = 1 WHERE ID = @IdGuiaRemision
END
|
Follow below steps to import big data in mysql:
1. Create the table with matching data types of csv file, usually with INT and TEXT datatypes only.
2. Open terminal or command prompt and login to mysql with below command.
$ mysql -u root -p
Note that root is my username for mysql, change it with your actual usernam... |
--Disparador que valida la CS#4: El número de préstamos concedidos no debe ser mayor al número de préstamos permitidos de acuerdo al tipo de lector.
--y la CS#5: La fecha de vencimiento depende del tipo de lector y de la fecha de préstamo.
CREATE OR REPLACE TRIGGER tgInsertaPrestamo
BEFORE INSERT ON prestamo
FOR EACH ... |
SELECT t.created, t.userMarketId, t.adspaceId, t.adId, t.clientVersionId
, t.delivery, t.deliveredImp, t.measurableImp, t.viewableImp, t.monetisedImp, t.click, t.firstInteraction
, t.inscreen_pct_00_vt_00, t.inscreen_pct_30_vt_300, t.inscreen_pct_30_vt_3000, t.inscreen_pct_50_vt_1000
FROM (
SELECT '2015-12-20 10:00... |
/*
Navicat MySQL Data Transfer
Source Server : vm
Source Server Version : 50723
Source Host : 192.168.145.131:3306
Source Database : vue
Target Server Type : MYSQL
Target Server Version : 50723
File Encoding : 65001
Date: 2019-03-22 14:29:02
*/
SET FOREIGN_KEY_CHECKS=0;
-- ------... |
create or replace procedure portfolio1
(v_xh varchar2,
v_lj VARCHAR2,
v_flag VARCHAR2)
AS
v_lj1 VARCHAR2(512) :='磁盘无法找到该文件';
v_lj2 VARCHAR2(512);
v_lj3 VARCHAR2(512);
BEGIN
v_lj3 := REPLACE(v_lj,'\','//');
SELECT lj INTO v_lj2 FROM portfolio WHERE xh=v_xh;
IF (v_flag ='y' AND v_lj2 <> v_lj3) THEN
... |
CREATE FUNCTION [macro].[ErroresSalidas]
(
@cargaId VARCHAR(50)
)
RETURNS TABLE
AS
RETURN
(
WITH
cte_00 AS
(
SELECT
a.*
,CASE WHEN b.id_cliente IS NULL THEN 1 ELSE 0 END AS error_cliente_no_existe
,CASE WHEN c.id_or... |
-- scripts sql ---
-- tabla TAZA---
CREATE TABLE TAZA (
PK_TAZA INTEGER NOT NULL,
TIPO VARCHAR(25) NOT NULL,
COLOR VARCHAR(100) NOT NULL,
DIMENSIONES VARCHAR(25) NOT NULL,
CAPACIDAD VARCHAR(25) NOT NULL,
MODELO VARCHAR(25) NOT NULL,
MATERIAL VARCHAR(25) NOT NULL,
PRECIO DOUBLE NOT NULL,
STOCK INTEGER NOT NULL... |
/* contenuti originarii ---------------
CREATE TABLE classics (
author VARCHAR(128),
title VARCHAR(128),
type VARCHAR(16),
year CHAR(4),
id INT UNSIGNED NOT NULL AUTO_INCREMENT KEY) ENGINE MyISAM;
fine contenuti originarii -------------*/
<?php // sqltest.php
$query = <<<_END
CREATE TABLE classics IF NOT ... |
insert into patient(id,name,age,gender,address) values(1,'Ravi',21,'Male','928/8,pkl');
insert into patient(id,name,age,gender,address) values(2,'Rajesh',56,'Male','64/9,hemingway');
insert into patient(id,name,age,gender,address) values(3,'Hari',74,'Male','925/8,arthur junction');
insert into doctor(id,name,speciali... |
-- MySQL dump 10.13 Distrib 5.7.17, for macos10.12 (x86_64)
--
-- Host: localhost Database: Trainly
-- ------------------------------------------------------
-- Server version 5.7.20
DROP DATABASE IF EXISTS `Trainly`;
CREATE DATABASE `Trainly`;
USE `Trainly`;
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SE... |
ALTER TABLE Sam3_Cedula
ADD UNIQUE (Espesor) |
SELECT OWNER AS SCHEMA_NAME, name AS OBJECT_NAME, type AS OBJECT_TYPE, MAX(line) AS LINE_COUNT,
COUNT(DECODE (REPLACE(text, chr(10), ''), NULL, NULL, '1')) AS NO_EMPLY_LINE_COUNT, SUM(LENGTH(TEXT)) AS CHAR_COUNT
FROM dba_source
WHERE OWNER NOT IN ('SYS', 'SYSTEM', 'ANONYMOUS', 'CTXSYS', 'DBSNMP', 'LBACSYS', 'MDS... |
-- MySQL dump 10.13 Distrib 5.1.49, for pc-linux-gnu (i686)
--
-- Host: localhost Database:
-- ------------------------------------------------------
-- Server version 5.1.47
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40... |
use posapp;
create table promotions(
id int(10) not null auto_increment,
code varchar(20) not null,
status varchar(30) not null,
discount double(10, 1) not null,
primary key(id)
) engine = InnoDB;
drop table promotions;
desc promotions;
select * from promotions;
|
-- phpMyAdmin SQL Dump
-- version 4.8.0.1
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 15-06-2018 a las 19:10:24
-- Versión del servidor: 10.1.32-MariaDB
-- Versión de PHP: 7.2.5
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00"... |
INSERT INTO DEPARTMENTS VALUES (1, 'Facilities', 'Lawler');
INSERT INTO DEPARTMENTS VALUES (2, 'Information Systems', 'Lindecamp');
INSERT INTO DEPARTMENTS VALUES (3, 'Accounting', 'Slaby');
INSERT INTO DEPARTMENTS VALUES (4, 'Accounts Control', 'Green');
INSERT INTO DEPARTMENTS VALUES (5, 'Member Service', 'Halstead')... |
/*
Programming for Data Science with Python Nanodegree
Udacity's certified program > SQL practice > Lesson 2 : SQL Joins
What are the different channels used by account id 1001? Your final table
should have only 2 columns: account name and the different channels. You can
try SELECT DISTINCT to narrow down the results ... |
CREATE VIEW v_trades AS SELECT a.trade_date,
a.market_order_id,
a.base_account_no,
a.side,
a.trade_qty,
a.price,
CASE
WHEN ((a.symbol_sfx)::text = '0NG'::text) THEN ((a.trade_qty)::numeric * a.price)
ELSE (((a.trade_qty * 100))::numeric * a.price)
END AS trade... |
spool scriptProducto.log
grant all privileges to tor identified by root;
conn tor/root
--prompt Dropeamos y creamos el Tablespace
--spool, prompt (Son comandos Auxiliares del SQLPLUS)
-- start, o @nombre.sql // Ejecutamos Script
--drop tablespace TB_DATOS including contents and datafiles;
--CREATE TABLESPACE TB_DATOS
... |
select
scode as 班级编码,
sname as 班级名称,
ncurrentcount as 当前人数,
scourseconsultant as 课程顾问,
sclasssubject as 科目,
squarter as 季度,
bcontinuedclass as 是否续班,
sareacode as 教学区,
dtbegindate as 开课日期,
dtenddate as 结课日期,
sprinttime as 上课时间,
nlesson as 课次,
nnormalcount as 正常人数,
nmaxcount as 最大人数,
dfee as 学费,
smanagementcode as 管理部门
f... |
CREATE TABLE `availabilityStatuses` (
`av_StatusID` INTEGER PRIMARY KEY,
`statusName` varchar(100),
`status_dx` varchar(200)
);
CREATE TABLE `classes` (
`classID` INTEGER PRIMARY KEY,
`class_name` varchar(100),
`class_dx` varchar(200),
`numberOfLevels` INT
);
CREATE TABLE `guests` (
`guestID` INTEGER ... |
use switch_snmp_lldp_t1;
select * from
ports inner join
LLDP_table using(id_ports) inner join
requests using(id_requests)
WHERE id_switches = '1'
and id_requests = (select max(id_requests) from (
select * from
ports inner join
LLDP_table using(id_ports) inner join... |
--创建数据库
create database ext_source;
--切换数据库
use ext_source;
--创建表
DROP TABLE IF EXISTS `ExDataSource`;
CREATE TABLE `ExDataSource` (
`ID` varchar(255) NOT NULL,
`URL` varchar(64) DEFAULT NULL,
`DATASOURCE_TYPE` varchar(10) DEFAULT NULL,
`TARGET_TABLE` varchar(50) DEFAULT NULL,
`USERNAME` varchar(32) DEFAULT... |
PARAMETERS [@ClienteID] Text (255);
SELECT A.ClienteID,
A.TipoDocumentoID,
B.TipoDocumento,
A.NumeroDocumento,
A.RazonSocial,
A.NombreComercial,
A.Direccion,
A.PaginaWeb,
A.APaterno,
A.AMaterno,
A.Nombres,
A.TipoPersonaID,
C.TipoPerso... |
DBCC CHECKIDENT ('route', RESEED, 0); |
-- phpMyAdmin SQL Dump
-- version 4.9.5deb2
-- https://www.phpmyadmin.net/
--
-- Хост: localhost:3306
-- Время создания: Дек 02 2020 г., 06:39
-- Версия сервера: 8.0.21-0ubuntu0.20.04.4
-- Версия PHP: 7.4.11
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!4... |
select *
from course
where course.id = ? |
CREATE TABLE Film (
ID int(10) NOT NULL,
Language VARCHAR(20) NOT NULL,
Title varchar(255) NOT NULL,
Description varchar(255),
Release_Year int(4),
DirectorID int(10) NOT NULL,
PRIMARY KEY (ID));
CREATE TABLE Film_Actors (
FilmID int(10) NOT NULL,
ActorID int(10) NOT NULL,
... |
BEGIN
-- Job defined entirely by the CREATE JOB procedure.
DBMS_SCHEDULER.create_job (
job_name => 'refreshMV_victor_job',
job_type => 'PLSQL_BLOCK',
job_action => 'BEGIN MVREFRESH; END;',
start_date => to_date('2012-08-28 11:25:00','yyyy-mm-dd hh24:mi:ss'),
repeat_interval => '... |
/*
used so that events are only processed once
this is a duplicate of what is in the person-impl ddl,
all services are using the same table (for simplicity's sake)
*/
CREATE TABLE IF NOT EXISTS read_side_offsets(
read_side_id VARCHAR(255),
tag VARCHAR(255),
sequence_offset int8,
time_uuid_offset char(36... |
-- BankAccountCheckNoMatch
INSERT INTO
public."BusEvent"
(
"BusEventID",
"BusEventName",
"BusEventDescription",
"BusEventTypeID"
)
VALUES (
'AAF415E2-325A-4BCB-8E62-A641788F42AA',
'BankAccountMarkedAsPotentialFraud',
'',
'707d82de-3ddd-11e4-95c4-a77fdf4021b5'
);
INSERT INTO
public."BusEventMessageSu... |
CREATE SCHEMA callws;
|
-- $Id: install.mysql.utf8.sql 2011-02-16 Rikard Erlandsson
-- ALTER TABLE `#__iller` ADD `catid` int(11) NOT NULL DEFAULT '0';
|
SELECT A.CuentaID,
A.MonedaID,
A.PagoMedioID,
B.NumeroDocumento,
A.FechaOperacionID,
A.FechaProcesoID,
A.NumeroOperacion,
A.Monto,
C.LoteID,
D.TipoComprobanteID,
D.Serie,
D.Numero,
C.Monto,
D.FichaPesoSerie,
D.FichaPesoNum... |
CREATE PROC [ERP].[Usp_Upd_Proyecto]
@IdProyecto INT,
@Nombre VARCHAR(50) ,
@Numero VARCHAR(50) ,
@FechaInicio DateTime ,
@FlagBorrador BIT,
@IdCliente INT,
@PresupuestoVenta DECIMAL(14, 5),
@PresupuestoCompra DECIMAL(14, 5),
@IdMoneda INT,
@UsuarioModifico VARCHAR(250),
@IdTipoProyecto int ,
@IdProyectoPrincipal in... |
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 31-08-2016 a las 13:13:04
-- Versión del servidor: 10.1.13-MariaDB
-- Versión de PHP: 5.6.23
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT... |
CREATE TABLE transaction_type(
cd_transaction_type BIGINT(9) primary key auto_increment,
ds_transactional_type varchar(20) not null
)engine=InnoDB default charset=utf8;
CREATE TABLE reg_telefonico (
cd_reg_telefonico BIGINT(9) primary key auto_increment,
nr_telefone_origem BIGINT(13) not null,
nr_telefone_destino... |
-- phpMyAdmin SQL Dump
-- version 4.6.4
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Nov 18, 2017 at 05:11 PM
-- Server version: 5.7.15-log
-- PHP Version: 5.6.26
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIEN... |
/*
Copyright 2021 Snowplow Analytics Ltd. All rights reserved.
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 a... |
/*------------------------------------------------------------
* Script SQLSERVER
------------------------------------------------------------*/
/*------------------------------------------------------------
-- Table: T_S_UTILISATEUR_UTI
------------------------------------------------------------*/
CREATE TA... |
SELECT P.*
FROM
CONTRACT_PRINCIPAL_COMPOSITION_INFO P
INNER JOIN CONTRACT_INFO C
ON C.CONTRACT_NO = P.CONTRACT_NO
AND C.CONTRACT_NO = /*contractNo*/''
LEFT JOIN
(
SELECT SUPPLIES_NO
FROM APPLY_SUPPLIES_INFO
WHERE APPLY_NO =
(SELECT MAX(APPLY_NO) APPLY_NO FROM APPLY_INFO
WHERE
CONTRACT_NO = /... |
create table STUDENT(
STUDENT_ID BIGINT PRIMARY KEY AUTO_INCREMENT,
FIRST_NAME VARCHAR(128),
MIDDLE_INITIAL VARCHAR (2),
LAST_NAME VARCHAR(128),
COURSE VARCHAR (64)
); |
-- RETORNA O DIA, MĘS E ANO
SELECT DATENAME(DAY,GETDATE()), DATENAME(MONTH,GETDATE()), DATENAME(YEAR,GETDATE())
SELECT DATEPART(DAY,GETDATE()), DATEPART(MONTH,GETDATE()), DATEPART(YEAR,GETDATE())
SELECT DAY(GETDATE()), MONTH(GETDATE()), YEAR(GETDATE())
SELECT DATETIMEFROMPARTS(2017,11,30,3,45,59,1) HORA
|
/* Formatted on 21/07/2014 18:46:09 (QP5 v5.227.12220.39754) */
CREATE OR REPLACE FORCE VIEW MCRE_OWN.VOMCRE0_APP_ELENCO_POS
(
COD_COMPARTO,
DESC_COMPARTO,
DESC_ISTITUTO,
COD_STRUTTURA_COMPETENTE_DC,
DESC_STRUTTURA_COMPETENTE_DC,
COD_STRUTTURA_COMPETENTE_RG,
DESC_STRUTTURA_COMPETENTE_RG,
COD_STR... |
insert into category values(1,NULL,'2018-09-05 10:25:21',NULL,'2018-09-05 10:35:21','CMB/LAP','Laptops',NULL);
insert into category values(2,NULL,'2018-06-06 11:24:37',NULL,'2018-06-06 11:24:37','CMB/OEQ','Office Equipments',NULL);
insert into category values(3,NULL,'2018-06-06 11:24:37',NULL,'2018-06-06 11:24:37','C... |
-- phpMyAdmin SQL Dump
-- version 4.7.7
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Mar 18, 2019 at 09:41 AM
-- 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 = "+00:00";
/*!40101 SET @OLD... |
select emp_id,sum(hours_worked) from date_log group by emp_id; |
use sakila;
-- 1a.
select first_name, last_name from actor;
-- 1b
ALTER TABLE actor
ADD COLUMN `Actor Name` VARCHAR(50);
UPDATE actor set `Actor Name` = CONCAT(first_name,' ', last_name);
CREATE TRIGGER insert_trigger
BEFORE INSERT ON actor
FOR EACH ROW
SET new.`Actor Name` = CONCAT(new.first_name, ' ', new.last_... |
-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Waktu pembuatan: 23 Jan 2021 pada 03.01
-- Versi server: 10.4.14-MariaDB
-- Versi PHP: 7.2.33
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@C... |
-
-- PostgreSQL database dump
--
-- Dumped from database version 9.5.6
-- Dumped by pg_dump version 9.5.6
ALTER TABLE IF EXISTS ONLY public.swuser DROP CONSTRAINT IF EXISTS pk_swuser_id CASCADE;
ALTER TABLE IF EXISTS ONLY public.planet_votes DROP CONSTRAINT IF EXISTS pk_planet_votes_id CASCADE;
ALTER TABLE IF EXISTS ... |
use vn_collection;
-- ---------------------------------------------------------------------
-- basic usages:
-- ---------------------------------------------------------------------
-- find a visual novel's releases by name
drop procedure if exists find_release_by_vn_name;
delimiter //
create procedure find_release... |
insert into role (role_name, is_active )
values('ADMIN', true);
insert into role (role_name, is_active )
values('USER', true);
insert into role (role_name, is_active )
values('MANAGER', true);
insert into account(user_name, login, password, creation_date, is_active, account_external_id)
values('Chief... |
-- User display name
ALTER TABLE USERS ADD COLUMN DISPLAYNAME VARCHAR(80) NULL;
UPDATE USERS SET DISPLAYNAME = NAME;
ALTER TABLE USERS ALTER COLUMN DISPLAYNAME SET NOT NULL;
-- @rollback
ALTER TABLE USERS DROP COLUMN IF EXISTS DISPLAYNAME;
-- @mysql
ALTER TABLE USERS ADD COLUMN DISPLAYNAME VARCHAR(80) NULL;
... |
SELECT
COUNT(*)
FROM
APPLY_INFO --申請情報
WHERE
--契約番号 = P.契約番号
CONTRACT_NO = /*contractNo*/
--申請状況 <> 10:決裁済
AND APPLY_STATE <> /*applyStateSanctioned*/10
--申請状況 <> 11:否決済
AND APPLY_STATE <> /*applyStateRejected*/11
--取消状況 = 1:取消未済
AND CANCAL_STATE = /*cancalStateN... |
-- https://modeanalytics.com/editor/code_for_san_francisco/reports/4eb2493a61af
-- Query 3
-- The goal is to identify empty or null values in each attribute, since it will help us
-- select key features to execute machine learning algorithms.
-- Total rows 1502264.
select
count(*),
--donor_city -- ... |
-- 1.0
set @this_year = '2018';
set @this_month = '01';
set @this_year_begin_time = CONCAT(@this_year,'-01-01 00:00:00');
set @this_month_begin_time = CONCAT(@this_year,'-',@this_month,'-01 00:00:00');
set @this_month_end_time = DATE_ADD(DATE_ADD(@this_month_begin_time, INTERVAL 1 MONTH), INTERVAL -1 SECOND);
set @last... |
-- Lists all genres of the show Dexter.
-- The tv_shows table contains only one record where title = Dexter (but the id can be different)
SELECT tv_genres.name AS name
FROM tv_show_genres INNER JOIN tv_genres
ON tv_show_genres.genre_id = tv_genres.id
INNER JOIN tv_shows ON tv_shows.id = tv_show_genres.show... |
SELECT DISTINCT format(FechaEmision,"YYYYMM") as Periodo
FROM com_1_compras |
/**
*
* @author Hanln
* @version $Id: ShisetsuTopService_getAvailableServiceKbnList_Sel_01.sql 20116 2014-08-11 08:11:30Z p_re_han $
*/
SELECT
SAS.AVAILABLE_SERVICE_KBN
FROM
FR_SHISETSU_AVAILABLE_SERVICE SAS
WHERE
SAS.SHISETSU_CD = /*shisetsuCd*/'000001092' |
SELECT
c1.concept_name AS category,
ard1.min_value AS minValue,
ard1.p10_value AS p10Value,
ard1.p25_value AS p25Value,
ard1.median_value AS medianValue,
ard1.p75_value AS p75Value,
ard1.p90_value AS p90Value,
ard1.max_value AS maxValue
FROM @results_database_schema.achilles_results_... |
DROP TABLE IF EXISTS report_manager_schema.parameter_list_history;
CREATE TABLE report_manager_schema.parameter_list_history (
parameter_id uuid NOT NULL,
parameter_name text NOT NULL,
parameter_type text NOT NULL,
parameter_load_method text NOT NULL,
parameter_description text NOT NULL,
datetime_paramet... |
create table team
(
team_id int auto_increment
primary key,
zone_id int not null,
leader_id int not null,
total_cnt int not null,
constraint team_ibfk_1
foreign key (zone_id) references zone (zone_id),
constraint team_ibfk_2
foreign key (leader_id) references employee... |
(select maker,p.model,type from product as p left join pc as c on p.model=c.model where type='pc' and code is null)
union
(select maker,p.model,type from product as p left join laptop as c on p.model=c.model where type='laptop' and code is null)
union
(select maker,p.model,p.type from product as p left join prin... |
/**
* SQL for get shisetsu image list to Create symbolic link
* @author TuyenVHA
* @version $Id: ShisetsuDashboardService_getShisetsuImageList_Sel_01.sql 16764 2014-07-25 06:49:01Z p__toen $
*/
SELECT
BSK.KAISHA_CD
,BSI.SHISETSU_CD
,BSI.IMAGE_TYPE
,BSI.IMAGE_NO
,BSI.IMAGE_FILE_NAME
,BSI.IMAGE_TI... |
# 1.查询同时存在1课程和2课程的情况
# 查询同时存在课程1和课程2的学生名
select s.name from `student_course` c left join `student` s on c.studentId=s.id where c.courseId=1 or c.courseId=2 group by s.name having count(s.name) = 2;
# 2.查询同时存在1课程和2课程的情况
# 查询同时存在课程1和课程2的教师名
select t.name from `course` c left join `teacher` t on c.teacherId=t.id where c.i... |
-- atabase dump from hbtn_0d_tvshows to your MySQL server: download
SELECT
tv_shows.title,
tv_genres.name
FROM
tv_genres
RIGHT JOIN tv_show_genres ON tv_genres.id = tv_show_genres.genre_id
RIGHT JOIN tv_shows ON tv_shows.id = tv_show_genres.show_id
ORDER BY
tv_shows.title,
tv_genres.name ASC... |
-- MySQL dump 10.13 Distrib 5.7.17, for Win64 (x86_64)
--
-- Host: localhost Database: phone_station
-- ------------------------------------------------------
-- Server version 5.7.19-log
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESUL... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.