text stringlengths 6 9.38M |
|---|
/* 가입 회원(댓글은 모두 가능) */
CREATE TABLE `ch_member` (
`seq` int(11) NOT NULL AUTO_INCREMENT COMMENT '번호',
`id` varchar(300) NOT NULL COMMENT '아이디(이메일)',
`password` varchar(65) NOT NULL COMMENT '비밀번호',
`nickname` varchar(300) NOT NULL COMMENT '닉네임',
`login_token` varchar(50) NULL COMMENT '로그인 토큰',
`last_ip... |
select rs.resortname, rs.townname
from resort rs left join cabin c
on rs.resortid = c.resortid
where c.bedroomcount = (select min(bedroomcount) from cabin)
order by 1; |
ALTER TABLE cmitem ALTER COLUMN cmitem_cmhead_id SET NOT NULL;
ALTER TABLE cmitem ALTER COLUMN cmitem_linenumber SET NOT NULL;
ALTER TABLE cmitem ALTER COLUMN cmitem_itemsite_id SET NOT NULL;
ALTER TABLE cmitem ADD CONSTRAINT cmitem_cmhead_id_fkey FOREIGN KEY (cmitem_cmhead_id) REFERENCES cmhead (cmhead_id) ON UPDATE C... |
select
count(*) as "Всего"
, count(case when stt.id is not null and ltt.id is null then 1 end) as "Только тариф КЗ"
, count(case when stt.id is null and ltt.id is not null then 1 end) as "Только тариф ДЗ"
, count(case when stt.id is not null and ltt.id is not null then 1 end) as "Тариф КЗ и тариф ДЗ"
f... |
select
max(CREDIT_PROGRAM_ID),
(lower(SUBSTR(replace(REGEXP_REPLACE(CREDIT_PROGRAM, '_| ', ''), '.', ''), 0,
length(replace(REGEXP_REPLACE(CREDIT_PROGRAM, '_| ', ''), '.', '')) - 8)))
as CREDIT_PROGRAM
from smth
group by
(lower(SUBSTR(replace(REGEXP_REPLACE(CREDIT_PROGRAM, '_| ', ''), '.', ''), 0,
length(... |
SELECT client_name, com_date, COUNT(client_name) as count_client_name
FROM dpoh_com_details
WHERE dpoh_first_name == "Stephen" AND dpoh_last_name == "Harper"
GROUP BY client_name
ORDER BY count_client_name DESC |
CREATE TABLE pdf(
pdf_id INTEGER NOT NULL UNIQUE,
pdf_name TEXT NOT NULL,
pdf_data BLOB NOT NULL,
username TEXT,
PRIMARY KEY(pdf_id AUTOINCREMENT)
);
CREATE TABLE instructor(
instructor_code TEXT NOT NULL UNIQUE,
first_name TEXT NOT NULL,
last_name TEXT NOT NULL,
email TEXT NOT NULL,
password TEXT NOT NULL,
... |
DROP DATABASE IF EXISTS pfc;
CREATE DATABASE pfc;
USE pfc;
DROP TABLE IF EXISTS user;
CREATE TABLE user(
id_user integer NOT NULL AUTO_INCREMENT,
nick varchar(20) NOT NULL,
name varchar(20) NOT NULL,
surname1 varchar(20) NOT NULL,
surname2 varchar(20),
email_user varchar(50) NOT NULL,
city varchar(20) NO... |
-- +goose Up
CREATE SEQUENCE if not exists serial START 100000;
create table if not exists dbo.orders
(
id uuid primary key not null,
code int default nextval('serial') not null,
user_name varchar(200) not null,
user_phone varchar(30) ... |
--github.com/imsunnyjha
select CITY, length(CITY) from STATION order by length(city),CITY limit 1;
select CITY, length(CITY) from STATION order by length(CITY) desc,city limit 1; |
/*
Author: Andrew Blair
Cruz ID: 1364884
Assignment: Lab 3
Description:
Write a statement that declares a default value of true to the active
attributes of mg customers.
script0.sql
*/
ALTER TABLE mg_customers
ALTER COLUMN active
SET DEFAULT true;
/*
SELECT *
FROM mg_customers
DECLARE active boo... |
"Country" "Sector"
"XA101" "Gondwana" "Stringy"
"XA103" "Amasia" "Whimsical"
"XA105" "Gondwana" "Whimsical"
"XA107" "Vaalbara" "Greedy"
"XA108" "Laurentia" "Sickly"
"XA111" "Baltica" "Bustling"
"XA113" "Amasia" "Stringy"
"XA115" "Pangaea" "Whimsical"
"XA120" "Laurentia" "Whimsical"
"XA126" "Pangaea" "Whimsical"
"XA127"... |
drop table if exists public.orders CASCADE;
create table orders
(
id bigint generated by default as identity,
create_date timestamp,
modify_date timestamp,
status varchar(32),
user_id bigint,
primary key (id),
FOREIGN KEY(USER_ID) REFERENCES PUBLIC.USERS(ID)
);
drop table... |
-- 여기는 USER3 화면입니다
-- 도서정보를 저장하기 위한 table 생성
CREATE TABLE tbl_books (
b_isbn VARCHAR2(13) PRIMARY KEY,
b_title nVARCHAR2(50) NOT NULL ,
b_comp nVARCHAR2(50) NOT NULL ,
b_writer nVARCHAR2(50) NOT NULL,
b_price NUMBER(5) ,
b_year VARCHAR2(10) ,
b_genre VARCHAR2(3)
);
-- 도서정보 추가
INSE... |
INSERT INTO
user_diets (user_id, diet_id)
VALUES
(2, 1),
(3, 2),
(1, 3); |
WITH SystemHealth AS (
SELECT CAST(target_data as xml) AS TargetData
FROM sys.dm_xe_session_targets as st
JOIN sys.dm_xe_sessions s
ON s.address = st.event_session_address
WHERE name = 'system_health'
AND st.target_name = 'ring_buffer')
SELECT XEventData.XEvent.value('@ti... |
insert into sync_config(id, schema, basic_table, foreign_table) values
('ea.term', 'ea', 'term', 'sv_term'),
('ea.department', 'ea', 'department', 'sv_department'),
('ea.place', 'ea', 'place', 'sv_place'),
('ea.place_department', 'ea... |
DROP VIEW IF EXISTS grape.v_access_roles;
CREATE OR REPLACE VIEW grape.v_access_roles AS
SELECT
ar.role_name,
(SELECT array_agg(g) FROM grape.get_role_roles(ar.role_name) g) AS membership,
(SELECT array_agg(g) FROM grape.get_role_assigned_roles(ar.role_name) g) AS assigned_roles
FROM
grape.access_role ar;... |
SELECT
USERS.*
FROM
USERS INNER JOIN USER_ROLES
ON USERS.USER_ID = USER_ROLES.USER_ID
WHERE
USER_ROLES.ROLE_ID = ?
AND USERS.DELETE_FLAG = 0 |
DROP DATABASE IF EXISTS socialmedia;
CREATE DATABASE socialmedia;
USE socialmedia;
CREATE TABLE UserAccount (
userID smallint NOT NULL,
emailAddress varchar(40) NOT NULL,
userPassword varchar(20) NOT NULL,
dateAccountCreated date NOT NULL,
isInactive bool NOT NULL,
profileID smallint,
PRIMARY... |
DECLARE
v_taskid INTEGER;
BEGIN
v_taskid := :TaskId;
UPDATE tbl_taskcc
SET col_name = Nvl(col_name, 'Task') || '-' || To_char(col_id)
WHERE col_id = v_taskid;
END; |
SELECT ID ,EMAIL ,PASSWORD ,NAME ,REGDATE FROM MEMBER;
INSERT INTO MEMBER (ID ,EMAIL ,PASSWORD ,NAME ,REGDATE) VALUES (5, test@test.com, 1234, 'test', sysdate);
DELETE FROM MEMBER WHERE ID=46;
DELETE FROM MEMBER; |
alter table SystemSet add oaaddress varchar2(1000)
/
|
--============================== Functions:
------1: This function returns information of available rooms of a specific hotel in a specific date:
------so input is a hotel_id and output is a table containing information of available rooms:
CREATE FUNCTION avail_rooms
( @hotel_id varchar(20), @start datetime, @en... |
/***********************************************************************************
|| QUERY INFORMATION
||
|| Department: Value Engineering
|| Programmer: Luis Fuentes
|| Date: 08/18/2019
|| Category: Table creation
||
|| Description: Creates table T_SLA_MISS_PREL_ROOT_CAUSE
||
... |
SELECT id, title, yr FROM movie WHERE title LIKE '%Star Trek%' ORDER BY yr |
-- phpMyAdmin SQL Dump
-- version 5.1.1
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 21-09-2021 a las 20:53:14
-- Versión del servidor: 10.4.20-MariaDB
-- Versión de PHP: 7.3.29
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD... |
-- Create the LICHEN_PLOT_SUMMARY table
create table FIA.LICHEN_PLOT_SUMMARY(
CN varchar(34),
PLT_CN varchar(34),
INVYR numeric(4,0),
STATECD numeric(4,0),
COUNTYCD numeric(3,0),
PLOT numeric(5,0),
MEASYEAR numeric(4,0),
SUMMATION numeric(7,4),
RICHNESS numeric(2,0),
EVENNESS numeric(5,4),
DIVERSITY numeric(... |
-- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jun 29, 2018 at 03:22 PM
-- Server version: 10.1.30-MariaDB
-- PHP Version: 7.2.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD... |
SET NAMES 'utf8';
SET CHARACTER SET utf8;
--
-- Data
--
INSERT INTO voting_tablet_targets (code, name)
VALUES ('bill', 'Billing'),
('care', 'Client Care Manager'),
('driver', 'Водители'),
('courier', 'Курьер');
|
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Jun 08, 2017 at 12:10 PM
-- Server version: 10.1.13-MariaDB
-- PHP Version: 7.0.8
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLI... |
select distinct de_desfecho from DESFECHOS;
select distinct de_tipo_atendimento from DESFECHOS;
select * from desfechos where lower(de_desfecho) like lower('%óbito%');
select * from desfechos where de_desfecho like 'Alta médica curado';
|
select
md5(i.invoice_number || i.header_sequence_number) as unique_key,
i.division,
i.invoice_number,
i.header_sequence_number,
i.invoice_date,
i.transaction_date,
i.purchase_order_number,
i.vendor_number,
i.invoice_amount,
i.shipping_amount,
i.invoice_comment,
i.terms_code,
v.vendor_name,
i.days_before_due,
nvl(ic.... |
create table sn.u_pedido_de_repuestos (
u_c_digo_csj nvarchar(60),
u_ciudad_de_despacho nvarchar(32),
sys_updated_on datetimeoffset,
u_n_mero_de_caso nvarchar(32),
u_placa nvarchar(60),
u_fecha_de_solicitud date,
sys_id nvarchar(32) primary key,
sys_updated_by nvarchar(40),
u_modelo nvarchar(60),
sys_created_on datetim... |
/*
43 Иркутская Область
1197 Иркутский Район
4752 г Иркутск
*/
select
cast(fu.DateRegistred as date) as DateRegistered
,fu.id as UserId
,fu.Lastname + ' ' + fu.Firstname + isnull(' ' + fu.Fathername, '') as fio
,case when uai.FactCityId = 4752 then N'Город Иркутск'
else N'Иркутская область'
end as factAddres... |
/*
Warnings:
- The primary key for the `heart` table will be changed. If it partially fails, the table could be left without primary key constraint.
*/
-- AlterTable
ALTER TABLE `heart` DROP PRIMARY KEY,
ADD COLUMN `id` INTEGER NOT NULL AUTO_INCREMENT,
ADD PRIMARY KEY (`id`);
|
CREATE OR REPLACE PROCEDURE workflow_addinoperate_Insert
(objid_1 integer,
isnode_2 integer,
workflowid_3 integer,
fieldid_4 integer,
fieldop1id_5 integer,
fieldop2id_6 integer,
operation_7 integer,
customervalue_8 varchar2,
... |
SET SERVEROUTPUT ON
DECLARE
v_exist NUMBER :=0;
BEGIN
SELECT 1
INTO v_exist
FROM CPI.GIIS_REPORTS
WHERE report_id = 'GIACR045';
IF v_exist = 1 THEN
DBMS_OUTPUT.PUT_LINE('GIACR045 existing.');
END IF;
EXCEPTION
WHEN NO_DATA_FOUND THEN
INSERT INTO CPI.GII... |
-- The following queries utilize the "dvdstore" database.
-- 1. All of the films that Nick Stallone has appeared in
-- (30 rows)
SELECT concat(a.first_name, ' ', a.last_name) AS actor_name
, f.*
FROM actor AS a
INNER JOIN film_actor AS fm
ON a.actor_id = fm.actor_id
INNER JOIN film AS f
ON fm.film_id = f... |
-- 1
set serveroutput on;
Declare
sumOfNum number:= 0;
itr number:=0;
Begin
loop
sumOfNum := sumOfNum + itr;
itr := itr + 2;
exit when itr > 200;
end loop;
dbms_output.put_line('Sum of of even numbers from 1 to 200: ' || sumOfNum);
End;
-- 2
set serveroutput on;
declare
p_name product.product_... |
DROP SCHEMA IF EXISTS ACEF_Cycads;
CREATE SCHEMA ACEF_Cycads CHARSET utf8 COLLATE utf8_general_ci;
DROP TABLE IF EXISTS ACEF_Cycads.`References`;
CREATE TABLE ACEF_Cycads.`References`
SELECT CONCAT('Cyd-Ref-', SPNUMBER) AS ReferenceID,
TRIM(IF(SP2 IS NULL, SUBSTRING_INDEX(SUBSTRING_INDEX(AUTHOR1, ')', 2), ')', ... |
CREATE or replace PROCEDURE HrmRoles_deleteSingle
(roleid_1 integer,
flag out integer,
msg out varchar2,
thecursor IN OUT cursor_define.weavercursor)
as
id_1 integer;
begin
select count(id) into id_1 from hrmrolemembers where roleid=roleid_1;
if id_1<>0 then
flag:=11;
open thecursor for
select flag from d... |
--分类
CREATE TABLE tbl_category (
id int(11) UNSIGNED NOT NULL AUTO_INCREMENT ,
category_name varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
category_code varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
category_desc varchar(200) CHARACTER S... |
SELECT TABNAME,CNT FROM
(
SELECT 'CUSTOMER_ES_ALLOCATION' AS TABNAME, COUNT(*) AS CNT FROM CUSTOMER_ES_ALLOCATION
UNION
SELECT 'CUSTOMER_GENERATE_DATA' AS TABNAME, COUNT(*) AS CNT FROM CUSTOMER_GENERATE_DATA
UNION
SELECT 'CUSTOMER_IDIOSYNCRATIC_RISK' AS TABNAME, COUNT(*) AS CNT FROM CUSTOMER_IDIOSYNCRATIC_RISK
UNION
SE... |
alter table ACT_HI_ENTITYLINK add column HIERARCHY_TYPE_ varchar(255);
|
DROP VIEW cust;
CREATE VIEW cust AS
SELECT cust_id, cust_active, cust_custtype_id, cust_salesrep_id,
cust_commprcnt, cust_name,
m.addr_line1 AS cust_address1,
m.addr_line2 AS cust_address2,
m.addr_line3 AS cust_address3,
m.addr_city AS cust_city,
m.addr_state... |
-- 数据表的操作
-- 查看当前数据库中所有表
show tables;
-- 创建表
-- 顺序可以不同
-- auto_increment 表示自动增长
-- not null 表示不能为空
-- primary key 表示主键
-- default 默认值
-- create table 数据表名字(字段 类型 约束[, 字段 类型 约束]);
create table xxx(id int, name varchar(30));
create table yyy(id int primary key not null auto_increment, name varchar... |
create table #answered (Id int, Label int)
insert #answered
SELECT Posts.Id AS Id, 1 AS Label
FROM Posts
WHERE Posts.PostTypeId=1 AND Posts.AcceptedAnswerId is not NULL
create table #unanswered (Id int, Label int)
insert #unanswered
SELECT Posts.Id AS Id, 0 AS Label
FROM Posts
WHERE Posts.PostTypeId=1 A... |
---------------FISCALIZA-------------------------
CREATE TABLE formulario(
id int not null AUTO_INCREMENT PRIMARY key,
data_envio varchar(40),
nome varchar(40) not null,
email varchar(40) not null,
cpf_cnpj int(12) not null,
tema_comentario varchar(30) not null,
tipo_comentario varchar(30) n... |
-- Table: mecab_schema
-- DROP TABLE mecab_schema;
CREATE TABLE mecab_schema
(
face character varying(100), -- 표층형
tag character varying(50), -- 품사 태그
mean character varying(50), -- 의미 부류
final character varying(10), -- 종성 유무
reading character varying(100), -- 읽기
ctype character varying(50), -- 타입
cfirst... |
-- phpMyAdmin SQL Dump
-- version 4.2.7.1
-- http://www.phpmyadmin.net
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 16-10-2014 a las 20:30:42
-- Versión del servidor: 5.6.20
-- Versión de PHP: 5.5.15
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHAR... |
INSERT INTO SPORT(LABEL, DESCRIPTION, ACTIVE) VALUES ('bball', 'bball', true);
INSERT INTO SPORT(LABEL, DESCRIPTION, ACTIVE) VALUES ('fball', 'bball', true);
INSERT INTO SPORT(LABEL, DESCRIPTION, ACTIVE) VALUES ('sball', 'bball', true);
|
alter table SEC_GROUP drop column SYS_TENANT_ID_NN__U09012 cascade ;
alter table SEC_GROUP drop column SYS_TENANT_ID__U80731 cascade ;
alter table SEC_GROUP drop column SYS_TENANT_ID_NN__U04788 cascade ;
alter table SEC_GROUP drop column SYS_TENANT_ID__U36868 cascade ;
alter table SEC_GROUP drop column SYS_TENANT_ID_NN... |
-- phpMyAdmin SQL Dump
-- version 4.9.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Tempo de geração: 08/12/2019 às 19:12
-- Versão do servidor: 10.2.27-MariaDB
-- Versão do PHP: 7.2.25
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 ... |
CREATE TABLE IF NOT EXISTS public.tasks (
id BIGSERIAL PRIMARY KEY NOT NULL,
public_id VARCHAR(255) UNIQUE NOT NULL,
task VARCHAR(255) NOT NULL,
detail TEXT,
done_at timestamp with time zone,
created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
updated_at timestamp with time zone D... |
-- phpMyAdmin SQL Dump
-- version 4.0.10.2
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Oct 06, 2014 at 07:38 PM
-- Server version: 5.6.19
-- PHP Version: 5.4.32
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT *... |
ALTER TABLE hpelement ADD newstemplate VARCHAR2(10)
/
update hpElement set newstemplate =''
/
update hpElement set newstemplate = (select max(newstemplate) from hpFieldLength where eid = hpElement.id and (usertype=3 or (userid=1 and usertype=0)) and newstemplate is not null)
/
|
INSERT into Incidencias.tipo_equipo(TIPO_EQUIPO_ID,CODIGO,NOMBRE) VALUES (1,'Otros','Otros');
INSERT into Incidencias.tipo_equipo(TIPO_EQUIPO_ID,CODIGO,NOMBRE) VALUES (2,'CPD','CPD');
INSERT into Incidencias.tipo_equipo(TIPO_EQUIPO_ID,CODIGO,NOMBRE) VALUES (3,'Escaner','Escaner');
INSERT into Incidencias.tipo_equipo... |
-- # Source: https://www.youtube.com/watch?v=7S_tz1z_5bA&list=PLTjRvDozrdlynYXGUfyyMZdrQ0Sz27aud
# download mysql installer (mysql-installer-web-community-x.x.x.x.msi) from https://dev.mysql.com/downloads/mysql/
# install the downloaded file with most default and set user name & password
# now run mysql workbench and c... |
CREATE TABLE public.words
(
id serial NOT NULL,
word text,
CONSTRAINT words_pk PRIMARY KEY (id)
);
CREATE TABLE public.sources
(
id serial NOT NULL,
source text,
CONSTRAINT sources_pk PRIMARY KEY (id)
);
CREATE TABLE public.index
(
id serial NOT NULL,
word_id integer,
source_id integer,
weight i... |
/*
select top 100
productid
,clientId
into #p1
from prd.vw_Product
where productType = 1
and status = 3
order by productid desc
*/
--select top 100
-- productid
-- ,clientId
--into #p2
--from prd.vw_Product p
--where productType = 1
-- and status = 4
-- and not exists
-- (
-- ... |
INSERT INTO `sql_online_judge`.`student`
(`name`,
`gender`,
`class`)
VALUES
("小花","female",
"1502");
|
-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3308
-- Generation Time: Oct 30, 2020 at 01:35 AM
-- Server version: 5.7.31
-- PHP Version: 7.3.21
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@... |
SELECT
a.TREE_NAME, TREE_NODE_NUM, TREE_NODE
FROM
PSTREENODE a,
PS_TZ_RS_MODAL_TBL b
WHERE
a.TREE_NAME = b.TREE_NAME
AND PARENT_NODE_NUM = 0
AND TZ_SCORE_MODAL_ID = ?
AND TZ_JG_ID = ? |
create table challenge (
challenge_id int not null,
hacker_id int not null,
difficulty_level int not null,
primary key (challenge_id)
);
describe challenge;
insert into challenge(challenge_id, hacker_id, difficulty_level) values(4810, 77726, 4);
insert into challenge(challenge_id, hacker_id, difficulty_level) values... |
<<outer>>
declare
num1 number := 95;
num2 number := 85;
begin
dbms_output.put_line('outer variable number1 '||num1);
dbms_output.put_line('outer variable number2 '||num2);
declare
num1 number := 195;
num2 number := 185;
begin
dbms_output.put_line('inner variable number1 '||num1);
dbms_output.put_line('inner va... |
alter table SystemSet add emlpath varchar2(1000)
/
alter table mailresource add emlpath varchar2(1000)
/ |
CREATE TABLE public.plant (
plant_id character varying(25) PRIMARY KEY NOT NULL,
name character varying(25) NOT NULL,
added_datetime timestamp with time zone NOT NULL DEFAULT NOW(),
last_watered timestamp with time zone,
days_to_wait numeric NOT NULL DEFAULT 1
);
|
--
-- PostgreSQL database dump
--
-- Dumped from database version 9.4.8
-- Dumped by pg_dump version 9.4.8
-- Started on 2016-08-02 22:07:39 ART
SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messag... |
set global validate_password_policy=LOW;
alter user root@localhost identified by 'password';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
drop database if exists origin;
drop database if exists target;
drop database if exists test;
create database origin;
cre... |
SELECT file_name FROM entries WHERE build_number = ?; |
select distinct A.userid, B.userid
from collaborate A, collaborate B
where
A.repo_name=B.repo_name and A.userid<B.userid
union
select distinct userid, owner
from collaborate, repository
where collaborate.repo_name = repository.name;
|
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for author
-- ----------------------------
DROP TABLE IF EXISTS `author`;
CREATE TABLE `author` (
`author_id` int(11) NOT NULL,
`author_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT N... |
-- INSERT INTO shippers (name)
-- VALUES ('shipper1'),
-- ('shipper2'),
-- ('shipper3')
INSERT INTO products (name, quantity_in_stock, unit_price)
VALUES
('NAME1', 1, 1.50),
('NAME2', 2, 2.50),
('NAME3', 3, 3.50) |
-- Task 1
-- If the user exists, delete and then, create new user with all privileges on localhost.
DROP USER IF EXISTS 'user_0d_1'@'localhost';
CREATE USER IF NOT EXISTS 'user_0d_1'@'localhost' IDENTIFIED BY 'user_0d_1_pwd';
GRANT ALL ON * . * TO 'user_0d_1'@'localhost';
|
DROP TABLE toy;
DROP SEQUENCE toy_seq;
DROP CONSTRAINT constr_age;
CREATE TABLE toy (
t_id int NOT NULL,
t_name VARCHAR2(100) NOT NULL UNIQUE,
price NUMBER,
amount INT,
s_age INT,
e_age INT,
... |
-- Tested on MySQL
/* scholarshipsDistribution
In the past, straight "A" students have gotten scholarships to reward them for their excellent
grades. This year, though, there has been an increase in the number of detentions given to excellent
students, so the administration is going to change the rules. In order to ... |
DROP TABLE T_ADFOX_STAT_BY_CAMPAIGN;
CREATE TABLE T_ADFOX_STAT_BY_CAMPAIGN
(
ID_ADFOX_CAMPAIGN NUMBER NOT NULL,
NAME VARCHAR2(2000) NOT NULL,
ADVERTISER_ID NUMBER NOT NULL,
ADVERTISER VARCHAR... |
# Write your MySQL query statement below
select p.product_id, ROUND(sum(price*units)/sum(units),2) as average_price
from Prices p left join UnitsSold u
on p.product_id = u.product_id
where purchase_date between start_date and end_date
group by p.product_id; |
drop database if exists worblehat;
create database worblehat;
grant all on worblehat.* to worblehat@'%' identified by 'worblehat';
grant all on worblehat.* to worblehat@'localhost' identified by 'worblehat';
|
-- --------------------------------------------------------------------------------
-- Routine DDL
-- Note: comments before and after the routine Body will not be stored by the server
-- --------------------------------------------------------------------------------
DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROC... |
--UC7 Query to retrieve size of address book by city
use address_book_service
select city,count(city) as size from address_book_table
group by city;
-- Query to retrieve size of address book by state
select state,count(state) as size from address_book_table
group by state; |
select distinct(i_product_name)
from item i1
where i_manufact_id between 707 and 707+40
and (select count(*) as item_cnt
from item
where (i_manufact = i1.i_manufact and
((i_category = 'Women' and
(i_color = 'goldenrod' or i_color = 'deep') and
(i_units = 'Case' or... |
CREATE TABLE `Categories` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
PRIMARY KEY (`id`)
);
CREATE TABLE `Books` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`categoryid` int(11) NOT NULL,
`title` varchar(100) NOT NULL,
`author` varchar(100) NOT NULL,
`price` decimal(5,2) NOT NULL D... |
-- =============================================
-- Author: Javier
-- Create date: April 2011
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE spCountriesSelect
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statement... |
create database locadora;
use locadora;
create table tbl_filmes(
id_filme int auto_increment primary key,
nome_filme varchar(60) not null,
categoria varchar(60) not null,
id_filme_ator int,
constraint foreign key FK_id_ator(id_filme_ator) references tbl_atores(id_ator)
);
create table tbl_atores(
id... |
Create Table crime as
select * from personal_crime_09_13
Union All
select * from personal_crime_14_18;
|
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET search_path = public, pg_catalog;
SET default_tablespace = '';
SET default_with_oids = fals... |
DELETE FROM favorites
WHERE user_id = $1 AND product_id = $2; |
select
case
when p.Way = -3 then N'Карта'
else 'Qiwi'
end as moneyWay
,isnull(p.CardNumber, fu.MobilePhone) as client
,case
when c.CardType = 1 then 'VISA'
when c.CardType = 2 then 'MasterCard'
end as CardType
,c.Holder
,format(p.DateCreated, 'dd.MM.yyyy HH:mm... |
SET SERVEROUTPUT ON;
DECLARE
v_exists NUMBER := 0;
v_module_id NUMBER := NULL;
BEGIN
BEGIN
SELECT module_id
INTO v_module_id
FROM cpi.giac_modules
WHERE module_name = 'GIACS008';
EXCEPTION
WHEN NO_DATA_FOUND
THEN
DBMS_OUTPUT.put_line
... |
-- phpMyAdmin SQL Dump
-- version 4.8.3
-- https://www.phpmyadmin.net/
--
-- Hôte : 127.0.0.1:3306
-- Généré le : mar. 19 fév. 2019 à 09:24
-- Version du serveur : 5.7.23
-- Version de PHP : 7.2.10
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SE... |
SELECT * FROM EOLC.CUSTOMER_PREFERENCE
where legal_entity_no = '049944143'
and customer_number in ('4446222','4446790') |
-- MySQL dump 10.13 Distrib 8.0.18, for Win64 (x86_64)
--
-- Host: localhost Database: sos_storage
-- ------------------------------------------------------
-- Server version 8.0.18
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;... |
-- phpMyAdmin SQL Dump
-- version 5.0.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: May 24, 2021 at 05:09 AM
-- Server version: 10.4.17-MariaDB
-- PHP Version: 7.4.15
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIE... |
SELECT count(*) as total from (
SELECT count(*)
FROM
(
SELECT distinct
entity_id,
entity_code,
entity_description,
aoca.bg_attr_name,
bg_display_name,
... |
--
-- add a confirmation key to users, which is non-null for unconfirmed users, also a timestamp
--
ALTER TABLE users ADD COLUMN confirmationkey varchar;
ALTER TABLE users ADD COLUMN timecreated timestamp(0) NOT NULL DEFAULT now();
|
-- phpMyAdmin SQL Dump
-- version 3.5.1
-- http://www.phpmyadmin.net
--
-- Хост: 127.0.0.1
-- Время создания: Янв 24 2019 г., 18:14
-- Версия сервера: 5.5.25
-- Версия PHP: 5.3.13
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!4010... |
DROP SEQUENCE CPI.CLAIMS_ADVICE_ID_S;
CREATE SEQUENCE CPI.CLAIMS_ADVICE_ID_S
START WITH 1
MAXVALUE 999999999999
MINVALUE 1
NOCYCLE
NOCACHE
NOORDER;
|
CREATE TABLE IF NOT EXISTS Component_select (
ID serial primary key,
array_name VARCHAR(450) NOT NULL,
array_object INT NOT NULL,
select_value VARCHAR(450) NULL,
select_display VARCHAR(450) NULL,
web_service VARCHAR(450) NULL,
Component_ID INT NOT NULL,
date_modify timestamp NOT NULL,
date_create time... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.