text stringlengths 6 9.38M |
|---|
SELECT CAST(LTRIM(SUBSTRING(PL.ord_no, 1, 6)) AS int) AS [PO #], AP.vend_name AS [VENDOR NAME], PL.item_no AS [ITEM NAME],
PL.item_desc_1 AS [ITEM DESCRIPTION], PL.qty_ordered AS [QTY ORDERED], PL.extra_8 AS [SHIP DATE], PL.user_def_fld_2 AS [DALLAS ETA],
PL.receipt_dt AS [RECEIPT DT],... |
-- USER1 화면 입니다.
----------------------------------------------------
-- 매입 매출 관리 프로젝트
---------------------------------------------------
-- 00 회사의 매입매출 관리 프로젝트를 수행하고 있다.
-- 이 회사는 기존에 액셀을 이용하여 거래처별 매입매출 관리를 수행해 왔는데
-- 최근 App 을 개발하여 데이터베이스 화 하고 관리를 수행하려 한다.
-- 액셀데이터를 받아서 DB로 보내기 위해 변환 작업을 수행하고 있다.
-- 액셀 매입매출 원장을 DB... |
--
-- Update sql for MailWizz EMA from version 1.3.8.7 to 1.3.8.8
--
--
-- Alter delivery_server table
--
ALTER TABLE `delivery_server` ADD `pause_after_send` INT(11) NOT NULL DEFAULT '0' AFTER `monthly_quota`;
ALTER TABLE `delivery_server` DROP `use_queue`;
-- -----------------------------------------------------
--... |
drop view eaadmin.software;
create view eaadmin.software
(
manufacturer_id,
software_category_id,
software_id,
software_name,
version,
priority,
level,
type,
change_justification,
comments,
remote_user,
record_time,
status,
vendor_managed,
product_role,
pid
)
as
(
selec... |
CREATE TABLE sites (
id uuid,
name varchar(40) unique,
healthcheck_endpoint varchar(255) unique,
interval integer
);
|
INSERT INTO Rvacsconv VALUES('1', '0', '14', '1', '2018-10-01', '2018-10-30', 0)
INSERT INTO Rvacsconv VALUES('1', '6', '21', '1', '2018-10-01', '2018-10-30', 0)
INSERT INTO Rvacsconv VALUES('1', '11', '28', '1', '2018-10-01', '2018-10-30', 0)
INSERT INTO Rvacsconv VALUES('1', '21', '35', '1', '2018-10-01', '2018-10-30... |
CREATE DATABASE sugar
USE sugar;
CREATE TABLE difficultyLevel(
difficultyLevelID int not null auto_increment,
level varchar(10),
PRIMARY KEY(difficultyLevelID)
);
CREATE TABLE recipe(
recipeID int not null auto_increment,
name varchar(40),
preparation text,
imagePath varchar(40),
piecesCount int,
preparationTime int... |
#设置客户端连接服务器编码
SET NAMES UTF8;
#丢弃数据库,如果存在
DROP DATABASE IF EXISTS xiaomi;
#创建数据库xiaomi,设置存储的编码
CREATE DATABASE xiaomi CHARSET=UTF8;
#进入该数据库
USE xiaomi;
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONN... |
-- phpMyAdmin SQL Dump
-- version 4.2.11
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Feb 21, 2015 at 11:25 PM
-- Server version: 5.6.21
-- PHP Version: 5.6.3
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
... |
@GeoNet/db/Views/Alarm_Durations_View_Def.sql
@GeoNet/db/Views/Outage_Durations_View_Def.sql
@GeoNet/db/Views/Valid_Scheduled_Outages_View_Def.sql
@GeoNet/db/Views/Unscheduled_Outages_View_Def.sql
@GeoNet/db/Views/tids_to_update_view_def.sql
@GeoNet/db/Views/PM_Totals_View_Def.sql
@GeoNet/db/Views/Interface_Info_By_TID... |
-- #2
select name meeting, count(*) persons
from meeting left join meeting_person mp on meeting.id = mp.meeting_id
where "confirmed"
group by name;
-- #3
select name empty_meetings
from meeting left join meeting_person mp on meeting.id = mp.meeting_id
where person_id is null;
|
-- phpMyAdmin SQL Dump
-- version 4.9.0.1
-- https://www.phpmyadmin.net/
--
-- Хост: 127.0.0.1:3306
-- Время создания: Ноя 18 2020 г., 12:44
-- Версия сервера: 10.3.13-MariaDB-log
-- Версия PHP: 7.1.32
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 S... |
INSERT INTO InterpretacionGRAMEtapa2 (idParteDelCuerpo, idBacteria, idAntibiotico, idAsignacion, mensaje)
SELECT
a2.idParteDelCuerpo,
g1.idBacteria,
6 as idAntibiotico,
a2.id,
a2.comentariosTratamiento
FROM
(
SELECT g.idBacteria, COUNT(1) as total
FROM
GRAM g
WHERE
g.tipoGRAM = '-' AN... |
SELECT COUNT(Email) AS EM
FROM Customer;
|
-- phpMyAdmin SQL Dump
-- version 4.6.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Dec 12, 2016 at 02:13 PM
-- Server version: 5.7.14
-- PHP Version: 5.6.25
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */... |
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Jan 26, 2018 at 12:50 PM
-- Server version: 10.1.19-MariaDB
-- PHP Version: 5.6.28
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CL... |
ALTER TABLE site ADD thumbnail_url VARCHAR(255) AFTER thumbnail;
ALTER TABLE site DROP thumbnail;
|
pregunta 01
===========
Desarrollar un procedimiento que
permita actualizar la nota de un estudiantes en un curso.
pregunta 02
===========
Desarrollar un procedimiento que permita obtener un listado de los estudiantes matriculados en un curso con sus respectivas notas.
Debe mostrar el nombre completo de los estudi... |
# Host: localhost (Version: 5.5.15)
# Date: 2018-03-22 17:59:57
# Generator: MySQL-Front 5.3 (Build 4.269)
/*!40101 SET NAMES utf8 */;
#
# Structure for table "role"
#
DROP TABLE IF EXISTS `role`;
CREATE TABLE `role` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增逐渐',
`role_id` int(11) NOT NULL DEFAULT '0'... |
USE BKEL;
CREATE TABLE IF NOT EXISTS COURSE (
CourseId CHAR(6) NOT NULL,
CourseName VARCHAR(255) NOT NULL,
DepartmentNo INTEGER NOT NULL,
Credits INTEGER NOT NULL CHECK (Credits > 0 AND Credits < 4),
PRIMARY KEY (CourseId),
FOREIGN KEY (DepartmentNo)
REFERENCES DEPARTMENT(DepartmentNo)... |
/*
SQLyog Enterprise v12.09 (64 bit)
MySQL - 5.0.51b-community-nt-log : Database - image
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;
/*!40101 SET SQL_MODE=''*/;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40101 SET @OLD_... |
Create Procedure mERP_sp_List_CSProductScopeInfo(@SchemeID Int)
As
Begin
Select ProdScope.Product_Code, Items.ProductName
from dbo.mERP_fn_Get_CSProductScope(@SchemeID) ProdScope
Left Outer Join Items On ProdScope.Product_Code = Items.Product_Code
Group By ProdScope.Product_Code, Items.ProductName Order by 1
End
|
drop table Persons_pipe_datetime_1
CREATE TABLE Persons_pipe_datetime_1
(
PersonID int,
LastName varchar(255),
FirstName varchar(255),
Address varchar(255),
City varchar(255),
PersonID2 int,
LastName2 varchar(255),
FirstName2 varchar(255),
Address2 varchar(255),
City2 Timestamp DATETIME DEFAULT CURRENT_TIMESTAMP
);
... |
create database if not exists jobinfo default charset utf8;
use jobinfo;
create table if not exists jobinfo(
jid varchar(32) primary key, -- id
jurl varchar(255), -- 信息url地址
jpost varchar(255), -- 岗位名称
jsalary varchar(255), -- 薪资
jcompany varchar(255), ... |
#DROP TABLE IF EXISTS `idx_concept`;
CREATE TABLE `idx_concept` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`code` varchar(20) NOT NULL COMMENT '概念分类ID',
`name` varchar(50) DEFAULT NULL COMMENT '概念分类名称',
`src` varchar(30) DEFAULT NULL COMMENT '来源',
`del` tinyint(3) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
U... |
USE ims;
CREATE TABLE `invoice_particulars` (
`InvoiceParticularID` int(11) unsigned NOT NULL,
`InvoiceID` int(11) unsigned DEFAULT NULL,
`ProductID` int(11) unsigned DEFAULT NULL,
`Quantity` float DEFAULT NULL,
`UnitPrice` float DEFAULT NULL,
`UnitPriceDiscount` float DEFAULT NULL,
`Tax` float DEFAULT... |
Create Procedure Sp_Recd_CustomerwiseMerchandise
As
Begin
Select Count(*) from tbl_merp_RecdCustomerwiseMerchandise Where Isnull(RecFlag,0) = 0
Update tbl_merp_RecdCustomerwiseMerchandise Set RecFlag = 1 Where Isnull(RecFlag,0) = 0
End
|
TRIM(
IF (
[Order Details Current].[Combined Parts Master].[Part GL Expense Code] in ('1RE', '1CU' )
)
---basis territory code
then(
CASE trim([Order Details Current].[D_BillTo Customers].[BillTo Territory Code] )
when '51' then 'DONNA'
when '52' then 'DORAN'
when '53' then 'RACHE'
when '54' the... |
# coding: utf-8
from sqlalchemy import Column, DateTime, Integer, String, text
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
metadata = Base.metadata
class Okopf(Base):
__tablename__ = 'okopf'
__table_args__ = {'schema': 'data'}
id = Column(Integer, primary_key=True, ... |
CREATE procedure sp_acc_prn_cus_contraentryabstract(@depositid int)
as
select
"Date" = DepositDate,
"Account Name" = Account_Name,
"Account Number" = Account_Number,
"Bank" = BankName,
"Branch" = BranchName,
"Amount Deposited" = Value,
"Depositor Name" = dbo.getaccountname(isnull(StaffID,0)),
"Narration" = Narration
f... |
-- phpMyAdmin SQL Dump
-- version 4.5.4.1deb2ubuntu2
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jan 30, 2018 at 12:49 PM
-- Server version: 5.7.21-0ubuntu0.16.04.1
-- PHP Version: 7.0.22-0ubuntu0.16.04.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_C... |
-- en tabla partidas_presupuestarias
select * from partidas_presupuestarias
-- ultima fase
create or replace view ultima_fase as
SELECT fe.idExpediente, f.nombre
FROM fases_expedientes fe left outer join fases f on fe.idFase = f.id
WHERE fe.fecha >= (SELECT max(fecha)
FROM fases_... |
/*
A QUICK NOTE TO SELF
So basically behind the scene, performs an O(n^2) time and space complexity operation when it picks one row in the first table and compares
it with every row in the second table and returns the row if the two match. (Note what is compared is the column specified in the on cl... |
/* What was the highest original price in the Dillard’s database of the item with SKU 3631365? */
SELECT SKU, ORGPRICE
FROM TRNSACT
WHERE SKU='3631365'
ORDER BY ORGPRICE DESC;
/* Answer = 17,50$ */
/* What is the color of the Liz Claiborne brand item with the highest SKU # in the Dillard’s database
(the Liz Claiborne... |
ALTER TABLE {$prefix}app_user
CHANGE provider platform varchar(31) NOT NULL COMMENT 'A platform like facebook or github',
CHANGE provider_uid platform_uid varchar(200) NOT NULL COMMENT "The user's id on that platform",
MODIFY appId varchar(200) NOT NULL COMMENT 'An external app id registered with the platform',
DROP PR... |
--Selecionar todos os autores
select * from Autores;
--Selecionar todos os generos
select * from Generos;
--Selecionar Todos os livros
select * from Livros;
--Selecionar os livros e seus respectivos autores
select Au.NomeAutor, Li.Titulo from Livros as Li join Autores as Au on li.IdAutor = au.IdAutor;
--Selecion... |
-- 1270. 向公司CEO汇报工作的所有人
-- 员工表:Employees
--
-- +---------------+---------+
-- | Column Name | Type |
-- +---------------+---------+
-- | employee_id | int |
-- | employee_name | varchar |
-- | manager_id | int |
-- +---------------+---------+
-- employee_id 是这个表的主键。
-- 这个表中每一行中,employee_id 表示职工的 ID,... |
/*==============================================================*/
/* DBMS name: ORACLE Version 11g */
/* Created on: 2015/7/24 16:27:14 */
/*==============================================================*/
alter table "xlfin_accountcondition"
dro... |
CREATE TABLE transactions (date date, cash_flow int);
INSERT into transactions values('2018-01-01',-1000),('2018-01-02',-100),('2018-01-03',50);
select * FROM transactions
SELECT *, sum (cash_flow) OVER(ORDER BY cash_flow) AS cumulative_cf from transactions;
|
DELETE FROM #__rsform_component_type_fields WHERE ComponentTypeId IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 41, 211);
INSERT IGNORE INTO `#__rsform_component_type_fields` (`ComponentTypeId`, `FieldName`, `FieldType`, `FieldValues`, `Ordering`) VALUES
(1, 'NAME', 'textbox', '', 1),
(1, 'CAPTION', 'textbox',... |
-- Oracle Changes
ALTER TABLE C_Invoice ADD M_RMA_ID NUMBER(10, 0) DEFAULT NULL;
ALTER TABLE C_InvoiceLine ADD M_RMALine_ID NUMBER(10,0) DEFAULT NULL;
ALTER TABLE M_InOut ADD M_RMA_ID NUMBER(10,0) DEFAULT NULL;
ALTER TABLE M_InOutLine ADD M_RMALine_ID NUMBER(10,0) DEFAULT NULL;
ALTER TABLE M_RMA ADD IsSO... |
/*
Navicat MySQL Data Transfer
Source Server : 真三国内部测试服
Source Server Version : 50170
Source Host : 192.168.5.7:3306
Source Database : zsg
Target Server Type : MYSQL
Target Server Version : 50170
File Encoding : 65001
Date: 2013-09-09 14:04:17
*/
set names utf8;
drop database IF ... |
SELECT user_name FROM tweeter_tweeter WHERE twitter_user_id=0;
|
show processlist;
SET SQL_SAFE_UPDATES=0;
/*Saber as informações de variaveis do mysql e alterar as mesmas*/
SHOW VARIABLES;
SET nome_da_variavel = novo_valor;
insert into TB_TP_USUARIO values (1,'ADMINISTRADOR');
insert into TB_USUARIO values (1,'Administrador Sistema','ALex',' XXXXXX',sysdate(),null,sysdate(),0,... |
-- phpMyAdmin SQL Dump
-- version 4.0.10.2
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Oct 11, 2014 at 01:11 AM
-- Server version: 5.1.73
-- PHP Version: 5.3.3
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */... |
set hive.execution.engine=spark;
drop table if exists dws.dwstmp_sys_user_auto_fill;
create table if not exists dws.dwstmp_sys_user_auto_fill (
user_id STRING comment '用户id'
, user_name STRING comment '用户姓名'
, user_status bigint comment '用户状态: 1 正常, 0 禁用'
, job_code STRING comment '岗位编码'
, job_name ST... |
# SQL to patch a release 33 Ensembl database schema to release 34
ALTER table object_xref MODIFY ensembl_object_type ENUM( 'RawContig', 'Transcript', 'Gene', 'Translation', 'regulatory_factor', 'regulatory_feature' ) not null;
DROP TABLE regulatory_factor_transcript;
CREATE TABLE regulatory_factor_coding (
regula... |
DROP DATABASE IF EXISTS INVENTORY;
CREATE DATABASE INVENTORY;
USE INVENTORY;
DROP TABLE IF EXISTS BRANDS;
CREATE TABLE BRANDS(
ID_BRAND INT(11) AUTO_INCREMENT,
NAME VARCHAR(100) UNIQUE NOT NULL,
PRIMARY KEY (ID_BRAND)
);
DROP TABLE IF EXISTS PRODUCTS;
CREATE TABLE PRODUCTS(
ID_PRODUCT INT(11) AUTO_INCREM... |
CREATE DATABASE IF NOT EXISTS `chat` ;
USE `chat`;
CREATE TABLE IF NOT EXISTS `messages` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`author` varchar(50) DEFAULT NULL,
`content` text,
`created_at` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=61 DEFAULT CHARSET=utf8 COMMENT='La table... |
ALTER TABLE categories ADD COLUMN `text` VARCHAR(100) NOT NULL DEFAULT '';
ALTER TABLE categories ADD COLUMN `order` INT NOT NULL DEFAULT 0; |
-- Sequence and defined type
CREATE SEQUENCE IF NOT EXISTS document_id_seq;
-- Table Definition
CREATE TABLE "public"."document" (
"id" int4 NOT NULL,
"topic" varchar NOT NULL,
"content" varchar NOT NULL,
"tags" _varchar NOT NULL DEFAULT '{}'::character varying[],
"user_id" int4 NOT NULL,
"crea... |
SET ECHO off
REM ------------------------------------------------------------------------
REM REQUIREMENTS:
REM SELECT on V$
REM ------------------------------------------------------------------------
REM PURPOSE:
REM Show users connections
REM ------------------------------------------------------------------... |
-- --------------------------------------------------------
-- Host: 127.0.0.1
-- Server version: 10.4.11-MariaDB - mariadb.org binary distribution
-- Server OS: Win64
-- HeidiSQL Version: 10.2.0.5599
-- -----------------------------------------------... |
use loop_logic;
set @target1 := '2022-02-01 07:10:02';
set @target2 := '2023-04-01 11:40:00';
set @uid := 7;
-- this finds the closest (in time) row to a given timestamp
-- (@target2) within a given window of time (here, I used 30 minutes)
-- working entirely in the database
-- this works, but I think that it's usua... |
USE nasa
CREATE TABLE `actor` (
`actor_id` smallint unsigned NOT NULL AUTO_INCREMENT,
`first_name` varchar(45) NOT NULL,
`last_name` varchar(45) NOT NULL,
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`actor_id`),
KEY `idx_actor_last_name` (`last_name`)
) ENGINE=I... |
INSERT INTO burgers (burger_name, devoured) VALUES ('Tucker Meat Market - Mammoth Burger', FALSE);
INSERT INTO burgers (burger_name, devoured) VALUES ('H & F Burger', TRUE);
INSERT INTO burgers (burger_name, devoured) VALUES ('One Eared Stag', FALSE);
|
# Write your MySQL query statement below
# !! This solution may be wrong when the id is not successive.
SELECT DISTINCT t1.Num
FROM Logs t1 JOIN Logs t2 ON t1.Num = t2.Num
JOIN Logs t3 ON t1.Num = t3.Num
WHERE t1.Id = t2.Id + 1 AND t2.Id = t3.Id + 1
|
DROP TABLE CLIENT IF EXISTS;
CREATE TABLE CLIENT
(
ID BIGINT NOT NULL AUTO_INCREMENT,
NAME VARCHAR(100) NOT NULL,
SURNAME VARCHAR(100) NOT NULL,
BIRTHDATE DATE NOT NULL,
PERSONAL_NUMBER BIGINT,
CITY VARCHAR(100),
STREET VARCHAR(100),
POST_NUMBER VARCHAR(5),
PRIMARY KEY (ID),
);
DROP TABLE LAST_PAYME... |
SELECT * FROM all_objects WHERE object_name LIKE 'MTL%DEFAULT%';
DESC MTL_DEFAULT_CATEGORY_SETS
SELECT * FROM MTL_DEFAULT_CATEGORY_SETS;
SELECT * FROM all_views WHERE view_name = 'MTL_DEFAULT_SETS_VIEW';
SELECT S.CATEGORY_SET_ID ,
ST.CATEGORY_SET_NAME ,
ST.DESCRIPTION ,
S.STRUCTURE_ID ,
S.VALIDATE_FLAG ,
D.F... |
-- --------------------------------------------------------
-- Хост: 127.0.0.1
-- Версия сервера: 10.3.13-MariaDB-log - mariadb.org binary distribution
-- Операционная система: Win64
-- HeidiSQL Версия: 11.2.0.6213
-- -------------------------------------------... |
-- my first github project in SQL
BEGIN
dbms_output.put_line ('Hello World..');
END;
/
|
drop table person;
drop table goal;
drop table goal_chain;
|
-- 選択列リストへのさまざまな指定
-- 選択列リストとは、SELECT の後ろに指定する値
SELECT 出金額, -- 列名での指定
出金額 + 100, -- 計算式での指定
'SQL' -- 固定値での指定
FROM 家計簿
-- CASE演算子
CASE 評価する値や式 WHEN 値1 THEN 値1のときに返す値
(WHEN 値2 THEN 値2のときに返す値)
(ELSE デフォルト値)
END
-- CASE-ENDまでの部分が選択列となる(なのでこのSQL文では選択列が3つあること... |
-- phpMyAdmin SQL Dump
-- version 4.9.1
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Waktu pembuatan: 24 Okt 2021 pada 02.37
-- Versi server: 8.0.18
-- Versi PHP: 7.3.11
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET... |
use yiiadvanced;
# Create a new rule item
# INSERT INTO auth_item (name, type, description) VALUES ('create_branch', 1, 'Allow to create a branch');
# Assign the rule created to an user id
# INSERT INTO auth_assignment (item_name, user_id) VALUES ('create_branch', 1);
# Created a new rule
# INSERT INTO auth_item (name,... |
-- Get length of a number
SEL MAX(A.ITEM_LEN), MIN(A.ITEM_LEN)
FROM (
SEL
CAST( CAST( offer_number AS FORMAT 'Z(I)' ) AS VARCHAR(25) ) AS ITEM_ID
,CHARACTERS(item_id) AS ITEM_LEN
FROM DXWI_PROD_GPML_PLAY_PEN.oe68_HUDM_1_final_dataset ) AS A
-- Get length of a number
SEL MAX(A.ITEM_LEN), MIN(A.ITEM_LEN)
F... |
/*
Name: Click to BHHS Web Page by country
Data source: 4
Created By: Admin
Last Update At: 2016-02-04T16:49:33.612576+00:00
*/
SELECT Loc.Country AS Country,
count(*) AS Clicks
FROM
(SELECT UPPER(geo_country) AS geo_country,
FROM (TABLE_QUERY(djomniture:cipomniture_djmansionglobal,'CONCAT(REPLACE(table_id,... |
CREATE TABLE `gw_user` (
`id` INT NOT NULL AUTO_INCREMENT,
`username` VARCHAR(32) NOT NULL,
`password` VARCHAR(32) NULL,
`token` VARCHAR(32) NULL,
`avatar` TEXT NULL,
`name` VARCHAR(32) NULL,
`mobile` VARCHAR(16) NULL,
`created_at` DATETIME NULL,
`updated_at` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ... |
CREATE SCHEMA `Movies`;
CREATE TABLE `directors`(
`id` INT PRIMARY KEY AUTO_INCREMENT,
`director_name` VARCHAR(50) NOT NULL,
`notes` TEXT
);
CREATE TABLE `genres`(
`id` INT PRIMARY KEY AUTO_INCREMENT,
`genre_name` VARCHAR(50) NOT NULL,
`notes` TEXT
);
CREATE TABLE `categories`(
`id` INT PRIMARY KEY AUTO_INCREMENT,
`... |
CREATE OR REPLACE PROCEDURE wxhp_cols_dynSql(lv_sql VARCHAR2,
o_COLUMNS out VARCHAR2,
omsg OUT VARCHAR2) IS
l_cur NUMBER; ---游标入口
l_dtbl dbms_sql.desc_tab; --数组 记录列信息
l_cnt NUMBER; ---计数器
--col_type NUMBER; ---列类型
--col_name VARCHAR2(2... |
USE TelerikAcademy
SELECT e.FirstName + ' ' + e.LastName AS EmployeeName,
em.FirstName + ' ' + em.LastName AS ManagerName,
a.AddressText AS EmployeeAdress
FROM Employees e
INNER JOIN Employees em
ON e.ManagerID = em.EmployeeID
INNER JOIN Addresses a
ON e.AddressID = a.AddressID |
INSERT INTO `user` (`id`,`name`,`department_id`) values (1,'lili','1'); |
update perusers set password = $1 where username = $2 and user_email = $3 |
@clears
col log_owner format a15 head 'LOG OWNER'
col master format a30 head 'MASTER TABLE'
col log_table format a30 head 'LOG TABLE'
col log_trigger format a30 head 'LOG TRIGGER'
col current_snapshots format a20 head 'CURR SNAPSHOTS'
break on log_owner
set line 130
select
log_owner
,master
,log_table
--,log_... |
-- Database generated with pgModeler (PostgreSQL Database Modeler).
-- pgModeler version: 0.9.1-beta
-- PostgreSQL version: 10.0
-- Project Site: pgmodeler.com.br
-- Model Author: ---
-- Database creation must be done outside an multicommand file.
-- These commands were put in this file only for convenience.
-- -- o... |
/*insert into Boxes (number, buisy, adress, capacity) values(1, 0, "Pushkina, 19", 1);
insert into Clients (Name) values("Ivanov Ivan Ivanovich");
insert into Cars (Box_ID, Model) values (1, "Mitsubishi Lancer Evo 10");
update Boxes set Buisy = 1 where Box_ID = 1;
insert into Appeals (Car_ID, Client_ID, 'Date', ... |
/*The first schema is here to hold information about humans. IE. the employees
and the clients. They're a similar idea so I grouped them together*/
CREATE DATABASE EmployeesClients;
USE EmployeesClients;
CREATE TABLE employeeRoles (
roleID int PRIMARY KEY NOT NULL UNIQUE AUTO_INCREMENT,
roleName VARCHAR(15)
);... |
/*DROP TABLE IF EXISTS students;
DROP TABLE IF EXISTs student_academics;
DROP TABLE IF EXISTS student_certs;
CREATE TABLE students (
id INT (8), firstName varchar (50),
lastName varchar (50), email varchar (50), state varchar (15), city varchar (50),
street_address varchar (50), zip int (5), phone varchar... |
-- requête permettant d'afficher les cours à vérifier depuis la table de backup
-- reservations_to_check
SELECT r.id, r.start_date, r.end_date, reason_short, reason_details, duration, student_group, u.sigle as "owner", rooms.name as "salle", wd.name as "jour", ts.start_time AS "plage"
FROM reservations_to_check as r... |
SELECT DISTINCT ON (a.title) *
FROM apps a
ORDER BY a.title, a.last_update_date DESC; |
-- phpMyAdmin SQL Dump
-- version 4.1.14
-- http://www.phpmyadmin.net
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 17-09-2018 a las 17:35:44
-- Versión del servidor: 5.6.17
-- Versión de PHP: 5.5.12
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARA... |
INSERT INTO users (first_name, last_name, email, password, nickname)
VALUES
('Quinton','Parogie','alex@gmail.com','password','broRogies'),
('Mohamed','Parogie','alex@gmail.com','password','broRogies'),
('Alex','Parogie','alex@gmail.com','password','broRogies');
INSERT INTO games (title, description)
VALUES
('Overwatch... |
-- -*- coding: utf-8 -*-
--
-- 会社と部署と社員
--
-- 会社
create table companies (
id integer primary key
, name varchar(255) not null unique
);
insert into companies (id, name)
values (301, '○○会社')
;
-- 部署
create table departments (
id integer primary key
, name varchar(255... |
/***********************************I-SCP-RCM-AF-1-04/10/2013****************************************/
CREATE TABLE af.tclasificacion (
id_clasificacion SERIAL NOT NULL,
codigo VARCHAR(20) NOT NULL,
descripcion VARCHAR(200),
sw_dep VARCHAR(2) DEFAULT 'no'::character varying NOT NULL,
estado VARCHAR(... |
-- phpMyAdmin SQL Dump
-- version 4.9.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: May 12, 2020 at 08:44 PM
-- Server version: 10.4.10-MariaDB
-- PHP Version: 7.3.12
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SE... |
-- phpMyAdmin SQL Dump
-- version 4.9.5deb2
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Aug 28, 2020 at 04:10 AM
-- Server version: 5.7.31-0ubuntu0.18.04.1
-- PHP Version: 7.4.7
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = ... |
--05. Write a SQL query to find all department names.
SELECT Departments.Name
FROM dbo.Departments |
\c dogWellness
--create users
INSERT INTO users (userName, email, password_digest)
VALUES ('Danae', 'danae@hotmail.com'),
('Kate', 'kate@hotmail.com'),
('Whitney', 'Whitney@hotmail.com');
--create dogs
INSERT INTO dogs (dog_name, vet, weight, user_id)
VALUES ('kai', 'roger', 90, 1),
('lilly',... |
CREATE TABLE purchaseorders (
purchaseorder_id SERIAL PRIMARY KEY,
purchaseorder_number VARCHAR(30),
reference_number VARCHAR(20),
date DATE,
status VARCHAR(20),
shipment_date DATE,
invoiced_status VARCHAR(30),
paid_status VARCHAR(30),
shipped_status VARCHAR(30),
creator_id INT R... |
INSERT INTO `ssaif_prod_abril`.`tbtiposanciones`
(`idtiposancion`,
`descripcion`,
`cantminfechas`,
`cantmaxfechas`,
`abreviatura`,
`expulsion`,
`amonestacion`,
`cumpletodascategorias`,
`llevapendiente`,
`ocultardetallepublico`)
SELECT `tiposanciones`.`tiposancionid`,
`tiposanciones`.`descripcion`,
`tiposancione... |
create table sys_admin(
sys_number varchar(20) primary key,
sys_name varchar(20),
sys_password varchar(20),
sys_sex varchar(5),
sys_age varchar(5),
sys_regdate date,
sys_telNumber varchar(20),
sys_idCard varchar(50)
);
create table system_books(
bookid varchar(20),
bookname varchar(20),
bookstylenumber varc... |
/*******************************************************************
* PROCEDURE: prc_RTMC_GetApprovedPurchaseRequest
* Purpose : This PROC will be invoked from console app prc_RTMC_GetUpdatePurchaseRequest.sln
* CREATED: Saiganesh Rajamani 06/23/2014 for T-CHEK RTMC Webservice
* MODIFIC... |
SELECT u.* FROM bookings b
JOIN users u ON b.user_id = u.id
JOIN tickets t ON t.id = b.ticket_id
WHERE t.title = 'Lagos';
|
--GROUP BY
DROP TABLE workers PURGE;
CREATE TABLE workers
(
id number(9),
name varchar2(50),
state varchar2(50),
salary number(20),
company varchar2(20)
);
INSERT INTO workers VALUES(123456789, 'John Walker', 'Florida', 2500, 'IBM');
INSERT INTO workers VALUES(234567890, 'Brad Pitt', 'Florida', 1500... |
SELECT
a.id, b.title project, a.title nameTask, a.status, c."name" asign, a.priority, a.due_date,
a.original_estimate, a.decription, a.start_date, a.end_date, d.name createdBy, a.create_on,
e.name modifyBy, a.modify_on , a.create_by createdById, a.modify_by modifyById, a.asign asignId
FROM task a
JOIN project b... |
Create Procedure mERP_sp_Get_CSQPSFreeItems (@CustomerID as nvarchar(50))
As
Begin
Select SchAbs.SchemeID, SchAbs.Description, SchCusItem.Product_Code, items.ProductName, Sum(SchCusItem.pending) as 'Pending', IsNull(SchCusItem.GroupID,0) 'GroupID', IsNull(SchDet.SlabID,0) 'SlabID', SchDet.SlabType, Sum(IsNull(BP.Quant... |
create table sales
select format(sum(d.tt), 2) as total, d.year from
(
select c.Company as Company, c.total as tt, format(c.total, 2) as total, year(c.OrderDate) as Year from
(
select b.Company, sum(b.total) as total, b.OrderDate from
(
select a.OrderId, a.CompanyName as Company, sum(a.UnitPrice * (1- a.Disco... |
USE `user_schema`;
DROP procedure IF EXISTS `check_existing_email_mobile`;
DELIMITER $$
USE `user_schema`$$
CREATE PROCEDURE `check_existing_email_mobile` (IN p_email VARCHAR(100), IN p_mobile CHAR(11))
BEGIN
SELECT user_id
FROM user
WHERE email = p_email OR mobile = p_mobile;
END$$
DELIMITER ; |
SELECT
category.name AS name,
COUNT(sale.id) AS sale_num
FROM
category
LEFT OUTER JOIN
category_has_good
ON
category.id = category_has_good.category_id
LEFT OUTER JOIN
good
ON
category_has_good.good_id = good.id
LEFT OUTER JOIN
sale_has_good
ON
good.id = sale_has_good.good_id
LEFT OU... |
drop database if exists limas;
drop user if exists student;
create user student with PASSWORD 'himitu';
create database limas owner student encoding 'UTF8';
\c limas
drop table if exists member;
drop table if exists book;
drop table if exists stock;
drop table if exists category;
drop table if exists lending;
drop tab... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.