text stringlengths 6 9.38M |
|---|
CREATE DATABASE `cupcake`;
USE `cupcake`;
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` int NOT NULL AUTO_INCREMENT,
`email` varchar(90) NOT NULL,
`password` varchar(45) NOT NULL,
`role` varchar(20) NOT NULL DEFAULT 'customer',
`saldo` int(11),
PRIMARY KEY (`id`),
UNIQUE KEY `email_UNIQUE`... |
DROP TABLE `mangobazar`.`category`;
CREATE TABLE `mangobazar`.`category` (
`id` BIGINT NOT NULL AUTO_INCREMENT,
`name` VARCHAR(250) NOT NULL,
PRIMARY KEY (`id`));
|
CREATE DATABASE mydb;
CREATE TABLE department (
id int NOT NULL AUTO_INCREMENT,
name varchar(20) NOT NULL,
created datetime,
updated datetime,
PRIMARY KEY (id),
UNIQUE (name)
) ENGINE=InnoDB;
CREATE TABLE employee (
id int NOT NULL AUTO_INCREMENT,
department_id int NULL... |
-- This file should undo anything in `up.sql`
ALTER TABLE `users` DROP COLUMN `updated_at`;
ALTER TABLE `users DROP COLUMN `created_at`
|
/* Create db and establish schema */
DROP DATABASE baseball;
CREATE DATABASE baseball;
\c baseball;
CREATE TYPE league AS ENUM ('American League', 'National League');
CREATE TABLE Teams (
name text NOT NULL,
city text NOT NULL,
league league NOT NULL,
division text NOT NULL,
id serial PRIMARY KEY... |
-- phpMyAdmin SQL Dump
-- version 2.11.6
-- http://www.phpmyadmin.net
--
-- Serveur: localhost
-- Généré le : Sam 04 Octobre 2008 à 13:56
-- Version du serveur: 5.0.51
-- Version de PHP: 5.2.6
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--
-- Base de données: `scoutvillejuif_scout`
--
-- ----------------------------------... |
select "a"."line1",
"city"."name" as "city",
"a"."district",
"country"."name" as "country"
from "addresses" as "a"
join "cities" as "city" using ("cityId")
join "countries" as "country" using ("countryId");
|
-- (1)查询DEPT表显示所有部门名称.
select d.dname from dept d;
-- (2)查询EMP表显示所有雇员名及其全年收入(月收入=工资+补助),处理NULL行,并指定列别名为"年收入"。(NVL(comm,0) comm取空值时用0替代)
select e.ename,(e.sal+nvl(e.comm,0))*12 年收入 from emp e;
-- (3)查询显示不存在雇员的所有部门号。
select d.deptno from emp e,dept d where e.deptno (+)= d.deptno group by d.deptno... |
CREATE TABLE IF NOT EXISTS transfers (
id uuid PRIMARY KEY,
sender_login VARCHAR(40) NOT NULL REFERENCES accounts(login) ON UPDATE CASCADE,
recipient_login VARCHAR(40) NOT NULL REFERENCES accounts(login) ON UPDATE CASCADE,
comment TEXT,
amount NUMERIC(20, 2) NOT NULL,
date TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP
) |
/* ROW_NUMBER() works per partition ! */
SELECT ROW_NUMBER() OVER() AS rnum,
dname
FROM dept
LIMIT 2;
SELECT ROW_NUMBER() OVER() AS rnum,
dname
FROM dept
LIMIT 2 OFFSET 2;
|
--1.
--SQL objects are schemas, journals, catalogs, tables, aliases, views, indexes, etc. An object is any SQL Server resource.
--Each object contains one or more counters that determine various aspects of the objects to monitor.
--2.
--An index is an on-disk structure associated with a table or view that speeds ... |
# Explore SQL data with SQL scripts
# Here are a few sample SQL scripts that can be used to explore data stores in SQL Server.
# Get the count of observations per day
SELECT CONVERT(date, <date_columnname>) as date, count(*) as c from <tablename> group by CONVERT(date, <date_columnname>)
# Get the levels in a catego... |
create or replace view v1_hdjh004_zbbh as
(
select czde397, to_char(wm_concat(zbbh)) as zbbh
from (select jsde115 as czde397, to_char(wm_concat(de151)) as zbbh
from (select distinct jsde115, b.de151
from zb010 a, zb006 b
where jsde013 = 25
and a.jsde107 ... |
-- aas-std.sql
-- gather AAS metrics from AWR
@clear_for_spool
set term off
spool aas-std-lks.csv
prompt begin_time,end_time,instance_number,elapsed_seconds,AAS
with data as (
select
to_char(h.begin_time,'yyyy-mm-dd hh24:mi:ss') begin_time
, to_char(h.end_time,'yyyy-mm-dd hh24:mi:ss') end_time
, (h.end_t... |
--PROBLEM 06
SELECT
*
FROM Planes
WHERE [NAME] LIKE '%tr%'
ORDER BY Id,[Name],Seats,Range |
-- --------------------------------------------------------
-- Хост: 127.0.0.1
-- Версия сервера: 5.7.13-log - MySQL Community Server (GPL)
-- ОС Сервера: Win64
-- HeidiSQL Версия: 9.3.0.4984
-- --------------------------------------------------------... |
drop table admin;
create table admin
( adminno varchar2(25),
fname varchar2(20),
lname varchar2(20),
country varchar2(25),
password varchar2(20),
gender varchar2(1),
primary key (adminno)
);
insert into admin values ('kapil_sharma','Kapil','Sharma','India','hellojiit','M');
insert into admin values ('aaka... |
--修改日期:2012.12.07
--修改人:周兵
--修改内容:自动生成余额
--修改原因:需求需要
--增加表字段
update bt_param set reverse1='0,否;1,是(不覆盖手工生成的余额);2,是(覆盖手工生成的余额)' where code ='autoBuildHisBal' and sys_code = 'adm' and name = '自动更新离线账户历史余额';
DECLARE
VN_COUNT NUMBER;
VC_STR VARCHAR2(1000);
BEGIN
--查看该表中该字段是否存在
SELECT COUNT(*)
IN... |
CREATE OR REPLACE PROCEDURE plch_show_orders
IS
CURSOR c_orders (as_status plch_orders.status%TYPE)
IS
SELECT order_id
FROM plch_orders
WHERE UPPER(status) = UPPER(as_status)
ORDER BY status, order_date DESC;
rec_orders c_orders%ROWTYPE;
BEGIN
OPEN c_orders('OPEN');
LOOP
FETCH c_o... |
IF db_id('AwfulInputs') IS NOT NULL
DROP DATABASE [AwfulInputs] |
DROP TABLE IF EXISTS users;
CREATE TABLE users (
id INTEGER PRIMARY KEY,
fname TEXT NOT NULL,
lname TEXT NOT NULL
);
DROP TABLE IF EXISTS questions;
CREATE TABLE questions (
id INTEGER PRIMARY KEY,
title TEXT NOT NULL,
body TEXT NOT NULL,
user_id INTEGER NOT NULL,
FOREIGN KEY (user_id) REFERENCES us... |
alter table a_asset_acct drop constraint a_asset_acct_pkey;
alter table a_asset_acct add constraint a_asset_acct_pkey primary key (a_asset_acct_id);
alter table c_order drop constraint c_order_m_freightcategory_id_fkey;
alter table c_order add constraint mfreightcategory_order foreign key(m_freightcategory_id)... |
/* Создание таблицы дочерних клиентов */
CREATE TABLE /*PREFIX*/CLIENT_CHILDS
(
CLIENT_ID VARCHAR(32) NOT NULL,
CHILD_ID VARCHAR(32) NOT NULL,
PRIMARY KEY (CLIENT_ID,CHILD_ID),
FOREIGN KEY (CLIENT_ID) REFERENCES /*PREFIX*/CLIENTS (CLIENT_ID),
FOREIGN KEY (CHILD_ID) REFERENCES /*PREFIX*/CLIENTS (CLIENT_ID)
)
... |
/*
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:38
*/
SET FOREIGN_KEY_CHECKS=0;
-... |
CREATE table `users` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`username` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
PRIMARY KEY(`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; |
CREATE TABLE versioning.VersioningTransfer
(
VersioningTransferID BIGINT NOT NULL
, VersioningDestination NVARCHAR(20) NOT NULL
, SchemaName SYSNAME NOT NULL
, TableName SYSNAME NOT NULL
, VersioningID_Reserved_Start BIGINT NOT NULL
, VersioningID_Reserved_End BIGINT NOT NULL
, VersioningID_Reserved_Timestamp DA... |
-- phpMyAdmin SQL Dump
-- version 4.8.4
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1:3306
-- Tiempo de generación: 09-01-2021 a las 04:55:36
-- Versión del servidor: 5.7.24
-- Versión de PHP: 7.2.14
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/... |
/*2013-01-25
修改视图,取数的公式
*/
create or replace view v_fc_acc_balance_month as
select fc_acc.corp_code, fc_acc.net_code, fc_acc.cur_code,
to_char(fc_acc_balance.balance_date,'yyyymm') as month_code,
sum(fc_acc_balance.debit_money - fc_acc_balance.rush_debit_money ) as debit_money,
sum((fc_acc_balance.debit_money - fc_acc... |
-- phpMyAdmin SQL Dump
-- version 4.7.9
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Mar 26, 2019 at 08:40 PM
-- Server version: 10.1.31-MariaDB
-- PHP Version: 7.2.3
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD... |
CREATE DATABASE book_change;
USE book_change;
CREATE TABLE usuario (
in_usuario_id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
va_nome VARCHAR(250) NOT NULL,
dt_data_nascimento date DEFAULT NULL,
va_celular VARCHAR(15) NOT NULL,
va_telefone VARCHAR(15) DEFAULT NULL,
va_email VARCHAR(250) NOT NULL UNIQUE,
v... |
-- MySQL dump 10.13 Distrib 5.7.12, for osx10.9 (x86_64)
--
-- Host: localhost Database: crowdsensingdb
-- ------------------------------------------------------
-- Server version 5.7.17
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULT... |
/*
Navicat MySQL Data Transfer
Source Server : VPS
Source Server Version : 50509
Source Host : 95.143.32.54:3306
Source Database : world_dev
Target Server Type : MYSQL
Target Server Version : 50509
File Encoding : 65001
Date: 2012-01-11 16:58:38
*/
SET FOREIGN_KEY_CHECKS=0;
-- --... |
DO $$
BEGIN
BEGIN
ALTER TABLE sys_user ADD COLUMN lms_id character varying;
EXCEPTION
WHEN duplicate_column THEN RAISE NOTICE 'column lms_id already exists in sys_user.';
END;
END;
$$
|
create table party_member_100 (
c_id INT,
p_id VARCHAR(1)
);
insert into party_member_100 (c_id, p_id) values (1, '3');
insert into party_member_100 (c_id, p_id) values (2, '1');
insert into party_member_100 (c_id, p_id) values (3, '5');
insert into party_member_100 (c_id, p_id) values (4, '2');
insert into party_mem... |
create domain description as varchar(60);
create domain currency as numeric(15,2);
create domain percent as numeric(15,4);
drop table if exists produtos, operacoes;
create table produtos (
id serial primary key,
descricao description,
preco currency
);
create table operacoes (
id serial primary key,
descricao descr... |
select count(*)
from (select `ps_suppkey`, count(*)
from `partsupp`
group by `ps_suppkey`
order by
fetch next 20 rows only) as `t1` |
--
-- MySQL 5.1.44
-- Thu, 10 Feb 2011 20:15:07 +0000
--
DROP TABLE IF EXISTS `accessgroups`;
CREATE TABLE `accessgroups` (
`id` int(11) not null,
`name` varchar(50),
`commands` longtext,
`worlds` varchar(255) default '*',
PRIMARY KEY (`id`),
UNIQUE KEY (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;... |
CREATE TABLE [clothing].[Stock] (
[StockID] INT IDENTITY (1, 1) NOT NULL,
[ItemID] INT NOT NULL,
[SizeID] INT NOT NULL,
[InventoryID] INT NOT NULL,
PRIMARY KEY CLUSTERED ([StockID]),
CONSTRAINT [FK_clothing.Stock_clothing.Items_ItemID] FOREIGN KEY ([ItemID])
REFERENCES [clothing].[Items] ... |
use dblaferme;
delimiter drop database dblaferme
drop function if exists getconso;
create function getconso(elevage int, plante text) returns int
deterministic
begin
return (select a.qtx from alimentation a
inner join plante p on p.idplante = a.fkplante and p.nom like plante
inner join animal an on an... |
If (SELECT count(*) FROM Story.StorySection) = 0
BEGIN
SET IDENTITY_INSERT Story.StorySection ON
INSERT INTO Story.StorySection ([Id], [Description], [HierarchyLevel],[Order],[ParentHierarchyElementId],[StoryId])
VALUES
(1,N'Act one', 1,1,-1,1),
(2,N'Act two', 1,2,-1,1),
(3,N'Act three', 1,3,-1,1);
SET IDENTITY_INSE... |
-- Restriciones de integridad
-- Email de una persona validado por expresion regular
ALTER TABLE persona
ADD CONSTRAINT chk_persona_email
CHECK (REGEXP_LIKE (email,'^[A-Za-z]+[A-Za-z0-9.]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$'));
-- A lo mas el guia tendra un descuento del 30%
ALTER TABLE guia ADD CONSTRAINT... |
-- you should take values for {RESOURCE_ID} and {ATTRIBUTE_ID} from Applications Manager web interface
--- min, max, avg values of response time for server - last 24hrs
select floor(min(minvalue)) as minv, floor(max(maxvalue)) as maxv, floor(sum(total)/sum(totalcount)) as avgv
from AM_RESPONSETIME_MinMaxAvgData where... |
CREATE procedure spr_list_Bank
as
select BankCode, "Bank Code" = BankCode, "Bank Name" = BankName, "Active" = Active
from BankMaster
|
-- Database generated with pgModeler (PostgreSQL Database Modeler).
-- pgModeler version: 0.9.1
-- PostgreSQL version: 10.0
-- Project Site: pgmodeler.io
-- Model Author: ---
-- Database creation must be done outside a multicommand file.
-- These commands were put in this file only as a convenience.
-- -- object: ne... |
# patch_53_54_c.sql
#
# title: Move analysis_id from identity_xref to object_xref
#
# description:
# Add analysis_xref column to object_xref, copy values from identity_xref, remove column from identity_xref.
# Will allow all object_xref relationships to have an analysis, not just those from sequence matching.
ALTER TA... |
CREATE DATABASE exercicio1 COLLATE 'utf8mb4_unicode_ci';
|
-- select statements
select * from student;
select * from course;
select * from enrolled;
-- null middle names
select *
from student
where middleInitial is null;
-- how many students in Ohio
select count(*)
from student
where state = 'OH';
-- oldest/youngest birthday options
select max(birthday)
from student;
... |
insert into units
(type, unit_name, description, owner_id, ppd, zip_code, img1, img2, img3, img4, subtype, contact_info, contact_info2)
values($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)
returning *; |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
* Author: Miry
* Created: 2/12/2016
*/
CREATE TABLE CONDUCTOR(ID_CONDUCTOR INTEGER,NOMBRE VARCHAR2(30),DIR VARCHAR2(50),
TEL ... |
/*
Warnings:
- The primary key for the `Issue` table will be changed. If it partially fails, the table could be left without primary key constraint.
- The primary key for the `Pair` table will be changed. If it partially fails, the table could be left without primary key constraint.
- You are about to drop the... |
-- Create the synonym
create or replace synonym FSSR_FSJK
for FS10.FSJK; |
insert into student (email_address, student_id) values('bart.simpson@oit.edu', 9);
insert into student (email_address, student_id) values('ralph.wiggum@oit.edu', 10);
insert into student (email_address, student_id) values('lisa.simpson@oit.edu', 11);
insert into student (email_address, student_id) values('milhouse.vanh... |
SET @@AUTOCOMMIT = 1;
DROP DATABASE IF EXISTS dsa;
CREATE DATABASE dsa;
USE dsa;
CREATE TABLE Product (
product_id CHAR(4) NOT NULL PRIMARY KEY,
price DECIMAL(4, 2),
size INT,
name varchar(100),
description VARCHAR(200)
);
CREATE TABLE Cart (
product_id CHAR(4) NOT NULL... |
-- Your database schema. Use the Schema Designer at http://localhost:8001/ to add some tables.
CREATE TABLE tweets (
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
author TEXT NOT NULL,
content TEXT NOT NULL
);
|
/*
Navicat MySQL Data Transfer
Source Server : localhost_3306
Source Server Version : 50554
Source Host : localhost:3306
Source Database : phpwamp
Target Server Type : MYSQL
Target Server Version : 50554
File Encoding : 65001
Date: 2019-03-01 11:55:55
*/
SET FOREIGN_KEY_CHECKS=0;
... |
--liquibase formatted sql
DROP TABLE subcategory CASCADE ; |
select a.dbid,a.name,a.type, c.lc_value,a.version,b.version,
a.state,a.work_directory,a.command_line
from cfg_application a, cfg_app_prototype b,cfg_locale c
where a.app_prototype_dbid = b.dbid and
a.type = c.lc_subtype and
c.lc_description = 'Enum_CfgAppType'
order by a.name |
INSERT IGNORE INTO cozinha (id,nome) VALUES (1,'Tailandesa');
INSERT IGNORE INTO cozinha (id,nome) VALUES (2,'Indiana');
INSERT IGNORE INTO cozinha (id,nome) VALUES (3,'Brasileira');
INSERT IGNORE INTO forma_pagamento(id,descricao) VALUES(1,'Crédito');
INSERT IGNORE INTO forma_pagamento(id,descricao) VALUES(2,'Dé... |
truncate table cs110;
truncate table csgl_bmlinkinfo;
truncate table csgl_dxpfxxb;
delete csgl_dxkhxxb;
truncate table csgl_dxwh;
truncate table csgl_lbjxfxx;
truncate table csgl_sbmz;
truncate table csgl_zxjbxx;
truncate table csgl_zxjbxx;
truncate table dtj_ryinfo;
truncate table fxpg_zrzt;
truncate table gabm_hjxxx... |
# ************************************************************
# Sequel Pro SQL dump
# Version 4541
#
# http://www.sequelpro.com/
# https://github.com/sequelpro/sequelpro
#
# Host: 127.0.0.1 (MySQL 5.7.23)
# Database: capstone
# Generation Time: 2019-04-15 00:28:13 +0000
# **********************************************... |
CREATE OR REPLACE PUBLIC SYNONYM ti_endorsements_pkg FOR orient.ti_endorsements_pkg; |
CREATE PROCEDURE [sp_put_SODocFooter](
@Product_Code [nvarchar](15),
@Quantity Decimal(18,6),
@SalePrice Decimal(18,6),
@SaleTax Decimal(18,6),
@Discount Decimal(18,6),
@SONumber [int],
@TaxSuffered Decimal(18,6)=0.0,
@TaxSuffApplicableOn Int=0,
@TaxSuffPartOff Decimal(18,6)=0.0,
@TaxApplicableOn Int=0,
@TaxPartOff ... |
-- create sequence
-- create sequence if not exists seq_transaction start with 1 increment by 1 maxvalue 99999999;
-- create table transaction
create table if not exists transactions (
id int auto_increment primary key,
username varchar(10) not null,
userid varchar(10) not null,
transaction_date varchar(2... |
-- Run like:
-- psql sandcrawler < dump_regrobid_pdf_petabox.sql
-- cat dump_regrobid_pdf_petabox.2020-02-03.json | sort -S 4G | uniq -w 40 | cut -f2 > dump_regrobid_pdf_petabox.2020-02-03.uniq.json
BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE READ ONLY DEFERRABLE;
COPY (
SELECT petabox.sha1hex, row_to_jso... |
create table prescriptions (
id serial primary key,
sha text,
pct text,
practice text,
bnfcode text,
bnfname text,
chemical_code text,
chemical_name text,
product text,
generic text,
equivalent text,
items integer,
nic numeric(10,2),
act_cost numeric(10,2),
quantity integer,
pe... |
CREATE TABLE `items_ordered` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`order_id` bigint(20) NOT NULL,
`item_id` bigint(20) NOT NULL,
`price_of_item` decimal(19,6) NOT NULL,
`number_of_items` bigint(20) NOT NULL,
PRIMARY KEY (`id`),
KEY `order_id_fk_idx` (`order_id`),
CONSTRAINT `order_id_fk` FOREIGN K... |
with mth as
(select
*, (avg_cena - lag(avg_cena)over(order by mth)) / lag(avg_cena)over(order by mth) mom
from
(select date_trunc('month',to_date(data,'YYYY-MM-DD')) mth , avg(zamkniecie) avg_cena from xpdusd_d
group by 1 order by 1 ) c),
dates as
(select generate_series('2016-01-01'::date, '2019-12-01'::date, inte... |
Create database Library
use Library
Create table Author
(
id int not null primary key identity(1,1),
Name varchar(50) not null,
LastName varchar(50) not null,
BirthDate date not null,
AuthorGender bit not null
)
Create table Gender
(
id int not null primary key identity(1,1),
NameGender varchar(50) not null u... |
-- phpMyAdmin SQL Dump
-- version 4.9.1
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Nov 15, 2020 at 09:11 AM
-- Server version: 8.0.18
-- 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_CHARACT... |
alter table car
add column batch varchar(128); |
CREATE Procedure sp_GetOldItemInvoiceQty(@Invoiceid Int,
@Prodid nvarchar(30),
@batchid nvarchar(20),
@saleprice Decimal(18,6),
@TaxSuffered Decimal(18,6) = 0,
@TaxSuffApplicable Integer = 0,
@TaxSuffPartOff Decimal(18,6) = 0)
as
if (@batchid<>'NA')
begin
Select Sum(Quantity) from Invoicedet... |
CREATE OR REPLACE PROCEDURE SSHARM17."assignPrimarySupporter" (
"patientSSN" IN VARCHAR2,
"hsSSN" IN VARCHAR2,
"authorizationDate" IN DATE)
AS
primaryOccurence INTEGER;
BEGIN
SELECT COUNT (*)
INTO primaryOccurence
FROM PATIENTTOHEALTHSUPPORTER p
WHERE p.PATIENTSSN = ... |
USE pokeTrainers_db;
-- Insert rows into table 'pokeTrainers_db'
INSERT INTO trainers
( -- columns to insert data into
matchName, img, attr
)
VALUES
(
'Brock', "brock.jpg", '5,3,5,4,5,5,1,5,3,2,4'
),
(
'Misty', "misty.jpg", '3,5,1,2,3,4,3,2,3,2,4'
),
(
'Ash', "ash.jpg", '1,4,3,2,5,2,1,5,5,3,1'
),
(
'Gary', "g... |
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
DROP SCHEMA IF EXISTS `shop` ;
CREATE SCHEMA IF NOT EXISTS `shop` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci... |
--1.회원별 주문 상품 통계
--회원아이디 상품번호 상품갯수 구매금액
--(조건:주문건이 없더라도 회원출력)
SELECT
U.USER_ID,
OG.GOOD_SEQ,
OG.ORDER_AMOUNT,
OG.ORDER_PRICE
FROM ORDERS O,
USERS U,
ORDERS_GOODS OG
WHERE U.USER_SEQ = O.USER_SEQ(+)
AND O.ORDER_CODE = OG.ORDER_CODE(+)
order by user_id, good_seq;
--2.업체별 공급 상품 리스트
--업체번호 업체명 상품번호 상품명
--(조... |
DROP DATABASE moviez;
CREATE DATABASE moviez;
\c moviez
CREATE TABLE moviez (
id serial8 primary key,
title varchar(150),
year int4 ,
rated varchar(50) ,
released varchar(20) ,
runtime varchar(9) ,
genre varchar(50) ,
director varchar(30) ,
writer text ,
actors varchar(200) ,
plot text,
imdbID varchar(20)
);
|
# --- !Ups
ALTER TABLE organization ADD COLUMN show_custodia BOOLEAN default false not null;
ALTER TABLE organization ADD COLUMN show_attendance BOOLEAN default true not null;
ALTER TABLE organization ADD COLUMN short_name VARCHAR(255) default '' not null;
ALTER TABLE organization ADD COLUMN custodia_password VARCHAR(... |
-- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 23-05-2019 a las 22:06:09
-- Versión del servidor: 10.1.39-MariaDB
-- Versión de PHP: 7.3.5
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
... |
Create Procedure mERP_sp_Update_TaxDesc(@TaxCode int,@TaxDesc nVarchar(255))
As
Begin
Update Tax Set Tax_Description = @TaxDesc Where Tax_Code = @TaxCode
End
|
-- Solo superior
SET SEARCH_PATH TO markus;
DROP TABLE IF EXISTS q3;
-- You must not change this table definition.
CREATE TABLE q3 (
assignment_id integer,
description varchar(100),
num_solo integer,
average_solo real,
num_collaborators integer,
average_collaborators real,
average_students_per... |
-- Provide a query that shows the total sales per country.
Select sum(i.total), c.Country
from Customer as c
join Invoice as i
on c.CustomerId = i.CustomerId
group by c.Country |
{{
config(
materialized='table',
tags='raw'
)
}}
select * from {{ source('sf_sample_data', 'orders') }} |
-- 3.2-2
SELECT sname FROM Sailors
WHERE
sid in (select sid from Reserves WHERE bid=103)
-- 3.2-3
SELECT DISTINCT sid FROM Reserves
WHERE
bid in (SELECT bid FROM Boats WHERE Color="Red") ;
-- 3.2-4
SELECT sname
FROM Sailors
WHERE sid IN
(
SELECT DISTINCT sid
FROM Reserves
WHERE bid in (
SELECT bid
FROM B... |
/*
To CREATE or REPLECE a PROCEDURE
- in your own schema, you must have the CREATE PROCEDURE system privilege
- in another user's schema, you must have the CREATE ANY PROCEDURE system privilege.
You can DROP a procedure when either of this conditions is met:
- the procedure is in your own schema and you have the CREAT... |
EXECUTE DBMS_CONNECTION_POOL.START_POOL()
|
SELECT * FROM LOCATION_GU;
SELECT * FROM LOCATION_SI;
DROP TABLE LOCATION_GU;
DROP TABLE LOCATION_SI;
|
SELECT m.title AS movie, r.rating AS rating
FROM movies m
JOIN ratings r
ON r.movie_id = m.id
WHERE year = 2010
ORDER BY 2 DESC, 1; |
/*
Navicat MySQL Data Transfer
Source Server : 税务云平台
Source Server Type : MySQL
Source Server Version : 50727
Source Host : 192.168.248.157:3306
Source Schema : cloudgo-business
Target Server Type : MySQL
Target Server Version : 50727
File Encoding : 65001
Date: 15/1... |
/*
** Question: https://leetcode.com/problems/department-highest-salary/
*/
-- method 1, Oracle
SELECT
d.Name AS Department,
t1.Name AS Employee,
t1.Salary AS Salary
FROM
(
SELECT
e.Id, e.Name, e.Salary, e.DepartmentId,
RANK() OVER (PARTITION BY e.DepartmentId ORDER BY e.Salary DESC) AS... |
alter table customers
drop constraint FK_8ty10pw947q1idxbhrm6sw3yr;
alter table items
drop constraint FK_av4mlxut8m30ehlvx8n8v8w8n;
alter table items
drop constraint FK_ioqq7ta9p1ewxjrdwe9p3duc1;
alter table orders
drop constraint FK_astys1dv61mdlp0n0wx0574r2;
dr... |
Create Procedure mERP_sp_Update_InvProcess_XMLAck(@RecdInvID int, @Status Int)
As
Begin
Update tbl_mERP_RecdDocAck Set ProcessAckStatus = @Status, ProcessAckDateTime =GetDate()
Where DocTrackID = (Select Top 1 IsNull(RecdXMLAckDocID,0) as ID From InvoiceAbstractReceived Where InvoiceID = @RecdInvID)
And IsNull(P... |
ALTER TABLE `#__md_tower` ADD `mod_user_id` INT(11) NULL AFTER `incl_corresp`, ADD `mod_date` TIMESTAMP NULL AFTER `mod_user_id`;
--
-- Table structure for table `#__md_tower_history`
--
CREATE TABLE IF NOT EXISTS `#__md_tower_history` (
`history_id` int(11) NOT NULL AUTO_INCREMENT,
`id` int(3) NOT NULL,
`dist... |
-- phpMyAdmin SQL Dump
-- version 4.4.15.7
-- http://www.phpmyadmin.net
--
-- Хост: 127.0.0.1:3306
-- Время создания: Янв 31 2017 г., 19:49
-- Версия сервера: 5.6.31
-- Версия PHP: 5.6.23
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT *... |
CREATE TABLE PERSONS(
id INT not null IDENTITY(1,1) ,
personFirstName varchar(25),
personSecondName varchar(25),
personThirdName varchar(25),
personFamilyName varchar(25),
personSex number,
personStatus number,
... |
insert into users values(1, 'jake', 'bern', 'xxxx', 20);
insert into users values(2, 'George', 'Goldstein', 'xxxx', 20);
insert into users values(3, 'Billy', 'Maise', 'xxxx', 19);
|
CREATE procedure sp_acc_get_Others_CreditNote(@DocumentID int)
as
select AccountsMaster.AccountID, AccountsMaster.AccountName, NoteValue, DocumentDate, Memo,
DocumentID, DocRef,
case
When Status & 64 <> 0 Then dbo.LookupDictionaryItem('Cancelled',Default)
When Memo <> N'' and status is null and isn... |
-- sample SQL statements for the NodeMeta
CREATE TABLE NodeMeta (
id int,
user_id int,
update_time ,
session_id int,
class_id int,
)
|
set echo on;
col sql_redo format a160
col container_name format a16
set lines 200
select container_name, commit_scn, sql_redo from replicated_txns order by id,commit_scn;
|
--修改日期:2012.12.5
--修改人:李程
--修改内容:用途代码名为“信贷管理”,不符合系统格式,也不利于维护。本脚本将系统原有的用途代码为“信贷管理”的数据更新为系统默认的自增长的用途代码。
--修改原因:user00035746广州建筑-信贷管理用途维护问题。
DECLARE
VN_COUNT NUMBER;
BEGIN
select COUNT(*)
INTO VN_COUNT
from cms_pl_purpose
where purpose_code = '信贷管理';
IF VN_COUNT > 0 THEN
LOOP
Exit When(VN_COUNT=0);
... |
-- MySQL dump 10.13 Distrib 5.6.27, for osx10.8 (x86_64)
--
-- Host: localhost Database: muse_dev
-- ------------------------------------------------------
-- Server version 5.6.27-enterprise-commercial-advanced
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESUL... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.