text stringlengths 6 9.38M |
|---|
BEGIN TRANSACTION;
DROP TABLE IF EXISTS p2p_message;
CREATE TABLE p2p_message (
"id" INTEGER PRIMARY KEY,
"message_id" TEXT,
"response_id" TEXT,
"message_name" TEXT,
"message" TEXT,
"queue" TEXT,
"is_ingoing" INTEGER,
"out_sender" TEXT,
"out_is_delivered" INTEGER,
"out_delivery_a... |
/*https://platform.stratascratch.com/coding-question?id=10026&python=*/
select distinct(winery)
from winemag_p1
where description ilike '%plum%'
OR description ilike '%cherry%'
OR description ilike '%rose%'
OR description ilike '%hazelnut%'; |
SET SERVEROUTPUT ON;
DECLARE
v_name VARCHAR2(30);
-- Declare the cursor
CURSOR cur_Example IS
SELECT ENAME FROM EMP
WHERE EMPNO < 7700;
BEGIN
OPEN cur_Example;
LOOP
FETCH cur_Example INTO v_name;
DBMS_OUTPUT.PUT_LINE(v_name);
EXIT WHEN cur_Example%NOTFOUND;
END LOOP;
CLOSE cur_Example;
END... |
-- MySQL dump 10.13 Distrib 8.0.19, for Win64 (x86_64)
--
-- Host: localhost Database: ticket_reservation_backend
-- ------------------------------------------------------
-- Server version 8.0.19
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_... |
CREATE TABLE IF NOT EXISTS test (
item_id SERIAL PRIMARY KEY,
item_name VARCHAR(50) NOT NULL,
item_desc VARCHAR(50) NOT NULL,
created TIMESTAMP NOT NULL
); |
drop database if exists red12;
create database red12;
use red12;
create table users(
id int primary key not null auto_increment,
username varchar(50) not null,
password varchar(50) not null,
email varchar(50)
);
insert into users(username,password,email) values ("testuser01","123","red1@hoge.ne.jp");
... |
DROP DATABASE IF EXISTS Testing_System_Assignment_2;
CREATE DATABASE Testing_System_Assignment_2;
USE Testing_System_Assignment_2;
-- ghi chú: 1
-- ghi chú: 1
DROP TABLE IF EXISTS department;
CREATE TABLE IF NOT EXISTS department (
department_id tinyint unsigned primary key auto_increment,
department_name nvarc... |
DELIMITER $$
DROP PROCEDURE IF EXISTS `cosmos`.`insertArgBefore`$$
CREATE
/*[DEFINER = { user | CURRENT_USER }]*/
PROCEDURE `cosmos`.`insertArgBefore`(IN domain VARCHAR(100), IN command VARCHAR(100), IN argIndex INT, IN name VARCHAR(50), IN inOutType VARCHAR(20), IN converter VARCHAR(50), IN remark VARCHAR(... |
--@exclude_input=bqxef;
--@exclude_output=avwaefrwagqbw;
INSERT
overwrite TABLE avwaefrwagqbw partition (pt)
SELECT a.zxbw
, a.xbax
, a.brand
, a.cpu
, a.xx_x3
, a.nwxus
, a.xbax xbax_first
, a.xbax xbax_first
, b.xbax xbax_last
, b.xbax xbax_last
, first_time
, l... |
select animal_id
from animal_ins
where 1 = 1
and name is null
order by animal_id
; |
alter table ctc.it_eventfilemounts
add event_type varchar(30) default null
update ctc.it_eventfilemounts
set event_type = 'student_event'
CREATE TABLE [ctc].[it_event_attend_stage_parents](
[field1] [varchar](max) NULL,
[field2] [varchar](max) NULL,
[field3] [varchar](max) NULL,
[field4] [varchar](max) NULL
) |
select SYSDATETIME() --The time zone offset is not included.
select SYSDATETIMEOFFSET ( ) --The time zone offset is included.
select SYSUTCDATETIME ( ) --The date and time is returned as UTC time (Coordinated Universal Time).
-- Lower-Precision System Date and Time Functions
select CURRENT_TIMESTAMP -- The time zone... |
USE tienda_libros;
SELECT
libro.idlibro AS Identificador,
libro.titulo AS Titulo,
categoria.categoria AS Categoria
FROM
libro,
libro_has_subcategoria,
subcategoria,
categoria
WHERE
libro.idlibro = libro_has_subcategoria.idlibro
AND libro_has_subcategoria.idsubcategoria = subcate... |
-- phpMyAdmin SQL Dump
-- version 4.3.11
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Jul 08, 2015 at 03:52 PM
-- Server version: 5.6.24
-- PHP Version: 5.6.8
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
... |
/*
Project Option: Coyote Residence Office
TEAM: King James & The Knights of the Data Table
CREATED BY: Daniel Urbach
*/
CREATE TABLE Instructor (
Instructor_Name VARCHAR2(100) /*PK*/
CONSTRAINT Instructor_PK PRIMARY KEY,
Instructor_Email VARCHAR2(60)
CONSTRAINT Instructor_Email_NN NOT NULL,
Instructor_Phone VARCHAR... |
/*
Platform: SQL Server
Created by: Andrew Martin
Region: TEAM Schools
Brief description:
College status by cohort, with student detail/audit strings
Using the XML techniques listed here for string aggregation:
https://www.simple-talk.com/sql/t-sql-programming/concatenating-row-values-in-transact-sql/
Also worth loo... |
USE majorLeagueBaseball;
LOCK TABLES farm_team WRITE;
SET foreign_key_checks = 0;
INSERT INTO farm_team VALUES
('Grizzlies', 'AAA', 'Fresno, CA', '0-0', '1800 Tulare Street Fresno, CA', 'Giants'),
('River Cats', 'AAA', 'Sacramento, CA', '0-0', '400 Ballpark Drive West Sacramento, CA', 'Athletics'),
('51s', 'AAA', 'L... |
/* Create database */
CREATE DATABASE registration
WITH OWNER = DEFAULT
ENCODING = 'UTF8'
TABLESPACE = DEFAULT
LC_COLLATE = 'en_US.UTF-8'
LC_CTYPE = 'en_US.UTF-8'
CONNECTION LIMIT = -1;
|
-- phpMyAdmin SQL Dump
-- version 4.0.10deb1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jan 15, 2015 at 06:17 PM
-- Server version: 5.5.40-0ubuntu0.14.04.1
-- PHP Version: 5.5.9-1ubuntu4.5
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CL... |
-- --------------------------------------------------------
-- -
-- Table Structure `assignment`
-- -
CREATE TABLE `assignment` (
`assignment_id` int(11) NOT NULL default 0,
`room_id` int(11) NOT NULL default 0,
`body_id` int(11) NOT NULL default 0,
`assignment_name` varchar(255)... |
/*==============================================================*/
/* DBMS name: SAP SQL Anywhere 16 */
/* Created on: 26/10/2021 2:23:49 p. m. */
/*==============================================================*/
if exists(select 1 from sys.sysforeignkey where ro... |
SELECT
DISTINCT name AS "Customer Support Manager"
FROM
demo.sales_reps
{% form %}
Customer Support Manager:
type: multiselect
default: Renetta Carew
options:
values: Customer Support Manager
labels: Customer Support Manager
{% endform %} |
-- phpMyAdmin SQL Dump
-- version 4.0.10.14
-- http://www.phpmyadmin.net
--
-- Host: localhost:3306
-- Generation Time: Dec 13, 2016 at 12:59 PM
-- Server version: 5.6.30-cll-lve
-- PHP Version: 5.6.20
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTE... |
/* Retrieve the home phone number, zipcode for customer 'charles K Eagle'. */
select home_phone, zipcode
from customers
where fname='Charles'
and minit='K'
and lname='Eagle'
/ |
SELECT
*,
SAFE_DIVIDE(feedback_available, #calculate various metrics which are proportions of other metrics. SAFE_DIVIDE handles the legitimate cases where the denominator is zero, passing null instead of failing in these cases.
vacancies_published) AS response_rate,
SAFE_DIVIDE(hires_through_tv,
feedback... |
# Author: Jasper, Camilla, Ferhat, Gustav, Elias
# GRP. 25
# 14/03-2021
# deletes the schema if it exist, so its possible to keep exicuting for testing.
# Create schema, and makeing sure the script is using that schema.
drop schema if exists quiz;
create schema quiz;
use quiz;
# Creates our tables with PK, FK and... |
with source_data as (
select
state_id
, state_name
, state_abbr
, state_region
/* Stitch extration */
, _sdc_extracted_at as last_elt_extract
, _sdc_received_at
, _sdc_sequence
, _sdc_batched_at
, _sdc... |
CREATE TABLE Sam3_Despacho(
[DespachoID] [int] Primary key IDENTITY(1,1) NOT NULL,
[ProyectoID] [int] NOT NULL,
[OrdenTrabajoSpoolID] [int] NOT NULL,
[MaterialSpoolID] [int] NOT NULL,
[NumeroUnicoID] [int] NOT NULL,
[SalidaInventarioID] [int] NOT NULL,
[Segmento] [nchar](1) NULL,
[EsEquivalente] [bit] NOT NULL... |
CREATE TABLE SHORT.LONK(
URL TEXT NOT NULL,
NAME VARCHAR(40) PRIMARY KEY NOT NULL
);
|
-- phpMyAdmin SQL Dump
-- version 4.1.14
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: 27-Abr-2015 às 17:00
-- 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 */;... |
-- database: presto; groups: tpch; tables: orders,lineitem
SELECT l_shipmode,
sum(CASE
WHEN o_orderpriority = '1-URGENT'
OR o_orderpriority = '2-HIGH'
THEN 1
ELSE 0
END) AS high_line_count,
sum(CASE
WHEN o_orderp... |
create policy transaction_select_all on transaction for
select using (true);
|
create or replace procedure DWH_DROP_WAREHOUSE as
BEGIN
FOR i IN (SELECT owner,table_name FROM all_tables where owner = 'MG_DWH' and table_name like 'RPT_%')
LOOP
EXECUTE IMMEDIATE('DROP TABLE ' || i.owner || '.' || i.table_name || ' CASCADE CONSTRAINTS');
END LOOP;
END; |
ALTER TABLE EKSTERN_VARSEL_KVITTERING
MODIFY MELDING varchar2(1024); |
DELETE FROM Movie
DELETE FROM Person
DELETE FROM Movie_Cast
DELETE FROM Movie_Director
DELETE FROM MovieAward
select top 100000 * from Movie order by publication_year desc
select top 100000 * from Person where lastname IS NOT NULL
select top 100000 * from Movie_Cast WHERE Movie_Cast.person_id IN (select top 100000 P... |
SELECT w.Id, w.Name,l.Name,e.Explanation, w1.Name,l1.Name, e1.Explanation FROM Words w
JOIN Translations t ON w.Id = t.WordId
JOIN Words w1 ON w1.Id = t.TranslationId
JOIN Explanations e ON e.Id = w.ExplanationId
JOIN Explanations e1 ON e1.Id = w1.ExplanationId
JOIN Languages l ON w.LanguageId = l.Id
JOIN Languages l1... |
CREATE TABLE IF NOT EXISTS fileLog (
id uuid,
fileNo text,
title text,
markFrom text,
markTo text,
markDate timestamp,
updateDate timestamp,
comment text,
PRIMARY KEY(id)
);
|
-- 262. 行程和用户
-- SQL架构
CREATE TABLE IF NOT EXISTS Trips (
Id INT,
Client_Id INT,
Driver_Id INT,
City_Id INT,
STATUS ENUM('completed', 'cancelled_by_driver', 'cancelled_by_client'),
Request_at VARCHAR(50)
);
CREATE TABLE IF NOT EXISTS trips (
Users_Id INT,
Banned VARCHAR(50),
Role ENUM('clie... |
-- SQL Required to get set up with the project
-- database config is in the application.properties
-- db default name is book_store
CREATE TABLE "owners"
(
"id" SERIAL PRIMARY KEY,
"name" VARCHAR(100)
);
CREATE TABLE "pets"
(
"id" SERIAL PRIMARY KEY,
"name" VARCHAR (100),
"type" VARCHAR (100),
"co... |
-- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- Хост: 127.0.0.1
-- Время создания: Май 13 2019 г., 15:12
-- Версия сервера: 10.1.38-MariaDB
-- Версия PHP: 7.3.4
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHAR... |
-- phpMyAdmin SQL Dump
-- version 4.9.1
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Nov 03, 2019 at 12:20 PM
-- Server version: 10.4.8-MariaDB
-- PHP Version: 7.3.10
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD... |
-- t_preset
DROP TABLE IF EXISTS t_preset;
CREATE TABLE t_preset
(
id bigint NOT NULL AUTO_INCREMENT,
dev_id char(36) NOT NULL COMMENT '设备id',
pre_value varchar(36) NOT NULL COMMENT '预置位值',
name varchar(128) NOT NULL COMMENT '预置位名称',
del_flag tinyint(1) unsigned NOT NULL COMMENT '删除标志',
add_time timestamp ... |
create role matchaadmin password 'matchapass';
ALTER ROLE matchaadmin WITH LOGIN;
CREATE DATABASE matchadb OWNER matchaadmin; |
-- Ensure core code scheme exists
INSERT IGNORE INTO concept (document, id, name, description)
VALUES (1, 'CM_DiscoveryCode', 'Discovery code', 'Discovery (core) coding scheme ');
-- Get scheme id
SELECT @scm := dbid FROM concept WHERE id = 'CM_DiscoveryCode';
-- Ensure NHS DD scheme exists --
INSERT IGNORE INTO conc... |
SELECT
--A.枝番
A.BRANCH_ID,
--A.契約番号
A.CONTRACT_NO AS C_CONTRACT_NO,
--A.回数
A.COUPON AS C_COUPON,
--A.回数連番
A.COUPON_SEQ AS C_COUPON_SEQ,
--回収種別名
CASE WHEN A.WITHDRAW_CASUS = CAST(/*dto.otherTypeCode*/ AS CHAR(2))
AND VIEWREQUESTINFO.WITHDRAW_CASUS_OTHER_NAME IS NOT NULL
THEN B.CODE_NAME + '(... |
--@Autor(es): Hector Espino Rojas, Néstor Martínez Ostoa
--@Fecha creación: 15/06/2020
--@Descripción: Escenarios con usos de tablas externas.
---
--- Configuracion previa
---
prompt configurando directorios para tablas externas;
prompt conectando como sys;
connect sys as sysdba;
prompt creando directorio... |
有一种情况就是,点位正常运行,但是状态显示为黄色,维修中等状态
UPDATE ems_pole SET STATUS='using' WHERE ID IN (
select A.ID from ems_pole a
where a.status='hitch'
and not exists (select * from ems_task b where a.id=b.pole_id and b.status!='complete')
AND exists (select * from ems_task b WHERE a.id=b.pole_id and b.status='complete' AND B.TYPE... |
CREATE DATABASE IF NOT EXISTS movies;
USE movies;
-- DROP TABLE IF EXISTS movies;
CREATE TABLE IF NOT EXISTS movies (
id INTEGER,
title VARCHAR(100),
year VARCHAR(4),
overview TEXT(250),
rating DECIMAL(6,4),
thumbnail VARCHAR(250),
genre VARCHAR(30),
watched ... |
-- This file should undo anything in `up.sql`
-- down.sql
DROP TABLE USER_ROLES;
DROP TABLE TICKET_ASSIGNMENTS;
DROP TABLE COMMENTS;
DROP TABLE TICKETS;
DROP TABLE STATUSES;
DROP TABLE SYSTEMS;
DROP TABLE ROLES;
DROP TABLE USERS;
DROP TABLE AUDITS; |
/*
Navicat Premium Data Transfer
Source Server : duodian
Source Server Type : MySQL
Source Server Version : 50634
Source Host : rds7b1n6yxdvko77nhv6o.mysql.rds.aliyuncs.com
Source Database : admore
Target Server Type : MySQL
Target Server Version : 50634
File Encoding : ... |
SELECT
count(*)
FROM
FINANCIAL_STATEMENTS_IMPORT
WHERE
CUSTOMER_CODE = /*dto.customerCode*/'' AND
DELETE_FLG = /*reportInvalidFlgValid*/'0' AND
SETTLEMENT_MONTH > /*settlementMonth*/''
|
CREATE TABLE `options` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`value` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `options` (`name`, `value`) VALUES
('speed',15000);
CREATE TABLE `posts` (
`id` varchar(40) NOT NULL,
`timestam... |
--Create a SQL statement that will select the invoices that have more than three items and will also give
--us total price of every of such invoices.
SELECT i.Id, i.CustomerName, i.IssueDate, Count(i.Id) as count, SUM(ii.Price) as sum
FROM Invoice as i
INNER JOIN InvoiceItem as ii
ON i.Id = ii.InvoiceId
GROUP ... |
/*
Navicat MySQL Data Transfer
Source Server : Aion Engine
Source Server Version : 50141
Source Host : localhost:3306
Source Database : aion_cms
Target Server Type : MYSQL
Target Server Version : 50141
File Encoding : 65001
Date: 2010-11-20 12:50:29
*/
SET FOREIGN_K... |
CREATE OR REPLACE VIEW CAT_MAT_ELEMENT AS
SELECT SET_ELEMENT_MAT (ID_GMAT) id,
INITCAP(ID_GMAT) descript,
null link
FROM NS_MATARO.CAT_POU_GRAONS_MATERIAL
UNION
SELECT SET_ELEMENT_MAT (ID_TMAT) id,
INITCAP(ID_TMAT) ... |
CREATE TABLE Users (
UserID INT,
LastName VARCHAR(50),
FirstName VARCHAR(50),
ADDRESS VARCHAR(200),
CITY VARCHAR(100));
|
-- Your SQL goes here
CREATE TABLE interaction_history (
id BIGSERIAL,
user_id BIGSERIAL REFERENCES users(id),
enjoyed_interaction BOOL,
start_time TIMESTAMP NOT NULL,
end_time TIMESTAMP ,
mode text REFERENCES game_modes (valid_mode) ON UPDATE CASCADE NOT NULL,
PRIMARY KEY(id, user_id)
); |
DROP TABLE IF EXISTS `vessel`;
CREATE TABLE `vessel`
(
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` VARCHAR(100) NOT NULL,
`mmsi` CHAR(9) NOT NULL COMMENT ' Maritime Mobile Service Identity (MMSI)',
`imo` CHAR(7) NOT NULL COMMENT ' International ... |
SELECT (roles->>'roleCategory')::text AS category,
count(*) AS count
FROM general_settings gs,
jsonb_array_elements(gs.data) roles
JOIN user_data ud ON LOWER((ud.profile->'roleCategory'->>'value')::text) = LOWER((roles->>'originalRole')::text)
JOIN "user" u ON u.research_entity = u... |
SELECT COUNT(C.CONTRACT_NO) FROM (
SELECT A.CONTRACT_NO FROM
(
SELECT
--契約番号
B.CONTRACT_NO,
--MAX(繰上返済関連回数) AS 繰上返済関連回数
MAX(B.PREPAYMENT_KEY) AS PREPAYMENT_KEY
FROM
--一括消込結果状態VIEW
VIEW_NEGATION_RESULT_DATA B
WHERE
--一括消込結果状態VIEW.セッションID = 当前セッションID
B.SESSION_ID = /*sessionId*/''
... |
SELECT DNUM AS TICKET,
IEAN AS EAN,
ICOD AS MODELO,
AICANTF AS VENTA_EN_UNIDADES,
AICOSTO * 1.16 AS COSTO_C_IVA,
AICOSTO * AICANTF * 1.16 AS COSTO_TOTAL,
AIPRECIO * 1.16 AS PRECIO_C_IVA,
AIPRECIO * AICANTF AS PRECIO_TOTAL,
FAM3.FAMDESCR AS TIPO,
IF(FAM5.FAMDESCR='IRON MAIDEN','GLOBAL IRON MAIDEN',
IF(FAM8.F... |
alter table wallets
add column turnover_bonus_monthly bigint not null;
|
ALTER TABLE account ADD COLUMN is_admin BOOLEAN DEFAULT FALSE; |
-- 15/09/2018 - Update balances
ALTER TABLE `costs` ADD `payment_type` VARCHAR(20) COLLATE utf8_general_ci DEFAULT 'cash' AFTER `amount`; |
-- phpMyAdmin SQL Dump
-- version 4.9.0.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Oct 16, 2019 at 06:10 AM
-- Server version: 10.3.16-MariaDB
-- PHP Version: 7.3.7
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @O... |
/*create table person
(
id int,
name varchar(20),
location varchar(30),
dob timestamp,
primary key(id)
);*/
insert into person (id,name,location,dob)
values (1001,'Anantha','Trivandrum',sysdate());
insert into person (id,name,location,dob)
values (1002,'Anjitha','Kochi',sysdate());
insert into person (id,name,locatio... |
DELIMITER &&
-- -----------------------------------------------------
-- procedure sp_CreatePlayer
-- -----------------------------------------------------
CREATE PROCEDURE sp_CreatePlayer(IN p_username varchar(45) , IN p_password varchar(45), IN p_firstName varchar(45) , IN p_lastname varchar(45), IN p_email varc... |
SELECT p.name
FROM people p
INNER JOIN stars s
ON s.person_id = p.id
INNER JOIN movies m
ON m.id = s.movie_id
WHERE m.title = 'Toy Story'; |
--- currencies ---
INSERT INTO currencies(id, code, description) VALUES(1, 'INR', 'Indian Rupees');
INSERT INTO currencies(id, code, description) VALUES(2, 'USD', 'US Dollars');
--- books ---
INSERT INTO books(id, title, price, description, currency_id) VALUES(1, 'Book 1', 200, 'Book 1', 1);
INSERT INTO books(id, titl... |
Insert into T_MCRE0_ETL_CALLER (CALLER,SQL_ORD,SQL_TEXT,STEP,FLG_EXEC,LAST_UPDATE_DATE,NOTE) values ('load_cr_ge_gb','4','insert into T_MCRE0_DAY_CGEG
select DTA_RIFERIMENTO_CR,
VAL_ACC_CR_GE,
VAL_ACC_SIS_GE,
VAL_GAR_CR_GE,
VAL_GAR_SIS_GE,
VAL_SCO_CR_... |
-- +goose Up
-- SQL in section 'Up' is executed when this migration is applied
create table if not exists contents (
id serial8 PRIMARY KEY,
mime varchar (50),
name varchar (100),
link_url varchar (1000),
thumbnail_url varchar (1000),
width int2,
height int2,
size ... |
/* Based on DDL scripts in https://github.com/tdongsi/databases/tree/master/sql/create */
/* Drop the database if it exists */
/* Drop the tables if they already exists */
/* Create the database */
/* Create the schema for the tables */
/* Populate the tables with data */
|
-- Table definitions for the tournament project.
--
-- Put your SQL 'create table' statements in this file; also 'create view'
-- statements if you choose to use it.
--
-- You can write comments in this file by starting them with two dashes, like
-- these lines here.
-- database name: tournament
-- CREATE DATABASE to... |
CREATE TABLE `contacto` (
`id` int(11) NOT NULL,
`nombre` varchar(30) COLLATE utf8_bin NOT NULL,
`email` varchar(20) COLLATE utf8_bin NOT NULL,
`mensaje` text COLLATE utf8_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
ALTER TABLE `contacto`
ADD PRIMARY KEY (`id`);
ALTER TABLE `contac... |
CREATE TEMPORARY TABLE DIAMOND_CU4800_1 AS
WITH C0_CU4800_1 AS (
SELECT * FROM tb_sensor_unified WHERE maxrotorspeed IS NOT NULL
),
C1_CU4800_1 AS (
SELECT dFrom, dTo
FROM (
SELECT datetime as dFrom,
LEAD(datetime, 1) OVER (ORDER BY datetime) AS dTo,
maxrotorspeed AS currRs,
LEAD(maxrotorspeed, 1) OVER (ORDER BY dat... |
--table SI
INSERT INTO public.si (id_si, nom_si) VALUES(1, 'SIPI');
INSERT INTO public.si (id_si, nom_si) VALUES(2, 'Siebel');
--table env: api RED
INSERT INTO public.env (id_env, nom_env, lib_env, flag_isobsolete, flag_anonym) VALUES(1, 'TCOR','Environnement test correctif',false, false);
INSERT INTO public.env (id_e... |
-- test data for todo app
TRUNCATE TABLE lists RESTART IDENTITY CASCADE;
INSERT INTO lists (name) VALUES ('Homework');
INSERT INTO lists (name) VALUES ('Groceries');
INSERT INTO todos (name, list_id) VALUES ('Math', 1);
INSERT INTO todos (name, list_id) VALUES ('Science', 1);
INSERT INTO todos (name, completed, list... |
# Write your MySQL query statement below
# need to left join Product table to calculate amount
# use group by to sum amounts for each user and product
# use rank to find the product id with highest amounts
# report only the rows with rank=1
with tbl_amt as
(select user_id, product_id, sum(quantity*price) as amt
... |
drop table if exists PatientRoom;
CREATE TABLE PatientRoom (
roomNumber integer,
patientID integer,
PRIMARY KEY (roomNumber),
FOREIGN KEY (patientID) REFERENCES Patient (patientID)
);
|
-- GROUP BY
select item_id, count(*)
from sales
group by item_id; |
SELECT --objects AND columns
CASE WHEN ob.parent_object_id>0
THEN OBJECT_SCHEMA_NAME(ob.parent_object_id)
+ '.'+OBJECT_NAME(ob.parent_object_id)+'.'+ob.name
ELSE OBJECT_SCHEMA_NAME(ob.object_id)+'.'+ob.name END
+ CASE WHEN ep.minor_id>0 THEN '.'+col.name ELSE '' END AS path,
'schema'+ CASE WHEN ob.parent_objec... |
INSERT INTO public.xphone_devs(name, email, key, create_time, last_login_time)
VALUES ('test', 'test@ginno.com', 'xphone', '1999-01-08 04:05:06', '1999-01-08 04:05:06');
INSERT INTO public.xphone_versions(type, version, url, release_time, release_dev_id)
VALUES ('OS', '1.0.1', 'https://d19sohnjnsw0y4.cloudfront.net/OS... |
CREATE ENDPOINT [SmoBaselineVerification_ServiceBrokerEndpoint]
AUTHORIZATION [Redmond\SqlCL01]
STATE = STOPPED
AS TCP (
LISTENER_PORT = 1338,
LISTENER_IP = ALL
)
FOR SERVICE_BROKER (
AUTHENTICATION = WINDOWS NEGOTIATE,
ENCRYPTION = REQUIRED A... |
# Suppression de monde : recuperation des documents concernes
SELECT `filename_document` FROM `document` AS `d`
WHERE (
SELECT COUNT(*) FROM `type_doc_document` AS `tdd`
WHERE
`tdd`.`fk_document` = `d`.`filename_document`
AND `tdd`.`fk_client` = :client
AND `tdd`.`fk_monde` = :monde
) > 0
|
select l.nome as "Logradouro", b.nome as "Bairro",c.nome as "Cidade", e.sigla as "Sigla", c.cep as "CEP", l.cep as "CEP",
l.complemento as "Complemento" from estados as e
inner join cidades as c on c.estado_sigla=e.sigla
left join bairros as b on b.cidade_id = c.id
left join logradouros as l on l.bai... |
CREATE TABLE `user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(64) NULL,
`type` enum('normal', 'anonymous', 'admin') NOT NULL DEFAULT 'normal',
`is_deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:active, 1:deleted',
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
PRIMARY KEY ... |
-- phpMyAdmin SQL Dump
-- version 4.2.3
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jan 26, 2015 at 10:15 AM
-- Server version: 5.6.19
-- 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 */;
... |
-- Rename the planned transfer tables (see #384) and adjusts them in such a
-- way that planned transfers with equal values are shared (to reduce the
-- number of stored transfers). Also adds a type column to the planned worklist
-- table to simplify type determination in workflows in which the type is
-- unknown.
-- T... |
CREATE TABLE proyecto.planta_4_lab
(
ID_UTC TEXT
, ID_CENTRO TEXT
, TIPO_DE_US DOUBLE PRECISION
, ID_EDIFICIO SMALLINT
, ID_PLANTA SMALLINT
, ILUMINACION TEXT
, PUERTAS TEXT
, TEMPERATURA DOUBLE PRECISION
, TEMPERATURAOBJETIVO DOUBLE PRECISION
, LOCATIONX FLOAT
, LOCATIONY FLOAT
)
;
SELECT AddGeometryColumn('proyecto... |
/*
* Pour exectuter ce fichier.
* 1. Avoir mysql comme commande reconnu.
* Sinon remplacer la commande par le chemin vers l'executable
* de votre environnement
* 2. Etre dans le dossier CityAlert_Web/dbSetup
* Sinon, remplacer le fichier par le chemin du fichier sur votre ordinateur.
* 3. Executer
* mysql
* ... |
create table admin.post (
id serial not null primary key,
title text not null,
body text,
img text,
posted_at timestamp default now()
);
alter table admin.post add column is_public boolean default true;
CREATE INDEX on admin.post (is_public) where (is_public = True);
create unique index on admin.post (id);
crea... |
use vk;
INSERT INTO `users` (`id`, `firstname`, `lastname`, `email`, `phone`)
VALUES ('58', 'Dean', 'Satterfield', 'ooo@ooo.net', '89269999999');
INSERT INTO `users` (`id`, `firstname`, `lastname`, `email`, `phone`)
VALUES ('59', 'Dean', 'Satterfield', 'ooo2@ooo.net', '89268888888');
INSERT INTO `users` VALUES
('5',... |
CREATE TABLE DBC_LOCK
(
INTERFACE_ID VARCHAR(64) NOT NULL,
USE_FLAG CHAR(1) NOT NULL,
NODE_ID VARCHAR(64),
LOCK_TIME CHAR(14),
CONSTRAINT DBC_LOCK_PK
PRIMARY KEY
(INTERFACE_ID)
);
CREATE TABLE BATCH_LOCK
(
INTERFACE_ID VARCHAR(64) NOT NULL,
USE_FLAG CHAR(1... |
with source as (
select * from {{ source('data_lake_silver', 'order_reviews') }}
)
select
review_id::varchar,
order_id::varchar,
review_score::int,
review_comment_title::varchar,
review_comment_message::varchar,
review_creation_date::date,
review_answer_timestamp::timestamp
from source |
DROP TABLE IF EXISTS notices;
CREATE TABLE IF NOT EXISTS notices (
gid BIGINT UNSIGNED NOT NULL UNIQUE,
rolegid BIGINT UNSIGNED NOT NULL,
already_read INT UNSIGNED NOT NULL,
notice BLOB NOT NULL,
INDEX (rolegid)
)
CHARACTER SET = utf8
ENGINE = InnoDB;
DELIMITER $$
DROP PROCEDURE IF EXISTS add_notice$$
CREATE PROCEDUR... |
SELECT week( curdate( ) ) , curdate( )
# Jobangebote dieses Monats
SELECT CONCAT( year( curdate( ) ), '-', month( curdate( ) ), '-01'), curdate( )
SELECT CONCAT(year( curdate( ) ), '-', month( curdate( ) ), '-01'), STR_TO_DATE(CONCAT(year( curdate( ) ), '-', month( curdate( ) ), '-01'),'%Y-%m-%d');
SELECT CONCAT(y... |
DECLARE
v_salary NUMBER(8);
BEGIN
SELECT SAL INTO v_salary FROM EMP
WHERE EMPNO = 7839;
DBMS_OUTPUT.PUT_LINE(v_salary);
END;
/
DECLARE
v_salary NUMBER(8);
v_ename VARCHAR2(20);
BEGIN
SELECT SAL,ENAME INTO v_salary,v_ename FROM EMP
WHERE EMPNO = 7839;
DBMS_OUTPUT.PUT_LINE(v_ename || ' has salaray ' |... |
-- admin@lenovo.com - DDZgrdah
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`name` VARCHAR(100),
`email` VARCHAR(50) NOT NULL,
`password` VARCHAR(50),
`gender` VARCHAR(10),
`phone` VARCHAR(20),
`birthday` DATE,
`address` TEXT,
`identity` TEXT,
`facebook_i... |
DROP TABLE IF EXISTS tb_products;
CREATE TABLE tb_products (
id int auto_increment primary key,
num int not null,
gbn varchar(6) not null,
title varchar(200),
price int not null,
qty int not null
);
INSERT INTO tb_products
(num, gbn, title, price, qty)
VALUES
('16374', '... |
SELECT *
FROM TB_ComprobanteCompra;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.