text stringlengths 6 9.38M |
|---|
SELECT TOP (5) e.EmployeeID, e.JobTitle, a.AddressID, a.AddressText
FROM [Employees] e
JOIN [Addresses] a ON a.AddressID = e.AddressID
ORDER BY a.AddressID |
-- 1098. 小众书籍
-- 书籍表 Books:
--
-- +----------------+---------+
-- | Column Name | Type |
-- +----------------+---------+
-- | book_id | int |
-- | name | varchar |
-- | available_from | date |
-- +----------------+---------+
-- book_id 是这个表的主键。
-- 订单表 Orders:
--
-- +----------------+----... |
-- SQL 2 --
-- alter table
--adding a new column and its value type
ALTER TABLE <table name> (
ADD COLUMN <column_name> <valuetype>
);
--deleting columns from your table
ALTER TABLE <table name>
DROP COLUMN <column_name>;
--changing a column’s data type
ALTER TABLE <table name>
ALTER <column_name>
SET DATA TYPE ... |
SELECT
purchases.user_id, purchases.stream_id, stream_title, stream_desc, stream_date, stream_hours, purchases.streamer_id, purchase_timestamp, purchases.purchase_price, purchases.purchase_id
FROM purchases
INNER JOIN streams ON streams.stream_id = purchases.stream_id
WHERE purchases.user_id = $1 AND purchases.stream_... |
-- phpMyAdmin SQL Dump
-- version 4.1.14
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Oct 28, 2015 at 03:47 AM
-- Server version: 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 */;... |
-- Initialisation spécifiques pour un jeu de test
INSERT INTO Galerie(id, nom, adresse) VALUES (1, 'Saatchi', 'King\''s Road, London');
INSERT INTO Exposition (id , debut, intitule ,duree, organisateur_id) VALUES (1, NULL, 'L Art Brut Contemporain', NULL, 1) ;
INSERT INTO Exposition (id, debut, intitule, duree, orga... |
@clears
set line 200 trimspool on
set pagesize 60
col member format a50 head 'MEMBER'
col group# format 999 head 'GRP'
col thread# format 999 head 'THR'
col sequence# format 999999 head 'SEQ'
col group_status format a8 head 'GROUP|STATUS'
col member_status head 'MEMBER|STATUS'
col systime format a18 head 'SYSTEM TIME... |
alter table "public"."SkillTag" drop constraint "SkillTag_skillId_tagId_key";
|
DROP DATABASE IF EXISTS pulstime_db_test;
CREATE DATABASE pulstime_db_test;
USE pulstime_db_test;
create table Orders_Contents (
orderid int,
itemid int,
qty int not null,
promo varchar(255) not null,
price double not null,
`instock` varchar(45) DEFAULT NULL
) engine=InnoDB;
CREATE TABLE `orders`
(
`or... |
insert into Pirkejai(ID,Vardas, Pavarde, Amzius, Kredito_Kortele)
Values(1, 'Simas', 'Purtokas', '21', 'VISA');
insert into Pirkejai(ID,Vardas, Pavarde, Amzius, Kredito_Kortele)
Values(2, 'Lukas', 'Burokauskas', '32', 'MasterCard');
insert into Pirkejai(ID,Vardas, Pavarde, Amzius, Kredito_Kortele)
Values(3, 'Saulius',... |
/*
Swiss army/spaghetti query for returning all pertinent information in this hierarchy:
Folder-->workflow-->mapping-->session-->MAPPLET.
Adapted from Informatica PC forums; used in Powercenter 9.6.1
*/
SELECT * FROM
( SELECT DISTINCT
(SELECT F.SUBJ_NAME
FROM PC_REPO.OPB_SUBJECT F
WHERE F.SUBJ_ID = S.S... |
CREATE TABLE rv.s_WeatherObservation_DataPoint (
WeatherObservationHashKey CHAR(32) NOT NULL
, LoadDate DATETIME2 NOT NULL
, RecordSource VARCHAR(500) NOT NULL
, HashDiff CHAR(32) NOT NULL
, [G] NUMERIC(10,2)
, [T] NUMERIC(10,2)
, [V] NUMERIC(10,2)
, [D] NVARCHAR(4)
, [S] NUMERIC(10,2)
, [W] NUMER... |
-- 1. Составьте список пользователей users, которые осуществили хотя бы один заказ orders в интернет магазине.
SELECT DISTINCT users.name
from orders
JOIN users ON orders.user_id = users.id;
--2. Выведите список товаров products и разделов catalogs, который соответствует товару.
SELECT products.name product_name, cata... |
CREATE TABLE [display].[spotlight]
(
[sys_id_display_value] NVARCHAR(MAX) NULL,
[spotlight_group_display_value] NVARCHAR(MAX) NULL,
[sys_mod_count_display_value] NVARCHAR(MAX) NULL,
[active_display_value] NVARCHAR(MAX) NULL,
[sys_updated_on_display_value] NVARCHAR(MAX) NULL,
[sys_tags_display_value] NVARCHAR(M... |
left join person p on p.id = f.id JOIN foo f on f.id=p.id
|
SELECT
[0] +' '+ [1] AS Район,
CITY.Сокращение AS [Тип НП],
CITY.Название AS [Населенный пункт],
STREET.Сокращение AS [Тип улицы],
STREET.Название AS Улица,
HOUSE.Номер AS Дом,
HOUSE.Фамилия AS Корпус,
FLAT.Номер AS Квартира,
FLAT.Фамилия AS [Литерал квартиры],
... |
DROP TABLE credit_line;
CREATE TABLE credit_line
(
credit_line_id NUMBER CONSTRAINT credit_line_id PRIMARY KEY,
customer_id NUMBER(8),
credit_limit NUMBER(10,2) DEFAULT 10000 NOT NULL,
creation_date DATE DEFAULT SYSDATE NOT NULL,
valid_from DATE DEFAULT TO_DATE('01.01.2017','DD.MM.YYYY') NOT NULL,
valid_to DATE DEFA... |
DELETE FROM DB_CEIBA_RENTA_PELICULA.PRESTAMO;
DELETE FROM DB_CEIBA_RENTA_PELICULA.CLIENTE;
DELETE FROM DB_CEIBA_RENTA_PELICULA.PELICULA;
INSERT INTO DB_CEIBA_RENTA_PELICULA.CLIENTE(DOC_IDENTIDAD,NOMBRES,APELLIDOS) VALUES ( 123, 'gabriel', 'arboleda' );
INSERT INTO DB_CEIBA_RENTA_PELICULA.CLIENTE(DOC_IDENTIDAD,NOMBRES,... |
CREATE VIEW `vista 1` AS
select Libros.titulo as "Titulo", Autores.nombre as "Nombre", Autores.apellido as "Apellido", Libros.fecha_publicacion as "Fecha"
from Biblioteca.Libros
join Biblioteca.libros_autores
on Libros.id_libro = libros_autores.id_libro
join Biblioteca.Autores
on Autores.id_autor = libros_autores.id_a... |
SELECT UPPER(last_name) AS 'NAME', first_name, subscription.price
FROM user_card
INNER JOIN member ON user_card.id_user = member.id_member
INNER JOIN subscription ON member.id_sub = subscription.id_sub
WHERE subscription.price > 42
ORDER BY last_name, first_name;
|
SELECT CHAVE
FROM TESTE1
WHERE CHAVE = 'pudim' |
CREATE TABLE users (
user_id SERIAL PRIMARY KEY,
username VARCHAR (75),
password VARCHAR (75)
);
INSERT INTO users (username, password)
VALUES ('test_user', 'password');
CREATE TABLE products (
product_id SERIAL PRIMARY KEY,
product_url text,
product_name VARCHAR (75),
pr... |
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for goods
-- ----------------------------
DROP TABLE IF EXISTS `goods`;
CREATE TABLE `goods` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`user_id` int(10) UNSIGNED NOT NULL COMMENT '商家id',
`goods_code` varcha... |
with `sr_items` as (select `i_item_id` as `item_id`, sum(`sr_return_quantity`) as `sr_item_qty`
from `store_returns`
where `sr_item_sk` = `i_item_sk` and `d_date` in (select `d_date`
from `date_dim`
where `d_week_seq` in (select `d_week_seq`
from `date_dim`
where `d_date` in (cast('2000-06-30' as date), cast('2000-09-2... |
SELECT
c.`uuid` AS uuid,
c.`name` AS name,
c.`user` AS user,
c.`open` AS open,
null as control,
b.`uri` AS brokerUri,
b.`name` AS brokerName,
b.`user` AS brokerUser
FROM `clients` c
INNER JOIN `brokers`b ON b.`uri` = c.`broker`
WHERE c.`user` <> ? AND b.`user`= c.`user` AND c.`open` = TRUE
AND c.`uuid`... |
USE `dbphp7`;
DROP procedure IF EXISTS `sp_usuarios_insert`;
DELIMITER $$
USE `dbphp7`$$
CREATE PROCEDURE `sp_usuarios_insert` (
pdeslogin VARCHAR (64),
pdessenha VARCHAR (256)
)
BEGIN
INSERT INTO tb_usuarios (deslogin,dessenha) VALUES (pdeslogin,pdessenha);
SELECT * FROM tb_usuarios WHERE idusuario = LAST_I... |
-- Select the burgers_db
USE rentals_db;
-- Insert new rows of data.
INSERT INTO bikes (bike_name, devoured)
VALUES ("schwinn", false), ("bmx", false), ("dirt bike", false); |
--修改人:蒲勇军
--修改时间:2012-10-24 17:04:26
--修改内容:添加资金预警查询菜单
insert into bt_sys_res (RES_CODE, RES_NAME, SYS_CODE, FATHER_CODE, RES_URL, FUNC_FLAG, RES_TYPE, LINK_TARGET, STATUS, RES_ORDER, RMK, REVERSE1, REVERSE2, REVERSE3, REVERSE4, REVERSE5, REVERSE6, REVERSE7, REVERSE8, REVERSE9, REVERSE10, RES_LEVEL, RES_ROLE)
values ... |
-- QUESTION #1:
-- Create a new table in your database.
-- Give it an auto-incrementing primary key,
-- and one column each with the data type date, time, and decimal.
CREATE TABLE labSeven (
id INT PRIMARY KEY AUTO_INCREMENT,
date_values DATE,
time_values TIME,
decimal_values DECIMAL(6,2)
);
-- QUESTION #2:
-... |
SELECT FirstName FROM Employees
WHERE (DepartmentID = 10 OR DepartmentID = 3)
AND (HireDate BETWEEN '1995/01/01' AND '2005/12/31') |
-- Criando sequences
CREATE SEQUENCE db_plugin_db145_sequencial_seq
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
START 1
CACHE 1;
-- TABELAS E ESTRUTURA
-- Módulo: configuracoes
CREATE TABLE db_plugin(
db145_sequencial int4 NOT NULL default 0,
db145_nome varchar(200) NOT NULL ,
db145_label varchar(20... |
drop procedure if exists itemsNotSold;
DELIMITER //
CREATE PROCEDURE itemsNotSold()
BEGIN
SELECT inventory.itemId,
itemName
FROM inventory
LEFT JOIN purchased
ON purchased.itemId = inventory.itemId
WHERE purchased.itemId IS NULL;
END //
delimiter ; |
select user.name as name, photo_post.createdAt as date, photo_post.description as description FROM mydb.photo_post
left join mydb.user on photo_post.user_iduser = user.iduser where user.name = 'Chernyakov'
order by createdAt asc; |
Create Procedure sp_acc_UpdateServiceInwardBalance(@Invoiceid int,@Adjusted Decimal(18,2))
as
Update ServiceAbstract Set Balance = Balance - @Adjusted Where InvoiceID = @Invoiceid
|
ALTER TABLE JOURNALPOST
ADD COLUMN type VARCHAR |
set SERVEROUTPUT on;
BEGIN
DBMS_OUTPUT.PUT_LINE('----FOR TRANSACTION----');
END;
/
--TRANSACTION MOVIE--
DECLARE
user_id user_table.user_id%TYPE;
quantity transaction_movie.quantity%type;
selection_id slot_selection.selection_id%type;
Begin
user_id:='&user_id';
quantity:=&quantity;
select... |
--Problem 11
SELECT
DepositGroup
,IsDepositExpired
,AVG(DepositInterest) AS AverageInterest
FROM
WizzardDeposits
WHERE DepositStartDate > '1985/01/01'
GROUP BY DepositGroup,IsDepositExpired
ORDER BY DepositGroup DESC,IsDepositExpired
|
INSERT INTO `materials` (`id`, `category`) VALUES
(1, '18k'),
(2, '14k'),
(3, '9k'),
(4, 'Silver'),
(5, 'Platinum'),
(6, 'Bi Colour with Gold'),
(7, 'Three Colour with Gold'),
(8, 'Black Metal'); |
USE CarFactory;
ALTER TABLE Car_Engine
ADD COLUMN assembly_days int;
UPDATE Car_Engine
SET assembly_days = 3
WHERE EngineId IN (3,4,5);
UPDATE Car_Engine
SET assembly_days = 1
WHERE EngineId IN (1);
UPDATE Car_Engine
SET assembly_days = 4
WHERE EngineId IN (2,6);
ALTER TABLE Car_Engine
MODIFY assembly_days in... |
/*
Name: Amount of clicks to Berkshire web page ext
Data source: 4
Created By: Admin
Last Update At: 2016-02-19T14:09:44.960550+00:00
*/
SELECT post_prop10,
page_url,
post_prop1,
count(*) AS ExternalClicks
FROM (TABLE_QUERY(djomniture:cipomniture_djmansionglobal,'CONCAT(REPLACE(table_id,"_","-"),"... |
select `n_name`
from `nation`
where `n_nationkey` = 17
intersect
select `n_name`
from `nation`
where `n_regionkey` = 1
union
select `n_name`
from `nation`
where `n_regionkey` = 2 |
SELECT
productName, productLine, productScale,productVendor
from products
WHERE productLine = "Classic Cars" OR productLine="Vintage Cars"
ORDER By productLine DESC , productName ASC; |
CREATE DATABASE exam_sql
USE exam_sql
CREATE TABLE Users(
UserID char(5),
FirstName varchar(255) NOT NULL,
LastName varchar(255) NOT NULL,
School varchar(255) NOT NULL,
AddressUser varchar(255) NOT NULL,
Email varchar(255) NOT NULL,
PhoneNumber varchar(255) NOT NULL,
LocationUser varchar(255) NOT ... |
-- 修改用户表,删除是否组织管理员字段,添加用户可见组织范围字段
ALTER TABLE `unified_user_access_control`.`user_info`
DROP COLUMN `is_admin`,
ADD COLUMN `view_root_code` VARCHAR(50) NULL COMMENT '用户可见组织范围-最高层组织编码' AFTER `gender`,
ADD COLUMN `view_root_name` VARCHAR(200) NULL COMMENT '用户可见组织范围-最高层组织名称' AFTER `view_root_code`;
-- 修改组织结构表,添加树级支持
ALTE... |
-- phpMyAdmin SQL Dump
-- version 5.1.0
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Apr 21, 2021 at 03:38 PM
-- Server version: 10.4.18-MariaDB
-- PHP Version: 8.0.3
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIEN... |
CREATE Procedure sp_acc_GetAmendedFACollection(@CollectionID Int)
As
Select CollectionDetail.OriginalID, CollectionDetail.DocumentDate,
CollectionDetail.DocumentValue, CollectionDetail.AdjustedAmount,
CollectionDetail.DocumentType, CollectionDetail.ExtraCollection,
CollectionDetail.DocRef, CollectionDetail.Adjustment,... |
drop table member;
create table member
(
no number(10) primary key,
name varchar(20 char),
regdate date
);
select table_name from user_tables;
select * from member;
insert into member
(no, name, regdate)
values
(20, 'xxx', '2020/11/11');
delete from member;
commit;
|
CREATE ROLE [PASAgreementGovernmentAffairs] |
CREATE TABLE selective_courses_year_parameters(
id SERIAL PRIMARY KEY,
first_round_start_date TIMESTAMP NOT NULL,
first_round_end_date TIMESTAMP NOT NULL,
second_round_start_date TIMESTAMP NOT NULL,
second_round_end_date TIMESTAMP NOT NULL,
study_year INTEGER NOT NULL,
bachelor_general_min_s... |
SELECT
id,
effort_name,
effort_primary_species,
effort_status,
effort_purpose,
effort_agency
FROM efforts
WHERE id = ${id};
|
#------------------------------------------------------------
# Script MySQL.
#------------------------------------------------------------
#------------------------------------------------------------
# Table: Editor
#------------------------------------------------------------
CREATE TABLE Editor(
I... |
SELECT empno, ename, sal
FROM employees
WHERE sal >=
(SELECT sal
FROM employees
WHERE empno = 1003)
/
|
DROP TABLE IF EXISTS Users;
DROP TABLE IF EXISTS Kingdoms;
DROP TABLE IF EXISTS Villages;
DROP TABLE IF EXISTS Variables;
PRAGMA foreign_keys = ON;
CREATE TABLE Users (
uid text,
username text,
doubloons int,
rank int,
rumpus_count int,
block in... |
--Création de la base de données webDevelopment avec l'encodage UTF-8
CREATE DATABASE `webDevelopment` CHARACTER SET 'utf8';
|
SELECT TOP 10
total_elapsed_time/1000.0 as total_elapsed_time
,execution_count
,(total_elapsed_time/execution_count)/1000.0 AS [avg_elapsed_time_ms]
,last_elapsed_time/1000.0 as last_elapsed_time
,total_logical_reads/execution_count AS [avg_log... |
CREATE DATABASE IF NOT EXISTS `workouts`;
USE `workouts`;
/* TODO Add proper CONSTRAINTs to the tables. */
/* TODO Revisit primary keys. */
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`email` varchar(128) DEFAULT NULL,
`password` varchar(128) DEFAULT... |
■問題
以下は、書籍目次テーブル(contents)から現在のコンテンツコードと前のコンテンツコードを、
現在のコンテンツコードについて昇順に取り出すためのSQLですが、誤りが2点あります。誤りを指摘してください。
SELECT
cp.c_id AS 前のページ,
cn.c_id AS 現在のページ
FROM
contents AS cp
OUTER JOIN
contents AS cn
ON
cp.next_id <> cn.c_id
ORDER BY
cn.c_id ASC
;
■実行文
指摘事項1:OUTER JOINではなくINNER JOINが正しい
指摘事項2:cp.next_id <> cn.c_idでは... |
-- +migrate Up
ALTER TABLE repos ADD COLUMN repo_config_path TEXT;
ALTER TABLE builds ADD COLUMN build_reviewer TEXT;
ALTER TABLE builds ADD COLUMN build_reviewed INTEGER;
ALTER TABLE builds ADD COLUMN build_sender TEXT;
UPDATE repos SET repo_config_path = '.drone.yml';
UPDATE builds SET build_reviewer = ... |
# Write your MySQL query statement below
select a.id from Weather as a join Weather as b
where a.temperature > b.temperature and dateDiff(a.recordDate,b.recordDate) = 1 |
DELIMITER $$
create procedure eliminarCabania (_cuil int)
begin
delete from cabania where cuil=_cuil;
end$$
DELIMITER $$
create procedure eliminarCliente (_cuit int)
begin
delete from cliente where cuit=_cuit;
end$$
DELIMITER $$
create procedure eliminarDomicilio (_idDomicilio int)
begin
... |
select
sub.prio
from (
select sel.prio as prio,
count(distinct issue_id) as cnt
from (
select distinct issue_id,
substring(dup_label_name from '(?i)priority/(.*)') as prio
from
gha_issues_labels
) sel
where
sel.prio is not null
group by
prio
order by
cnt desc,
pri... |
-- sample SQL statements for the digi_m_auth
CREATE TABLE digi_m_auth (
id int not null PRIMARY KEY,
created int,
updated ,
creator int,
updater int,
orderid int,
parentid int,
nodeid int,
rolename varchar(255),
username varchar(255),
password varchar(255),
)
|
select FirstName, LastName, EmployeeId
from Employee
where Title
LIKE 'Sale%'; |
DELETE FROM
open_street_next a
USING
open_street_next b
WHERE
a.cartodb_id < b.cartodb_id
AND a.segmentid = b.segmentid
AND a.segmentid <> '0000000';
--enforce whatever we started with as schema changes at DOT and open data
alter table open_street_next rename column open_date TO date_open_;
alter table
... |
create table POSITION (
id BIGINT primary key auto_increment,
code VARCHAR(100)
);
insert into position(id, code) values (0, 'Начальник цеха');
insert into position(id, code) values (1, 'Мастер');
insert into position(id, code) values (2, 'Старший мастер');
insert into position(id, code) values (3, 'Зам. мастер... |
-- Jul 6, 2008 10:30:49 AM EST
-- Default comment for updating dictionary
UPDATE AD_Column SET Callout='org.eevolution.model.CalloutBOM.getdefaults',Updated=TO_TIMESTAMP('2008-07-06 10:30:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=53333
;
-- Jul 6, 2008 10:44:22 AM EST
-- Default comment for u... |
SELECT * FROM pcinnovations.carousel |
Create Procedure mERP_sp_InsertRecdTLTypeDetail( @RecdID int, @TLTypeDesc nVarchar(1000), @Active int, @ReportFlag int)
As
Insert into tbl_mERP_RecdTLTypeDetail(RecdID, TLType_Desc, Active, ReportFlag )
Values (@RecdID, @TLTypeDesc, @Active, @ReportFlag)
|
/**
* Arquivo ddl up
*/
----------------------------------------------------
---- TIME FOLHA DE PAGAMENTO
----------------------------------------------------
---- Tarefa: 96909
----------------------------------------------------
-- Insert de valor para a tabela thtipofolha
INSERT INTO rhtipofolha VALUES(6, 'Suple... |
alter table `challenge` add column `invite_image` varchar(1024) null default null;
|
/*want to understand how many distinct campaigns the company has
running, the number of sources they have, and how they are
related*/
SELECT COUNT (DISTINCT utm_campaign)
FROM pageVistsData;
SELECT COUNT (DISTINCT utm_source)
FROM pageVistsData;
SELECT DISTINCT utm_campaign, utm_source
FROM pageVistsData
ORDER BY utm... |
--
-- Requêtes pour la création d'un base de données : `Librairie`
--
-- Total = 6 tables
-- --------------------------------------------------------
--
-- Structure de la table `Abonnes`
--
CREATE TABLE `Abonnes` (
`numSecu` varchar(15) NOT NULL PRIMARY KEY,
`nom` varchar(50) DEFAULT NULL,
`prenom` varchar... |
--Autor: Diego Salas
--Resumen: Crea un tipo de dato definido por el usuario de tipo
-- varray numerico de 20 espacios maximo.
--Fecha creacion: 20/08/2013
--Fecha modificacion:29/01/2014
--=================================================
create or replace type lista is varray(20) of number;
/
|
--ALTER VIEW BG_SHIPPED_BUT_NOT_INVOICED AS
SELECT DISTINCT
TOP (100) PERCENT MAX(CONVERT(varchar, CAST(RTRIM(OEORDHDR_SQL.shipping_dt) AS datetime), 101)) AS [Order Shipping Date],
MAX(CONVERT(varchar, CAST(RTRIM(SH.ship_dt) AS datetime), 101)) AS [Ship Date], OEORDHDR_SQL.ord_no AS [Order],... |
# ************************************************************
# Sequel Pro SQL dump
# Version 4541
#
# http://www.sequelpro.com/
# https://github.com/sequelpro/sequelpro
#
# Host: 192.168.0.254 (MySQL 5.6.28-log)
# Database: test_gc1
# Generation Time: 2018-11-22 15:25:16 +0000
# **************************************... |
CREATE view [source].dim_order_status
as
select distinct
isnull(state, '[Not Specified]') as state
,isnull(status, '[Not Specified]') as status
from
dbo.staging_orders
where
status is not null
or state is not null
--order by 1,2
|
# CATALOG
use shop_r2;
CREATE TABLE if not exists NODES (
`N_ID` BIGINT NOT NULL AUTO_INCREMENT,
`N_P0` BIGINT NULL,
`N_KIND` char(4) NOT NULL collate utf8_bin,
`N_VOID` TINYINT NOT NULL,
`N_H... |
USE burgers_db;
INSERT INTO burgers(burger_name, devoured) VALUES ("Bacon Cheese Burger", False), ("Mushroom Swiss Burger", False), ("Impossible Burger", True) |
COPY Lab1.ChirpUsers FROM stdin USING DELIMITERS '|' NULL AS '';
101|jSoRP2c7|Sirius|11/1/15|12 Grimauld Pl., London|H|4343.45||0
102|8Rhg2ive|Lavender|08/14/2015|121 West Lane, London|H|76543.5||1
123|q9hy22hh|Cho|9/3/15|Ireland|H|4323646||1
113|00ZN7H5f|Neville|7/4/15|Manchester, England|G|23455|114|1
114|Y8zUI9EZ|Lu... |
-- 1
SELECT
STUDENT_NO AS 학번
, STUDENT_NAME AS 이름
, ENTRANCE_DATE AS 입학년도
FROM TB_STUDENT
WHERE DEPARTMENT_NO = '002'
ORDER BY ENTRANCE_DATE;
-- 2
SELECT PROFESSOR_NAME
, PROFESSOR_SSN
FROM TB_PROFESSOR
WHERE LENGTH(PROFESSOR_NAME) != 3;
-- 3
SELECT PROFESSOR_NAME
, 120 - SUBSTR(PROFESSOR_SSN,1,2)
FROM TB_... |
-- phpMyAdmin SQL Dump
-- version 4.8.3
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jul 31, 2021 at 05:15 PM
-- Server version: 10.1.37-MariaDB
-- PHP Version: 7.2.12
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OL... |
set linesi 1000 trims on pagesi 1000
----------------------------------------------------------------------------
-- Step 4:
-- The president makes the final decision.
----------------------------------------------------------------------------
DECLARE
l_prin_id WF_PROCESS_INSTANCES.ID%TYPE; ... |
drop table tbl_user if exists;
drop table tbl_institute if exists;
drop table tbl_funds if exists;
drop table tbl_jwtauth if exists;
CREATE TABLE tbl_user(
usrid varchar(20) NOT NULL,
passwd varchar(64) NOT NULL,
SALT varchar(16) NOT NULL,
PRIMARY KEY (usrid)
);
CREATE TABLE tbl_jwtauth(
usrid varchar(20) N... |
INSERT INTO transactions
VALUES('2019-10-08T09:00:00Z', '1111', 1, NULL)
INSERT INTO transactions
VALUES('2019-10-08T09:00:00Z', '2222', 1, 'aaaa-bbbb-cccc-dddd')
INSERT INTO transactions
VALUES('2019-10-08T09:00:00Z', '2222', 1, NULL)
INSERT INTO transactions
VALUES('2019-10-08T09:00:00Z', '7777', 1, 'mmmm-nnnn-ooo... |
/* Question 5 */
--5.1
/*Get all the clients whose subscriptions are out of date */
SELECT cid
FROM clients
EXCEPT SELECT cid
FROM subscriptions S
WHERE S.enddate > '2018-01-01'
LIMIT 50;
--5.2
/* Show how much each drug appears in prescription for the female gender*/
SELECT PC.duid, sum(Pc.quantity)
FROM prescriptio... |
--////////////////////////////////////////////////////// 教委 //////////////////////////////////////////////////////////////////////////////////
select de042,c11,c21 from gz011cz where de011 = 2013 and de007 = '12' and jsdeg124 = 1 and czde701 = 2
and czde103 = 20130000000128 group by de042,c11,c21 order by de042;
s... |
-- Remove all orders and related records
DELETE FROM order_item_addons;
DELETE FROM order_items;
DELETE FROM shipping_requests;
DELETE FROM shipping_tracks;
DELETE FROM orders;
-- Remove all customers
DELETE FROM customers;
-- Remove all you_images
DELETE FROM you_images;
-- Remove all not used product on page.
DEL... |
-- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: 29 Okt 2018 pada 04.49
-- Versi Server: 10.1.28-MariaDB
-- PHP Version: 7.1.11
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CH... |
-- phpMyAdmin SQL Dump
-- version 5.0.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Sep 28, 2020 at 05:36 PM
-- Server version: 10.4.11-MariaDB
-- PHP Version: 7.4.2
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD... |
/*Shipments processed in WISYS, already invoiced, join with OH history to gather updated tracking and carrier if available*/ SELECT ltrim(oh.ord_no) AS Ord_No,
OH.cus_alt_adr_cd AS [Store], CASE WHEN LEN(cmt_1) = 3 THEN cmt_1 ELSE oh.ship_via_cd END AS [Carrier_Cd], pp.loc AS loc, OH.cmt_3 AS [tracking... |
/*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.
This second schema hold the information pertaining to events. Where they are,
policies, types, etc and a table to hold all the information needed for a whole event.
This... |
-- Select "Creating database and Tables";
source schema.sql
Select "Changing Engine to MyISAM";
Source change_to_myisam.sql
Select "Inserting Base Data ";
Source basedata.sql
Select "Changing Engine to InnoDB";
Source change_to_innodb.sql
Select "Adding Constraint";
Source constraint.sql
|
-- 130p
CREATE TABLE USERS(
ID VARCHAR2(8) PRIMARY KEY,
PASSWORD VARCHAR2(8),
NAME VARCHAR2(20),
ROLE VARCHAR2(5)
);
select * from users;
truncate table users;
insert into users
values('test', 'test123', '관리자', 'Admin');
commit;
... |
CREATE TABLE IF NOT EXISTS `ride` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`comment` text NOT NULL,
`track` text CHARACTER SET latin1 NOT NULL,
`length` double NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 A... |
DELIMITER $$
USE ticketstore$$
/*
*Author - Neloy Das
*Created on 24/07/2016
*/
DROP PROCEDURE IF EXISTS ticketstore.insertScreening$$
CREATE PROCEDURE ticketstore.insertScreening (
IN in_imdbid VARCHAR(50),
IN in_title VARCHAR(500),
IN in_moviedate VARCHAR(50),
IN in_ticketprice DOUBLE,
OUT POUT_Ret_C... |
create table session(
key char(16) not null,
data bytea,
expiry integer not null,
primary key(key)
);
grant all privileges on table "session" to gha_admin;
|
SET DATABASE TO Goliath;
ALTER TABLE IF EXISTS Feed ADD COLUMN link STRING;
UPDATE Feed SET link = url; |
CREATE procedure spr_list_PaymentDetail(@PaymentID integer)
as
select PaymentDetail.OriginalID,
"Document ID" = PaymentDetail.OriginalID,
"Date" = PaymentDetail.DocumentDate,
"Type" = case DocumentType
when 1 then
'Purchase Return'
when 2 then
'Debit Note'
when 3 then
'Payments'
when 4 then
'Purchase'
when 5 then
'Cred... |
DELIMITER $$
drop function if exists calc_tweet_prio;
create function calc_tweet_prio(
p_favoriteCount int, p_retweetCount int, p_followerCount int
) returns float
begin
/*
Errechnet die Priorität für einen Tweet anhand dessen Retweets, Likes und Anzahl Follower
Implementiert die Formel zur Priorisieren von Tweet... |
# A table for mapping variations to variation_sets
CREATE TABLE IF NOT EXISTS variation_set_variation (
variation_id int(10) unsigned NOT NULL,
variation_set_id int(10) unsigned NOT NULL,
PRIMARY KEY (variation_id,variation_set_id),
KEY variation_set_idx (variation_set_id,variation_id)
);
# A table containing vari... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.