text stringlengths 6 9.38M |
|---|
desc store;
--1번 학동점 정보입력
insert into STORE(store_no,store_name,store_businessTime,store_phone,store_address,store_deliveryPrice,jumun_estimatedTime,store_rating,jumun_no)
values(1,'학동점','00:00~23:59','02-515-1014','서울 강남구 학동로 171',3000,'15분~20분',null,null);
--2번 수서점 정보입력
insert into STORE(store_no,store_name,store_bus... |
# Report total payments for Atelier graphique.
SELECT SUM(amount) FROM Payments AS p
JOIN Customers AS c ON p.customerNumber=c.customerNumber
WHERE c.customerNumber = (
SELECT customerNumber FROM Customers WHERE customerName = 'Atelier graphique'
) |
SELECT DISTINCT ON
(i.id,priority) i.id,u.id AS user_id, user_name, user_phone, user_avatar,
item_category, item_title, item_price, item_description,
item_location, item_lat, item_lng, im.image_url, priority
FROM users u INNER JOIN
items i
ON u.id = i.user_id INNER JOIN
images im
ON im... |
DELETE FROM hibernate_sequence;
INSERT INTO hibernate_sequence(next_val) VALUE (10);
DELETE FROM message;
INSERT INTO message(id, text, tag, user_id) VALUES
(1, 'first', 'my-tag', 1),
(2, 'second', 'more', 1),
(3, 'third', 'my-tag', 1),
(4, 'fourth', 'another', 1);
# TODO reset indexes |
if (select count(*) from Tournaments) = 0
BEGIN
insert into Tournaments (Name) values ('Tournament 1'), ('Tournament 2')
END |
USE orders;
SELECT * FROM order_one;
-- Второе задание
SELECT MAX(o_date) FROM order_one;
SELECT MIN(o_date) FROM order_one;
-- Наблюдаемый периуд с 2001 по 2031
-- Третье задание
SELECT COUNT(DISTINCT(user_id)) AS users FROM order_one; -- количество пользлвателей 28,938
SELECT COUNT(*) FROM order_one; -- количеств... |
CREATE TABLE `user_op` (
`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'id,自增长',
`userId` varchar(36) CHARACTER SET utf8mb4 NOT NULL COMMENT 'userId',
`op` varchar(20) comment '行为',
`resourceId` varchar(36) CHARACTER SET utf8mb4 COMMENT '资源id',
`note` text COMMENT '备注',
`createTime` timestamp NOT NULL default CUR... |
USE burgers_db;
INSERT INTO eats (bName, eaten) VALUES ("Super Chicken Bacon", false);
INSERT INTO eats (bName, eaten) VALUES ("Veggie", true);
INSERT INTO eats (bName, eaten) VALUES ("Regular no toppings", false);
|
# --- !Ups
alter table section alter num type varchar(8);
alter table entry alter num type varchar(8);
# --- !Downs
alter table section alter num type int;
alter table entry alter num type int;
|
-- Produce a monotonically increasing numbered list of members, ordered by their date of joining. Remember that member IDs are not guaranteed to be sequential.
select count(*) over(order by joindate) as row_number,
firstname,
surname
from cd.members
order by joindate;
select row_number() over(order by joindate), firs... |
--修改日期:2012-11-09
--修改人:卢燕南
--修改内容:添加字段
--修改原因:中远——ZY-ZH-06
--添加字段
alter table bt_dictionary add stat number(10);
--添加字段注释
comment on column BT_DICTIONARY.stat is '状态';
commit;
|
-- Here we are creating a table called users. Note that we have created a priamry key user id and set it to auto_increment.
CREATE TABLE users (
userID MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT,
firstName VARCHAR(15) NOT NULL,
lastName VARCHAR(30) NOT NULL,
email VARCHAR(40) NOT NULL,
password CH... |
/* Part 1 */
create database mydb;
use mydb;
create table BUS(BusNo int primary key,
Origin varchar(100),
Dest varchar(100),
Rate int,
Km int
);
|
-- Banco de Dados SCHEMA
-- ________________
create database Eventos_Cientificos;
use Eventos_Cientificos;
-- Tabelas
-- _____________
create table APRESENTA (
cpf bigint not null,
codigo_atividade int not null,
constraint ID_APRESENTA_ID primary key (codigo_atividade, cpf));
create table APRESENTA... |
-- phpMyAdmin SQL Dump
-- version 4.9.1
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 22-01-2020 a las 19:21:40
-- Versión del servidor: 10.4.8-MariaDB
-- Versión de PHP: 7.1.33
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
... |
INSERT INTO `towns` (`id`,`name`) VALUES (1,'Sofia');
INSERT INTO `towns` (`id`,`name`) VALUES (2,'Plovdiv');
INSERT INTO `towns` (`id`,`name`) VALUES (3,'Varna');
INSERT INTO `minions` (`id`,`name`,`age`,`town_id`) VALUES (1,'Kevin',22,1);
INSERT INTO `minions` (`id`,`name`,`age`,`town_id`) VALUES (2,'Bob',15,3);
INS... |
-- --------------------------------------------------------
-- Host: 127.0.0.1
-- Server version: 10.2.9-MariaDB - mariadb.org binary distribution
-- Server OS: Win64
-- HeidiSQL Version: 9.4.0.5125
-- --------------------------------------------... |
~ Failed DROP can be ignored if necessary
drop table T_TEST if exists;
~ Create the demo.test table
create table T_TEST (NAME varchar(50) not null); |
ALTER USER root IDENTIFIED WITH mysql_native_password BY 'mamram';
CREATE DATABASE `core`;
USE `core`;
CREATE TABLE `boards` (
`board_id` INT(11) NOT NULL,
`title` VARCHAR(300) NOT NULL,
`createdAt` TIMESTAMP NULL DEFAULT NULL,
`updatedAt` TIMESTAMP NULL DEFAULT NULL,
PRIMARY KEY (`board_id`)
)... |
-- phpMyAdmin SQL Dump
-- version 4.8.0
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Mar 08, 2019 at 04:27 PM
-- Server version: 10.1.31-MariaDB
-- PHP Version: 7.2.4
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD... |
insert into product(id, title, price, inventorycount)
values(1, 'Racket', 20, 100);
insert into product(id, title, price, inventorycount)
values(2, 'Ball', 25, 500);
insert into product(id, title, price, inventorycount)
values(3, 'Rubber', 100, 10); |
CREATE TABLE etl.lut_divisa
(
id SERIAL NOT NULL PRIMARY KEY,
azienda_id INTEGER NOT NULL,
codice_sap VARCHAR(50) NOT NULL,
codice_gestionale INTEGER NOT NULL
);
INSERT INTO etl.lut_divisa (azienda_id, codice_sap, codice_gestionale) VALUES (1, 'EUR', 1);
INSERT INTO etl.lut_divisa (azienda_id, codice_sap, codice_g... |
-- MySQL dump 10.13 Distrib 8.0.21, for Win64 (x86_64)
--
-- Host: localhost Database: hackathon_alfa
-- ------------------------------------------------------
-- Server version 8.0.21
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS ... |
{DEFAULT @target_database = 'SJ_CLEAR_CDM4' }
USE [@target_database];
-- get SUMMARY
SELECT *
FROM MATCHING_TMP
|
CREATE TABLE AttachedFiles (
Id INT NOT NULL IDENTITY(1,1),
Name NVARCHAR(200),
MimeType NVARCHAR(200),
[Key] UNIQUEIDENTIFIER NOT NULL,
[Description] NVARCHAR(200)
CONSTRAINT PK_RegisterFiles PRIMARY KEY (Id)
);
|
CREATE TABLE IF NOT EXISTS drives (
uuid integer,
game_id integer,
first_play_id integer,
team varchar(3),
drive_number smallint,
how_obtained varchar(4),
quarter smallint,
minutes smallint,
seconds smallint,
starting_field_position smallint,
plays smallint,
successful_plays smallint,
rushing_first_downs s... |
1. Zbuduj zapytanie, które dla każdej podkategorii znajdzie liczbę produktów do niej należących.
Następnie utwórz ranking podkategorii ze względu liczbę na produktów.
/*V1
SELECT PROD_SUBCATEGORY,PROD_SUBCATEGORY_ID, COUNT(*),
RANK() OVER(ORDER BY COUNT(*) DESC) RANKING
FROM H_PRODUCTS
GROUP BY (PROD_SUBCATEGORY,PROD_... |
DROP DATABASE IF EXISTS webapp;
CREATE DATABASE webapp
CHARACTER SET utf8
COLLATE utf8_general_ci;
USE webapp;
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` int NOT NULL AUTO_INCREMENT,
`login` char(15) NOT NULL UNIQUE,
`password` char(15) NOT NULL,
`email` char(25) NOT NULL,
`role_id` int NOT... |
create database dbo4
default charset utf8;
show databases;
create table t_user (
id int primary key auto_increment,
username varchar(50)
);
|
/*
Navicat MySQL Data Transfer
Source Server : 张强本机mysql
Source Server Version : 50720
Source Host : localhost:3306
Source Database : zqmybatisplus
Target Server Type : MYSQL
Target Server Version : 50720
File Encoding : 65001
Date: 2020-11-17 11:05:52
*/
SET FOREIGN_KEY_CHECKS=0;... |
CREATE DEFINER=`root`@`localhost` PROCEDURE `editCustomer`(
IN customername VARCHAR(150),
IN customertypeid INT(11),
IN dateofbirth DATE,
IN mobileno VARCHAR(13),
IN emailaddress VARCHAR(100),
IN modifiedby VARCHAR(100),
IN id IN... |
insert into business_type(name) values
('CTO'),
('shinomantazh'),
('shop'),
('test');
insert into service_type(name, business_type_id) values
('body', (select id from business_type where name like 'CTO')),
('run', (select id from business_type where name like 'CTO')),
('engine', (select id from business_type where nam... |
USE classicmodels;
-- PREGUNTA 1
SELECT employeeNumber, lastName, firstName
FROM employees
WHERE firstName LIKE 'a%';
-- PREGUNTA 2
SELECT employeeNumber, lastName, firstName
FROM employees
WHERE firstName LIKE '%on';
-- PREGUNTA 3
SELECT employeeNumber, lastName, firstName
FROM employees
WHERE firstName LIKE '%on%';
-... |
/*The purchase funnel is:
Take the Style Quiz → Home Try-On → Purchase the Perfect Pair of Glasses
During the Home Try-On stage, we will be conducting an A/B Test:
50% of the users will get 3 pairs to try on
50% of the users will get 5 pairs to try on
Let’s find out whether or not users who get more pairs to try on... |
-- Your SQL goes here
CREATE TABLE jsonb_test (
id SERIAL PRIMARY KEY,
nullable JSONB,
not_nullable JSONB NOT NULL
);
|
/******** Commonly Used Functions for Time Series ***********/
--------------------- LAG() function ---------------------------
-- to reference rows relative to the currently processed rows.
-- LAG() looks backwards and allows us to compare condition with the previous nth row of current row.
SELECT dept_id, server_id... |
-- Usuarios mas populares
create table max_followers_trend (
followers int
);
insert into max_followers_trend (followers)
(select max(u.followers_count)
from app_user u
inner join app_tweet tt on (tt.author_id = u.id)
inner join app_trend at on (at.id = tt.trend_id)
group by tt.trend_id order by at.tweets_count... |
CREATE DEFINER=`root`@`localhost` PROCEDURE `Changer_Afficher_Sinistre`(IN Id_S INT,
IN afficher boolean)
BEGIN
IF afficher THEN
UPDATE sinistres
SET
afficher = 1
WHERE
id = Id_S;
ELSE
UPDATE sinistres
SET
afficher = 0
WHERE
i... |
insert into m_biodata(first_name,last_name) values ('Mulya','Prasetya'); |
-- phpMyAdmin SQL Dump
-- version 5.1.0
-- https://www.phpmyadmin.net/
--
-- Servidor: localhost
-- Tiempo de generación: 07-06-2021 a las 11:24:51
-- Versión del servidor: 5.7.33-0ubuntu0.16.04.1
-- Versión de PHP: 7.4.13
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 ... |
create database if not exists game;
use game;
create table if not exists user(
id int(11) not null auto_increment,
name varchar(255) not null default '',
gold int(11) not null default 0,
exp int(11) not null default 0,
diamond int(11) not null default 0,
vip_level int(11) not null default 0,
player_level int(1... |
insert into user (user_id, username, password, first_name, last_name, email) values
(1, 'csr_admin', '$2y$12$Je2nx4NYYQnZfUFqeEfWAekNwg0qBs1sZKA4ay70Ea39dItCxw6wW', 'admin', 'admin', 'admin@travel.com'),
(2, 'csr_tom', '$2y$12$mMgV9eakGVSZ3IxeSW7CR.5NrDmrvnqtsBzfz7uwZZU2PRJFa4L6a', 'Tom', 'Miles', 'tom.cook@travel.com'... |
BEGIN TRANSACTION;
UPDATE ref_quota
SET cpu_requests = 16, cpu_limits = 32
WHERE id = 'large';
END TRANSACTION;
|
SELECT product_title, product_cat
FROM products p
INNER JOIN categories c
ON p.product_cat=c.cat_id; |
-- jfdkf sfsdf sdfdsf sdfsdfs
CREATE TABLE IF NOT EXISTS unique_id(id NOT UNIQUE DEFAULT 1, name VARCHAR(@%^));
|
create or replace view v_zb003_cd as
(--用于至表单选择通知书。
select JSDE103,
JSDE104,
JSDE931,
DE156,
CZDE951,
CZDE181,
DE186,
DE062,
DE042,
DE084,
CZDE119,
JSDE802,
JSDE118,
JSDE108,
DE151 AS TZSBH,
CZDE182,
JSDE901,... |
-- phpMyAdmin SQL Dump
-- version 5.0.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Waktu pembuatan: 30 Sep 2021 pada 21.34
-- Versi server: 10.4.16-MariaDB
-- Versi PHP: 7.4.12
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@C... |
-- Paired Margaret & Aja
-- DEFINE YOUR DATABASE SCHEMA HERE
DROP TABLE IF EXISTS sales, customers, employees CASCADE;
CREATE TABLE customers (
id SERIAL PRIMARY KEY,
customer_name varchar(100) NOT NULL,
account_no varchar(100) NOT NULL
);
CREATE TABLE employees (
id SERIAL PRIMARY KEY,
employee_name varc... |
create or replace trigger check_date after
INSERT on reservation
FOR EACH ROW
DECLARE
checkIn reservation.resv_checkin%TYPE;
user_date_error EXCEPTION;
BEGIN
checkIn := :new.resv_checkin;
IF checkIn < SYSDATE THEN
RAISE user_date_error;
ELSE
DBMS_OUTPUT.PUT_LINE('예약을 환영합니다');
END IF;
EXCEPTION
WHEN user_date... |
-- --------------------------------------------------------
-- Host: localhost
-- Server version: 10.5.9-MariaDB - mariadb.org binary distribution
-- Server OS: Win64
-- HeidiSQL Version: 11.0.0.5919
-- ------------------------------------------------... |
/* insert transaction status */
INSERT INTO payment.transactionstatus
SELECT * FROM (SELECT 1, 'pending') a
WHERE NOT EXISTS (
SELECT * FROM payment.transactionstatus
WHERE status = 1 AND name = 'pending');
INSERT INTO payment.transactionstatus
SELECT * FROM (SELECT 2, 'cancelled') a
WHERE NOT EXISTS (
SELECT * FROM ... |
-- phpMyAdmin SQL Dump
-- version 4.4.12
-- http://www.phpmyadmin.net
--
-- Client : 127.0.0.1
-- Généré le : Mer 07 Octobre 2015 à 14:22
-- Version du serveur : 5.6.25
-- Version de PHP : 5.6.11
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_... |
-- phpMyAdmin SQL Dump
-- version 4.1.4
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: 27-Mar-2015 às 16:07
-- Versão do servidor: 5.6.15-log
-- PHP Version: 5.4.24
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT ... |
CREATE OR REPLACE PROCEDURE valideAge(profil VARCHAR2, jeu VARCHAR2) IS
dateJoueur DATE;
pegiJeu VARCHAR2(30);
CURSOR cJoueur IS SELECT date_naissance FROM joueur WHERE joueur.login=profil;
CURSOR cPegi IS SELECT pegi FROM jeu WHERE jeu.titre=jeu;
BEGIN
OPEN cPegi;
OPEN cJoueur;
FETCH cPegi INTO... |
DELIMITER $$
DROP VIEW IF EXISTS `flat_school_user`$$
CREATE ALGORITHM=UNDEFINED SQL SECURITY DEFINER VIEW `flat_school_user` AS (
SELECT
`su`.`id` AS `userId`,
`su`.`uid` AS `uid`,
`sc1`.`id` AS `schoolId`,
`sc1`.`name` AS `schoolName`
FROM ((`sys_user` `su`
JOIN `sys_office` `sc`)
JOIN `sys_offi... |
SELECT * FROM Timestamp_test_from;
|
DROP TABLE IF EXISTS AGGREGATE_tract_{{ decade }};
SELECT
YEARLY_devdb_{{ decade }}.bct{{ decade }}::TEXT,
SUM(comp2010ap) as comp2010ap,
{%- for year in years %}
SUM(comp{{ year }}) as comp{{year}},
{% endfor %}
-- SUM(since_cen10) as since_cen10,
SUM(filed) as filed,
S... |
create table active_user_per_service (
date varchar(8) NOT NULL,
VID int(8),
VI int (8),
VISMS int (8),
VIM int (8),
VMMS int (8),
VIMM int (8),
VIG int (8),
VLTE int (8),
VGG int (8),
TOTAL int (8)
) DEFAULT CHARACTER SET utf8;
create table active_user_per_operator ... |
DROP DATABASE IF EXISTS bamazon_DB;
CREATE DATABASE bamazon_DB;
USE bamazon_DB;
CREATE TABLE products (
item_id INT NOT NULL AUTO_INCREMENT,
product_name VARCHAR(200) NULL,
department_name VARCHAR(50) NULL,
price DECIMAL(10, 2),
stock_quantity INT,
PRIMARY KEY (id)
);
INSERT INTO products (product_name,... |
connect 'jdbc:derby://localhost:1527/matedu;user=root;password=root;create=true;';
create table usuario(
id int PRIMARY KEY GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),
email varchar(128) not null,
nombre varchar(128) not null,
password varchar(32) not null
);
create table material(... |
-- phpMyAdmin SQL Dump
-- version 4.7.9
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: May 22, 2018 at 10:39 AM
-- 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 Function merp_fn_Get_StockReconcile_ZeroBatch(@Product_Code nVarchar(50))
Returns @ZeroBatchInfo Table (Product_Code nVarchar(50) COLLATE SQL_Latin1_General_CP1_CI_AS, Batch_Number nVarchar(255) COLLATE SQL_Latin1_General_CP1_CI_AS)
As
Begin
Insert into @ZeroBatchInfo
Select Product_Code, IsNull(Ba... |
-- displays the top 3 of cities temperature during July and August ordered by temperature
SELECT city, SUM(value)/COUNT(city) AS avg_temp FROM temperatures
WHERE month IN (7, 8)
GROUP BY city ORDER BY avg_temp DESC LIMIT 3;
|
/* Создание процедуры генерации таблиц всех представлений */
CREATE PROCEDURE /*PREFIX*/R_PRESENTATIONS
(
)
BEGIN
DECLARE PRESENTATION_ID VARCHAR(32);
DECLARE DONE INTEGER DEFAULT 0;
DECLARE C1 CURSOR FOR SELECT P.PRESENTATION_ID
FROM /*PREFIX*/PRESENTATIONS P;
DECLARE CONTINUE HANDLER FOR NOT FOU... |
DROP TABLE plch_orders;
CREATE TABLE plch_orders
(
order_id INTEGER PRIMARY KEY
, order_date DATE
, status VARCHAR2 (100)
)
/
BEGIN
INSERT INTO plch_orders
VALUES (100, DATE '2010-01-15', 'CLOSED');
INSERT INTO plch_orders
VALUES (200, DATE '2010-11-15', 'OPEN');
... |
--test insert to an empty limitedCourse--
\echo '------test insert to an empty limitedCourse-------';
SELECT * FROM registrations WHERE course = 'TESLIM';
INSERT INTO registrations VALUES(101,'TESLIM');
INSERT INTO registrations VALUES(102,'TESLIM');
SELECT * FROM registrations WHERE course = 'TESLIM';
--test insert t... |
-- phpMyAdmin SQL Dump
-- version 4.0.4
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Nov 12, 2013 at 10:31 PM
-- Server version: 5.6.12-log
-- PHP Version: 5.4.16
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT ... |
create user SmartCoast@'%' identified by '123VORbei!';
grant all privileges on *.* to SmartCoast@'%';
flush privileges;
quit
|
with inv as
(
select w_warehouse_name
, w_warehouse_sk
, i_item_sk
, d_moy
, stdev
, mean,
case mean when 0 then null else stdev/mean end cov
from(
select w_warehouse_name
, w_warehouse_sk
... |
-- MySQL dump 10.13 Distrib 8.0.18, for Win64 (x86_64)
--
-- Host: localhost Database: psi_baza
-- ------------------------------------------------------
-- Server version 8.0.18
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*... |
-- phpMyAdmin SQL Dump
-- version 4.8.0.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Sep 15, 2018 at 09:45 AM
-- Server version: 10.1.32-MariaDB
-- PHP Version: 5.6.36
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @... |
-- SCHEMA MIGRATION: BEGIN
-- CREATE TABLES: BEGIN
CREATE TABLE images ( id TEXT NOT NULL PRIMARY KEY, value BLOB NOT NULL );
CREATE TABLE classes ( id TEXT NOT NULL PRIMARY KEY, name TEXT NOT NULL, parent_id TEXT, FOREIGN KEY (parent_id) REFERENCES classes(id) );
CREATE TABLE categories ( id TEXT NOT NULL PRIMARY KE... |
-- phpMyAdmin SQL Dump
-- version 4.4.0
-- http://www.phpmyadmin.net
--
-- Client : localhost:8889
-- Généré le : Mer 06 Juillet 2016 à 22:15
-- Version du serveur : 5.5.38
-- Version de PHP : 5.5.14
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
--
-- Base de données : `wizardalley`
--
--
--... |
CREATE procedure sp_acc_updateclosingbalance(@bankaccountid int,
@balancedate datetime,@debit decimal(18,6),@credit decimal(18,6),
@transactiondate datetime)
as
If exists(Select Top 1 BankAccountID from BankClosingBalance where BankAccountID = @bankaccountid
and dbo.stripdatefromtime(BalanceDate) = @balancedate)
Begin... |
-- Bot configuration schema
# --- !Ups
CREATE TABLE users (
id VARCHAR(255) NOT NULL,
first_name VARCHAR(255) NOT NULL,
last_name VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL
);
# --- !Downs
DROP TABLE if EXISTS users;
|
SELECT [Examiner's Supervisor], [Supervisor Name], [SupervisorEmail], COUNT([Supervisor Name])
FROM OSHA.dbo.OCE
WHERE [Supervisoremail] IS NULL
AND [Supervisor Name] <> ''
GROUP BY [Supervisor Name], [Examiner's Supervisor], [SupervisorEmail]
ORDER BY COUNT([Supervisor Name]) DESC |
/*
BSA Application Schema
David Tompkins
9.20.2007
*/
-- Evolution Genetic/Neural Schema
drop table if exists evolutions;
create table evolutions (
id int not null auto_increment,
type varchar(100) not null,
description varchar(100) not null,
start_at datetime null,
en... |
CREATE DATABASE books CHARACTER SET utf8 COLLATE utf8_general_ci;
use books;
-- DROP TABLE author;
-- DROP TABLE genre;
-- DROP TABLE book;
-- DROP TABLE comment;
CREATE TABLE IF NOT EXISTS author (
id VARCHAR(255) PRIMARY KEY,
first_name VARCHAR(100),
last_name VARCHAR(100)
) ENGINE=InnoDB;
CREATE INDEX author_... |
SELECT customerName as "Customer Name", CONCAT(employees.lastName, ", ", employees.firstName) as "Sales Rep Name"
FROM customers
INNER JOIN employees
ON customers.salesRepEmployeeNumber=employees.employeeNumber
ORDER BY customerName ASC
|
/*
Misc. query for finding any expression port using SUBSTR.
Can be extended for any inline SQL statements. Very useful.
Part of standardization project; also a tool shared with developers.
Informatica PC 9.6.1
*/
SELECT DISTINCT REP_ALL_MAPPINGS.SUBJECT_AREA
, REP_ALL_MAPPINGS.MAPPING_NAME
, REP_WIDGET_INST.WI... |
UPDATE Reports
SET CloseDate = GETDATE()
WHERE CloseDate IS NULL
DELETE Reports
WHERE StatusId=4 |
/*
Name : spGetIdForProgressEntry
Object Type: STORED PROCEDURE
Dependency :
TABLE:
- PROGRESS
STORED PROCEDURE :
- spGetObjectId
*/
use BIGGYM;
drop procedure if exists spGetIdForProgressEntry;
delimiter $$
create procedure spGetIdForProgres... |
DROP TABLE IF EXISTS db_version;
CREATE TABLE db_version (version INTEGER);
INSERT INTO db_version (version) VALUES (51);
DROP TABLE IF EXISTS user;
CREATE TABLE user (
id TEXT(50) PRIMARY KEY NOT NULL,
email TEXT,
name TEXT UNIQUE NOT NULL,
permissions_json TEXT NOT NULL
);
CREATE INDEX IF NOT EXISTS user_email_i... |
CREATE DEFINER=`dba`@`%` PROCEDURE `INCLUIR_ARTISTA`(OUT P_ID_ARTISTA INT,
IN P_ART_NOME VARCHAR(255),
IN P_ART_LINK_FOTO VARCHAR(500),
IN P_COMMIT CHAR(1),
OUT P_OK CHAR(1),
OUT P_RETORNO VARCHAR(2000))
INCLUIR_ARTI... |
# Write your MySQL query statement below
SELECT wt1.Id
FROM Weather wt1, Weather wt2
WHERE wt1.Temperature > wt2.Temperature AND
TO_DAYS(wt1.RecordDate)-TO_DAYS(wt2.RecordDate)=1; |
USE ResidentialLife
CREATE TABLE dbo.GuestLog(
GuestLogId INT IDENTITY(1,1) PRIMARY KEY,
GuestName VARCHAR(255) NOT NULL,
StudentId INT NOT NULL,
Guest_In DATETIME NOT NULL DEFAULT GETDATE(),
Guest_Out DATETIME,
FOREIGN KEY (StudentId) REFERENCES dbo.Resident(StudentId)
);
DROP TABLE dbo.Gu... |
CREATE procedure Sp_Acc_SaveCustDetails (@PriceListID Int,@BranchID nVarchar(50))
as
Insert into PriceListBranch (PriceListID,BranchID)
Values (@PriceListID,@BranchID)
|
SELECT
@year:=`year`,
@month:=`month`,
@customer:=`customer`,
IFNULL(sum(`value_rashod`),0) as rashod,
IFNULL(sum(`value_prihod`),0) as prihod,
( SELECT IFNULL(sum(`value`),0) as prihod FROM `income` where `customer` = @customer and (YEAR(`date`)<@year or (YEAR(`date`)=@year and MONTH(`date`)<=@month)) )
... |
CREATE TABLE persons
(
id BIGINT(20) PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(50) NOT NULL,
date_of_birth DATE NOT NULL,
cpf VARCHAR(11),
email VARCHAR(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
create database hemolines;
use hemolines;
create table cadastro (
idEmpresa int primary key auto_increment,
nomeEmpresa varchar (50),
email varchar (50),
telefone varchar (40),
nacionalidade varchar (40),
cnpj char (12)
);
insert into cadastro (nomeEmpresa, email, telefone, nacionalidade, cnpj) v... |
drop table BOARD_QNA CASCADE CONSTRAINTS;
create table BOARD_QNA(
QNA_NUM NUMBER NOT NULL, --글번호
QNA_PASS VARCHAR2(20) NOT NULL, --비밀번호
QNA_SUBJECT VARCHAR2(40) NOT NULL, --제목
USER_ID VARCHAR2(50) references member(USER_ID) on delete cascade, --아이디
USER_NICK... |
INSERT INTO "ORDER"(ID, USER_ID, PAYMENT, STATUS, ADDRESS) VALUES (1, 1, 100, 0, 'shenzhen futian');
INSERT INTO ORDER_ITEM(ORDER_ID, PRODUCT_ID, AMOUNT) VALUES (1, 1, 1);
|
LOAD DATA LOCAL INFILE 'data/Users.txt' INTO TABLE Users FIELDS TERMINATED BY ',';
LOAD DATA LOCAL INFILE 'data/Books.txt' INTO TABLE Books FIELDS TERMINATED BY ',';
LOAD DATA LOCAL INFILE 'data/Chapters.txt' INTO TABLE Chapters FIELDS TERMINATED BY ',';
LOAD DATA LOCAL INFILE 'data/Questions.txt' INTO TABLE Questions ... |
CREATE DEFINER=`root`@`localhost` PROCEDURE `VerifyUser`(IN typedEmailID VARCHAR(50),IN typedpassword VARCHAR(50),
OUT total INT)
BEGIN
SELECT COUNT(EmailID)
INTO total
FROM Users
WHERE EmailID=typedEmailID
AND Loginpassword=MD5(typedpassword);
insert userdetails(Firstname,Lastname,EmailID... |
-- Up
insert into tenant_types
values (1, 'LTD');
insert into tenant_types
values (2, 'SE');
insert into tenant_types
values (3, 'PE');
insert into tenants
values (1, 1, 'Организация 1', 'Типочек 1', 'Адрес 1', 'ИНН');
insert into contract_statuses
values (1, 'ACTIVE');
insert into contract_statuses
values (2, 'EXTE... |
-- MariaDB dump 10.19 Distrib 10.6.4-MariaDB, for Linux (x86_64)
--
-- Host: localhost Database: db_rent_car
-- ------------------------------------------------------
-- Server version 10.6.4-MariaDB
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACT... |
DELIMITER //
CREATE FUNCTION mask_inner(str VARCHAR(128), margin_left INTEGER, margin_right INTEGER)
RETURNS VARCHAR(128) CHARSET utf8
NO SQL
DETERMINISTIC
BEGIN
DECLARE str_len INTEGER DEFAULT LENGTH(str);
DECLARE res_str VARCHAR(128) DEFAULT '';
IF @mask_character IS NULL THEN
SET @... |
insert INTO area(idarea, nombre, descripcion) VALUES (1, 'matematicas', 'area de matematicas');
insert INTO area(idarea, nombre, descripcion) VALUES (2, 'algoritmos', 'area de algoritmos');
insert INTO area(idarea, nombre, descripcion) VALUES (3, 'redes', 'area de redes');
insert INTO asignatura(idasignatura, idarea... |
create or replace type fg as table of varchar2(50);
declare
text varchar2(50):=&text;
c number;
d varchar2(50);
n number:=4;
r varchar2(50);
x varchar2(50);
fgf fg;
begin
fgf:=fg();
fgf.extend(50);
for i in 1..length(text) loop
d:=substr(text,i,1);
if regexp_like(text,'^[[:upper:]]+$') the... |
DROP TABLE modules_jobs;
DROP TABLE modules;
DROP TYPE modules_status; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.