text stringlengths 6 9.38M |
|---|
-- phpMyAdmin SQL Dump
-- version 4.6.5.2
-- https://www.phpmyadmin.net/
--
-- Хост: 127.0.0.1
-- Час створення: Січ 14 2018 р., 09:57
-- Версія сервера: 10.1.21-MariaDB
-- Версія PHP: 5.6.30
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIE... |
--PIVOT Example
-- Let's create our example table
CREATE TABLE dbo.PivotTest
(
OrderID INT NOT NULL,
OrderDate DATE NOT NULL,
SalesID INT NOT NULL,
CustID VARCHAR(5) NOT NULL,
Qty INT NOT NULL,
CONSTRAINT PK_Orders PRIMARY KEY(OrderID)
);
-- Load the ... |
create database Final_Eleccion
use Final_Eleccion
--Tabla Administrador
create table administrador
(
Id_administrador int IDENTITY,
Usuario varchar(50),
Passwor int,
CONSTRAINT PK_ADMINISTRADOR PRIMARY KEY(Id_administrador)
)
--Tabla Elecciones
create table Elecciones
(
Id_eleccion int IDENTITY,
Nombre varchar(50),
... |
-- Table: user_roles
-- DROP TABLE user_roles;
create table user_roles
(
id bigint not null auto_increment,
user_id bigint not null,
role_id bigint not null,
constraint user_roles_pkey primary key (id),
constraint user_roles_user_id_fkey foreign key (user_id) references users (id),
constraint user_ro... |
-- phpMyAdmin SQL Dump
-- version 3.3.9
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Apr 03, 2014 at 06:28 PM
-- Server version: 5.5.8
-- PHP Version: 5.3.5
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SE... |
/* File with statements for creating tuples for the Boxes and Items relation in order to keep track
of boxes and items in storage.
Created: 5/15/17
Last updated: 5/19/17 */
/* Boxes have attributes (bid, label location). Location defaults as null.
Items have attributes (iid, name, owner, description, bid). Descritpion... |
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Mar 01, 2019 at 08:35 AM
-- Server version: 10.1.9-MariaDB
-- PHP Version: 5.6.15
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLI... |
--繰上返済情報
SELECT DISTINCT
--契約番号
B.CONTRACT_NO,
--回数(PK)
B.COUPON,
--繰上返済関連回数
B.PREPAYMENT_KEY,
--申請番号
B.APPLY_NO,
--回収通貨
B.CURRENCY_ID,
--回収予定日
B.WITHDRAW_SCHEDULE_DATE,
--回収予定額
B.WITHDRAW_SCHEDULE_AMOUNT,
--回収実績日
B.WITHDRAW_RESULT_DATE,
--回収実績額
B.WITHDRAW_RESULT_AMOUNT,
--回収不要フラグ
B.UN_WITHDRAW_FLG,... |
--3. Заказы (Orders) с ценой товара более 100$ либо количеством единиц товара более 20 штук и присутствующей датой комплектации всего заказа (PickingCompletedWhen).
--Вывести:
--* OrderID
--* дату заказа в формате ДД.ММ.ГГГГ
--* название месяца, в котором была продажа
--* номер квартала, к которому относится прода... |
CREATE TABLE `place` (
`Id` int NOT NULL AUTO_INCREMENT,
`IdClient` int NOT NULL DEFAULT '0',
`IdAddress` int NOT NULL DEFAULT '0',
`IdPlaceGroup` int NOT NULL DEFAULT '0',
`Lat` decimal(8,6) NOT NULL DEFAULT '0.000000',
`Lon` decimal(8,6) NOT NULL DEFAULT '0.000000',
`LatShort3` smallint NOT NULL DEFAULT... |
INSERT INTO public.user_types (id, user_type) VALUES (1, 'student');
INSERT INTO public.user_types (id, user_type) VALUES (2, 'mentor');
INSERT INTO public.user_types (id, user_type) VALUES (3, 'creep'); |
CREATE ROLE sympa;
-- [..omissis.. ] give him access hba.conf....
GRANT CONNECT ON DATABASE obvious_db TO sympa WITH PASSWORD 'youknowwhatitis';
-- This assumes you're actually connected to obvious_db..
GRANT USAGE ON SCHEMA exixting_schema TO sympa;
ALTER ROLE sympa SET search_path TO exixting_schema;
CREATE VIEW li... |
# 查询出以美字为结尾的用户有哪些
select *
from 20200605_tb_employee
where employee_name like '%美';
# 查询出出生在是湖北省的用户有哪些
select *
from 20200605_tb_employee
where employee_city like '湖北省%';
# 找出属于研发部的男性用户且名字长度是3的用户有哪些
select *
from 20200605_tb_employee
where employee_name like '___'
and employee_dept = '研发部'
and employee_sex = '男';... |
/*
################################################################################
Migration script to rename ASSOCIATION table columns
Designed for execution with Flyway database migrations tool; this should be
automatically run to completely generate the schema that is out-of-the-box
compatible with the GOCI model ... |
--------------------------------------------------------
-- Constraints for Table R_FLEX_ATTRIBUTE_MGMT
--------------------------------------------------------
ALTER TABLE "VF_SPMC_REF"."R_FLEX_ATTRIBUTE_MGMT" MODIFY ("FLEX_ATTR_DISPLAY_NAME" NOT NULL ENABLE);
ALTER TABLE "VF_SPMC_REF"."R_FLEX_ATTRIBUTE_MGMT"... |
create table player_limitation_traces
(
id bigint not null auto_increment,
player_id bigint not null,
user_id bigint,
loss_limit bigint,
loss_time_unit character varying(20),
bet_limit bigint,... |
-- change default tablespace
ALTER DATABASE DEFAULT TABLESPACE &ts_name;
-- change default temp tablespace
ALTER DATABASE DEFAULT TEMPORARY TABLESPACE &temp_name;
-- change global name
ALTER DATABASE RENAME GLOBAL_NAME TO &new_global_name.&new_domain;
-- change date/time settings for session
ALTER SESSION ... |
-- MySQL dump 10.13 Distrib 8.0.26, for Win64 (x86_64)
--
-- Host: 127.0.0.1 Database: test
-- ------------------------------------------------------
-- Server version 8.0.26
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;... |
CREATE TABLE IF NOT EXISTS `admins` (
`ckey` varchar(255) NOT NULL,
`rank` int(2) NOT NULL,
PRIMARY KEY (`ckey`)
) DEFAULT CHARACTER=latin1;
CREATE TABLE `library` (
`id` INT(11) NOT NULL AUTO_INCREMENT ,
`author` TEXT NOT NULL ,
`title` TEXT NOT NULL ,
`content` TEXT NOT NULL ,
`category` TEXT NOT NU... |
-- 1. List the details of all the managers of the store in the past two months.
select
P.`address`,
P.`gender`,
P.`date_of_birth`,
P.`first_name`,
P.`middle_name`,
P.`last_name`,
M.`start_date`,
E.`current_status`
from `Manager` as M
inner join `Person` as P
inner join `Employee` as E on M.`... |
CREATE PROC [ERP].[Usp_Sel_Cliente_By_Nombre_Documento]-- 1,'PP'
@IdEmpresa INT,
@NombreDocumento VARCHAR(250)
AS
BEGIN
SELECT C.ID,
EN.Nombre AS NombreCompleto,
C.FechaRegistro,
P.Nombre,
P.ApellidoPaterno,
P.ApellidoMaterno,
ETD.IdTipoDocumento,
ETD.NumeroDocumento,
TD.Abreviatura AS N... |
# --- Created by Ebean DDL
# To stop Ebean DDL generation, remove this comment and start using Evolutions
# --- !Ups
create table task (
id bigint auto_increment not null,
description varchar(255),
priority integer,
done ... |
USE employee_management_db;
INSERT INTO departments (department)
VALUES ("Kitchen"), ("Finance"), ("Operations");
INSERT INTO roles (title, salary, dept_id)
VALUES ("Owner", 250000, 3),
("Head Chef", 155000, 1),
("Pastry Chef", 125000, 1),
("Finance Manager", 115000, 2),
("General Manag... |
select count(*) from RawDataset where bedyear is null
select count(*) from RawDataset where bedyear is not null
select count(*) from RawDataset where endage is null
select count(*) from RawDataset where endage is not null
select count(*) from RawDataset where ethnos is null
select count(*) from RawDataset where et... |
-- CS 61A Fall 2014
-- Name: Ganesh Prasad Rapolu
-- Login: cs61a-yp
create table parents as
select "abraham" as parent, "barack" as child union
select "abraham" , "clinton" union
select "delano" , "herbert" union
select "fillmore" , "abraham" union
select "... |
CREATE TABLE student(sid integer, sn char(32));
--CREATE TABLE course(cid integer, cn char(32));
--CREATE TABLE take(sid integer, cid integer, crating double, cgrade double);
INSERT INTO student(sid, sn) VALUES (1, 'sdfj, oisdfjso');
--
select * from student;
--
--test insert with redundent data
INSERT INTO student(... |
# Write your MySQL query statement below
# Find all the pairs of users with the maximum number of common followers
# Construct table with common follower numbers
# Find pairs with maxCommon
WITH Pairs AS (SELECT user1_id, user2_id, COUNT(*) AS CommF
FROM (SELECT R1.user_id AS user1_id, R2.user_id AS user2_i... |
/*
@author 2019aliu
SQL database operations for cookie clicker
*/
-- Make all tables, populate data as needed
-- Main table, keep track of user stats
DROP TABLE IF EXISTS cookieClickers;
CREATE TABLE cookieClickers(
user VARCHAR(100), PRIMARY KEY(user),
cookiesCount DECIMAL(18,1) DEFAULT 0,
clickCount INT... |
SELECT
org_branches.id as Id,
org_branches.organization_id as org_unit_id,
org_branches.address_id as mpd_address,
coalesce(org_branches.caption, '') as caption
from
org_branches
where
org_branches.record_state <> 4 |
/*
Queries used for Covid-19 Project
*/
select * from CovidProject..CovidDeaths
where continent <> ''
order by 3,5
-- Select Data that we are going to be starting with
select location, date, total_cases, new_cases, total_deaths, population
from CovidProject..CovidDeaths
where continent <> ''
order by ... |
drop table polling_places;
create table polling_places (
State text,
DivisionID numeric,
DivisionNm text,
PollingPlaceID numeric,
PollingPlaceTypeID numeric,
PollingPlaceNm text,
PremisesNm text,
PremisesAddress1 text,
PremisesAddress2 text,
PremisesAddress3 text,
PremisesSuburb text,
PremisesStateAb text,... |
/* Chapter 7: The SELECT Clause */
/* COUNT(*) */
/* First, the ubiquitous "SELECT COUNT(*) FROM table" */
SELECT
COUNT(*) AS rows
FROM
members
;
/* Results should look like this --
rows
5
*/
SELECT
forums.id AS f_id
, forums.name AS forum
, threads.id AS t_id
, threads.name AS threa... |
-- 1) 4th Highest salary in Specific Dept or all Dept
SELECT salary FROM
(SELECT DISTINCT salary FROM employee_system.employee
ORDER BY salary DESC LIMIT 3) AS Result
ORDER BY salary LIMIT 1;
-------------
SELECT salary, dept_id FROM
(SELECT DISTINCT salary, dept_id FROM employee_system.employee
GROUP BY dept_id ORDE... |
\c Xanadu;
INSERT INTO category (name) VALUES ('Machine Learning');
INSERT INTO category (name) VALUES ('Music');
INSERT INTO category (name) VALUES ('Sports');
INSERT INTO category (name) VALUES ('Entertainment');
INSERT INTO category (name) VALUES ('Gaming');
INSERT INTO category (name) VALUES ('Frameworksq');
|
drop database if exists Trackr;
create database Trackr;
use Trackr;
create table `user` (
id int primary key auto_increment,
fname varchar(20) not null,
lname varchar(20) not null,
email varchar(50) not null,
`password` varchar(32) not null
);
create table to_do_folder (
id int primary ke... |
# Write your MySQL query statement below
# CTE: products that have changed prices
## Use rank() function to get the latest price
with Changes as (select product_id, new_price, rank () over (partition by product_id order by change_date desc) as ranks
from Products
where change_date <= '2019-08-16')
# Main Output
## Ass... |
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: localhost:3306
-- Generation Time: Jan 21, 2017 at 09:01 PM
-- Server version: 5.6.34
-- PHP Version: 5.5.30
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT... |
SET SERVEROUTPUT OFF;
DECLARE
v_feed_id NUMBER := ###;
type r_loc is record
(
location_mapping_id NUMBER
);
type t_locs is table of r_loc index by pls_integer;
v_locs t_locs;
type r_range is record
(
location_mapping_range_id NUMBER
);
type t_ranges is table of r_ran... |
select
1
, 'foo' as "f"
, bar as b
from
/*$table_name*/xxxxxxxx
where 1 = 1
and 2 = 2
/*%if t_param*/
and col1 = /*:c1*/'col1_value'
/*end*/
/*%if f_param*/
and col2 = /*:c2*/'col2_value'
/*end*/
/*%if t_param*/
and col1 = /*$c1*/'col1_value'
/*end*/
/*%if f_par... |
create table DEPARTAMENTO (
id_departamento number not null constraint departamento_pk primary key,
nombre_depto varchar2(15),
localizacion_piso number,
localizacion_oficina number
);
create table EMPLEADO (
id_empleado number not null constraint empleado_pk primary key,
cedula number not null,
... |
DELETE FROM newsales
WHERE id IN
(SELECT id
FROM
(SELECT id,
ROW_NUMBER() OVER( PARTITION BY
clie_id,
subs_id,
account,
nz,
channel,
channel_detail,
filial,
ltc,
tstet,
top147,
np,
street,
house,
korp,
apartment,
phone_room,
serv_name,
tp,
town_id,
fio,... |
CREATE TABLE user_sessions(
id UUID PRIMARY KEY,
user_id UUID REFERENCES users(id),
refreshed_at TIMESTAMP NOT NULL,
created_at TIMESTAMP NOT NULL
)
|
-- compute average of all scores in table
SELECT SUM(score)/COUNT(*) AS average FROM second_table;
|
SELECT * FROM temp_users a WHERE rowid = (SELECT MAX(rowid) FROM temp_users b WHERE a.password=b.password);
SELECT * FROM temp_users a WHERE rowid != (SELECT MAX(rowid) FROM temp_users b WHERE a.password=b.password);
SELECT username, marks from temp_users where marks > (SELECT AVG(marks) from temp_users);
SELECT e.use... |
SET NAMES UTF8;
DROP DATABASE IF EXISTS gk;
CREATE DATABASE gk CHARSET=UTF8;
USE gk;
/*果酷水果家族分类*/
CREATE TABLE gk_fruit_family(
fid INT PRIMARY KEY AUTO_INCREMENT,
fname VARCHAR(32)
);
/*果酷水果家族分类数据导入*/
INSERT INTO gk_fruit_family VALUES
/*专利分格 超级果盒 三分果盒 二分果盒 迷你果盒 */
(NULL,'专利分格'),
/*彩虹果杯 大型果杯 中型果杯 标准果杯 迷你果杯*/
(NULL,... |
DECLARE
CURSOR instruct(dept instructor.dept_name%TYPE) IS SELECT * FROM INSTRUCTOR;
inst_row instructor%ROWTYPE;
salary instructor.salary%TYPE;
id instructor.ID%TYPE;
x INT := 0;
BEGIN
open instruct;
while(x < 5) LOOP
FETCH instruct INTO inst_row;
if inst_row %FOUND THEN
FETCH inst_row.ID INTO id;
FETCH inst... |
SELECT *
FROM adventureworks_analytics.all_person_info
WHERE email_promotion = 'Does not wish to receive promotions'
AND phone_number_type = 'Cell' |
REM INSERTING into VF_SPMC_REF.R_CURRENCY
SET DEFINE OFF;
Insert into VF_SPMC_REF.R_CURRENCY (CURRENCY_CD,CURRENCY_DESC,CREATION_DT,CURR_FLAG_YN,VALID_FROM_DT,VALID_UNTIL_DT) values ('INR','Indian Rupees',to_date('05-MAR-15','DD-MON-RR'),'Y',to_date('05-MAR-15','DD-MON-RR'),null);
|
ALTER TABLE IACUC_PROTOCOL_PERSONS
ADD CONSTRAINT FK_IACUC_PROTOCOL_PERS_AFF
FOREIGN KEY (AFFILIATION_TYPE_CODE)
REFERENCES AFFILIATION_TYPE (AFFILIATION_TYPE_CODE)
/
ALTER TABLE IACUC_PROTOCOL_PERSONS
ADD CONSTRAINT FK_IACUC_PROTOCOL_PERS_PROT
FOREIGN KEY (PROTOCOL_ID)
REFERENCES IACUC_PROTOCOL (PROTO... |
-- phpMyAdmin SQL Dump
-- version 5.0.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: May 06, 2021 at 07:26 PM
-- Server version: 10.4.17-MariaDB
-- PHP Version: 8.0.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIEN... |
-- UTF-8:Sí (sin bom)
/*TIENE:SCHEMA*/
drop schema if exists tests cascade;
--DB*/
/*OTRA*/
/*TIENE:SCHEMA*/
create schema tests;
--DB*/
/*OTRA*/
/*POSTGRESQL*/
set search_path to tests,tipox,public;
--DB*/
/*OTRA*/
create table prueba_tabla_comun(
id serial primary key,
nombre text,
importe... |
ALTER TABLE person ADD COLUMN cupido bit DEFAULT 1;
CREATE TABLE `_cupido_ignores` (
`email1` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`email2` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`ignore_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY ... |
-- *********************************************************************
-- Update Database Script
-- *********************************************************************
-- Change Log: changelog.groovy
-- Ran at: 10/04/14 5:58 PM
-- Against: postgres@jdbc:postgresql://localhost/downloads-dev
-- Liquibase version: 2.0... |
/*
################################################################################
Migration script to accommodate a SNP_MERGED_SNP table,
designed to captured snps that have been merged into another SNP in a
newer genome build
Designed for execution with Flyway database migrations tool; this should be
automaticall... |
Use iSell;
Select * from iSell.Visitor_Log
order by visit_datetime desc;
Select * from Recently_Viewed_Product
order by Viewed_DateTime desc;
Select vl.Customer_IP_Address, vl.Visit_DateTime, vl.Initial_URL, rv.Product_ID, rv.Email_ID
from Visitor_Log vl
inner join Recently_Viewed_Product rv
on vl.Customer_IP_Addre... |
CREATE VIEW TZ_ETL_JOB_AGENT AS
SELECT J.JOB_AGENT_CD ,
J.JOB_AGENT_NAME ,
J.JOB_AGENT_DESC ,
J.RECORD_STATUS ,
J.LAST_RUN_NO ,
J.LAST_RUN_STATUS ,
J.LAST_RUN_START_DT + TZ.UTC_minutes * INTERVAL '1 minute' as LAST_RUN_START_DT ,
J.LAST_RUN_END_DT + TZ.UTC_minutes* INTERVAL '1 minute' as LAST_RUN_END... |
/* Formatted on 21/07/2014 18:39:05 (QP5 v5.227.12220.39754) */
CREATE OR REPLACE FORCE VIEW MCRE_OWN.V_MCREI_APP_BENI
(
ID_DPER,
ID_LOGICAL_BENE,
COD_ABI,
COD_UO_BENE,
COD_BENE,
DESC_EX_TIPO_BENE,
COD_TIPO_BENE,
DESC_COD_TIPO_BENE,
COD_STATO_BENE,
DESC_COMUNE,
COD_PROVINCIA,
DESC_LO... |
SELECT
/*IF (maxCount != null && maxCount != "")*/
TOP /*$maxCount*/9991
/*END*/
T1.INVOICE_ID AS hInvoiceId, --债权ID
T1.INVOICE_NO AS hInvoiceNo, --债权号
T1.BUYER_CODE, --买方代码
T1.BUYER_NAME, --买方名称
T1.FACTORING_STATUS AS financingStatus, --融资状态
T1.AMOUNT AS hInvoiceAmount, --债权有效金额
T1.TRANSFEREE_DATE AS h... |
ALTER TABLE `wtss_user`
ADD COLUMN `modify_type` varchar(50) NULL COMMENT '用户变更类型' AFTER `update_time` ;
ALTER TABLE `wtss_user`
ADD COLUMN `modify_info` varchar(300) NULL COMMENT '用户变更内容' AFTER `modify_type`;
UPDATE `wtss_user` SET modify_type='0';
UPDATE wtss_user set modify_info='Normal'; |
WITH REQUST_WITHDRAW_INFO_VIEW AS (
--請求回収情報
SELECT
--契約番号
AA.CONTRACT_NO,
--(回収予定額 - ISNULL(回収実績額, 0)) AS 回収額
ISNULL(AA.WITHDRAW_SCHEDULE_AMOUNT,0) - ISNULL(AA.WITHDRAW_RESULT_AMOUNT,0) AS WITHDRAW_AMOUNT,
--NULL AS 開始日
NULL AS DELAYED_START_DATE,
--回収予定日
AA.WITHDRAW_SCHEDULE_DATE,
--10:賦払金 AS 入金小分類
'10' AS ... |
ALTER TABLE `addons_users`
MODIFY `addon_id` int(10) unsigned NOT NULL,
MODIFY `user_id` int(11) NOT NULL,
MODIFY `role` smallint(6) NOT NULL,
MODIFY `listed` tinyint(1) NOT NULL,
MODIFY `position` int(11) NOT NULL,
DROP FOREIGN KEY `addons_users_ibfk_1`, /* `addon_id` */
DROP FOREIGN KEY `... |
SET FOREIGN_KEY_CHECKS = 0;
DROP TABLE IF EXISTS HISTORIQUE;
DROP TABLE IF EXISTS REMOTE;
DROP TABLE IF EXISTS UTILISATEUR;
DROP TABLE IF EXISTS EVENEMENT;
DROP TABLE IF EXISTS EVENEMENT_COULEUR;
DROP TABLE IF EXISTS EVENEMENT_CATEGORIE;
DROP TABLE IF EXISTS DOSSIER_CLIENT;
CREATE TABLE DOSSIER_CLIENT (
id ... |
CREATE DATABASE IF NOT EXISTS m2h1;
use m2h1;
set hive.exec.dynamic.partition.mode=nonstrict;
set hive.tez.java.opts=-Xmx1024m;
set hive.execution.engine=${engine};
CREATE TABLE IF NOT EXISTS carriers (
code varchar(5),
description string
)
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.OpenCSVSerde'
WITH SERD... |
SELECT *
FROM mode.line_items |
select car_img, maker, model, car_year, price, car_option, hiredate
from (select car_img, maker, model, car_year, price, car_option, hiredate, row_number() over(order by hiredate desc) r_num
from(select cmo.car_img, cma.maker, cmo.model, cmo.car_year, cmo.price, cmo.car_option, cmo.hiredate
from car_maker cma, c... |
create table Entrada(
id serial primary key,
nombre varchar(20)
);
create table Camara(
id serial primary key,
fkEntrada int references Entrada(id),
modelo varchar(20)
);
create table Persona (
id serial primary key,
mac varchar(30)
);
create table ePersona (
id serial primary key,
sexo varchar(10),
edad ... |
DROP DATABASE ERP;
-- Abrir consola de MySQL
-- Loguearse como usuario: root password: root
-- Copiar y pegar el código siguiente en la consola
-- El usuario para conectarse a la base de datos desde la aplicación es ADMIN y la contraseña 1234
create database erp default character set utf8 collate utf8_general_ci... |
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
insert into producto values (010, 'sencillo resortado 100x190','colchon','dormissueños',3);
insert into producto val... |
--liquibase formatted sql
--changeset admin:2
create table review
(
id bigint primary key
not null,
grade int,
review_comment character varying,
book_id bigint
not null
references book
);
insert into review (id, grade, review_comment, book_id)
values (... |
SELECT
-- A.一括取込番号
A.UPLOAD_BATCH_ID,
-- A.ファイル明細連番
A.SEQ_ID,
-- A.拠点コード
A.BRANCH_CODE,
-- A.通货
A.CURRENCY_ID,
-- A.小切手番号
A.CHEQUE_NO,
-- A.小切手種別
A.CHEQUE_CATEGORY,
-- A.発行銀行
A.ISSUE_BANK,
-- A.チェックグループ
A.CHECK_GROUP,
-- A.有効期限日
A.EXPIRY_DATE,
-- A.小切手状況
A.CHEQUE_STATUS,
-- A.取引先コード
A.CUSTOM_CODE,... |
/*
SQLyog Community v12.2.6 (64 bit)
MySQL - 10.1.36-MariaDB : Database - oglasnik
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;
/*!40101 SET SQL_MODE=''*/;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIG... |
CREATE TABLE Users (
Id int NOT NULL IDENTITY PRIMARY KEY,
Email varchar(255) NOT NULL,
Password varchar(255) NOT NULL,
RegistrationDate date DEFAULT GETDATE()
);
CREATE TABLE Roles (
Id int NOT NULL IDENTITY PRIMARY KEY,
RoleName varchar(255) NOT NULL,
);
CREATE TABLE UserRoles (
UserId ... |
insert into comment values(1, 'hello');
insert into comment values(2, 'world');
alter sequence HIBERNATE_SEQUENCE restart with 3; |
PARAMETERS [@FechaIniID] Text ( 255 ), [@FechaFinID] Text (255);
SELECT cdate(format(A.FechaID,"####-##-##")) AS Fecha,
C.Fundo,
D.Categoria,
E.LoteNombre,
F.NombreComercial,
B.Cantidad,
G.MotivoNombre,
B.Dosis,
B.CantidadCilindro,
B.Campaña,
H.Maq... |
/*3. Выберите информацию по клиентам, которые перевели компании пять максимальных платежей из Sales.CustomerTransactions.
Представьте несколько способов (в том числе с CTE).*/
--------Подзапрос. 1 вариант.--------
SELECT CustomerID, FullName, PersonID
FROM Sales.CustomerTransactions CT
JOIN Application.People P ... |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
* Author: Hoca
* Created: 27.Şub.2016
*/
insert into auth_kullanici (id,username,pass) values (1,'test','1');
--select 'i... |
INSERT INTO burgers (burger_name, devoured)
VALUES
("Five Guys", false),
("Bobs Burger", false),
("Super Duper Burger", false),
("Smash Burger", false),
("InNOut Burger", false);
|
CREATE TABLE todos (
id BIGSERIAL PRIMARY KEY,
name TEXT NOT NULL,
completed BOOLEAN DEFAULT FALSE,
created_at timestamptz DEFAULT (now())
);
|
-- phpMyAdmin SQL Dump
-- version 4.0.9
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Nov 10, 2014 at 07:07 PM
-- Server version: 5.6.14
-- PHP Version: 5.5.6
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/... |
-- 1. HAWQ table
DROP TABLE IF EXISTS retail_demo.categories_dim_hawq;
CREATE TABLE retail_demo.categories_dim_hawq
(
category_id integer NOT NULL,
category_name character varying(400) NOT NULL
)
WITH (appendonly=true, compresstype=quicklz) DISTRIBUTED RANDOMLY;
-- 2. HAWQ table
DROP TABLE IF EXISTS retail_dem... |
SET ECHO OFF
SET TERMOUT OFF
SET TIMING OFF
SET HEADING OFF
SET TRIMSPOOL ON
SET VERIFY OFF
SET FEEDBACK OFF
SET FEED OFF
SET LONG 10000
SET NEWPAGE NONE
SET PAGESIZE 0
SET LINESIZE 10000
SPOOL "&2/&1..spool";
WITH HEAD AS
(SELECT 'SET ECHO OFF' || CHR(10) || 'SET TERMOUT OFF' || CHR(10) || 'SET TIMING OFF' || CHR(1... |
-- DropForeignKey
ALTER TABLE "accounts" DROP CONSTRAINT "accounts_fk";
-- DropForeignKey
ALTER TABLE "sessions" DROP CONSTRAINT "sessions_fk";
-- DropForeignKey
ALTER TABLE "user_tokens" DROP CONSTRAINT "user_tokens_fk";
-- AlterTable
ALTER TABLE "projects" ADD COLUMN "public_project" BOOLEAN NOT NULL DEFAULT t... |
CREATE TABLE klanten.dbo.TblInvoiceline (
Id int NOT NULL IDENTITY(1,1),
OrderId int DEFAULT (NULL),
InvoiceId int DEFAULT (NULL),
VatRateId int DEFAULT (NULL),
Currency VARCHAR(3),
Amount float DEFAULT ((0)),
SequenceNumber int DEFAULT ((0)),
Description VARCHAR(8000)
)
CREATE INDEX TblInvoiceline$Amou... |
-- this is to import the different .csv in the folder data into a database which follows create_tables.sql's schema
import from Podcast.csv of del insert into Podcast;
import from Subscription.csv of del insert into Subscription;
import from Audiofile.csv of del insert into Audiofile;
import from b_user.csv of del ... |
-- Prepare the Balic flag dimension
DROP TABLE IF EXISTS BAJAJ_DM.D_balic_flag;
CREATE TABLE BAJAJ_DM.D_balic_flag (
id TINYINT NOT NULL,
description varchar(20) NOT NULL
)ENGINE=MDB DEFAULT CHARSET=utf8;
INSERT INTO BAJAJ_DM.D_balic_flag (id, description) VALUES
(0, 'NOT_BALIC_PRODUCT'),
(1, 'BALIC_PRODUCT');
|
# --- !Ups
CREATE TABLE REVISIONS (
id BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
repoAuthorID BIGINT,
logMessage VARCHAR(2048) NOT NULL,
revisionNumber BIGINT NOT NULL,
date TIMESTAMP NOT NULL,
repoID BIGINT NOT NULL
);
-- foreign key constrai... |
select plane.model, count(*) from plane where plane.model like '767%' group by plane.model;
|
CREATE DATABASE IF NOT EXISTS `car_pooling` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `car_pooling`;
-- MySQL dump 10.13 Distrib 5.6.17, for Win32 (x86)
--
-- Host: localhost Database: car_pooling
-- ------------------------------------------------------
-- Server version 5.5.41
/*!40101 SET @OLD_CHARACTER_SE... |
DECLARE
CURSOR C_CT_ESCOPO IS
SELECT
CT.*
FROM VND.ELO_CARTEIRA CT
INNER JOIN VND.ELO_AGENDAMENTO AGE
ON
AGE.CD_ELO_AGENDAMENTO = CT.CD_ELO_AGENDAMENTO
WHERE
CT.IC_ATIVO = 'S'
AND AGE.IC_ATIVO = 'S'
AND AGE.CD_ELO_STATUS IN (1,2,3,4,5,6,7 )
AND AGE.DT_WEEK_START < CURRENT_DATE -20
AND NVL(CT.QT_AGENDADA_CONF... |
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';
CREATE SCHEMA IF NOT EXISTS `ibrainmart` DEFAULT CHARACTER SET latin1 ;
USE `ibrainmart` ;
CREATE TABLE IF NOT EXISTS `ibrainma... |
ALTER TABLE `abuse_reports`
MODIFY `addon_id` int(10) unsigned DEFAULT NULL,
DROP FOREIGN KEY `reporter_id_refs_id_12d88e23`,
DROP FOREIGN KEY `user_id_refs_id_12d88e23`,
DROP FOREIGN KEY `addon_id_refs_id_2b6ff2a7`,
ADD CONSTRAINT `abuse_reports_addon_id_f15faa13_fk_addons_id` FOREIGN KEY (`addon_i... |
-- #df:checkEnv(df:default)#
-- #df:assertEquals(MemberStatus)#
select * from MEMBER_STATUS;
-- #df:assertEquals(EscapedDfprop)#
select * from WHITE_ESCAPED_DFPROP;
|
CREATE OR REPLACE PROCEDURE pr_Example IS
var_name VARCHAR2(20) := 'Lionel';
var_web Varchar2(20) := 'LionelMessi.com';
BEGIN
DBMS_OUTPUT.PUT_LINE(var_name || ' from ' || var_web);
END pr_Example;
/
EXECUTE pr_Example;
/
BEGIN
pr_Example;
END;
/
-- homework, calling procedure from a function
CREATE OR REPLA... |
--// Create_Notification_table
-- Migration SQL that makes the change goes here.
create table Notification(
id varchar(36) primary key not null,
updatedOn bigint unsigned not null,
createdOn bigint unsigned not null,
echoedUserId varchar(36) not null,
originId varchar(36) not null,
category var... |
SELECT s.hacker_id, h.name
FROM submissions s JOIN challenges c ON s.challenge_id = c.challenge_id
JOIN difficulty d ON c.difficulty_level = d.difficulty_level
JOIN hackers h ON s.hacker_id = h.hacker_id
WHERE s.score = d.score
GROUP BY s.hacker_id, h.name
HAVING COUNT(s.hacker_id) > 1
ORDER BY C... |
-- DDL
CREATE DATABASE Filmes; -- aqui foi criado o banco de dados "Filmes" (a entidade no conceitual)
USE Filmes; -- aqui muda de "branch"
CREATE TABLE Generos -- criação da tabela de Generos (na lógica)
(
idGenero INT PRIMARY KEY IDENTITY, -- o idGenero vai ser uma INT, uma PRIMARY KEY(CHAVE PRIMÁRIA) e uma IDENT... |
/*
Covid-19 Data Exploration
Skills used: Import tables with the correct data type, Aggregate Functions, Joins, CTE's, Temp Tables, Creating Views
Data source: Hannah Ritchie, Esteban Ortiz-Ospina, Diana Beltekian, Edouard Mathieu, Joe Hasell, Bobbie Macdonald, Charlie Giattino, Cameron Appel, Lucas Rodés-Guirao an... |
CREATE TABLE FORUM_SUBCATEGORIES(
ID NUMBER,
CONSTRAINT FORUM_SUBCATEGORIES_PK PRIMARY KEY(ID),
ID_CATEGORY NUMBER,
CONSTRAINT FORUM_CATEGORIES_FK FOREIGN KEY(ID_CATEGORY) REFERENCES FORUM_CATEGORIES(ID),
TITLE NVARCHAR2(45),
DESCRIPTION CLOB,
DATE_ TIMESTAMP,
IP NVARCHAR2(20)
); |
SET
foreign_key_checks = 0;
DROP TABLE IF EXISTS scopes;
SET
foreign_key_checks = 1; |
/* raw password is 'john' */
insert into t_user values
(1, 'JohnDoe', 'L2nNR5hIcinaJkKR+j4baYaZjcHS0c3WX2gjYF6Tmgl1Bs+C9Qbr+69X8eQwXDvw0vp73PrcSeT0bGEW5+T2hA==', 'YcM=A$nsYzkyeDVjEUa7W9K', 'ROLE_USER');
/* raw password is 'jane' */
insert into t_user values
(2, 'JaneDoe', 'EfakNLxyhHy2hVJlxDmVNl1pmgjUZl99gtQ+V3mxSeD8Ij... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.