text stringlengths 6 9.38M |
|---|
/*
Navicat MySQL Data Transfer
Source Server : app
Source Server Version : 50720
Source Host : localhost:3306
Source Database : usersdata
Target Server Type : MYSQL
Target Server Version : 50720
File Encoding : 65001
Date: 2019-07-25 18:14:35
*/
SET FOREIGN_KEY_CHECKS=0;
-- -----... |
-- MySQL dump 10.13 Distrib 8.0.23, for Linux (x86_64)
--
-- Host: localhost Database: subway
-- ------------------------------------------------------
-- Server version 8.0.23
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!4... |
current_dept_emp |
| departments |
| dept_emp |
| dept_emp_latest_date |
| dept_manager |
| employees |
| salaries |
| titles
Which employees have a salary above 150,000 and what are their titles?
delimiter //
Drop PROCEDURE IF EXISTS high_salary;
... |
-- Script lists all databases
-- of my MySQL server
SHOW DATABASES;
|
INSERT INTO `users` (`id`, `username`, `user_email`, `user_role`, `user_status`) VALUES
(1, 'Pavot', 'lpavot@cesi.fr', 'Concepteur', 1),
(2, 'Coma', 'rcoma@cesi.fr', 'Concepteur', 1),
(3, 'nolin', 'lnolin@cesi.fr', 'Concepteur', 0),
(4, 'Brousset', 'rbrousset@cesi.fr', 'Concepteur', 0),
(5, 'rainbowdash', 'rdash@cesi... |
CREATE PROCEDURE sp_List_Customer_BeatWise(@CustomerCategory nVarchar(50), @CustomerType nVarchar(50), @BeatID nVarchar(50), @FromDate DateTime, @ToDate DateTime)
As
SELECT @FromDate = dbo.StripDateFromTime(@FromDate), @ToDate = dbo.StripDateFromTime(@ToDate)
SELECT
Distinct Customer.CustomerId, Company_N... |
/*
* Relation between User model and Profile model
* Needs: Profile, User
*/
CREATE TABLE IF NOT EXISTS AuthProfile
( id SERIAL PRIMARY KEY
, auth_id UUID NOT NULL REFERENCES Auth
, profile_id UUID NOT NULL REFERENCES Profile
, verified BOOLEAN NOT NULL
);
GRANT USAGE ON SEQUENCE authprofile_id... |
1) 3학년 학생의 학과별 평점 평균과 분산 및 편차를 검색하세요
SELECT major, AVG(avr), STDDEV(avr), VARIANCE(avr)
FROM student
WHERE syear=3
GROUP BY major;
2) 화학과 학년별 평균 평점을 검색하세요
SELECT syear, AVG(avr)
FROM student
WHERE major='화학'
GROUP BY syear;
3) 각 학생별 기말고사 평균을 검색하세요
SELECT sno, AVG(result)
FROM score
GROUP BY sno;
4) 각 학과별 학생 수를 검색하세요... |
USE dmab0914_2sem_7;
CREATE TABLE Invoices
(
invoiceNo int NOT NULL,
paymentDate date,
dueDate date NOT NULL,
amount int NOT NULL,
PRIMARY KEY(invoiceNo)
); |
drop table if exists anuncios;
create table anuncios(
num_anuncio int(6) primary key,
fecha_publicacion datetime not null,
fecha_termino datetime not null,
num_periodico int(6)not null,
num_inmueble varchar(6)not null
);
insert into anuncios values(0001,'2003-04-06','2003-06-06',0001,'PG4');
insert into anuncios valu... |
/*
Navicat Premium Data Transfer
Source Server : 本地
Source Server Type : MySQL
Source Server Version : 50732
Source Host : localhost:3306
Source Schema : testplus
Target Server Type : MySQL
Target Server Version : 50732
File Encoding : 65001
Date: 18/04/2021 18:57:43... |
-- tpch11 using 1395599672 as a seed to the RNG
select
ps.ps_partkey,
sum(ps.ps_supplycost * ps.ps_availqty) as `value`
from
cp.`tpch/partsupp.parquet` ps,
cp.`tpch/supplier.parquet` s,
cp.`tpch/nation.parquet` n
where
ps.ps_suppkey = s.s_suppkey
and s.s_nationkey = n.n_nationkey
and n.n_name... |
CREATE DATABASE myNote default charset utf8;
use myNote;
create table s_note(
id mediumint unsigned not null auto_increment comment 'Id',
title varchar(100) not null comment '标题',
content longtext not null comment '内容',
addtime datetime not null /*default current_timestamp*/ comment '添加时间',
ip int not null comme... |
alter table gha_actors drop constraint gha_actors_pkey;
alter table gha_actors add primary key(id, login);
create index actors_id_idx on gha_actors(id);
create index repos_id_idx on gha_repos(id);
|
/*
Insight producing "InvalidCacheLoadException: loadAll failed to return a value for xxx" or "This attribute needs to be indexed" errors
link: https://confluence.atlassian.com/jirakb/insight-producing-invalidcacheloadexception-loadall-failed-to-return-a-value-for-xxx-or-this-attribute-needs-to-be-indexed-errors-1063... |
Groups, strings, and counting things |
-- phpMyAdmin SQL Dump
-- version 3.4.8
-- http://www.phpmyadmin.net
--
-- 主机: localhost
-- 生成日期: 2013 年 07 月 08 日 00:16
-- 服务器版本: 5.5.28
-- PHP 版本: 5.3.17
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET... |
ALTER TABLE `boyo_user` ADD `wildUserId` VARCHAR( 255 ) NOT NULL AFTER `coin`; |
CREATE TABLE IF NOT EXISTS todo(
id_todo INT PRIMARY KEY AUTO_INCREMENT,
nom VARCHAR(25),
statut BOOLEAN DEFAULT(FALSE)
); |
SELECT COALESCE(a.id, a.id) filled_id, a.name, a.website, a.lat, a.long, a.primary_poc, a.sales_rep_id, o.*
FROM accounts a
LEFT JOIN orders o
ON a.id = o.account_id
WHERE o.total IS NULL;
SELECT COALESCE(a.id, a.id) filled_id, a.name, a.website, a.lat, a.long, a.primary_poc, a.sales_rep_id, COALESCE(o.account_id, a.i... |
DROP TABLE OFERTAVIVIENDAUNIVERSITARIA;
DROP TABLE OFERTAHABITACIONMENSUAL;
DROP TABLE OFERTAHABITACIONDIARIA;
DROP TABLE OFERTAESPORADICA;
DROP TABLE OFERTAAPARTAMENTO;
DROP TABLE CONTRATOS;
DROP TABLE RESERVAS;
DROP TABLE INTERESAN;
DROP TABLE ADICIONALES;
DROP TABLE OFERTAS;
DROP TABLE PERSONASJURIDICAS;
DROP TABLE ... |
-- phpMyAdmin SQL Dump
-- version 4.6.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: 22 Mei 2017 pada 15.42
-- Versi Server: 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 */;
/*... |
-- integration test reference database
DROP TABLE IF EXISTS person, patient, datetimes;
-- SCHEMA
CREATE TABLE person (
id INT NOT NULL,
firstname VARCHAR(255) DEFAULT NULL,
lastname VARCHAR(255) DEFAULT NULL,
age VARCHAR(50) DEFAULT NULL,
postalcode VARCHAR(10) DEFAULT NULL,
PRIMARY KEY (id)
);
CREATE ... |
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
DROP DATABASE IF EXIS... |
CREATE SCHEMA `cupcakeshop`;
|
--Insecao de dados na Tabela schema_version
INSERT INTO public.schema_version(
installed_rank, version, description, type, script, checksum, installed_by, installed_on, execution_time, success)
VALUES
('2', 'BCD', 'teste02', 'BBBB', 'tttttt', '22', 'CCCCCCC', '2019-10-29 10:20:53','11', '1'),
('3', 'BCDF', 'teste... |
ALTER TABLE article ADD FOREIGN KEY (site_id) REFERENCES site (id);
|
DROP TABLE IF EXISTS `agendamentos`;
DROP TABLE IF EXISTS `usuarios_tem_perfis`;
DROP TABLE IF EXISTS `exame_procedimentos`;
DROP TABLE IF EXISTS `medicos_tem_especialidades`;
DROP TABLE IF EXISTS `exames`;
DROP TABLE IF EXISTS `pacientes`;
DROP TABLE IF EXISTS `procedimentos`;
DROP TABLE IF EXISTS `horas`;
DROP TABLE ... |
CREATE TABLE cats_owners (cat_id INTEGER, owner_id INTEGER);
|
CREATE TABLE Orders (
id INT PRIMARY KEY,
name VARCHAR(255),
customerId INT REFERENCES Customers(id),
);
|
insert into microservice.student(id,name) values(1,'Owl');
insert into microservice.student(id,name) values(2,'Darsh'); |
SET storage_engine = InnoDB;
-- Create and use database
drop database IF EXISTS fypdb;
create database fypdb character set utf8;
use fypdb;
ALTER DATABASE fypdb CHARACTER SET utf8 COLLATE utf8_unicode_ci;
-- Create table
drop table IF EXISTS Admin;
CREATE TABLE Admin (
adminID VARCHAR(255) NOT NULL,
userN... |
drop table if exists user_profile;
CREATE TABLE `user_profile` (
`id` int NOT NULL,
`device_id` int NOT NULL,
`gender` varchar(14) NOT NULL,
`age` int ,
`university` varchar(32) NOT NULL,
`province` varchar(32) NOT NULL);
INSERT INTO user_profile VALUES(1,2138,'male',21,'北京大学','BeiJing');
INSERT INTO user_profile VALU... |
alter table CURRENCY_CURRENCY drop column UPDATE_TIME_ZONE__U85915 cascade ;
|
CREATE TABLE IF NOT EXISTS actions (
id INTEGER PRIMARY KEY,
action_name TEXT NOT NULL,
processing INTEGER DEFAULT 0,
processed INTEGER DEFAULT 0,
added TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS colors (
id INTEGER PRIMARY KEY,
value TEXT NOT NULL,
added TIMESTAM... |
1)TEMP 테이블에서 SALARY(연봉)을 이용하여 월 급여를 알아보는 SQL을 작성하시요.
월 급여는 연봉을 18로 나누어 홀수 달에는 연봉의 1/18 이 지급되고,
짝수 달에는 연봉의 2/18 가 지급된다고 가정했을 때 홀수 달과 짝수 달에
받을 금액을 SELECT 해 보세요.
결과>
EMP_NAME SALARY/18 SALARY*2/18
---------- ---------- -----------
김길동 5555555.56 11111111.1
홍길동 4000000 ... |
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id('FK_ApplicationUser_ApplicationRole_ApplicationRole') AND OBJECTPROPERTY(id, 'IsForeignKey') = 1)
ALTER TABLE ApplicationUser_ApplicationRole DROP CONSTRAINT FK_ApplicationUser_ApplicationRole_ApplicationRole
;
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE i... |
DELIMITER //
DROP PROCEDURE IF EXISTS spCity_Ins //
CREATE PROCEDURE spCity_Ins
(IN CityName VARCHAR(45), StateID INT)
BEGIN
INSERT into City(name, StateID)
VALUES (CityName, StateID);
END; //
delimiter ;
call spCity_Ins('Hatillo', (select StateID from State where name = 'San José'));
call spCity_Ins('Desampa... |
/*
出运明细-采购明细
*/
delimiter $
drop trigger if exists Tgr_ShipmentsDelivery_AftereDelete $
create trigger Tgr_ShipmentsDelivery_AftereDelete after delete
on ShipmentsDelivery
for each row
begin
call Proc_PurchaseOrders_SumShippingQty(old.SOL_RecordID,old.PurchaseOrderNo,old.ItemNo);-- 采购合同-出货数量
end$
delimiter ; |
USE taxi;
SELECT dr.name, ca.number, cd.using_time FROM dbo.cars_to_drivers cd
JOIN dbo.drivers dr ON dr.id = cd.driver_id
JOIN dbo.cars ca ON ca.id = cd.cars_id; |
CREATE OR REPLACE
ALGORITHM = MERGE
DEFINER = `synapsemaster`@`%`
SQL SECURITY INVOKER
VIEW person_riskmodel_calc_view AS
SELECT
orgm.org_id,
rgph.person_id,
orgm.risk_group_id,
orgm.risk_model_id,
RS_numerator(orgm.org_id, orgm.risk_group_id, rgph.person_id) AS R... |
-- Aug 29, 2009 11:55:21 PM ECT
-- Create Field IncludeTab_ID
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSele... |
CREATE TABLE "Album"
(
"AlbumId" INT NOT NULL,
"Title" VARCHAR(160) NOT NULL,
"ArtistId" INT NOT NULL,
CONSTRAINT "PK_Album" PRIMARY KEY ("AlbumId")
);
CREATE TABLE "Artist"
(
"ArtistId" INT NOT NULL,
"Name" VARCHAR(120),
CONSTRAINT "PK_Artist" PRIMARY KEY ("ArtistId")
);
CREATE TABLE "C... |
--1. Get all customers and their addresses.
SELECT *
FROM "customers"
JOIN "addresses"
ON "customers"."id" = "addresses"."customer_id";
--2. Get all orders and their line items (orders, quantity and product).
SELECT
"line_items"."quantity" as "productQuantity",
"line_items"."order_id" as "orderId",
"products"."de... |
CREATE TABLE `category` (
`categoryId` int(11) NOT NULL AUTO_INCREMENT,
`categoryName` varchar(50) NOT NULL,
PRIMARY KEY (`categoryId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
create table ProgramTable(
ProgamId int identity(1,1) primary key,
ProgramName varchar(200),
ProgramCode varchar(100),
Duration varchar(100),
Description varchar(400)
); |
-- Intro to PL/SQL
-- Lab Assignment 5, Problem 2
-- Wolfgang C. Strack
-- Student ID#: ****7355
-- Due Date: 08 October 2015
-- Date Handed In: 08 October 2015
-----
----- 2. Create a PL/SQL block to retrieve the name of each department from the
----- DEPARTMENTS table and print each department name on the screen,
-... |
-- MySQL dump 10.13 Distrib 5.1.40, for Win32 (ia32)
--
-- Host: localhost Database: piadb
-- ------------------------------------------------------
-- Server version 5.1.50-community
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RE... |
CREATE TABLE MUSTERI(
ID tinyint not null IDENTITY (1,1) unique ,
MUSTERI_FIRMA varchar(20) primary key not null,
AD varchar(20) not null,
SOYAD varchar(20) not null,
TEL_NO1 CHAR(11) not null,
TEL_NO2 CHAR(11)NULL,
EMAIL varchar(50) NOT NULL,
ADRES varchar(100) NOT NULL
) |
# --- !Ups
CREATE TABLE "USER" (
"LOGIN" VARCHAR(200) PRIMARY KEY,
"BALANCE" DECIMAL(20, 2) NOT NULL
);
INSERT INTO "USER" VALUES ('user1@mail.com', 100.51);
INSERT INTO "USER" VALUES ('user2@mail.com', 200.51);
INSERT INTO "USER" VALUES ('user3@mail.com', 300.51);
CREATE TABLE "TRANSACTION" (
"ID" ... |
alter table satıslar add tücret int |
#DROP TABLE IF EXISTS `stk_fina_audit`;
CREATE TABLE `stk_fina_audit` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`ts_code` varchar(9) NOT NULL COMMENT 'TS代码',
`ann_date` char(8) NOT NULL COMMENT '公告日期',
`end_date` char(8) NOT NULL COMMENT '报告期',
`audit_result` varchar(0) NULL COMMENT '审计结果',
`audit_fees` floa... |
-- 집계쿼리: select 그룹함수가 적용된 경우
select avg(salary) from salaries;
-- select절에 그룹함수가 있는 경우, 어떤 컬럼도 select절에 올 수 없다.
-- emp_no는 아무 의미가 없다.
-- 오류!
select emp_no, avg(salary) from salaries;
/* query 실행 순서
* - 1) from: 접근 테이블 확인
* - 2) where: 조건에 맞는 row 선택
* - 3) 집계
* - 4) projection
*/
select avg(salary) from salaries w... |
ALTER TABLE mhac.teams
ADD COLUMN active BOOLEAN;
BEGIN TRANSACTION;
UPDATE mhac.teams
SET active = true;
|
/*
Navicat MySQL Data Transfer
Source Server : localhost - mysql
Source Server Version : 50721
Source Host : localhost:3306
Source Database : cache
Target Server Type : MYSQL
Target Server Version : 50721
File Encoding : 65001
Date: 2018-08-23 23:50:16
*/
SET FOREIGN_KEY_CHECKS=0;... |
SET SERVEROUTPUT ON
DECLARE
A INTEGER :=70;
B INTEGER :=50;
M INTEGER;
BEGIN
M :=A*B;
DBMS_OUTPUT.PUT_LINE('VALUE OF M:'||M);
END;
/
SET SERVEROUTPUT OFF |
create or replace view v_jh001_edhz as
(
/*****************计划额度汇总
*****************************************/
select de011,de022,Jsde955,czde951,de084,jsde702,jsde802,de192,czde119,de156,de202,
sum(de181) as de181,
sum(syje) as syje,
sum(V_JH001.de181-V_JH001.syje) as edkyje,
sum(V_JH001.syje-V_JH001.ztsyje) ... |
select*from dba_tables;
--시스템에서 만들어야 한다
create user user2 identified by 1234;
grant connect to user2; --logon 권한 부여 dba권한만 가능
grant create table to user2;
|
/* Создание просмотра водителей на сменах */
CREATE VIEW /*PREFIX*/S_DRIVER_SHIFTS
(
SHIFT_ID,
DRIVER_ID,
DATE_BEGIN,
DATE_END,
DRIVER_NAME,
CAR_ID,
MIN_BALANCE,
CAR_COLOR,
CAR_BRAND,
CAR_STATE_NUM,
CAR_CALLSIGN,
CAR_TYPE_ID,
CAR_TYPE_NAME,
CAR_TYPE_FONT_COLOR,
CAR_TYPE_BRUSH_COLOR,
PAR... |
library cdc_bp_lessThanOneHundredAndFortyOverNinety version '1'
using FHIR version '4.0.0'
include FHIRHelpers version '4.0.1' called FHIRHelpers
include Diabetes_Library version '4.0.0' called Diabetes_Library
codesystem "LOINC": 'http://loinc.org'
valueset "Nonacute Inpatient Stay": '2.16.840.1.113762.1.4.1182.289... |
SELECT
sms.id as sms_id,
concat_ws(' ', usr.first_name, usr.last_name) as sms_name,
date_format(sms.created_at, '%M %D %Y') as sms_dt,
sms.message_TXT,
cmt.id as cmt_id,
(SELECT concat_ws(' ', b.first_name, b.last_name) FROM comments a LEFT JOIN users b ON a.user_id = b.id WHERE b.id = cmt.user_id) as cmt_name,
date_f... |
Create Procedure mERP_SP_GetRecdMarginlist
AS
Select Isnull(ID,0) from tbl_mERP_RecdMarginAbstract where isNull(Status,0) = 0 order by id
|
-- phpMyAdmin SQL Dump
-- version 5.1.0
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Oct 27, 2021 at 05:09 PM
-- Server version: 10.4.18-MariaDB
-- PHP Version: 7.4.16
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIE... |
drop table if exists `wn_antonym`;
drop table if exists `wn_attr_adj_noun`;
drop table if exists `wn_cause`;
drop table if exists `wn_class_member`;
drop table if exists `wn_derived`;
drop table if exists `wn_entails`;
drop table if exists `wn_gloss`;
drop table if exists `wn_hypernym`;
drop table if exists `wn_hyponym... |
SELECT
CAST(
SUM( IF (MCM_1_SRC = 2
, IF(MEASUREMENT_SOURCE_TYPE = 'PMI'
, MCM_1_NON_SUSPICIOUS_IMPS
, ROUND(
MCM_1_NON_SUSPICIOUS_IMPS * (
IF(Q_DATA_IMPS > IMPS
, ( COALESCE(IN_VIEW_PASSED_IMPS,0) + COALESCE(IN_VIEW_FLAGGED_IMPS,0) + COALESCE(NOT_IN_VIEW_PASSED_IMPS,0) + COALESCE(NOT_IN_VIEW_FL... |
CREATE Procedure sp_Can_CancelGiftVoucher(@CollectionID Int)
As
If Exists(Select SequenceNumber From GiftVoucherDetail,IssueGiftVoucher
Where IssueGiftVoucher.SerialNo=GiftVoucherDetail.SerialNo
and CollectionID=@CollectionID
and ((GiftVoucherDetail.Status & 1) = 1 or (GiftVoucherDetail.Status & 2) = 2))
Be... |
-- MySQL dump 10.13 Distrib 5.7.9, for osx10.9 (x86_64)
--
-- Host: 127.0.0.1 Database: glucometer
-- ------------------------------------------------------
-- Server version 5.7.11
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;... |
-- MySQL dump 10.16 Distrib 10.1.47-MariaDB, for debian-linux-gnu (x86_64)
--
-- Host: localhost Database: groupomania
-- ------------------------------------------------------
-- Server version 10.1.47-MariaDB-0ubuntu0.18.04.1
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHA... |
INSERT INTO rconfvac VALUES ('15 ', 2018, 7, 2, 7, 4, '2050-12-30')
INSERT INTO rconfvac values ('22 ', 2010, 7, 0, 0, 4, '2050-12-30');
INSERT INTO rconfvac values ('22 ', 2011, 7, 0, 0, 4, '2050-12-30');
INSERT INTO rconfvac values ('22 ', 2012, 7, 0, 0, 4, '2050-12-30');
INSERT IN... |
insert into _data_entity values(0);
SELECT @feedbacktypeId:=LAST_INSERT_ID();
insert into feedback_type values(@feedbacktypeId, 'OSM! bookmark', 'OSM');
/*update all webItemtypes to this feedback option*/
Update web_item_type set feedback_type_id=@feedbacktypeId;
insert into _data_entity values(0);
SELECT @feedbackOpt... |
create or replace procedure orgupdate(oname in varchar2,mob in varchar2,mail in varchar2,oid in number)
is
begin
update organizer set name=oname
where id=oid;
update orgcont set mob_number=mob,email=mail
where orgid=oid;
end;
/
create or replace procedure orgupdate2(oname in varchar2,mob in varchar2,mob2 in varchar2... |
DROP TABLE IF EXISTS `chat_message`;
CREATE TABLE `chat_message` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL DEFAULT '0' COMMENT '用户id',
`content` varchar(255) NOT NULL DEFAULT '' COMMENT '聊天内容',
PRIMARY KEY (`Id`)
) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COMMENT='聊天信息';
... |
insert into Inne (Rezyser, Aktor) values ('Tak', 'Nie');
insert into Inne (Rezyser, Aktor) values ('Nie', 'Tak');
insert into Inne (Rezyser, Aktor) values ('Tak', 'Tak'); |
USE dbase;
-- ================================================
-- DROPPING EXISTING TABLES
-- ================================================
DROP TABLE IF EXISTS periodicals_of_user;
DROP TABLE IF EXISTS periodicals_of_theme;
DROP TABLE IF EXISTS roles;
DROP TABLE IF EXISTS users;
DROP TABLE IF EXISTS blocked_users;... |
set serveroutput on size 30000;
declare
begin
PROC_LOB_TEST;
end; |
-- ----------------------------
-- Table structure for sys_authority
-- ----------------------------
DROP TABLE IF EXISTS `sys_authority`;
CREATE TABLE `sys_authority` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '权限角色表主键',
`name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL C... |
DROP DATABASE IF EXISTS dash_db;
CREATE DATABASE dash_db;
USE dash_db;
CREATE TABLE samples (
`Segment` VARCHAR(16) CHARACTER SET utf8,
`Country` VARCHAR(24) CHARACTER SET utf8,
`Product` VARCHAR(9) CHARACTER SET utf8,
`Discount_Band` VARCHAR(6) CHARACTER SET utf8,
`Units_Sold` NUMERIC(5, 1),
`M... |
create table `team15`.`qna` (
number int unsigned not null primary key auto_increment,
title varchar(150) not null,
content text not null,
id varchar(20) not null,
date datetime not null,
); |
create database db_atividade_1;
use db_atividade_1;
create table tb_funcionarios (
id bigint auto_increment,
nome varchar (60) not null,
codigo bigint (4) not null,
cargo varchar (40) not null,
salario float (9,2) not null,
data_contratacao date,
primary key (id)
);
describe tb_funcionarios;
alter table tb_funcionar... |
SELECT emp.first_name, emp.last_name, dep.dept_name
FROM employees as emp
LEFT JOIN dept_manager as manager
on manager.emp_no = emp.emp_no
LEFT JOIN departaments as dep
on dep.dept_no = manager.dept_no
WHERE emp.emp_no in (110022, 110085, 10006); |
# Write a procedure to increase the price of a specified product
# category by a given percentage.
DROP PROCEDURE if exists increaseCategoryPrice;
DELIMITER //
CREATE PROCEDURE increaseCategoryPrice(IN perc FLOAT, IN kate VARCHAR(40))
BEGIN
UPDATE Products SET MSRP=ROUND(MSRP*(1 + perc/100) ,2) WHERE productLine=kat... |
-- phpMyAdmin SQL Dump
-- version 4.6.5.2
-- https://www.phpmyadmin.net/
--
-- Хост: 127.0.0.1:3306
-- Время создания: Дек 23 2017 г., 17:00
-- Версия сервера: 5.6.34-log
-- Версия PHP: 7.1.0
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIE... |
DROP TABLE IF EXISTS USERS;
CREATE TABLE USERS(
userId varchar(12) NOT NULL,
password varchar(12) NOT NULL,
name varchar(20) NOT NULL,
email varchar(50),
PRIMARY KEY (userId)
);
INSERT INTO USERS VALUES('javajigi','password','자바지기', 'blue@tigrison.com'); |
-- # Write your MySQL query statement below
SELECT W1.Id
FROM Weather AS W1
LEFT JOIN (SELECT *, DATE_ADD(RecordDate, INTERVAL 1 DAY) RecordDate_P1
FROM Weather) AS W2
ON W1.RecordDate = W2.RecordDate_P1
WHERE W1.Temperature > W2.Temperature; |
/*
MySQL Backup
Source Server Version: 5.1.30
Source Database: medtrabajo
Date: 22/03/2021 00:29:55
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `mensual`
-- ----------------------------
DROP TABLE IF EXISTS `mensual`;
CREATE TABLE `mensual` (
`MeEmPrT` varchar(200) COLLATE u... |
SET DATABASE TO Goliath;
-- Migrate Folder data
CREATE TABLE IF NOT EXISTS FolderWithId (
-- Key columns
userid UUID NOT NULL REFERENCES UserTable(id),
id SERIAL NOT NULL UNIQUE,
PRIMARY KEY (userid, id),
-- Data columns
name STRING UNIQUE
) INTERLEAVE IN PARENT UserTable (userid);
INSERT INTO FolderWith... |
DROP DATABASE iniciales;
CREATE SCHEMA IF NOT EXISTS `iniciales` DEFAULT CHARACTER SET utf8 ;
USE `iniciales` ;
-- -----------------------------------------------------
-- Table `mydb`.`Usuario`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `iniciales`.`Usuario` (
`Carnet` INT N... |
SELECT COUNT(*) FROM Comments;
# 62,389,330
SELECT COUNT(*) FROM Comments
WHERE UserId IS NULL AND UserDisplayName IS NULL;
# 591
SELECT COUNT(*) FROM Comments
WHERE UserId IS NOT NULL AND UserDisplayName IS NOT NULL;
# 4,640
SELECT COUNT(*) FROM Comments
WHERE UserId IS NULL XOR UserDisplayName IS NULL;
# 62,384,09... |
--List the vendors, that are not in California or Michigan, with more than 2 invoices dated within the same week of the year.
--
-- List the vendor name and state, and each vendor should only appear once.
SELECT DISTINCT VENDOR_NAME, VENDOR_STATE
FROM INVOICEVENDORS
WHERE VENDOR_STATE <> 'CA' AND VENDOR_STATE ... |
-- Create DataBase.
create database wiki;
-- Switch To DataBase.
use wiki;
-- Create External Table And Give Path To The Database.
create external table data_02 (prev string, curr string, types string, pair int)
row format delimited
fields terminated by '\t'
stored as textfile
location "/user/raj_ops/data_02";
-- Q... |
ALTER TABLE datki ADD PRIMARY KEY (pk);
ALTER TABLE start_upy ADD PRIMARY KEY (pk);
ALTER TABLE fundacje ADD PRIMARY KEY (pk);
ALTER TABLE towary ADD PRIMARY KEY (pk);
ALTER TABLE towary_datki ADD PRIMARY KEY (pk);
ALTER TABLE sprzedaze ADD PRIMARY KEY (pk);
ALTER TABLE towary_sprzedaze ADD PRIMARY KEY (pk);
ALTER TABL... |
ALTER TABLE topics DROP COLUMN description;
|
DROP TABLE IF EXISTS `#__anodos_file_to_order`;
DROP TABLE IF EXISTS `#__anodos_file_to_task`;
DROP TABLE IF EXISTS `#__anodos_file_to_contract_specification`;
DROP TABLE IF EXISTS `#__anodos_file_to_contract`;
DROP TABLE IF EXISTS `#__anodos_file_to_contract_template`;
DROP TABLE IF EXISTS `#__anodos_file`;
DR... |
CREATE TABLE IF NOT EXISTS gameachievements.game (
id CHAR(64) PRIMARY KEY,
display_name VARCHAR(50) NOT NULL,
created TIMESTAMP NOT NULL,
updated TIMESTAMP NOT NULL
);
CREATE TABLE IF NOT EXISTS gameachievements.achievement (
id CHAR(64) PRIMARY KEY,
display_name VARCHAR(100) NOT NULL,
des... |
--------------------------------------------------------------------------------
-- Name: Shujing Yue
-- Student#: 122072176
-- Date: June 7, 2018
-- Purpose: Lab 5 DBS301
--------------------------------------------------------------------------------
-- Part-A Simple Joins
-- Question 1. Display the departme... |
SELECT CASE loc WHEN 'IT' THEN 'TRANSFER OUT'
ELSE 'TRANSFER IN'
END AS [TransType], ord_no AS [Transf. #], convert(varchar(10),trx_dt,101) AS [Transf. Dt.], convert(varchar(10), RIGHT(trx_tm, 8), 101) AS [Transf. Tm], item_no AS [Item], doc_ord_no AS [Ord #], quantity AS [Trx Quantity], user... |
-- Ernesto Jara Olveda
-- SEPTIEMBRE 30, 2017
-- Model: UNEDL Version: 7.0.0
DROP DATABASE IF EXISTS UNEDL;
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';
CREATE... |
DROP TABLE IF EXISTS users;
DROP TABLE IF EXISTS submissions;
DROP TABLE IF EXISTS categories;
DROP TABLE IF EXISTS statuses;
DROP TABLE IF EXISTS upvotes;
CREATE TABLE users (
id INTEGER PRIMARY KEY AUTOINCREMENT
, email TEXT NOT NULL
, password TEXT NOT NULL
, first_name TEXT NOT NULL
, last_name TEXT NO... |
CREATE OR REPLACE PROCEDURE "deletePrimarySupporter" (
"patientSSN" IN VARCHAR2,
"hsSSN" IN VARCHAR2)
AS
sickOccurence INTEGER;
secondaryOccurence INTEGER;
BEGIN
SELECT count(*)
INTO sickOccurence
FROM SICKPATIENT s
WHERE s.PATIENTSSN="patientSSN";
SELECT COUNT(*) INTO secondaryOccurenc... |
drop schema if exists `myDb`;
create schema if not exists `myDb`;
use `myDb`;
-- drop table if exists computer;
-- drop table if exists company;
create table company (
id bigint IDENTITY,
name varchar(255),
constraint pk_company primary key (id))
;
create table compu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.