text stringlengths 6 9.38M |
|---|
-- Account
CREATE TABLE account (
acc_id varchar(255) NOT NULL PRIMARY KEY,
acc_password varchar(255),
acc_first_name varchar(255),
acc_last_name varchar(255),
acc_email varchar(255)
);
CREATE INDEX account_acc_id ON account(acc_id);
-- Products
CREATE TABLE products (
id INTEGER NOT NULL PRIMARY KEY,
de... |
/*
** Question: https://leetcode.com/problems/reformat-department-table/
*/
-- method 1, Oracle
SELECT
d.id,
SUM(CASE WHEN d.month = 'Jan' THEN d.revenue ELSE NULL END) AS Jan_Revenue,
SUM(CASE WHEN d.month = 'Feb' THEN d.revenue ELSE NULL END) AS Feb_Revenue,
SUM(CASE WHEN d.month = 'Mar' THEN d.reven... |
-- Aggregate functions
select count(first_name) from books;
select count(title) from books;
select count(*) from books;
select count(distinct last_name) from books;
select count(distinct first_name, last_name) from books;
select count(*) from books where title like '%the%';
select * from books group by title;
s... |
INSERT INTO LOC_LAU_T (LAU_ID, COUNTRY_CODE, NUTS3, LAU1, LAU2, _CHANGE, NAME1, NAME2, AREA, POP)
VALUES (1, 'ES', 'ES511', 'no', '08019', 'no', 'Barcelona', 'Barcelona', 98211086, 0);
INSERT INTO LOC_LAU_T (LAU_ID, COUNTRY_CODE, NUTS3, LAU1, LAU2, _CHANGE, NAME1, NAME2, AREA, POP)
VALUES (2, 'ES', 'ES511', 'no', '0820... |
PRO
PRO CPU LATENCY between &&cs_begin_date_from. and &&cs_end_date_to. (on average)
PRO ~~~~~~~~~~~
SET TERM OFF;
DEF cs_order_by = 's.cpu_ms_pe DESC NULLS LAST';
GET cs_internal/&&cs_script_name._internal.sql NOLIST
.
666666 SELECT s.sql_id,
666666 s.plan_hash_value,
666666 s.has_baseline... |
/* UPGRADE FROM 2.5 */
/* pt_issues */
ALTER TABLE `pt_issues` ADD `googlecalID` varchar(500) default NULL;
/* pt_milestones */
ALTER TABLE `pt_milestones` ADD `googlecalID` varchar(500) default NULL;
/* pt_projects */
ALTER TABLE `pt_projects` ADD `googlecal` varchar(200) default NULL;
/* pt_settings */... |
-- phpMyAdmin SQL Dump
-- version 4.9.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Waktu pembuatan: 26 Jan 2021 pada 10.26
-- Versi server: 10.4.8-MariaDB
-- Versi 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_CHARA... |
ALTER TABLE `employees`
ADD `middle_name` VARCHAR(50) NOT NULL DEFAULT '';
ALTER TABLE `products`
ADD CONSTRAINT fk_category_id
FOREIGN KEY (`category_id`)
REFERENCES `categories` (`id`)
ON DELETE NO ACTION
ON UPDATE CASCADE;
ALTER TABLE `employees`
MODIFY `middle_name` VARCHAR(100) NOT NULL... |
-- phpMyAdmin SQL Dump
-- version 4.7.0
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: May 18, 2019 at 02:03 PM
-- Server version: 10.1.26-MariaDB
-- PHP Version: 7.1.8
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD... |
CREATE PROCEDURE Sp_Get_SalesPortalIPList As
Select 'ipaddress' = IPAddress From SalesPortalIPList
Select 'salesportalip' = SalesPortalIP From Setup
|
CREATE TABLE `contact_details` (
`Firstname` varchar(100) NOT NULL,
`Lastname` varchar(100) DEFAULT NULL,
`Email` varchar(120) DEFAULT NULL,
`Phone` int(100) NOT NULL,
`Subject` varchar(700) NOT NULL
); |
DROP DATABASE IF EXISTS database_development;
CREATE DATABASE database_development;
USE database_development;
CREATE TABLE `pets` (
`pets_id` int NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`pet_type` varchar(255),
`breed` varchar(255),
`status` varchar(255),
`age` varchar(255),
... |
ALTER TABLE carros ADD COLUMN vendido BOOLEAN NOT NULL DEFAULT 0;
|
--PROBLEM 17
--Select all planes with their name, seats count and passengers count.
--Order the results by passengers count (descending), plane name (ascending) and seats (ascending)
SELECT
p.Name, p.Seats, COUNT(t.Id) AS PassengersCount
FROM Planes AS p
LEFT JOIN Flights AS f ON f.PlaneId=p.Id
LEFT JOIN Tickets... |
-- supression des objets prédifinie
INSERT INTO `playercreateinfo_item` VALUES ('0', '3', '12282', '-1');
INSERT INTO `playercreateinfo_item` VALUES ('0', '0', '51809', '-1');
-- Dwarf Hunter
INSERT INTO `playercreateinfo_item` VALUES ('3', '3', '148', '-1');
INSERT INTO `playercreateinfo_item` VALUES ('3', '3', '147'... |
delete from order_dishes;
delete from orders_status_history;
delete from orders; |
SHOW TABLES;
/*** Games Table ***/
DESC Games;
INSERT INTO Games (name, description, price, console_name) values (
'Test Game',
'This game is being used to test the database.',
'79.99',
'Microsoft Surface'
);
INSERT INTO Games (name, description, price, console_name) values (
'Another Test Game',
... |
# patch_49_50_e.sql
#
# title: Create tables for new mapping_seq_region tables
#
# Description: Creates two new tables, seq_region_mapping and mapping_seq that will allow to upload user data and be able to map it
# even there is a change of seq_region in a previous release
############################################... |
-- MySQL dump 10.13 Distrib 8.0.16, for Win64 (x86_64)
-- ------------------------------------------------------
-- Server version 8.0.13
/*!40101 SET @OLD_CHARACTER_SET_CLIENT = @@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS = @@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION = @... |
-- phpMyAdmin SQL Dump
-- version 3.5.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jun 03, 2014 at 06:35 AM
-- Server version: 5.5.24-log
-- PHP Version: 5.3.13
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */... |
-- phpMyAdmin SQL Dump
-- version 4.7.1
-- https://www.phpmyadmin.net/
--
-- Host: mysql:3306
-- Generation Time: Jan 23, 2018 at 06:08 PM
-- Server version: 5.7.18
-- PHP Version: 7.0.16
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARAC... |
# noinspection SqlResolveForFile
--
-- Various queries to report on progress and status
--
-- Total time taken by category
SELECT
schema_name,
category,
count(*) AS table_count,
sum(seconds_taken) AS total_seconds,
sec_to_time(sum(seconds_taken)) AS total_time
FROM LOG_TA... |
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
-- Database: `crud`
--
-- --------------------------------------------------------
--
-- Table structure for table `student`
--
CREATE TABLE `student` (
`sid` int(10) NOT NULL,
`sname` varchar(30) NOT NULL,
`saddress` var... |
delete from customer_industry;
insert into customer_industry(id,name,superior_id,level,descript,disp_order) values(1,'券商',null,1,null,1);
insert into customer_industry(id,name,superior_id,level,descript,disp_order) values(2,'银行',null,1,null,2);
insert into customer_industry(id,name,superior_id,level,descript,disp_or... |
WITH RECURSIVE search_recursive_messages (counter, parent_counter, updated, profile_id, depth, path, cycle) AS (
SELECT f.counter, f.parent_counter, f.updated, f.profile_id, 1,
ARRAY[f.counter],
false
FROM message_messages f
UNION ALL
SELECT f.counter, f.parent_counter,... |
/*
Navicat MySQL Data Transfer
Source Server : mysql
Source Server Version : 50514
Source Host : localhost:3306
Source Database : odontologia
Target Server Type : MYSQL
Target Server Version : 50514
File Encoding : 65001
Date: 2011-08-18 21:32:14
*/
SET FOREIGN_KEY_CHECKS=0;
-- --... |
ALTER TABLE payment DROP CONSTRAINT fk_payment_users;
ALTER TABLE payment ADD CONSTRAINT fk_payment_users FOREIGN KEY(user_id) REFERENCES users(id) |
with commits_data as (
select r.repo_group as repo_group,
c.sha,
c.dup_actor_id as actor_id,
c.dup_actor_login as actor_login
from
gha_repos r,
gha_commits c
where
c.dup_repo_id = r.id
and c.dup_repo_name = r.name
and c.dup_created_at >= '{{from}}'
and c.dup_created_at < '{{to}... |
DROP TABLE IF EXISTS base_entity;
CREATE TABLE base_entity (
entity_id VARCHAR(127) NOT NULL,
entity_name VARCHAR(256) NOT NULL,
entity_created_time TIMESTAMP NOT NULL,
entity_last_updated_time TIMESTAMP NOT NULL,
PRI... |
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: 2016 m. Bal 01 d. 17:53
-- Server version: 10.1.8-MariaDB
-- PHP Version: 5.6.14
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIE... |
SET FOREIGN_KEY_CHECKS=0;
TRUNCATE TABLE `users`;
TRUNCATE TABLE `items`;
insert into `users` (`id`, `name`, `email`, `salt`, `salted`, `icon_image`, `created_at`, `updated_at`, `deleted_at`)
values
(null, 'user1', 'user1@example.com', 'hoge', 'qvl6hWDUqIhwpg1W0QgVh7ClzykqMoXF5Djd525Ssf8=', '', '2017-08-30 17:55:16',... |
-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jul 17, 2020 at 04:34 PM
-- Server version: 10.4.11-MariaDB
-- PHP Version: 7.4.6
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIEN... |
CHECKPOINT;
DBCC FREEPROCCACHE;
DBCC DROPCLEANBUFFERS; |
ALTER TABLE JOURNALPOST
ADD COLUMN OPPRETTET_TID TIMESTAMP(3) DEFAULT localtimestamp,
ADD COLUMN OPPRETTET_AV VARCHAR DEFAULT 'VL' NOT NULL;
UPDATE JOURNALPOST
SET OPPRETTET_TID = '2020-06-24 00:00:00-00';
ALTER TABLE JOURNALPOST
ALTER COLUMN OPPRETTET_TID SET NOT NULL;
ALTER TABLE behandling
D... |
INSERT INTO `Genres`(`Genres`)VALUES('Horreur');
INSERT INTO `Genres`(`Genres`)VALUES('Science Fiction');
INSERT INTO `Genres`(`Genres`)VALUES('Roman');
INSERT INTO `Genres`(`Genres`)VALUES('Jeunesse'); |
-- phpMyAdmin SQL Dump
-- version 5.0.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Waktu pembuatan: 05 Agu 2020 pada 02.18
-- Versi server: 10.4.11-MariaDB
-- Versi PHP: 7.2.27
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHAR... |
SELECT
abs( - 0.8 );
SELECT
RAND( ) -- 字符串内置函数
SELECT
CHAR_LENGTH( "全栈" );
SELECT
length( "全栈" );
-- 日期和时间
SELECT
CURDATE( );
SELECT MONTH
( "20190422" );
-- 条件判断函数
-- if
SELECT
IF
( sal > 2000, 'high', 'low' )
FROM
emp;
-- case
SELECT
CASE
WHEN
sal <= 2000 THEN
'low' ELSE 'high'
END
FROM
emp;
-- 系统信息... |
create table t_usuarios (id_usuario int auto_increment,
nombre varchar(255),
apellidoP varchar(255).
email varchar(255),
usuario varchar(255),
password varchar(255),
primary key(id_usuario)
); |
-- 12 lines 4 code 5 comments 3 blanks
SELECT * FROM Users
WHERE FirstName is not null; -- select rows where the user has a first name
/* this is the beginning of a block comment
insert a new user into the Users table
-- line comment in a block comment
*/
INSERT INTO Users (FirstName, LastName)
VALUES ... |
create or replace view V_JG_YKJH as (
select a.*, b.jsde107
from jh001 a, zb010 b
where a.de011 = b.de011
and b.jsde117 = 'JH001'
and a.jsde201 = b.jsde115
and a.jsde940 >= '88'
)
|
/*
Navicat MySQL Data Transfer
Source Server : laravel
Source Server Version : 50625
Source Host : localhost:3306
Source Database : asset_db
Target Server Type : MYSQL
Target Server Version : 50625
File Encoding : 65001
Date: 2020-12-11 18:31:35
*/
SET FOREIGN_KEY_CHECKS=0;
-- ---... |
drop table if exists users;
create table users(
name varchar(255),
email varchar(255)
);
insert into users(name, email) values('taguchi', 'taguchi@gmail.com');
|
create or replace view v_td_jkhb_info as
select a.id,
b.srmxid,
c.hbmxid,
a.yy,
a.dkmc,
a.dkbh,
a.dkjg,
a.dkdm,
a.xzqh as xmdm,
b.jkkm,
b.jkje,
c.jkkm hbjkkm,
c.hbje,
c.hbsj,
c.yhdm as skyh,
a.bz,
c.shbz,
... |
DELIMITER $$
CREATE PROCEDURE CountCustomerByType(IN Ctype INT, OUT total INT)
BEGIN
SELECT count(Customer_No)
INTO total
FROM CustomerDT
WHERE Ctype_No=Ctype;
END $$
DELIMITER ; |
create database bamazon;
use bamazon;
CREATE TABLE IF NOT EXISTS departments (
DepartmentID int(11) NOT NULL AUTO_INCREMENT,
DepartmentName varchar(100) NOT NULL,
OverHeadCosts int(11) DEFAULT NULL,
TotalSales decimal(10,2) DEFAULT 0.00,
PRIMARY KEY (DepartmentID));
INSERT INTO `departments` (`DepartmentID... |
/* Following DDL SQL commands will help you to create a physical database
for managing the employee's data on a DBMS supporting posgres. */
/* Creating Education table (primary key - education id) */
CREATE table Education(
edu_id SERIAL primary key,
edu_level varchar(50)
);
/* Creating Employee tab... |
-- start with employee
create table employee (
id BIGINT not null,
thFirstName nvarchar(100),
thLastName nvarchar(100),
enFirstName nvarchar(100),
enLastName nvarchar(100),
PRIMARY KEY (id)
); |
insert into region (id,code,local_code,region_name,continent,iso_country) values (1,'AD-02','02','Canillo','EU','AD');
insert into region (id,code,local_code,region_name,continent,iso_country) values (2,'AD-03','03','Encamp','EU','AD');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3... |
CREATE DATABASE sequelize_passport;
USE DATABASE sequelize_passport;
|
/* Added in MySQL 8.0.21
* See https://dev.mysql.com/doc/refman/8.0/en/json-search-functions.html#function_json-value
* JSON_VALUE(json_doc, path RETURNING type) is equivalent to
* CAST(JSON_UNQUOTE(JSON_EXTRACT(json_doc, path)) AS type)
*/
SELECT JSON_VALUE('{"id": "1", "name": "Item 1", "price": "12.34"}',
... |
CREATE DATABASE IF NOT EXISTS modulo_admin;
CREATE DATABASE IF NOT EXISTS modulo_compras;
CREATE DATABASE IF NOT EXISTS modulo_inventario;
CREATE DATABASE IF NOT EXISTS modulo_produtos;
CREATE DATABASE IF NOT EXISTS modulo_pessoas;
CREATE DATABASE IF NOT EXISTS modulo_producao;
CREATE DATABASE IF NOT EXISTS modulo_rh;
... |
# 10/ Pour chaque classe, afficher sa moyenne globale (Moyenne de toutes les notes au sein de la classe)
SELECT C.name, AVG(G.mark) AS ClassAverage
FROM class C, grade G, assessment ASS
WHERE C.id = ASS.class_id
AND G.assessment_id = ASS.id
GROUP BY C.name
HAVING AVG(G.mark); |
CREATE DATABASE dbfarm;
USE dbfarm;
CREATE TABLE type_plante (
idtype_plante INT NOT NULL,
nom VARCHAR(45) NOT NULL,
CONSTRAINT pkplante
PRIMARY KEY (idtype_plante)
);
CREATE TABLE plante (
idplante INT NOT NULL,
nom VARCHAR(45) NOT NULL,
fktype INT NULL,
CONSTRAINT pkplante
PRIMARY K... |
-- 导出 test 的数据库结构
CREATE DATABASE IF NOT EXISTS `test`;
USE `test`;
-- 导出 表 test.account 结构
CREATE TABLE IF NOT EXISTS `account`
(
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) DEFAULT NULL,
`balance` double NOT NULL DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE = InnoDB
AUTO_INCRE... |
Create Table Missions (
MissionID int Primary Key,
MissionName varchar(120),
FK_Tour int,
Foreign Key (FK_Tour)
References Tours(TourID)
); |
--OPTION 2 W/O DUPLICATE
SELECT A.OBJECT_ID "Ticket ID",
E.CACHKNUM "Payment ID",
E1.CACHKNUM "Original Payment ID",
K.BILLING_ACCOUNT_CODE "BAN",
D.ZZREFUND_METHOD,
-- REA.L1 "Refund Type",
E1.CACHKDATE "Original Payment Date",
E.CACHKDATE "Refund Date",
E1.CACHKA... |
CREATE PROCEDURE sp_get_newsvnumber
AS
SELECT DocumentID FROM DocumentNumbers WHERE DocType = 62
|
DROP TABLE IF EXISTS jersey;
CREATE TABLE IF NOT EXISTS jersey (
id VARCHAR(36) PRIMARY KEY,
size INT,
brand VARCHAR(50),
club VARCHAR(50),
year YEAR,
type INT,
cut INT,
material INT DEFAULT 1
); |
/*
Navicat MySQL Data Transfer
Source Server : localhost_3306
Source Server Version : 50726
Source Host : localhost:3306
Source Database : newti
Target Server Type : MYSQL
Target Server Version : 50726
File Encoding : 65001
Date: 2020-11-23 17:34:04
*/
SET FOREIGN_KEY_CHECKS=0;
-... |
-- Describe the object in detail (i.e. Columns data types)
DESC COUNTRIES;
DESC DEPARTMENTS;
DESC EMPLOYEES;
DESC JOB_HISTORY;
DESC JOBS;
DESC LOCATIONS;
DESC REGIONS;
-- Show User Indexes
SELECT INDEX_NAME, TABLE_OWNER, TABLE_NAME, UNIQUENESS
FROM USER_INDEXES;
-- Show All Indexes
SELECT INDEX_NAME, TABLE_OWNER, TA... |
/*==============================================================*/
/* DBMS name: DB2 */
/* Created on: 2016/6/28 17:51:25 */
/*==============================================================*/
drop table F_ADDRESS_BOOK ;
drop table F_DATACATALOG ;
drop tab... |
use burgers_db;
insert into burgers (burger_name, devoured)
values
("Veggie", 0),
("Bacon Cheesburger", 0),
("Southwest Ranch", 0),
("Classic", 0 ),
("Avacado Toast", 0); |
REM ------------------------------------------------------------------------
REM REQUIREMENTS:
REM SELECT on dba_*
REM ------------------------------------------------------------------------
REM PURPOSE:
REM Show segments' segments for a given tablespace
REM -----------------------------------------------------... |
CREATE ROLE spvchannels LOGIN
PASSWORD 'WR6NUJEyG-kYMKz9Z6Y9^%^SP^3kuX'
NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION;
GRANT ALL PRIVILEGES ON DATABASE spvchannels TO spvchannels;
GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO spvchannels;
GRANT USAGE, SELECT ON ALL SEQUEN... |
CREATE procedure sp_View_PurchaseReturn (@DocSerial int)
As
Select AdjustmentID, AdjustmentReturnAbstract.VendorID, Vendors.Vendor_Name,
AdjustmentDate, DocumentID, Total_Value, Balance, Status,DocReference,DocIdRef,
adjustmentIDRef,(select a.adjustmentdate from adjustmentreturnabstract a where adjustmentid... |
set hive.execution.engine=spark;
use ods ;
drop table if exists dim.dimtmp_monthly_accumulative_work_date;
create table if not exists dim.dimtmp_monthly_accumulative_work_date (
yearmonth STRING COMMENT '年月',
day TIMESTAMP COMMENT '日期',
IsWorkDay bigint comment '是否工作日',
CumWorkDay bigint comment '月连续累计工作日',
C... |
CREATE DATABASE IF NOT EXISTS `csc330project2` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `csc330project2`;
-- MySQL dump 10.13 Distrib 5.7.9, for Win64 (x86_64)
--
-- Host: localhost Database: csc330project2
-- ------------------------------------------------------
-- Server version 5.6.28-log
/*!40101 SET @OLD... |
--PROBLEM 11
--Select all people who don't have tickets. Select their first name, last name and age .
--Order them by age (descending), first name (ascending) and last name (ascending).
SELECT
p.FirstName
,p.LastName
,p.Age
FROM Passengers AS p
LEFT JOIN Tickets AS t ON p.Id=t.PassengerId
WHERE t.Id IS NULL
OR... |
create table if not exists ddelivery_ddelivery
(
ID int(11) NOT NULL auto_increment,
PARAMS text,
ORDER_ID int(11),
ddelivery_ID int(12),
STATUS varchar(40),
MESSAGE text,
UPTIME varchar(10),
PRIMARY KEY(ID),
INDEX ix_ddelivery_ddeliveryoi (ORDER_ID)
);
/*//==backTown
CREATE TABLE ddelivery_ddelivery_cities... |
-- Navn, Beskrivelse
INSERT INTO Apparat (navn, beskrivelse) VALUES ('Benk', 'Benk med stang'), ('Mølle', 'Til løping'), ('Romaskin', 'Sånn man ror med'),
('Bakkeløp', 'Intervalltrening opp bakker'), ('Traktordekk', 'Crossfitraritet'),
('Sykkel', 'Sånn man sykler med'), ('Multiapparat', 'For diverse øvelser');
-- Navn... |
ALTER TABLE customers_addresses RENAME COLUMN customer_id TO owner_id;
|
-- phpMyAdmin SQL Dump
-- version 4.6.4
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 25-06-2017 a las 21:45:13
-- Versión del servidor: 5.7.14
-- Versión de PHP: 5.6.25
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHAR... |
CREATE TABLE [Client].[RemoteServerNode] (
[Guid] UNIQUEIDENTIFIER NOT NULL,
[Server] [sysname] NULL,
[CPU] NVARCHAR (2000) NULL,
[NumberOfLogicalProcessors] SMALLINT NULL,
[Cores] SMALLINT NULL... |
2018-10-17 00:00:45
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
3.810ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
2.560ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and... |
/*
客诉管理
*/
delimiter $
drop trigger if exists Tgr_Complaints_AftereDelete $
create trigger Tgr_Complaints_AftereDelete after delete
on Complaints
for each row
begin
call Proc_Settlements_SumClaimAmount(old.InvoiceNO);-- 结算中心-索赔金额
call Proc_Settlements_MathGrossProfit(old.rid);-- 结算中心-实际业务毛利
end$
delimiter ; |
source createobjects.sql;
source createuser.sql;
|
CREATE PROCEDURE sp_list_GRN_DocLU (@FromDocID int,@ToDocID int,@DocumentRef nvarchar(510)=N'')
AS
If Len(@DocumentRef)=0
Begin
SELECT GRNID, GRNDate, Vendors.Vendor_Name, GRNAbstract.VendorID, GRNStatus, DocumentID,
DocumentReference,DocSerialType
FROM GRNAbstract, Vendors
WHERE GRNAbstract.VendorID = Vendors.V... |
# --- !Ups
INSERT INTO fields (id, name)
VALUES (1, 'Software')
ON CONFLICT DO NOTHING;
INSERT INTO fields (id, name)
VALUES (2, 'Food and Wine')
ON CONFLICT DO NOTHING;
INSERT INTO jobs (id, field, name, from_date, to_date, country, description, requirement)
VALUES (1, 1, 'Scala Magician', '2018-02-01', '2018-10-01'... |
/*
================================================================================
INDEXES
================================================================================
================================================================================
For a given table, the INDEX store... |
SELECT
extract(epoch from homes_measurement.timestamp),
homes_measurement.value,
homes_measurement.meter_port_id
FROM
public.homes_measurement
WHERE
homes_measurement.timestamp BETWEEN 'fromtime' AND 'totime'
AND homes_measurement.meter_port_id IN (SELECT
homes_meterport.id
FROM
public.home... |
CREATE PROCEDURE [display].[pDel_core_company]
AS
TRUNCATE TABLE [display].[core_company] |
--adhoc使用
select city.cityname
, count (distinct search_w.cid ) as WAU
, count (distinct pay_w.orderid) as order_w
, concat(round(count (distinct pay_w.orderid)/count (distinct search_w.cid )*100,2),'%') as conversion_w
, count (distinct bnbpay_w.orderid ) as bnborder_w
, count (distinct hotelpay_w.orderid) ... |
CREATE TABLE autobus (
matricula VARCHAR2(16) NOT NULL,
wc NUMBER,
cantidad_asientos NUMBER,
CONSTRAINT autobus_pk PRIMARY KEY(matricula)
);
|
ALTER TABLE `ssm_stdtmp_file_01`
ADD COLUMN `T_DATE_04` DATE COMMENT '生效日期' AFTER `T_DATE_03`;
ALTER TABLE `sys_stdtmp_file_01`
ADD COLUMN `T_DATE_04` DATE COMMENT '生效日期' AFTER `T_DATE_03`;
|
-- it creates a database named hbtn_0d_2 and a user_0d_2.
CREATE DATABASE IF NOT EXISTS hbtn_0d_2;
CREATE USER IF NOT EXISTS
user_0d_2@localhost IDENTIFIED BY 'user_0d_2_pwd';
GRANT SELECT ON hbtn_0d_2.* TO 'user_0d_2'@'localhost'; |
create or replace function GetMscid(region_name string,vendor_id number,omc_id number)
RETURN varchar2 is
Mscname varchar2(64);
begin
if vendor_id=7 then
if region_name like '安庆%' then
Mscname:='WHMsce2';
elsif region_name like '池州%' then
Mscname:='WHMSCe2';
elsif region_name like '黄山%'... |
create index IX_7CA94756 on es_ESHardware (SerialNo);
create index IX_E932831B on es_ESHardware (companyId);
create index IX_72098163 on es_ESHardware (drOwnerId);
create index IX_9027145D on es_ESHardware (groupId);
create index IX_1E890C3E on es_ESHardware (hardwareSerialNo);
create index IX_85280D1E on es_ESHardware... |
--<ScriptOptions statementTerminator=";"/>
CREATE TABLE radiologydate (
id INT8 NOT NULL,
date DATE,
radiology_fk INT8
);
CREATE UNIQUE INDEX radiologydate_pkey ON radiologydate (id ASC);
ALTER TABLE radiologydate ADD CONSTRAINT radiologydate_pkey PRIMARY KEY (id);
ALTER TABLE radiologydate ADD CONSTRAINT fk... |
#Create database
CREATE DATABASE if NOT EXISTS quotedb;
GRANT ALL PRIVILEGES ON quotedb.* TO 'Radha'@'%';
FLUSH PRIVILEGES;
use quotedb;
CREATE TABLE IF NOT EXISTS `hibernate_sequence` (
`next_val` bigint DEFAULT NULL
);
INSERT INTO quotedb.hibernate_sequence(next_val) VALUES (1);
CREATE TABLE IF NOT EXISTS `log... |
create database EscalaWeb;
use EscalaWeb;
create table contatos(
id int primary key auto_increment,
nome varchar(50),
email varchar(50),
telefone varchar(50),
mensagem varchar(200)
);
insert into contatos(nome, email, telefone, mensagem) values('Armando Víctor Pereira','armando2019ti@gmail.com','11995052373','Mensa... |
DROP VIEW newest_users;
DROP VIEW trzaskowski_tweets;
DROP VIEW jaki_tweets;
DROP VIEW newest_tweets; |
alter table ore_calcs add column store_items_text text;
create table store_items(
id bigint not null auto_increment primary key,
ore_calc_id bigint not null,
type_id bigint not null,
qty bigint not null
); |
/*
Navicat Premium Data Transfer
Source Server : mysql
Source Server Type : MySQL
Source Server Version : 50719
Source Host : localhost:3306
Source Schema : permission
Target Server Type : MySQL
Target Server Version : 50719
File Encoding : 65001
Date: 12/04/2020 10:... |
/****** Object: StoredProcedure [dbo].[prc_CWI_SetCorrespondenceDelivery] Script Date: 11/7/2014 3:49:30 PM ******/
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[prc_CWI_SetCorrespondenceDelivery]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[prc_CWI_SetCorrespondenceDelivery]
GO
... |
/***************** Linear Models ****************/
/* Linear Model such as regression are useful for estimating values for business.
Such as: We just run an advertising campaign and expect to sell more items than usual.
How many employees should we have working?
*/
/*********** Computing Intercept (employee shifts on... |
CREATE TABLE present (user_id int, date text);
INSERT INTO present VALUES (1, '01.07.2018'), (234, '04.10.2018'), (234, '02.07.2018'), (3, '02.07.2018'), (1, '01.07.2018');
WITH mau AS (SELECT DATE_TRUNC("month", date) month_timestamp, COUNT(DISTINCT user_id) mau FROM logins GROUP BY DATE_TRUNC("month", date))
SELECT a... |
-- phpMyAdmin SQL Dump
-- version 3.5.1
-- http://www.phpmyadmin.net
--
-- Servidor: localhost
-- Tiempo de generación: 19-12-2016 a las 13:04:44
-- Versión del servidor: 5.5.24-log
-- Versión de PHP: 5.4.3
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARA... |
DROP TABLE IF EXISTS classes;
CREATE TABLE classes (
depttag text,
coursenum real,
coursename text,
termsoffered text,
reqfilled text,
classperiod text,
professor text,
classdescription text
);
|
Select *
From Orders;
-- match up customer to the customerid
Select *
From Orders
join Customers
on orders.CustomerId = Customers.Id;
-- only include columns name, city, state, date then order by name.
Select name, city, state, date
From Orders
join Customers
on orders.CustomerId = Customers.Id
order by name;
-... |
-- Creating the database
CREATE DATABASE IF NOT EXISTS worldcup;
USE worldcup;
-- Creating the table
CREATE TABLE IF NOT EXISTS LogDataRaw(
userId INT,
gap1 STRING,
gap2 STRING,
logTime1 STRING,
logTime2 STRING,
request1 STRING,
request2 STRING,
request3 STRING,
statusCode INT,
dataSize DOUBLE
)
R... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.