text stringlengths 6 9.38M |
|---|
-- File: slow_query_report.sql
-- the query extracts run time statistics of all SQL queries that took more than 2 seconds, in the last 5 hours, grouped by the user defined query labels
Select request_label ,user_name,request,pct_90, median,avg,max, number_of_runs, number_of_runs_above_sec
from
(
select
request_label ,
... |
CREATE PROCEDURE [actual].[pDel_core_country]
AS
TRUNCATE TABLE [actual].[core_country] |
SELECT movies.title FROM movies
JOIN stars ON movies.id = stars.movie_id
JOIN people ON people.id = stars.person_id
JOIN ratings ON ratings.movie_id = movies.id
WHERE people.name = "Chadwick Boseman"
ORDER BY ratings.rating DESC
LIMIT 5; |
CREATE DATABASE cadastro;
USE cadastro;
CREATE TABLE cadastro(
IdCadastro
Nome VARCHAR (100) NOT NULL,
RG VARCHAR(20),
CPF VARCHAR(20),
Idade INT
);
CREATE TABLE cursos
IdCursos INT IDENTITY PRIMARY KEY NOT NULL,
curso VARCHAR(50) NOT NULL
|
INSERT INTO `starwars`.`perfil`
(`idperfil`,
`nome`)
VALUES
(1,
"administrador");
INSERT INTO `starwars`.`perfil`
(`idperfil`,
`nome`)
VALUES
(2,
"usuario"); |
-- set term and feed off then back on when calling
col utracefile new_value utracefile format a100
select value utracefile from v$diag_info where name = 'Default Trace File'
/
|
-- phpMyAdmin SQL Dump
-- version 4.8.3
-- https://www.phpmyadmin.net/
--
-- Хост: 127.0.0.1:3306
-- Час створення: Лют 21 2019 р., 10:38
-- Версія сервера: 5.6.41
-- Версія PHP: 5.5.38
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTE... |
USE city_life_db
INSERT INTO apt_search
(street, home_type, rooms, price, summary)
VALUES
("3036 S Denison Ave", "Single Level","Two Bedroom", "430,000", "A lovely two bedroom house, across the street from the local Airforce base. Located close to the Port of LA."),
("3036 S Denison Ave", "Single ... |
CREATE Procedure sp_list_InvAdjustments
As
Select AdjustmentReference.AdjustmentReasonID, dbo.lookupdictionaryItem( AdjustmentReason.Reason,default) as Reason,
Sum(Case AdjustmentReference.DocumentType
When 5 Then
0 - Balance
Else
Balance
End) From AdjustmentReference, AdjustmentReason
Where AdjustmentReference.Adjustm... |
ALTER TABLE
empresas
MODIFY cnpj VARCHAR(14);
INSERT INTO empresas
(nome, cnpj)
VALUES
('Itau', 95694186000132),
('Santander', 27887145800146),
('Zup', 12488107000146);
DESC empresas; -- descreve a tabela
SELECT * FROM empresas;
SELECT * FROM cidades;
INSERT INTO
empresas_unidades
VALUES
... |
-- phpMyAdmin SQL Dump
-- version 5.1.0
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Czas generowania: 14 Cze 2021, 15:42
-- Wersja serwera: 10.4.19-MariaDB
-- Wersja PHP: 8.0.6
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CH... |
CREATE DATABASE buildEvents;
USE buildEvents;
CREATE TABLE eventTypes (
typeID int PRIMARY KEY NOT NULL UNIQUE AUTO_INCREMENT,
type VARCHAR(15),
eventPrice int,
typeBookable bit
);
CREATE TABLE eventLocations (
locationID int PRIMARY KEY NOT NULL UNIQUE AUTO_INCREMENT,
city VARCHAR(20)
);
CREATE ... |
/*
SQLyog Ultimate v10.00 Beta1
MySQL - 5.5.36
说明:添加意见反馈表sys_feedback
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;
CREATE TABLE `sys_feedback` (
`id` VARCHAR(64) COLLATE utf8_unicode_ci NOT NULL COMMENT 'ID',
`version` VARCHAR(64) COLLATE utf8_unicode_ci NOT... |
CREATE PROCEDURE mERP_sp_Reopen_RecdInvoice(@RecdInvID INT)
AS
Update InvoiceAbstractReceived Set Status = 0 where InvoiceID = @RecdInvID
Update InvoiceDetailReceived Set Pending = Quantity where InvoiceID = @RecdInvID
|
CREATE DATABASE CarsDB;
USE CarsDB;
SELECT * FROM Car; |
-- phpMyAdmin SQL Dump
-- version 3.2.4
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Mar 09, 2012 at 03:25 PM
-- Server version: 5.1.41
-- PHP Version: 5.3.1
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_S... |
USE SQLBusinessIntelligence
SELECT * FROM TEST
|
SELECT count(*) FROM InvoiceLine WHERE InvoiceId="37"
|
/*
Navicat MySQL Data Transfer
Source Server : 127.0.0.1_3306
Source Server Version : 50718
Source Host : 127.0.0.1:3306
Source Database : logistics
Target Server Type : MYSQL
Target Server Version : 50718
File Encoding : 65001
Date: 2018-11-20 09:41:25
*/
SET FOREIGN_KEY_CHECKS=0... |
select NODE.NODE_ID,
NODE.NODE_NAME
from NODE
where NODE.NODE_TYPE = 'SF'
order by NODE_ID |
CREATE TABLE `reinze`.`rsnews` (
`id` INT NOT NULL AUTO_INCREMENT,
`title` VARCHAR(255) NOT NULL,
`url` VARCHAR(125) NOT NULL,
`hash_id` VARCHAR(5) NOT NULL,
`created_at` TIMESTAMP NOT NULL DEFAULT now(),
`runescape` ENUM("oldschool", "runescape3") NOT NULL,
PRIMARY KEY (`id`));
CREATE TABLE `reinze`.`ne... |
/* Emulate CHECK constraint with default expression (since MySQL 8.0.13) */
CREATE TABLE chk_w_defexpr (
id INT AUTO_INCREMENT,
val INT,
val_check INT DEFAULT (IF(val > 0, val, NULL)) NOT NULL,
CONSTRAINT PRIMARY KEY (id)
);
/* Query OK, 0 rows affected */
INSERT INTO chk_w_defexpr (val) VALUES (10);
/* Query... |
Create procedure mERP_sp_CatHandler_ListCustomerMapping
(@SalesManList nVarchar(Max),
@BeatList nVarchar(Max),
@Active Int,
@MapFilter Int)
as
Begin
Create Table #TmpSalesManID(SalesmanID Int)
Create Table #TmpBeatID(BeatID Int)
Create table #tmpCatHandler(Serial Int,
... |
-- INSERT INTO reservations (guest_id, property_id, start_date, end_date)
-- VALUES (1, 1, '2018-09-11', '2018-09-26'),
-- (2, 2, '2019-01-04', '2019-02-01'),
-- (3, 3, '2021-10-01', '2021-10-14');
INSERT INTO users (name, email, password)
VALUES ('Heyo Joe', 'areyouexperienced@electriclady.com', '$2a$10$FB/BOAVhpuLv... |
INSERT INTO burgers (burger_name, devoured) VALUES ('Double bacon Cheeseburger', false);
INSERT INTO burgers (burger_name, devoured) VALUES ('Triple bacon Cheeseburger', false);
INSERT INTO burgers (burger_name, devoured) VALUES ('Quadruple bacon Cheeseburger', true);
INSERT INTO burgers (burger_name, devoured) VALUES ... |
-- Drops the bamazon_db if it exists currently --
DROP DATABASE IF EXISTS bamazon_DB;
-- Creates the "animals_db" database --
CREATE DATABASE bamazon_DB;
-- Makes it so all of the following code will affect animals_db --
USE bamazon_DB;
-- Creates the table "people" within animals_db --
CREATE TABLE products (
item... |
CREATE DATABASE bamazon_db;
USE bamazon_db;
CREATE TABLE products(
itemId INT NOT NULL AUTO_INCREMENT,
productName VARCHAR(45) NULL,
deptName VARCHAR(45) NULL,
price INTEGER(6),
quanity INTEGER(6),
PRIMARY KEY (`itemId`));
INSERT INTO products (itemId,productName,deptName,price) VALUES ('001','frisbee','sports','5.0... |
INSERT INTO city (id, name, state) VALUES(1, 'Garopaba', 'SC');
INSERT INTO city (id, name, state) VALUES(2, 'Flordenapolis', 'SC');
INSERT INTO city (id, name, state) VALUES(3, 'Florianopolis', 'SC');
INSERT INTO city (id, name, state) VALUES(4, 'Passo fundo', 'RS');
INSERT INTO city (id, name, state) VALUES(5, 'Caraz... |
SELECT * FROM cart
JOIN items ON items.item_id = cart.item_id
WHERE user_id = $1; |
/*
Created: 4/21/2013
Modified: 4/21/2013
Model: CarSurvey
Database: PostgreSQL 9.1
*/
-- Create tables section -------------------------------------------------
-- Table Questions
CREATE TABLE "Questions"(
"QuestionID" Bigint NOT NULL,
"QuestionDesc" Text NOT NULL,
"QuestionWeight" Numeric(6,2) DEF... |
CREATE OR REPLACE PACKAGE BODY reservation_info AS
procedure all_resv_info
IS
CURSOR resv_cursor is
select * from reservation;
BEGIN
for cur in resv_cursor loop
DBMS_OUTPUT.PUT_LINE('이름 : ' || cur.resv_name);
DBMS_OUTPUT.PUT_LINE('어른 인원 : ' || cur.resv_adult);
DBMS_OUTPUT.PUT_LINE('어린이 인원 : ' || cur.resv_... |
INSERT INTO GG_MS_ROLE (PK_ROLE, NAME) VALUES(226, 'TEST ROLE4');
INSERT INTO GG_MS_ROLE (PK_ROLE, NAME) VALUES(227, 'TEST ROLE5');
INSERT INTO GG_MS_ROLE (PK_ROLE, NAME) VALUES(228, 'TEST ROLE6'); |
-- phpMyAdmin SQL Dump
-- version 4.1.14
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: 02-Jul-2020 às 14:51
-- Versão do servidor: 5.6.17
-- PHP Version: 5.5.12
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;... |
prompt Taking a &1 second snapshot...
@@snapper "stats,gather=s,sinclude=redo size" &1 1 "select sid from v$session"
|
col called_object format a40
col caller_object format a40
set linesize 200 trimspool on
set pagesize 100
with dep_recurse (
owner
, name
, type
, referenced_owner
, referenced_name
, referenced_type
, referenced_link_name
, dependency_type
, lvl
, idx
) as (
select
d.owner
, d.name
, d.type
, d.r... |
set line 200
col cclass_name format a50
select
cclass_name
, num_requests
, num_hits
, num_misses
, num_waits
--, wait_time -- reserved for future use
--, client_req_timeouts -- reserved for future use
, num_authentications
from V$CPOOL_CC_STATS
where num_requests > 0
order by cclass_name
/
|
select * from conference_event ce
JOIN conference_eventbooking cevb on ce.id = cevb.event_id
JOIN conference_talk ctk on ctk.id = ce.talk_id
where ce.talk_id=1279;
select * from conference_eventbooking where event_id = 2199;
select cf.*, ap.*, ao.* from conference_ticket ct
join conference_fare cf on cf.id=c... |
select * from pt999 where menuid like '2503%' order by menuid for update
select * from sstranscode where id like
select a.jsde940,a.czde941,a.jsde090,a.jsde019,jsde999,a.jsde014,a.jsde047,a.id,a.de011,a.mc,b.de061 ks,a.lx,a.lb,a.hzbz,c.jsde908 lrr,a.lrdate,a.ks as ksdm
from jxjdjhb a ,cs061 b,jscs007 c where a.de01... |
DROP FUNCTION hostname();
|
/* Создание таблицы действий */
CREATE TABLE /*PREFIX*/ACTIONS
(
ACTION_ID VARCHAR(32) NOT NULL,
NAME VARCHAR(100) NOT NULL,
DESCRIPTION VARCHAR(250),
PROC_DETECT VARCHAR(100),
FONT_COLOR INTEGER,
BRUSH_COLOR INTEGER,
PERIOD INTEGER,
PRIORITY INTEGER,
PRIMARY KEY (ACTION_ID)
)
--
/* Создание просмо... |
WITH cte1 AS (
SELECT
c.CLM_NBR
,f.EXPO_NBR
,(c.CLM_NBR || f.EXPO_NBR) AS FEATURE_KEY
,c.SRC_SYS_ID
,c.SRC_SYS_ORGN_CD
,uw.UW_CMPY_CD
,uw.UW_CMPY_NM
,c.POL_SUBTYP
FROM EDW_CLM.WCL_CLM c
INNER JOIN EDW_CLM.WCL_EXPO f ON f.CLM_NBR = c.CLM_NBR
INNER JOIN EDW_REFDATA.WRD_UW_CMPY_MAP uwm ON uwm.UW_CMPY_MAP_ID ... |
/* Load data into redshift from csv*/
drop table if exists jyazman.horserace;
create table jyazman.horserace (
respondent_id varchar(100)
, district varchar(100)
, poll_id varchar(100)
, w_lv float
, w_rv float
, phone_type varchar(100)
, response varchar(100)
... |
SELECT MAX(login_time) AS [Last Login Time], login_name [Login]
FROM sys.dm_exec_sessions
GROUP BY login_name; |
/* ==================================================================== <HEADER>
Source : lijst_van_vragen.sql
Description :
======================================================================== <NOTES>
Werkt niet altijd, alleen met lijsten zonder subvragen? Uitzoeken.
========================================... |
INSERT INTO core_available_module_structure_type_param_type(id,paramtype)
VALUES
(1,'text');
update core_available_module_structure_type_param_type set myid=id;
|
select `orderkey`, `discount`, dense_rank() over (order by `discount`), rank() over (order by `discount` range between unbounded_preceding and current_row)
from `tpch`.`tiny`.`lineitem`
where `partkey` = 272 |
create table syohin(
syohinId int(3) auto_increment,
user_mail varchar(30) not null,
Artist varchar(100) not null,
cdname varchar(100) not null,
nedan varchar(10000) not null,
img varchar(300) not null,
bgm varchar(300) not null,
primary key(syohinId)
);
insert into syohin(user_mail,Ar... |
select
sub.repo_group,
sub.actor,
count(distinct sub.id) as comments
from (
select 'htop_commenters,' || r.repo_group as repo_group,
t.dup_actor_login as actor,
t.id
from
gha_repos r,
gha_comments t
where
{{period:t.created_at}}
and t.dup_repo_id = r.id
and t.dup_repo_name = r.na... |
-- 修改日期:20130222
-- 修改人:梁铭利
--修改内容:云南白药加票据录入打印功能
create table BIS_EXC_INPUT
(
VOUCHER_NO CHAR(10) not null,
CBS_BILL_NO VARCHAR2(20),
COUNTER_ACC VARCHAR2(50),
REQ_DATE DATE,
BIF_CODE CHAR(4),
PAYER_ACC_NO VARCHAR2(30),
PAYER_BANK_NAME VARCHAR2(14... |
CREATE TABLE CART(
C_ID VARCHAR2(10) ,
C_COUNT NUMBER ,
C_CODE VARCHAR2(10) ,
C_PRICE NUMBER,
C_GPRICE NUMBER ,
C_NAME VARCHAR2(100)
)
SELECT * FROM CART;
insert into cart_test values('admin',1,0)
select * from cart_test c, product p where c.c_code = p.p_code;
select
p.p_image,
c.c_no,
c.c_id,
p.p_c... |
DROP DATABASE IF EXISTS bamazon_DB;
CREATE DATABASE bamazon_DB;
USE bamazon_DB;
CREATE TABLE products(
item_id INT NOT NULL,
product_name VARCHAR(70) NOT NULL,
department_name VARCHAR(70) NOT NULL,
price DECIMAL (8,2) NOT NULL,
stock_quantity INT NOT NULL,
PRIMARY KEY (item_id)
);
INSERT INTO products (p... |
set echo on;
set serveroutput on;
CREATE OR REPLACE PROCEDURE prc_inv_delete (INV_NUM IN NUMBER)
IS
BEGIN
DELETE from INVOICE where INV_NUMBER = INV_NUM;
END;
/
commit;
select * from invoice where inv_number in (1001,1008);
select * from line where inv_number in (1001,1008);
exec prc_inv_delete(1001);
exec prc_inv_... |
SHOW tables;
SELECT * FROM t_member;
SELECT ROWNUM, t_board.* FROM t_board ORDER BY regdate DESC;
--ROWNUM (의사 칼럼)
SELECT ROWNUM AS 순번, board.*
FROM (SELECT * FROM t_board ORDER BY regdate DESC) board
WHERE ROWNUM BETWEEN 1 AND 10; --rownum은 1부터 시작하므로 1무조건 포함
select * from(
SELECT ROWNUM num, board... |
CREATE TABLE `product_tbl`
(
`product_id` bigint(15) NOT NULL AUTO_INCREMENT,
`title_fld` varchar(255) NOT NULL,
`cost_fld` int(11) DEFAULT NULL,
PRIMARY KEY (`product_id`)
) ;
insert into product_tbl (title_fld, cost_fld) values ('Boots',5499),
('Hat',1499),
('Car',255499),
('Cookies',199),
('Phone'... |
CREATE PROCEDURE sp_view_receivedso_DocLU (@FromDocID int,
@ToDocID int)
AS
Select SOAbstractReceived.VendorID, Vendors.Vendor_Name, SOAbstractReceived.SONumber,
SOAbstractReceived.SODate, Value, Status, DocumentID from SOAbstractReceived, Vendors
where Vendors.VendorID = SOAbstractReceived.VendorID
and (dbo.Get... |
CREATE TABLE shoes (
id SERIAL PRIMARY KEY,
name VARCHAR(80),
cost INTEGER
);
INSERT INTO shoes (name, cost)
VALUES ('Nike Air Pegasus', 65),
('Red Wing', 250),
('Saucony', 40);
INSERT INTO shoes (name, cost)
VALUES ('Nike Air Pegasus', 65);
SELECT * FROM shoes; |
drop table if exists api_orderstatus_option;
drop table if exists api_orderstatus_file;
drop table if exists api_orderstatus_history;
drop table if exists api_orderstatus_tpl;
drop table if exists api_orderstatus_macros;
drop table if exists api_orderstatus_sms_gateway;
drop table if exists api_orderstatus_sms_history;... |
CREATE TABLE `users` (
`remember_token` varchar(100) NOT NULL,
`name` varchar(100) NOT NULL,
`email` varchar(100) NOT NULL,
`password` varchar(45) NOT NULL,
`user_id` int(100) NOT NULL AUTO_INCREMENT,
`nick_name` varchar(100) DEFAULT NULL,
`updated_at` datetime NOT NULL,
`created_at` datetime NOT NULL,
... |
--
CREATE VIEW S_ARTICLES
AS
SELECT A.ARTICLE_ID,
A.ACCOUNT_ID,
A.SUBJECT_ID,
A.DATE_CREATE,
A.SECTION,
A.DATE_ARTICLE,
A.TITLE,
A.EXCERPT,
CONVERT(A.ARTICLE_TEXT USING cp1251) ARTICLE_TEXT,
A.PICTURE,
A.LINK,
... |
-- MySQL dump 10.13 Distrib 5.1.49, for debian-linux-gnu (x86_64)
--
-- Host: localhost Database: carpenter
-- ------------------------------------------------------
-- Server version 5.1.49-1ubuntu8.1
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARA... |
INSERT INTO burgers (doneness, meat_id, buns_id) VALUES ('medium-rare', 1, 1);
INSERT INTO cheese_join (burgers_id, cheese_id) VALUES (3, 1);
INSERT INTO toppings_join (burgers_id, toppings_id) VALUES (3, 2);
INSERT INTO toppings_join (burgers_id, toppings_id) VALUES (3, 12);
INSERT INTO toppings_join (burgers_id, topp... |
CREATE TABLE slids (
sid int unsigned NOT NULL DEFAULT '0',
heading varchar(200),
sub varchar(200),
link varchar(500),
img varchar(500),
PRIMARY KEY (sid)
) ENGINE=InnoDB; |
USE Gringotts
--01
SELECT COUNT(Id) AS [TotalRecords]
FROM WizzardDeposits
--02
SELECT MAX(MagicWandSize) AS [LongestMagicWand]
FROM WizzardDeposits
--03
SELECT DepositGroup,MAX(MagicWandSize)
FROM WizzardDeposits
GROUP BY DepositGroup
--04
SELECT TOP(2) ... |
--liquibase formatted sql
--changeset andre.moreira:2020-07-08_13-44.sql labels:1.0.1
DROP SEQUENCE IF EXISTS sq_usuario;
DROP SEQUENCE IF EXISTS sq_usuario_aud;
DROP TABLE IF EXISTS usuario;
DROP TABLE IF EXISTS usuario_aud;
CREATE SEQUENCE sq_usuario
INCREMENT BY 1
MINVALUE 1
MAXVALUE 9223372036854775807
START ... |
CREATE TABLE IF NOT EXISTS public.user
(id int not null primary key,
username varchar(30) not null);
CREATE TABLE IF NOT EXISTS public.repository
(id int not null primary key,
name varchar(50) not null,
user_id int not null,
url varchar(60),
size int,
stargazers int,
watchers int,
... |
CREATE VIEW TestView2
AS
SELECT * from MyTable |
-- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Apr 17, 2019 at 09:49 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... |
SET SERVEROUTPUT ON
BEGIN
pkg_unit_testing.prc_add_employee_test;
pkg_unit_testing.prc_adjust_emp_test;
pkg_unit_testing.prc_remove_employee_test;
pkg_unit_testing.prc_add_department_test;
pkg_unit_testing.prc_adjust_dep_test;
pkg_unit_testing.prc_remove_department_test;
END;
|
# patch_61_62_b.sql
#
# Title: 'Synonym' field extension.
#
# Description:
# Extend field 'synonym' in 'external_synonym' table to 100 chars
# to support some very long synonyms in D. melanogaster.
ALTER table external_synonym MODIFY synonym VARCHAR(100) NOT NULL;
# Patch identifier
INSERT INTO meta (species_id, ... |
CREATE TABLE `user` (
id int not null auto_increment primary key,
avatar varchar(500) not null,
username varchar(250) not null,
email varchar(250) not null,
phone varchar(250),
password varchar(250) not null,
isactive tinyint(1) not null default 1,
lastupd... |
-- SQLite
INSERT INTO posts (id, user_id, title, description, deleted_at, created_at, updated_at)
VALUES ("",1,"Test","Test","","",""); |
--QUEARY FOR SQL-CHALLENGE
--queary to display employee details(1)
select E."EMP_NO", E."LAST_NAME", E."FIRST_NAME", E."SEX", S."SALARY" FROM "EMPLOYEE" AS E, "SALARY" AS S
WHERE S."EMP_NO" = E."EMP_NO"
--QUEARY TO DISPLAY EMPLOYEE INFO HIRED IN 1986(2)
SELECT "FIRST_NAME", "LAST_NAME", "HIRE_DATE" FROM "EMPLOYEE"
... |
DROP TABLE acteur CASCADE CONSTRAINT;
DROP TABLE realisateur CASCADE CONSTRAINT;
DROP TABLE genre CASCADE CONSTRAINT;
DROP TABLE film CASCADE CONSTRAINT;
DROP TABLE jouer CASCADE CONSTRAINT;
CREATE TABLE acteur
(
idA CHARACTER(4) primary key,
nom CHARACTER(15),
prenom CHARACTER(15),
nationalite CHARACTER(15)
);
C... |
CREATE TABLE `Books` (
`ID` smallint(6) NOT NULL AUTO_INCREMENT,
`Name` varchar(20) DEFAULT NULL,
`Author_ID` smallint(6) DEFAULT NULL,
`Type` varchar(10) DEFAULT NULL,
`Description` varchar(20) DEFAULT NULL,
PRIMARY KEY (`ID`)
);
CREATE TABLE `Magazine` (
`IBBN` smallint(6) NOT NULL,
`B... |
-- subquery
-- 1)from 절의 서브 쿼리
select now() as n, sysdate() as b, 3 + 1 as c;
select *
from(select now() as n, sysdate() as b, 3 + 1 as c) s;
-- ex)현재 Fai Bale이 근무하는 부서에서 근무하는 직원의 사번, 전체 이름 출력
use employees;
select * from employees;
select b.dept_no
from employees a, dept_emp b
where a.emp_no = b.emp_no
and b.to_d... |
DROP TABLE IF EXISTS `task`; |
-- DropForeignKey
ALTER TABLE "answer" DROP CONSTRAINT "answer_choiceId_fkey";
-- AlterTable
ALTER TABLE "answer" ALTER COLUMN "choiceId" DROP NOT NULL;
-- AddForeignKey
ALTER TABLE "answer" ADD CONSTRAINT "answer_choiceId_fkey" FOREIGN KEY ("choiceId") REFERENCES "choice"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
Create Procedure mERP_sp_UpdateMarginFlag
As
Begin
If ((Select Count(*) From tbl_mERP_Margin_Log) > 0 )
Update tbl_mERP_ProcessStatus Set Status = 1 Where ProcessCode = 'MARGIN'
End
|
select max(rtime)
from insulin_carb_smoothed_2
where cgm is not null;
select count(*)
from insulin_carb_smoothed_2 as ics inner join realtime_cgm2 as rt using(rtime)
where rtime >= (select max(rtime) from insulin_carb_smoothed_2
where cgm is not null);
update insulin_carb_smoothed_2 as a inner join r... |
CREATE procedure sp_List_RevertStock(@InvoiceID as int)
as
select InvoiceDetail.Product_code, Batch_code, Quantity, Track_Inventory
from InvoiceDetail, Items, ItemCategories
where InvoiceID = @InvoiceID and
InvoiceDetail.Product_Code = Items.Product_Code and
Items.CategoryID = ItemCategories.CategoryID
|
--
-- Tabellenstruktur für Tabelle `user`
--
CREATE TABLE IF NOT EXISTS `user` (
`userID` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`email` varchar(100) NOT NULL,
`password` varchar(32) NOT NULL,
`passportID` varchar(100) NOT NULL,
`name` varchar(100) NOT NULL,
`firstName` varchar(100) NOT NULL,
... |
# What is the difference in days between the most recent and oldest order date in the Orders file?
SELECT DATEDIFF(
LEFT(MAX(orderDate),10),
LEFT(MIN(orderDate),10)
) FROM Orders |
-- Once you have a complete database, do the following:
-- List the following details of each employee: employee number, last name, first name, gender, and salary.
select e.emp_no, e.last_name, e.first_name, e.gender, s.salary
from employees as e
inner join salaries as s on (e.emp_no = s.emp_no);
-- List employees w... |
DELETE FROM qaqc_historic WHERE version = :'VERSION';
INSERT INTO qaqc_historic(
SELECT
:'VERSION',
SUM(CASE WHEN b_likely_occ_desc != '0' THEN 1 ELSE 0 END),
SUM(CASE WHEN b_large_alt_reduction != '0' THEN 1 ELSE 0 END),
SUM(CASE WHEN b_nonres_with_units != '0' THEN 1 ELSE 0 END),
SUM(CASE WHEN un... |
CREATE OR REPLACE PUBLIC SYNONYM ti_policies_pkg FOR orient.ti_policies_pkg; |
drop database if exists furumaHotel ;
create database furumaHotel;
use furumaHotel;
create table viTri(
idViTri int not null primary key,
tenViTri varchar(45) not null
);
insert into viTri
values
(1,'staff'),
(2,'Manager'),
(3,'Chief'),
(4,'Security'),
(5,'Lao cong');
create table trinhDo(
idTrinhDo int not null p... |
/*
3. Uma tabela que represente um varejo, contendo:
• ID do produto;
• Preço do produto;
• Categoria do produto ( Ex: quarto/sala / cozinha / banheiro)
• Nome produto;
*Importante a tabela também precisa ter 5 dados;
Para essa tabela considere fazer o SELECT que retorne:
• Todos os produtos que comecem com a letra ... |
-- 1. I want to know how many employees with each title were born after 1965-01-01.
select count(*) as 'Employees born after 1965-01-01', t.title as Title
from employees e
inner join titles t on e.emp_no = t.emp_no
where e.birth_date > '1965-01-01'
group by t.title;
-- 2. I want to know the average salary p... |
select member, facility, cost from (
select mem.firstname || ' ' || mem.surname as member, fac.name as facility,
case
when mem.memid = 0 then
book.slots * fac.guestcost
else
book.slots * fac.membercost
end as cost
from cd.members mem
inner join cd.bookings book
on mem.memid = book.memid
in... |
-- Creates database hbtn_0d_usa and the table cities on your MySQL server
CREATE DATABASE IF NOT EXISTS hbtn_0d_usa;
USE hbtn_0d_usa;
CREATE TABLE IF NOT EXISTS cities(`id` INT UNIQUE AUTO_INCREMENT NOT NULL,`state_id` INT NOT NULL,`name` VARCHAR(256),PRIMARY KEY(`id`),FOREIGN KEY(`state_id`) REFERENCES states(`id`));
|
DROP TABLE IF EXISTS queue_classic_jobs CASCADE;
DROP TABLE IF EXISTS queue_classic_workers CASCADE;
|
/* UPGRADE FROM 2.5 beta 7 */
/* pt_projects - add new column */
ALTER TABLE `pt_projects` ADD `reg_report` int(1) default NULL;
UPDATE `pt_projects` set `reg_report` = 0;
|
-- phpMyAdmin SQL Dump
-- version 3.2.0.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Aug 28, 2012 at 10:12 PM
-- Server version: 5.1.36
-- PHP Version: 5.3.0
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--
-- Database: `schema`
--
-- --------------------------------------------------------
--
-... |
CREATE TABLE `account` (
`account_id` BIGINT(20) NOT NULL AUTO_INCREMENT,
`last_name` VARCHAR(255) NULL DEFAULT '0',
`first_name` VARCHAR(255) NULL DEFAULT '0',
`registration_date` DATETIME NULL DEFAULT CURRENT_TIMESTAMP,
`image_profile` VARCHAR(255) NULL DEFAULT NULL,
PRIMARY KEY (`account_id`),
UNIQUE INDEX `a... |
/*
产品推荐
*/
delimiter $
drop trigger if exists Tgr_RecommendationAddress_AftereDelete $
create trigger Tgr_RecommendationAddress_AftereDelete after delete
on RecommendationAddress
for each row
begin
call Proc_Customers_LastRecommend(old.CustomerShortName);-- 客户资料-最近推荐
end$
/*恢复结束符为;*/
delimiter ; |
/*
Warnings:
- You are about to drop the column `instructorName` on the `FinishedCourses` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "Course" ADD COLUMN "instructorId" INTEGER;
-- AlterTable
ALTER TABLE "FinishedCourses" DROP COLUMN "instructorName",
ADD COLUMN "instruct... |
-- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Oct 30, 2017 at 10:54 AM
-- Server version: 5.7.19
-- PHP Version: 7.0.23
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
-- ------------------... |
CREATE TABLE IF NOT EXISTS Roles
(
RoleId BIGINT NOT NULL AUTO_INCREMENT,
Name VARCHAR(64) NOT NULL UNIQUE,
PRIMARY KEY (RoleId)
);
INSERT INTO Roles(Name)
VALUES ('ADMIN'),
('USER'),
('NOT_VERIFIED');
CREATE TABLE IF NOT EXISTS Users
(
UserId BIGINT NOT NULL AUTO_INCREMEN... |
-- Function: geomfromewkt(text)
-- DROP FUNCTION geomfromewkt(text);
CREATE OR REPLACE FUNCTION geomfromewkt(text)
RETURNS geometry AS
'$libdir/postgis-2.1', 'parse_WKT_lwgeom'
LANGUAGE c IMMUTABLE STRICT
COST 1; |
create table devices(
id serial primary key,
name varchar(255),
price float
);
create table people(
id serial primary key,
name varchar(255)
);
create table devices_people(
id serial primary key,
device_id int references devices(id),
people_id int references people(id)
)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.