text stringlengths 6 9.38M |
|---|
/**
* Used at method ShisetsuDetailService.updateDetailShisetsuKihon()
* @author ThuanLM
* @version $Id: ShisetsuDetailService_updateDetailShisetsuKihon_Upd_01.sql 21305 2014-08-16 07:28:29Z p_re_mintoan $
*/
UPDATE BY_SHISETSU_KIHON SK
SET
SK.ACCESS_1_EKI_NAME = /*access1EkiName*/'XXXX'
,SK.ACCESS_1_DISTANCE =... |
declare
a number:='&a';
begin
if(mod(a,2)=0) then
dbms_output.put_line(a||' is even');
else
dbms_output.put_line(a||' is odd');
end if;
end;
/*
S.KAARTHIKEYA PAVANA KUMAAR
19BQ1A05L5
*/ |
CREATE index LatIdx on accrm.postcodes(Latitude);
CREATE index LonIdx on accrm.postcodes(Longitude);
DROP Index LatIdx ON accrm.postcodes;
DROP Index LonIdx ON accrm.postcodes; |
create table sec_systems
(
Name varchar2(100)
)
/
insert into sec_systems(Name) values ('Windows XP'); commit;
insert into sec_systems(Name) values ('Windows 7'); commit;
insert into sec_systems(Name) values ('Windows'); commit;
insert into sec_systems(Name) values ('Linux - Red Hat'); commit;
insert into sec_systems(... |
-- phpMyAdmin SQL Dump
-- version 5.0.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Apr 14, 2020 at 02:49 PM
-- Server version: 10.4.11-MariaDB
-- PHP Version: 7.4.3
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD... |
CREATE TABLE jobaddresses(
_id serial PRIMARY KEY,
company_id INT,
job_id INT,
street VARCHAR (50)
); |
CREATE TABLE public.users
(
user_id serial NOT NULL,
first_name character varying(255) DEFAULT NULL,
last_name character varying(255) DEFAULT NULL,
email character varying(255) DEFAULT NULL UNIQUE
CONSTRAINT user_pkey PRIMARY KEY (user_id),
CONSTRAINT user_email_key UNIQUE (email)
); |
-- :name create_upvote :insert
INSERT INTO upvote(upvote_id)
VALUES (:id) |
UPDATE BUS
SET RATE_PKM = RATE_PKM + 10*RATE_PKM/100;
SELECT *
FROM BUS;
|
CREATE OR REPLACE VIEW price_report AS
WITH page_pulls_with_recency AS (
SELECT page_pulls.id,
page_pulls.trust,
page_pulls.location,
page_pulls.url,
page_pulls.html,
page_pulls.created_at,
page_pulls.updated_at,
rank() OVER... |
CREATE USER projecttwo IDENTIFIED BY p4ssw0rd;
GRANT CONNECT, RESOURCE TO projecttwo;
GRANT DBA TO projecttwo WITH ADMIN OPTION;
CREATE OR REPLACE FUNCTION GET_HASH(USERNAME VARCHAR2, PASSWORD VARCHAR2) RETURN VARCHAR2
IS
EXTRA VARCHAR2(10) := 'SALT';
BEGIN
RETURN TO_CHAR(DBMS_OBFUSCATION_TOOLKIT.MD5(
INPUT => UT... |
/*触发器:
1、新增事件文章(tb_event_article)数据时,事件源文章数(tb_source_article_num)新增1
*/
create Trigger t_afterinsert_on__tb_event_article_add1
after insert on tb_event_article
for each row
begin
update tb_source_article_num sn set sn.num = num + 1 where sn.event_id = new.event_id and sn.table_id = new.table_id;
end;
/*触发器:
2、删除事件... |
--
-- Dumping data for table `history`
--
INSERT INTO `history` VALUES (4709,81,1032341936,2,'aut-num: AS20507
as-name: AsName
descr: sequence 81
source: RIPE
','AS20507');
INSERT INTO `history` VALUES (4709,82,1032857323,2,'aut-num: AS20507
as-name: AsName
descr: sequence 82
so... |
-- List the number of records with the same score in the second table
SELECT score, COUNT(score) AS number
FROM second_table
GROUP BY score DESC;
|
CREATE INDEX idx_da_doctor ON public.da_doctor USING btree (dw_last_updated_dt, dw_facility_cd);
CREATE UNIQUE INDEX uk_da_doctor ON public.da_doctor USING btree (dw_row_id, dw_facility_cd);
CREATE UNIQUE INDEX uk_da_doctor_2 ON public.da_doctor USING btree (doctor_cd, dw_facility_cd); |
ALTER TABLE `acc_user`
CHANGE COLUMN `user_onwikiname` `user_onwikiname` VARCHAR(255) NULL,
ADD COLUMN `oauthrequesttoken` VARCHAR(45) NULL AFTER `user_emailsig`,
ADD COLUMN `oauthrequestsecret` VARCHAR(45) NULL AFTER `oauthrequesttoken`,
ADD COLUMN `oauthaccesstoken` VARCHAR(45) NULL AFTER `oauthrequestsecret`,
... |
-- update einstein database
USE einstein;
-- update dbheatpump
ALTER TABLE dbheatpump ADD COLUMN Reference VARCHAR(200) DEFAULT NULL AFTER HPSubType;
ALTER TABLE dbheatpump DROP DBFuel_id;
ALTER TABLE dbheatpump ADD COLUMN FuelType VARCHAR(45) DEFAULT NULL AFTER HPCoolCOP;
ALTER TABLE dbheatpump CHANGE COLUMN HPAbsEff... |
# 4@(#) tMyTables.sql 4.1@(#) 07/09/07 12:27:05
/*---------------------------------------------------
mytables.sql - Tables Owned by User - By Table Name
----------------------------------------------------*/
@tCleanup
SET echo off pagesize 59 newpage 0 heading ON
COLUMN Today NEW_VALUE xTODAY noprint format a1 tr... |
--DROP Database Bakery
--18/25 ??? само заради DECIMAL , a иска MoNEY no zanapred da davaem decimal
CREATE TABLE Countries(
Id INT PRIMARY KEY IDENTITY ,
Name NVARCHAR(50) UNIQUE
)
CREATE TABLE Distributors(
Id INT PRIMARY KEY IDENTITY ,
Name NVARCHAR(25) UNIQUE ,
AddressText NVARCHAR(30) ,
Summary NVARCHAR(200),
C... |
select top 1 * from smsdss.c_HCRA_FMS_Rpt_Tbl_2016;
select top 1 * from smsdss.c_HCRA_ADS_Rpt_Tbl_2016;
select top 1 * from smsdss.c_HCRA_FMS_ADS_Rpt_Tbl_2016; |
UPDATE `decenie`
SET `century`= case
when `decenie` < 100 then 'Moins de 100'
when `decenie` >= 100 and `decenie` < 200 then '100-200'
when `decenie` >= 200 and `decenie` < 300 then '200-300'
when `decenie` >= 300 and `decenie` < 400 then '300-400'
when `decenie` >= 400 and `decenie` < ... |
CREATE TABLE "SCCTOOLS"."SCC_SALDO_CALC_ANALITICO_HIST"
( "DT_SALDO" DATE NOT NULL ENABLE,
"EMP" CHAR(2) NOT NULL ENABLE,
"CONTRATO" VARCHAR2(9) NOT NULL ENABLE,
"PARCELA" NUMBER(3,0) NOT NULL ENABLE,
"STATUS" CHAR(1),
"VAL_SALDO_ATUAL" NUMBER(14,5),
"RDA_SALDO_ATUAL" NUMBER(14,5),
"VAL_APRDO" NUMBER(... |
SET FOREIGN_KEY_CHECKS=0;
DROP TABLE if exists member;
DROP TABLE if exists baf_event;
DROP TABLE if exists registration;
DROP TABLE if exists event_type;
DROP TABLE if exists user_role;
DROP TABLE if exists user_credentials;
SET FOREIGN_KEY_CHECKS=1;
CREATE TABLE member (
id INT UNSIGNED AUTO_INCREMENT PRIMARY KE... |
ALTER TABLE `fav_location` CHANGE `department_id` `department_id` INT(11) NOT NULL DEFAULT '0';
|
-- phpMyAdmin SQL Dump
-- version 4.0.10.18
-- https://www.phpmyadmin.net
--
-- Host: localhost:3306
-- Generation Time: Apr 15, 2018 at 09:10 AM
-- Server version: 10.1.31-MariaDB-cll-lve
-- PHP Version: 5.6.30
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=... |
create table [Main].[Genre]
(
[GenreId] smallint NOT NULL IDENTITY (1, 1)
, [Name] varchar(50) NOT NULL
, CONSTRAINT [PK_Genre] PRIMARY KEY ([GenreId])
, CONSTRAINT [AK_Genre_Name] UNIQUE ([Name])
) |
CREATE TABLE animals (
id INTEGER PRIMARY KEY AUTOINCREMENT, -- take care of IDs automatically
name TEXT,
species TEXT,
description TEXT,
roundness INTEGER,
alive BOOLEAN,
age INTEGER,
image_url TEXT
);
INSERT INTO animals( name, species, description, roundness, alive, age, image_url )
VALUES(
'... |
SELECT TOP(CONVERT(INT, /*topRow*/))
--借入枠情報.借入枠ID(KEY)
FI.DEBT_FACILITY_ID,
--借入枠情報.借入枠番号
FI.DEBT_FACILITY_NO,
--借入枠情報.借入先名
FI.DEBT_CUST_NAME,
--借入枠情報.借入種類
FI.DEBT_TYPE,
E.CODE_NAME AS DEBT_TYPE_NAME,
--借入枠情報.営業所在地
FI.BUSINESS_LOCATION,
F.CODE_NAME AS BUSINESS_LOCATION_NAME,
--借入枠情報.枠通... |
/**
* SQL for update BY_SHISETSU_CUSTOMER_VOICE for reflect shisetsu to From
* @author TuyenVHA
* @version $Id: ShisetsuDashboardService_updateShisetsuCustomerVoice_Upd_01.sql 9294 2014-06-28 09:57:05Z p__toen $
*/
UPDATE BY_SHISETSU_CUSTOMER_VOICE BSCV
SET
BSCV.CST_VOI_KEISAI_STS_KBN = /*cstVoiKeisaiStsKbn*/'1'
... |
--
-- 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;
--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
--
CREATE EXTENSION IF NOT EXISTS plpgs... |
USE ProjetRJ;
CALL ps_creer_abonnement('jade1', 'influe1');
CALL ps_creer_abonnement('jade2', 'influe1');
CALL ps_creer_abonnement('jade2', 'influe2');
CALL ps_creer_abonnement('influe1', 'influe3');
CALL ps_creer_abonnement('influe1', 'influe2');
CALL ps_creer_demande_ami('jade3', 'jade1');
CALL ps_creer_abonnement('... |
-- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: Aug 06, 2018 at 10:17 AM
-- Server version: 5.7.19
-- PHP Version: 7.1.9
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHA... |
SELECT COUNT(*)
FROM
--契約情報テーブル
CONTRACT_INFO CONTRACT
WHERE
--検収日<業務日付 AND
CONTRACT.ACCEPTANCE_CHECK_DATE</*busnessDate*/ AND
--契約状況<30:検収済 AND
CONTRACT.CONTRACT_CONDITION< CAST(/*alreadyAcceptanceCheck*/ AS CHAR(2)) AND
--取消状況=1:未取消
CONTRACT.CANCAL_STATE = CAST(/*notCanceled*/ AS CHAR(1)) |
/****************************************************************************************
问题点:单独把下面的SQL拿出来执行,两个语句的执行计划是一样的。但是放到存储过程里,就会出现差异。差异的原因是存储过程的预编译+传参导致执行计划选择异常。属于参数嗅探的一种
优化:尽早的缩小结果集
原SQL:
SELECT UserName,SmsContent,SendTime FROM
(
select u.UserName,u.PKCompany,sr.SmsContent,SR.SendTime,ROW_NUMBER() OVER(PART... |
-- Interview Witness
SELECT *
FROM interview
WHERE person_id in (16371, 14887)
-- 16371
-- I heard a gunshot and then saw a man run out.
-- He had a "Get Fit Now Gym" bag.
-- The membership number on the bag started with "48Z".
-- Only gold members have those bags.
-- The man got into a car with a plate that inclu... |
SELECT TOP 10 p.Name, p.Description,
AVG(f.Rate) AS AverageRate,
COUNT(fi.FeedbacksAmount) AS FeedbacksAmount
FROM Products AS p
JOIN Feedbacks AS f
ON f.ProductId = p.Id
JOIN (
SELECT ProductId, COUNT(Id) AS FeedbacksAmount
FROM Feedbacks
GROUP BY ProductId
) AS fi
ON fi.ProductId = p.Id
GROUP By p.Name,p... |
CREATE TABLE IF NOT EXISTS images (
id INTEGER PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
post_id INTEGER REFERENCES posts(id) NOT NULL,
public_id TEXT,
url TEXT NOT NULL
);
|
-- DROP DATABASE
DROP DATABASE IF EXISTS agarthan_db;
-- CREATE DATABASE
CREATE DATABASE agarthan_db;
|
/*
#---------------------------------------------------------------+
# PostgreSQL commands for creating database 'vpkshd' |
# |
# Creation date: Tue Mar 1 14:56:57 MSK 2016 |
# The host where it was developed=pnpi-itmo.pnpi.spb.... |
CREATE TABLE dbo.carga_texto (
[id_linea_carga] BIGINT IDENTITY (1, 1) NOT NULL,
[fecha] DATETIME CONSTRAINT [DF_carga_texto_fecha] DEFAULT (getdate()) NULL,
[estado] VARCHAR (50) NULL,
[usuario] VARCHAR (50) NULL,
[tipo_registro] VARCHAR (50) NULL,
... |
GRANT SELECT ON MV_BLOCK_STAT0_AGGR_180_DAYS TO CMS_POPULARITY_SYSTEM_R;
GRANT SELECT ON MV_BLOCK_STAT0_AGGR_12_MONTHS TO CMS_POPULARITY_SYSTEM_R;
GRANT SELECT ON MV_BLOCK_STAT0_LAST_ACCESS TO CMS_POPULARITY_SYSTEM_R;
GRANT SELECT ON V_CORRUPTEDFILESDETAIL TO CMS_POPULARITY_SYSTEM_R;
GRANT SELECT ON V_CORRUPTEDFILESSIT... |
select n.ASSOCIATED_DOCUMENT_ID, to_char(last_modified_date,'YY:MM:DD:HH24:MI:SS'),to_char(a.update_timestamp,'YY:MM:DD:HH24:MI:SS')
from negotiation_activity a,
negotiation n
where n.negotiation_id = a.negotiation_id
order by n.ASSOCIATED_DOCUMENT_ID; |
SELECT last_name, first_name FROM db_saburadi.user_card
WHERE last_name LIKE '%-%' OR first_name LIKE '%-%'
ORDER BY last_name ASC, first_name ASC
;
|
/*
左连接:主表 left join 从表 on 连接条件
右链接:从表 right join 主表 on 连接条件
保留主表所有的结果,从表没连接成功则补null
*/
--查询每位学生对应的班级信息
select * from students left join classes on students.cls_id = classes.id;
--查询没有对应班级的学生
select students.* from students left join classes
on students.cls_id = classes.id where classes.id is null;
|
/*
* Insert lists
*/
INSERT INTO list (id, name, owner_id)
VALUES (1, 'Testilista 1', 'testUser');
INSERT INTO list (id, name, owner_id)
VALUES (2, 'Testilista 2', 'testUser');
INSERT INTO list (id, name, owner_id)
VALUES (3, 'Testilista 3', 'testUser');
/*
* Insert list items
*/
INSERT INTO listitem (id, n... |
CREATE TABLE "public"."users" (
"id" uuid NOT NULL,
"name" character varying(120) NOT NULL,
"username" character varying(60) NOT NULL,
CONSTRAINT "users_id" PRIMARY KEY ("id")
) WITH (oids = false);
CREATE INDEX "users_name" ON "public"."users" USING btree ("name");
CREATE INDEX "users_username" ON "p... |
DROP DATABASE IF EXISTS burgers_db;
CREATE DATABASE IF NOT EXISTS burgers_db;
USE burgers_db;
--If table already exists, remove it before creating the table again
DROP TABLE IF EXISTS burgers;
--Creates the burgers table
CREATE TABLE burgers(
id int NOT NULL AUTO_INCREMENT,
burger_name varchar(255) NOT NULL,
... |
select "this might error on a duplicate index or, if not, take a very long time to run..." as NOTE;
create index spl_bk_site on site_play_log (booking_id, site_id);
|
ALTER TABLE IF EXISTS ONLY public.books_categories DROP CONSTRAINT IF EXISTS books_categories_category_id_fkey;
ALTER TABLE IF EXISTS ONLY public.books_categories DROP CONSTRAINT IF EXISTS books_categories_book_id_fkey;
ALTER TABLE IF EXISTS ONLY public.categories DROP CONSTRAINT IF EXISTS categories_pkey;
ALTER TABLE ... |
insert into Categories (Name) values('Clothing');
|
/* Aufgabe 7.1.a: Studenten mit Ethikprüfung */
SELECT s.Name AS Student
FROM vorlesungen v
NATURAL JOIN pruefen p
NATURAL JOIN studenten s
WHERE v.Titel = 'Ethik'
AND p.Note IS NOT NULL
ORDER BY Student ASC;
/* Aufgabe 7.1.b: Carnaps Pruefungen */
SELECT vl.Titel AS Vorlesung, p.Note AS Note
FROM studenten s... |
-- phpMyAdmin SQL Dump
-- version 4.8.3
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Feb 03, 2019 at 12:24 AM
-- Server version: 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 @OL... |
-- phpMyAdmin SQL Dump
-- version 4.9.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Feb 05, 2020 at 03:01 PM
-- Server version: 10.4.11-MariaDB
-- PHP Version: 7.4.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD... |
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Хост: 127.0.0.1
-- Время создания: Май 23 2016 г., 09:02
-- Версия сервера: 10.1.13-MariaDB
-- Версия PHP: 5.5.34
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT ... |
/* For each group of laptops with the identical model number, add following record into PC table:
code: minimal code among laptops in the group +20;
model: laptop's model number +1000;
speed: maximal speed among laptops in the group;
ram: maximal ram size among laptops in the group *2
hd: maximal hd capacity among lapt... |
-- DROP TABLE roles;
DROP TABLE administrator;
DROP TABLE manager;
DROP TABLE employee;
DROP TABLE types;
DROP TABLE cars;
DROP TABLE contracts;
DROP TABLE client;
DROP TABLE users;
DROP TABLE userroles; |
/*
Navicat Premium Data Transfer
Source Server : local_mysql
Source Server Type : MySQL
Source Server Version : 80015
Source Host : localhost:3306
Source Schema : library
Target Server Type : MySQL
Target Server Version : 80015
File Encoding : 65001
Date: 20/12/2019 ... |
use testdb;
-- table update details would be here
UPDATE dbversion SET version=11;-- the database version would be update
|
-- Select all the employees who were born between January 1, 1952 and December 31, 1955 and their titles and title date ranges
-- Order the results by emp_no
SELECT e.emp_no,
e.first_name,
e.last_name,
t.title,
t.from_date,
t.to_date
FROM employees as e
INNER JOIN titles as t
ON (e.em... |
CREATE DATABASE IF NOT EXISTS banco;
USE banco;
CREATE TABLE IF NOT EXISTS usuarios(id_usuario INT AUTO_INCREMENT PRIMARY KEY);
CREATE TABLE IF NOT EXISTS logado(id_logado INT AUTO_INCREMENT PRIMARY KEY);
CREATE TABLE IF NOT EXISTSprodutos(
id_produto INT AUTO_INCREMENT PRIMARY KEY,
descricao VARCHAR(40) NOT NUL... |
-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Tempo de geração: 25-Set-2020 às 00:40
-- Versão do servidor: 10.4.14-MariaDB
-- versão do PHP: 7.4.9
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CL... |
CREATE TABLE parts
(
partid INTEGER PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
partnumber TEXT,
description TEXT,
category TEXT,
supplier TEXT
) |
DELETE FROM log;
DELETE FROM user;
ALTER TABLE log ALTER COLUMN id RESTART WITH 1;
ALTER TABLE user ALTER COLUMN id RESTART WITH 1;
INSERT INTO user (email, password, created_at) VALUES ('admin@admin.com', 'aaaaa', now());
INSERT INTO user (email, password, created_at) VALUES ('user@user.com', '654321', now());
|
-- --------------------------------------------------------
--
-- Table structure for table `transform`
--
CREATE TABLE `transform` (
`station` varchar(1) NOT NULL,
`Item_ID` varchar(15) NOT NULL,
`Product_Name` varchar(25) DEFAULT NULL,
`Quantity` int(11) NOT NULL,
`Manufactured_date` date DEFAULT NULL,
... |
use academia_ginastica;
-- QUESTÃO 01: Recupere os nomes e sobrenome dos instrutores e o código das turmas que eles ministram. Ordene pelo nome do instrutor.(1008 linhas retornadas)
-- QUESTÃO 02: Recupere os dados dos instrutores que dão aula para mais de 2 turmas. (47 linhas retornadas)
select * from turma;
selec... |
/*
To run this file, we do the following in our Terminal:
1. Go to the directory of this sql file.
2. Get into our mysql console.
3. Run "source schema.sql"
*/
-- Create the database burger_db and specified it for use.
CREATE DATABASE sequelizedBurger_db;
|
select employee_id, hire_date, add_months(hire_date, 6) "REVIEW", next_day(hire_date, 'Friday'), last_day(hire_date)
from employees
where months_between(sysdate, hire_date) < 120
order by employee_id;
|
drop table alternativeIngredientName CASCADE CONSTRAINTS;
create table alternativeIngredientName
(
ingredientID number not null,
name varchar2(100) not null,
ingredientOption varchar2(100) not null,
CONSTRAINT fk_ingred_altIngred
FOREIGN KEY ( ingredientID ) REFERENCES ingredient( ID ) ON DELETE CASCADE,
CONSTR... |
-- phpMyAdmin SQL Dump
-- version 4.9.0.1
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 11-07-2019 a las 19:42:06
-- Versión del servidor: 10.3.15-MariaDB
-- Versión de PHP: 7.3.6
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00"... |
select
o_year,
sum(case
when nation = 'BRAZIL'
then volume
else 0
end) / sum(volume) as mkt_share
from
(select
extract(year from o_orderdate) as o_year,
l_extendedprice * (1-l_discount) as volume,
n2.n_name as nation
from
part,supplier,lineitem,orders,customer,nation n1,nation n2,region
where
p_partkey = l_partkey
and... |
--use [template_db]
--go
/* Сгенерировано из шаблона
Developer : Перепечко А.В.
Created : 27.03.2017
Purpose : Группы
Change list:
04.05.2017 Перепечко А.В. Переносим на PG
14.05.2017 Перепечко А.В. Приводим к единому виду обязательных атрибутов (id, descr, comm, cu, cd, ct, cu_id)
*/
--if OBJECT_ID( ... |
DROP TABLE dbo.users
DROP TABLE dbo.recipes
DROP TABLE dbo.usersInduction
DROP TABLE dbo.myRecipes
DROP TABLE dbo.familyRecipes
Drop TABLE dbo.favorites
|
CREATE TABLE `users` (
`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`username` VARCHAR(20) NOT NULL,
`password` VARCHAR(20) NOT NULL
) |
INSERT INTO burgers (burger) VALUES ('Bacon Cheese Burger');
INSERT INTO burgers (burger) VALUES ('Rancor Burger');
INSERT INTO burgers (burger) VALUES ('Slap Ya Mama Burger'); |
-- select * from vms.gonk2_interlin_manchu
UPDATE vms.gonk2_interlin_manchu
SET ID_TYPE = 2
where mod(id, 2) = 0 ;
UPDATE vms.gonk2_interlin_manchu
SET ID_TYPE = 1
where mod(id, 2) != 0 ;
COMMIT;
update VMS.GONK2_interlin_manchu m
set mph_code = vms.metaphone( m.text );
commit;
--delete duplicates
DELETE FROM ... |
-- Based on the relationship diagram we can see, that apart from the GPS coordinates there are no indirect connections between the routes and the stops
-- So first we have to join stops and shapes based on the common GPS coordinates
-- We can do this, because shapes contain series of GPS coords. that when drawn on a ... |
CREATE TABLE wines (
fixed_acidity FLOAT,
volatile_acidity FLOAT,
citric_acid FLOAT,
residual_sugar FLOAT,
chlorides FLOAT,
free_sulfur INT ,
total_sulfur INT,
density FLOAT,
ph FLOAT,
sulphates FLOAT,
alcohol FLOAT,
quality INT,
good BOOLEAN,
color STRING,
wi... |
CREATE PROC [ERP].[Usp_Sel_Producto_By_Familia]
@IdFamilia INT,
@IdEmpresa INT
AS
BEGIN
SELECT PRO.ID,
PRO.Nombre,
UM.Nombre UnidadMedida,
MA.Nombre Marca,
EX.Nombre Existencia
FROM ERP.FamiliaProducto FP
INNER JOIN ERP.Producto PRO ON PRO.ID = FP.IdProducto
INNER JOIN PLE.T6UnidadMedi... |
CREATE TABLE IF NOT EXISTS images(
image_id BIGSERIAL PRIMARY KEY UNIQUE,
url VARCHAR(255)
);
|
--first, check if tablename exists - if so, drop it
IF OBJECT_ID('dbo.DimEndage') IS NOT NULL
BEGIN
DROP TABLE dbo.DimEndage
END
--then select the IDs from the relevant column, create table, adding description (use case statement, and values from data dictionary)
SELECT DISTINCT
Endage as I... |
COPY (
SELECT compound_name,
target_name,
INPUT_BIOACTIVITIES_LIST
FROM public.pivot_bioactivity_by_compound_and_target
WHERE target_name in ('Unchecked',
'ADMET',
'Rattus norvegicus',
'Cyclooxygenase-2')
) TO STDOUT WITH CSV HEADER;
|
SET TERMOUT OFF
SET ECHO OFF
SET ESCAPE OFF
SET FEEDBACK OFF
SET HEAD ON
SET TRIMSPOOL ON
SET TIMING OFF
SET VERIFY OFF
SET DEFINE ON
SET SERVEROUTPUT ON
SET LINES 1000 PAGES 1000
DECLARE
v_table VARCHAR2(30) := 'Registry_Post';
sql_stmt VARCHAR2(200);
BEGIN
sql_stmt := 'drop table '|| v_table... |
--실습 테이블 생성
CREATE TABLE TBL_SCORE
( SID NUMBER
, NAME VARCHAR2(30)
, KOR NUMBER(3)
, ENG NUMBER(3)
, MAT NUMBER(3)
);
--=> 생성
-- 제약조건 추가 (SID컬럼에 PK제약조건 추가)
ALTER TABLE TBL_SCORE
ADD (
CONSTRAINT SCORE_SID_PK PRIMARY KEY(SID)
);
--=>변경
-- 제약조건 추가(KOR, ENG, MAT컬럼에 CK제약조건 추가)
ALTER TABLE TBL_SCORE
ADD (
CONS... |
select last_name, salary
from employees
where manager_id in (select employee_id
from employees
where last_name = 'King');
|
INVALID TEST
Postgres9.5 doesn't support stored procedures processing
|
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Client : 127.0.0.1
-- Généré le : Jeu 13 Avril 2017 à 07:49
-- Version du serveur : 5.7.9
-- Version de PHP : 5.6.15
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_... |
/*
Create table If Not Exists Employee (EmpId int, Name varchar(255), Supervisor int, Salary int)
Create table If Not Exists Bonus (EmpId int, Bonus int)
Truncate table Employee
insert into Employee (EmpId, Name, Supervisor, Salary) values ('3', 'Brad', 'None', '4000')
insert into Employee (EmpId, Name, Supervisor, Sal... |
------------------------------------------
--Host : localhost
--Database : openempi
SET SESSION AUTHORIZATION 'openempi';
SET search_path = public, pg_catalog;
ALTER TABLE ONLY public.person DROP CONSTRAINT fk_created_by_app_user;
ALTER TABLE ONLY public.user_session DROP CONSTRAINT fk_user_session_user;
ALTER ... |
CREATE TABLE `save` (
`no` int(11) DEFAULT NULL,
`save` text CHARACTER SET utf8 COLLATE utf8_unicode_ci
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
set names 'utf8';
delete from bjgl_menu;
alter table bjgl_menu auto_increment=1;
insert into bjgl_menu (name, url, order_view, valid, memo) values ('系统管理', '', '0', 1, '');
commit;
delete from bjgl_permission;
alter table bjgl_permission auto_increment=1;
insert into bjgl_permission (name, url, menu_id, order_view, act... |
DROP TABLE dbo.Incident_type;
DROP TABLE dbo.Incident_detail;
DROP TABLE dbo.Incident; |
#
# TABLE DATA FOR: users
#
INSERT
INTO
`users` (`id`, `login`, `email`, `created_at`, `updated_at`)
VALUES
('1', 'culpa', 'kferry@example.com', '2020-11-09 13:25:24', '2020-02-09 17:10:47'),
('2', 'aut', 'trantow.della@example.net', '2015-06-27 17:38:03', '2020-06-19 22:53:46'),
('3', 'commodi', 'thaddeus26@exa... |
CREATE TABLE public.da_room (
room_cd character varying(15),
room_name character varying(64),
nursestation_cd character varying(15),
ward_cd character varying(8) NOT NULL,
block_cd character varying(2),
floor_cd character varying(15),
record_status character(1),
loc_cd character varying(... |
--
-- PostgreSQL database cluster dump
--
SET default_transaction_read_only = off;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
--
-- Drop databases (except postgres and template1)
--
DROP DATABASE birddemo;
--
-- Drop roles
--
DROP ROLE postgres;
--
-- Roles
... |
/* Dans le système actuel il n'y a pas de gestion des périmètres superposés:
donc lorsqu'un secteur PAD, de danger, de protection... affecte un des polygons de
affectation_com, ce polygon est découpé et une remarque est placé dans le champ remarque
afin de préciser la nature de la superposition.
Puisque le nouveau... |
-- phpMyAdmin SQL Dump
-- version 4.9.1
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 12-11-2019 a las 15:21:48
-- Versión del servidor: 10.4.8-MariaDB
-- Versión de PHP: 7.1.32
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
... |
create table memes(
id serial4 primary key,
title varchar(100),
description text,
url text,
genre varchar(50)
);
|
/*
This is the solution for Module 3 Practice Quiz.
The database is from https://d3c33hcgiwev3.cloudfront.net/imageAssetProxy.v1/UAPENoOVEei4RQ5L9j9nDA_5042a1f0839511e8beb2b5b4ae9fa29a_ER-Diagram.png?expiry=1577059200000&hmac=aDgYCJd-i_T438PlmxPq2Rek9xIophPny3rpUEWX2LM
*/
--Q1: How many albums does the artist Led Zepp... |
# 本文件使用 # 作为注释
SHOW COLUMNS FROM test_table;
# DROP TABLE IF EXISTS `test_table`;
# CREATE TABLE `test_table` (
# `role_id` bigint(20) NOT NULL COMMENT '角色id',
# KEY `role_id` (`role_id`)
# ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='测试数据库'; |
/*
create or replace function add2(a in number,b in number)return number as c number;
begin
c:=a+b;
return(c);
end;
*/
--EXP-22(***S.KAARTHIKEYA PAVANA KUMAAR -19BQ1A05L5)
declare
x number:=5;
y number:=12;
r number;
begin
r:=add2(x,y);
dbms_output.put_line('Sum is :'||r);
end... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.