text stringlengths 6 9.38M |
|---|
CREATE table users (
user_id INTEGER PRIMARY KEY AUTO_INCREMENT,
email VARCHAR(255) NOT NULL,
first_name varchar(25) NOT NULL,
last_name varchar(25) NOT NULL,
password CHAR(128) NOT NULL,
user_type VARCHAR(25) NOT NULL,
bio TEXT,
last_logon DATETIME
);
ALTER TABLE users
ADD weekly_msg BOOLEAN DEFAULT... |
INSERT INTO "ConsignmentProperty" ("PropertyId", "Name", "Description", "Shortname")
VALUES (uuid_generate_v4(), 'AllEnglishConfirmed', '', ''),
(uuid_generate_v4(), 'AppraisalSelectionSignOffConfirmed', '', ''),
(uuid_generate_v4(), 'CrownCopyrightConfirmed', '', ''),
(uuid_generate_v4(), 'FinalOp... |
/* Formatted on 17/06/2014 18:12:03 (QP5 v5.227.12220.39754) */
CREATE OR REPLACE FORCE VIEW MCRE_OWN.V_MCRES_CL_PRODOTTI_SOFF
(
COD_TIPO_SOFF,
VAL_DESC_TIPO_SOFF,
FLG_FILIALE,
FLG_PRESIDIO,
FLG_AUTOMATICA,
FLG_DISMESSA,
DTA_INS,
MATRICOLA_INS
)
AS
SELECT COD_TIPO_SOFF,
VAL_DESC_TIP... |
-- Creates a table with data
CREATE TABLE IF NOT EXISTS second_table (id INT, name VARCHAR(256), score INT);
INSERT INTO second_table (`id`,`name`,`score`) VALUES (1,'John', 10), (2,'Alex', 3), (3,'Bob',14), (4,'George',8);
|
* UC Translated to BB4 by Juan Gea Bermúdez 2018.
* Simple bounds are set on the number of units online, offline, started and
* shut-down within a single hour.
* Exogenous capacity:
* At most a number of units equal to the installed capacity, divided by the unit size rounded up, can be committed, started or shutdow... |
INSERT INTO "fldArea" VALUES (3437650,
'BLANE',
43814,
'1/2-1 BLANE',
NULL,
NULL,
'YES',
'OIL',
'OIL',
'PRODUCING',
'PRODUCING',
'BLANE',
'http://factpages.npd.no/FactPages/default.aspx?nav1=discovery'||chr(38)||'nav2=PageView|All'||chr(38)||'nav3=43814',
'http://factpages.npd.no/FactPages/default.aspx?nav... |
CREATE TABLE `users` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`email` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`nickname` varchar(45) NOT NULL,
`password` varchar(64) NOT NULL,
`gender` varchar(8) DEFAULT NULL,
`fullname` varchar(128) NOT NULL,
`firstname` varchar(64) NOT NULL,
`last... |
DROP MATERIALIZED VIEW person CASCADE;
CREATE MATERIALIZED VIEW person AS
SELECT u.id AS id,
u.username AS username,
u.name ... |
CREATE PROC SelectAllProducts
AS
BEGIN
Select *
FROM Products
END; |
/* Formatted on 17/06/2014 18:06:58 (QP5 v5.227.12220.39754) */
CREATE OR REPLACE FORCE VIEW MCRE_OWN.V_MCRE0_WRK_AL_DEL_NON_CONFORM
(
COD_ABI,
COD_NDG,
COD_SNDG,
COD_STATO,
VAL_ALERT,
VAL_ORDINE_COLORE,
VAL_CNT_DELIBERE,
VAL_CNT_RAPPORTI,
COD_PROTOCOLLO_DELIBERA
)
AS
SELECT d.cod_abi,
... |
-- Utilize o banco de dados seguros para executar as seguintes consultas:
use seguros;
-- 1) Crie e exiba uma visão que recupere a média dos valores dos danos ocorridos no estado RJ.
CREATE VIEW media_danos_RJ AS
SELECT
AVG(p.valor_dano)
FROM
participou p
INNER JOIN
acide... |
-- 07/11/2019 - Adding fields for assessment table
ALTER TABLE `assessment` ADD `violated_rule` VARCHAR(255) NULL AFTER `rules_violation`;
ALTER TABLE `assessment` ADD `self_criticism` TINYINT(1) NULL AFTER `violated_rule`;
ALTER TABLE `assessment` ADD `disconcentrated` VARCHAR(255) NULL AFTER `concentration`;
ALTER TA... |
CREATE TABLE IF NOT EXISTS `brbad_cops` (
`id` INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
`playerUUID` VARCHAR(255) NOT NULL,
`copUUID` VARCHAR(255) NOT NULL
); |
SELECT
count(*) AS cnt
FROM
company_name AS cn,
company_type AS ct,
info_type AS it1,
info_type AS it2,
movie_companies AS mc,
movie_info AS mi,
movie_info_idx AS mi_idx,
title AS t
WHERE
t.id = mi.movie_id
AND t.id = mi_idx.movie_id
... |
CREATE USER 'avaliacao'@'localhost' IDENTIFIED BY 'avaliacao';
GRANT ALL PRIVILEGES ON *.* TO 'avaliacao'@'localhost';
ALTER USER 'avaliacao'@'localhost' IDENTIFIED WITH mysql_native_password BY 'avaliacao'; |
--
-- Estrutura da tabela `1_ficha`
--
CREATE TABLE IF NOT EXISTS `1_ficha` (
`id_ficha` int(11) NOT NULL AUTO_INCREMENT,
`n_controle` varchar(15) DEFAULT '',
`nome` varchar(100) NOT NULL DEFAULT '',
`idade` varchar(3) DEFAULT '',
`sexo` varchar(10) DEFAULT '',
`n_sus` varchar(15) DEFAULT '',
`n_prontuar... |
create database agendas;
use agendas;
create table contactos(
id int not null AUTO_INCREMENT PRIMARY KEY,
nombre varchar (50) not null,
telefono varchar(10) not null,
email varchar(30) not null
);
insert into contactos (nombre, telefono, email) values ('alejandro', '7751221098', ... |
-- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Oct 17, 2019 at 07:05 PM
-- Server version: 10.1.26-MariaDB
-- 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... |
-- =======================================================================================
-- Colorful Schema
-- ===============
-- /= = = = = = = = = = = = = = = = = = =... |
-- phpMyAdmin SQL Dump
-- version 4.0.9
-- http://www.phpmyadmin.net
--
-- Host: 172.16.4.229
-- Generation Time: Jan 03, 2016 at 08:23 PM
-- Server version: 5.0.83-community
-- PHP Version: 5.3.3
-- CONOR WALSH 2016
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_C... |
/** 2017-04-09 - Mejora collares **/
ALTER TABLE `perros` ADD `has_collar` BOOLEAN NOT NULL DEFAULT FALSE AFTER `duenio`, ADD `collar_detalle` VARCHAR(50) NULL AFTER `has_collar`;
ALTER TABLE `perros` ADD `collar_color` VARCHAR(7) NULL DEFAULT NULL AFTER `collar_detalle`; |
-- create cputimes
create table if not exists cpu_metric (
machine_id int not null,
"user" float,
nice float,
system float,
idle float,
created_at TIMESTAMPTZ not null);
-- create mem_metric
create table if not exists mem_metric(
machine_id int not null,
total bigint,
available bigint,
percen... |
with totals AS
(SELECT state, SUM(population_estimate_2012) AS Total_State_Population FROM tutorial.city_populations GROUP BY 1 ORDER BY 1)
SELECT tcp.city, tcp.state, sum(tcp.population_estimate_2012) AS City_Population_2012, SUM(totals.Total_state_Population) AS Total_state_Population
FROM tutorial.city_populations... |
DROP TABLE IF EXISTS products_dev;
CREATE TABLE products (
id SERIAL PRIMARY KEY,
name TEXT,
url TEXT,
price DECIMAL(10,2),
detail TEXT
);
|
SELECT cohorts.name as cohort, count(assignment_submissions.*) as total_submissions
FROM assignment_submissions
JOIN students ON students.id = student_id
JOIN cohorts ON cohorts.id = cohort_id
GROUP BY cohorts.name
ORDER BY total_submissions DESC;
-- What I had in comparison
-- SELECT cohorts.start_date as cohort_na... |
CREATE TABLE "projects" (
"id" INTEGER NOT NULL,
"name" TEXT NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "tasks" (
"id" INTEGER NOT NULL,
"name" TEXT NOT NULL,
"status" VARCHAR(256) NULL,
"project_id" INTEGER NULL,
PRIMARY KEY ("id"),
FOREIGN KEY ("project_id") REFERENCES projects("i... |
-- --------------------------------------------------------
-- Host: 127.0.0.1
-- Server version: 5.5.27 - MySQL Community Server (GPL)
-- Server OS: Win32
-- HeidiSQL version: 7.0.0.4053
-- Date/time: 2015-03-27 16:50:55
-- -... |
drop procedure if exists ToggleActiveSchoolYear;
delimiter $$;
create procedure ToggleActiveSchoolYear(
in intSchoolYearId int,
in boolActive boolean,
in intModifiedById int,
out itExists int
)
begin
-- check and retrieve the active school year
-- if school year id of current active is not... |
CREATE TABLE TASK_DB.user (
id INT NOT NULL AUTO_INCREMENT,
login varchar(512) NOT NULL,
password varchar(512) NOT NULL,
email VARCHAR(255) NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (i... |
INSERT INTO users VALUES
(1,'Dell Weber','Icie_Brekke@yahoo.com','5I7wSxzQAGlmOTZ','https://s3.amazonaws.com/uifaces/faces/twitter/vigobronx/128.jpg'),
(2,'Vladimir Schinner','Audra14@yahoo.com','37G5b8UTt78JHFH','https://s3.amazonaws.com/uifaces/faces/twitter/m_kalibry/128.jpg'),
(3,'Skyla Jast','Reyna_Schroeder@gmail... |
-- phpMyAdmin SQL Dump
-- version 4.6.5.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Mar 13, 2018 at 05:49 AM
-- Server version: 10.1.21-MariaDB
-- PHP Version: 7.1.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET... |
```
查找当前薪水(to_date='9999-01-01')排名第二多的员工编号emp_no、薪水salary、last_name以及first_name,不准使用order by
CREATE TABLE `employees` (
`emp_no` int(11) NOT NULL,
`birth_date` date NOT NULL,
`first_name` varchar(14) NOT NULL,
`last_name` varchar(16) NOT NULL,
`gender` char(1) NOT NULL,
`hire_date` date NOT NULL,
PRIMARY KEY (`emp_no`)... |
/*
SQLyog Ultimate v12.09 (64 bit)
MySQL - 5.7.18 : Database - test
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;
/*!40101 SET SQL_MODE=''*/;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, ... |
-- MySQL Script generated by MySQL Workbench
-- Sáb 25 Mar 2017 13:35:52 BRT
-- Model: New Model Version: 1.0
-- MySQL Workbench Forward Engineering
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... |
create view student_view as
select student.roll_number as "roll_number",
student.name as "name",
student.gender as "gender",
student.address as "address",
city.name as "city",
student.date_of_birth as "DOB",
student.indian as "indian"
from student inner join city on city.code=student.city_code; |
CREATE PROC [ERP].[Usp_Del_Contrato]
@IdContrato INT,
@IdDatoLaboral INT
AS
BEGIN
DELETE ERP.Contrato WHERE ID = @IdContrato AND IdDatoLaboral = @IdDatoLaboral
END
|
create table plat_log
(
id varchar(32) not null comment '日志ID'
primary key,
type varchar(50) not null comment '类型,业务日志类型 1:添加 2:删除 3:修改 4:查询 5:查看,6:详细信息(可以自定义更多操作类型,通用操作依次添加,与业务模块相关的添加业务模块序号前缀)',
description varchar(200) null comment '日志描述',
ip varchar(200) null comment '访问IP',
client_type varchar(200) nu... |
-- NA_BINC.UBICACIO CAT2_T_VENT_SIT
-- NA_VALV.UBICACIO CAT2_T_VENT_SIT
-- NA_VENT.UBICACIO CAT2_T_VENT_SIT
CREATE OR REPLACE VIEW GW_MIGRA_NETAQUA.MAN_TYPE_LOCATION AS
SELECT ROWNUM id,
T1.*
FROM (
SELECT ID_ESCO_PORTELLA_SIT location_type,
'ELEMENT' feature_type,
... |
/* Formatted on 17/06/2014 18:12:58 (QP5 v5.227.12220.39754) */
CREATE OR REPLACE FORCE VIEW MCRE_OWN.V_MCRES_FEN_RETTIFICHE_RVDACON
(
COD_ABI,
VAL_RVNETTE_ULTIMO_MESE_DACONT
)
AS
SELECT s.cod_abi,
SUM (
CASE
WHEN s.cod_stato_rischio = 'S'
... |
use mission;
create table mission(id int);
commit; |
TRUNCATE TABLE GL_OFFSET_DEFN_T
/
INSERT INTO GL_OFFSET_DEFN_T (UNIV_FISCAL_YR,FIN_COA_CD,FDOC_TYP_CD,FIN_BALANCE_TYP_CD,OBJ_ID,VER_NBR,FIN_OBJECT_CD)
VALUES (2009.0,'BA','OLE_AA','AC','6E87373C-E831-A3FA-CC09-0834782BC7A5',1.0,'8000')
/
INSERT INTO GL_OFFSET_DEFN_T (UNIV_FISCAL_YR,FIN_COA_CD,FDOC_TYP_CD,FIN_BALANCE_... |
CREATE TABLE tweets(
id INTEGER NOT NULL AUTO_INCREMENT,
username VARCHAR(250) NOT NULL,
text TEXT NOT NULL,
created_at DATETIME NOT NULL,
PRIMARY KEY (id)
) ENGINE = InnoDB, CHARSET=utf8;
CREATE INDEX by_user ON tweets (username);
|
DROP DATABASE IF EXISTS iexchange;
CREATE DATABASE IF NOT EXISTS iexchange;
USE iexchange;
DROP TABLE IF EXISTS customers;
CREATE TABLE IF NOT EXISTS customers(
`customerId` smallint(3) unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
`createDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIME... |
CREATE TABLE `User` (
`user_id` INT NOT NULL,
`user_email` VARCHAR(20) NULL,
`user_password` VARCHAR(20) NULL,
`user_address` VARCHAR(50) NULL,
`user_register_date` DATETIME NULL
);
CREATE TABLE `Favorite` (
`user_id` INT NOT NULL,
`code` BIGINT NOT NULL
);
CREATE TABLE `HouseDeal` (
`deal_id` INT NOT NULL,
... |
/*
Navicat MySQL Data Transfer
Source Server : test
Source Server Version : 50645
Source Host : localhost:3306
Source Database : db_boot
Target Server Type : MYSQL
Target Server Version : 50645
File Encoding : 65001
Date: 2020-07-21 20:09:15
*/
SET FOREIGN_KEY_CHECKS=0;
-- ------... |
create database mashan;
use mashan;
drop table JWF1312B_bingtiao;
drop table JWF1418_cusha;
drop table JWF1562_xisha;
drop table SMARO_E_luotong;
create table JWF1312B_bingtiao (
record_id bigint not null auto_increment,
machineNo int,
record_timestamp datetime,
leveling_switch_r int,
leveling_range_r int,
enla... |
-- database: presto; groups: tpch; tables: customer,orders,lineitem
SELECT l_orderkey,
sum(l_extendedprice * (1 - l_discount)) AS revenue,
o_orderdate,
o_shippriority
FROM customer,
orders,
lineitem
WHERE c_mktsegment = 'BUILDING'
AND c_custkey = o_custkey
AND l_orderkey = o_orderkey
... |
-- phpMyAdmin SQL Dump
-- version 4.8.3
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Feb 16, 2019 at 09:54 PM
-- Server version: 5.7.23
-- PHP Version: 5.6.37
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
--
-- Database: `tasktracker`
--
DELIMITER $$
--
-- Procedu... |
select distinct Community.Name, U1.UserInfoId, U1.Username, U2.UserInfoId, U2.Username
from UserInfo U1, UserInfo U2, Subscription, Community
where U1.UserInfoId in
(select UserInfo.UserInfoId
from UserInfo, Subscription, Community
where UserInfo.UserInfoId = Subscription.UserInfoId and Subscription.CommunityI... |
SELECT
gating_set,
wsid,
workspace,
group_id,
group_name,
num_samples,
num_unique_days,
num_unique_tube,
panels,
fw_version,
study
FROM gatingSetMetaData
WHERE gatingSetMetaData.container IN (SELECT Container FROM study.participant)
|
SELECT channel,
order_id
FROM(
SELECT we.channel,
o.id as order_id,
row_number() OVER (PARTITION BY o.id ORDER BY we.occurred_at ASC)
FROM demo.orders o
JOIN demo.web_events we
ON o.occurred_at BETWEEN we.occurred_at AND we.occurred_at + interva... |
CREATE TABLE IF NOT EXISTS user (
id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(45) NOT NULL,
password VARCHAR(255) NOT NULL,
avatar TINYINT NOT NULL,
money INT NULL DEFAULT 5000,
PRIMARY KEY (id),
UNIQUE INDEX id_UNIQUE (id ASC) VISIBLE,
UNIQUE INDEX name_UNIQUE (name ASC) VISIBLE); |
WITH wlm_queries AS (
SELECT
service_class,
userid,
"query" AS query_id,
final_state AS state,
total_exec_time / 1000000 AS total_exec_time_sec,
total_queue_time / 1000000 AS total_queue_time_sec,
queue_start_time,
queue_end_time,
exec_start_time,
exec_end_time
FROM
STL_W... |
create table chat_rooms(
id integer primary key autoincrement,
chat_room text unique);
create table users(
id integer primary key autoincrement,
username text,
ip_address text,
port integer);
create table messages (
id integer primary key autoincrement,
message text,
chat_room_id intege... |
--
-- Copyright 2009-2011, Trustees of Indiana University
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- Redistributions of source code must retain the above copyright notice,
-- th... |
-- =======================================================================
-- 07_update-organisation-settings
-- =======================================================================
DROP TABLE public."OrganisationSetting";
CREATE TABLE public."OrganisationSetting" (
"OrganisationSettingID" UUID NOT NULL,
"Nam... |
select * from select21;
select * from select22;
select * from select23;
select * from select24; |
--돼지김치찌개
insert into Recipe ( recipeId, recipeName, recipeCategoryType, recipeDescription, cookingTime, calory ) values ( 1, '돼지김치찌개', '한식','김치찌개', 30, 200)
insert into RecipeMaterial (id, mandantory, materialId, recipeId) values (1, 'true', 11, 1)
insert into RecipeMaterial (id, mandantory, materialId, recipeId) va... |
--- land insert statements
insert into land (survey_no, area, unit, address_line1, land_mark, city, state, postal_zip_code, number_of_farms, description)
values('240/D/1', 1, 'acre', 'Raidurgam','near bio-diversity park', 'Hyderabad', 'Telangana', '500032', 5, 'This is sample description');
-- land owner insert statem... |
--------------------------------------------------------
-- DDL for Table R_PRODUCT_FAMILY
--------------------------------------------------------
CREATE TABLE "VF_SPMC_REF"."R_PRODUCT_FAMILY"
( "PRODUCT_FAMILY_CD" VARCHAR2(10),
"PRODUCT_FAMILY_DESC" VARCHAR2(100),
"CREATION_DT" DATE,
"CURR_FLAG_YN" C... |
-------------------------------------------------------------
--- Call Type
-------------------------------------------------------------
INSERT INTO Call_Type VALUES('A', 'Call', 'Call');
INSERT INTO Call_Type VALUES('B', 'Change Request', 'ChangeRequest');
INSERT INTO Call_Type VALUES('C', 'Complain', 'Complain');
... |
INSERT INTO produto
(cod_produto, descricao, vlr_distribuidor, vlr_admin, quantidade, dta_criacao, dta_atualizacao, ativo)
VALUES(11111, 'HD TOSHIBA 120GB', 80.00, 119.99, 30, now(), now(), true);
INSERT INTO produto
(cod_produto, descricao, vlr_distribuidor, vlr_admin, quantidade, dta_criacao, dta_atualizacao, ativo)
... |
SELECT * FROM users
WHERE authid = $1; |
CREATE TABLE `slot_1` (
`dr_id` float NOT NULL,
`Mon_s` float default NULL,
`Mon_e` float default NULL,
`Mon_p` float default NULL,
`Mon_a` float default NULL,
`Tue_s` float default NULL,
`Tue_e` float default NULL,
`Tue_p` float default NULL,
`Tue_a` float default NULL,
`Wed_s` float defa... |
SELECT
p.page_title AS source_page,
r.rd_title AS dest_page
FROM page p
INNER JOIN (SELECT rd_title, rd_from FROM redirect WHERE rd_namespace=0) r ON p.page_id=r.rd_from
WHERE page_namespace=0
INTO OUTFILE '/var/lib/mysql/redirect.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n';
|
SELECT * FROM HJ; |
use workshop;
insert into user(email,password)
values ( 'tester@futurefitbusiness.org', '$2b$12$FGxUfHcVWTQGOKaA2HQQn.T2cEMt.1q2vf2XtIYrP2XWw/bwjEY62' );
|
DROP TABLE IF EXISTS Used_code;
DROP TABLE IF EXISTS QRrcode;
DROP TABLE IF EXISTS Utilisateur;
CREATE TABLE QRCode (
ID int(10) NOT NULL AUTO_INCREMENT,
libelle varchar(255) NOT NULL UNIQUE,
montant int(10) NOT NULL UNIQUE,
PRIMARY KEY (ID));
CREATE TABLE Utilisateur (
id int(10) NOT NULL AUTO_I... |
-- Mostra informações sobre a tabela informada
--accept lwrorupp prompt 'Lower or Upper...: '
--accept tablename prompt 'Table Name...: '
set verify off
col partitioned for a11
col temporary for a9
select owner
,table_name
,num_rows
,sample_size
,last_analyzed
,partitioned
,temporary
from dba_tables
where lower(tabl... |
--Upit koji vraca informacije o najjeftinijim automobilima za iznajmljivanje
select TOP 5 a.id_automobila,a.kategorija, a.proizvodjac, a.model, a.registracija, a.gorivo, a.vrsta_upravljanja, a.datum_zadnjeg_servisa, r.iznos as iznos from
Dim_Automobil as a, Dim_Racun as r, Fact_Iznajmljivanje as f
where f.id_automobil... |
-- !Ups
create table if not exists game_tables (
game_id varchar(255) primary key unique not null,
game_name varchar(255) not null unique,
game_hashed_password varchar(255),
game_creator_id varchar(255) not null references users(user_id) on delete cascade,
created_on timestamp not null
);
-- !Dow... |
-- phpMyAdmin SQL Dump
-- version 4.8.0.1
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Jun 12, 2018 at 03:56 PM
-- Server version: 10.1.32-MariaDB
-- PHP Version: 7.2.5
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @O... |
-- Description: Add not null for fields in reporting tables
-- REPORT_REPORT
alter table REPORT_REPORT alter column NAME varchar(255) not null;
update REPORT_REPORT set REPORT_TYPE = 10 where REPORT_TYPE is null;
alter table REPORT_REPORT alter column REPORT_TYPE integer not null;
-- REPORT_BAND_DEFINITION
delete fr... |
CREATE TABLE player (
playerId NUMBER NOT NULL,
nickname VARCHAR2(30),
password VARCHAR2(30),
status VARCHAR2(10),
PRIMARY KEY (playerId)
);
CREATE TABLE personageClass (
personageClassId NUMBER NOT NULL,
personageClassName VARCHAR2(10),
personageClassFeatures VARCHAR2(200),
maxHp N... |
INSERT INTO offer (product_id, shop_id, shop_name, price) VALUES
(1, 1, 'Example shop 1', 700),
(1, 2, 'Example shop 2', 740),
(1, 3, 'Example shop 3', 690),
(1, 4, 'Example shop 4', 685),
(2, 2, 'Example shop 2', 100),
(2, 3, 'Example shop 3', 125),
(3, 4, 'Example shop 4', 95),
(4, 2, 'Example shop 2'... |
-- Table: public."FRIENDS"
DROP TABLE IF EXISTS public.friends CASCADE;
CREATE TABLE public.friends
(
user_id1 integer NOT NULL,
user_id2 integer NOT NULL,
CONSTRAINT friends_fk1 FOREIGN KEY (user_id1)
REFERENCES public.users (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE CASCADE,... |
CREATE TABLE `sga`.`tornillo` (
`ID_Tornillo` INT NOT NULL auto_increment,
`Tamaño` DECIMAL(3,2) NULL,
`Material` VARCHAR(20) NULL,
`PrecioXpieza` DECIMAL(3,2) NULL,
PRIMARY KEY (`ID_Tornillo`)
) auto_increment=100;
CREATE TABLE `sga`.`clavo` (
`ID_Clavo` INT NOT NULL auto_increment,
`Tamaño` DECIM... |
CREATE PROC [ERP].[Usp_Upd_Usuario_Activar]
@IdUsuario INT,
@UsuarioActivo VARCHAR(250)
AS
BEGIN
UPDATE Seguridad.Usuario SET Flag = 1,UsuarioActivo = @UsuarioActivo ,FechaActivacion = DATEADD(HOUR, 3, GETDATE()) WHERE ID = @IdUsuario
END |
-- insert subquery
-- 단수행
-- cp_emp3에 아래와 같은 레코드를 추가하때여
-- 사원번호: 1111, 사원명: 김희철, 부서번호: 10, 직무: 사원
-- 연봉: emp 테이블의 사원번호가 7566인 사원의 연봉과 동일한 연봉으로 추가
insert into cp_emp3 (empno, ename, deptno, job, sal)
values (1111, '김희철', 10, '사원',
(select sal from EMP where empno = 7566));
-- 단일형 서브쿼리가 들어가야 하는 곳에서 복수행이 사용되면 error
-... |
CREATE TABLE MCRE_OWN.TE_MCREI_LGD_GRI_BAD
(
BAD VARCHAR2(81 BYTE)
)
ORGANIZATION EXTERNAL
( TYPE ORACLE_LOADER
DEFAULT DIRECTORY D_MCRE0_BAD
ACCESS PARAMETERS
( RECORDS FIXED 81 CHARACTERSET WE8EBCDIC500
NOBADFILE
NODISCARDFILE
NOLOGFILE
FIELDS (
... |
.headers on
.nullvalue '-null-'
.mode csv
-- -- 01
SELECT personal || ' ' || family FROM Person;
|
-- phpMyAdmin SQL Dump
-- version 4.8.3
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Sep 19, 2019 at 03:47 PM
-- Server version: 10.1.36-MariaDB
-- PHP Version: 7.2.11
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OL... |
ALTER TABLE listnms ENGINE = MYISAM;
CALL create_fulltext_index_if_not_exists('listname', 'listnms', 'listname');
CALL create_index_if_not_exists('index_liststatus','listnms','liststatus');
CALL create_index_if_not_exists('index_listname','listnms','listname');
CALL create_index_if_not_exists('index_desig',... |
declare
begin
for CUR_SEQ in (select t.sequence_name from user_sequences t where t.sequence_name like 'FM$$/_%' ESCAPE '/') loop
execute immediate 'drop sequence ' || CUR_SEQ.SEQUENCE_NAME;
end loop;
end;
/ |
-- phpMyAdmin SQL Dump
-- version 3.4.10.1
-- http://www.phpmyadmin.net
--
-- 主机: localhost
-- 生成日期: 2015 年 06 月 10 日 13:54
-- 服务器版本: 5.5.20
-- PHP 版本: 5.3.10
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_... |
-- phpMyAdmin SQL Dump
-- version 4.9.1
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Nov 23, 2020 at 05:29 PM
-- Server version: 8.0.18
-- PHP Version: 7.3.11
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACT... |
CREATE TABLE IF NOT EXISTS TEST2 (
id UUID NOT NULL PRIMARY KEY,
email VARCHAR(200) not null UNIQUE
); |
SELECT t.employee_id, t.id, t.work_station_id, t.supply_id, t.jhi_time, sta.name, stav.value
FROM mms.tracer t
INNER JOIN tracer_supply_type_attr_value tstav ON tstav.tracers_id = t.id
INNER JOIN supply_type_attr_value stav ON stav.id = tstav.supply_type_attr_values_id
INNER JOIN supply_type_attr sta ON sta.id = stav.... |
drop table paf_batch_loan_detail;
create table paf_batch_loan_detail(
batch_no varchar(20) comment '批量编号',
seq_no varchar(20) comment '序号',
tx_amt decimal(16,2) comment '预计扣款金额' ,
su_amt decimal(16,2) comment '实际扣款金额' ,
de_acctno varchar(32) comment '付方账号',
de_acctname varchar(255) comment '付方户名 ',
de_chgno va... |
Enumerated Types
In the previous exercise, we added a CHECK constraint to the stars table to
enforce that the value stored in the spectral_type column for each row is valid.
In this exercise, we will use an alternate approach to the same problem.
PostgreSQL provides what is called an enumerated data type; that is, a ... |
select top 10 InvoiceNumber
,InvoiceTotal
from Invoices |
-- Rename 'Checksum' StatusType to 'ChecksumMatches' to better reflect what is represents
UPDATE "FileStatus" SET "StatusType" = 'ChecksumMatches' WHERE "StatusType" = 'Checksum';
Commit;
|
/*
Navicat SQLite Data Transfer
Source Server : Douban
Source Server Version : 30808
Source Host : :0
Target Server Type : SQLite
Target Server Version : 30808
File Encoding : 65001
Date: 2017-01-17 22:49:47
*/
PRAGMA foreign_keys = OFF;
-- ----------------------------
-- Table structu... |
SELECT MONTHS*SALARY AS earnings, COUNT(*)
FROM employee
GROUP BY earnings
ORDER BY earnings DESC
LIMIT 1; |
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Nov 01, 2016 at 11:30 AM
-- Server version: 10.1.16-MariaDB
-- PHP Version: 5.6.24
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CL... |
create table Blue_Pages(
id int(11) not null primary key AUTO_INCREMENT,
Title varchar(255) not null,
Content_URL varchar(255) not null,
Aurthor varchar(255) not null,
prevlidge int(1) not null,
DateCreated DATETIME DEFAULT CURRENT_TIMESTAMP,
DateModified DATETIME DEFAULT CURRENT_TIMESTAMP,
... |
--
-- with the ~20K records in the table in production, this executed under 1 second when run on RC
--
ALTER TABLE organisation_id DROP PRIMARY KEY, DROP KEY `range_end`, DROP KEY `space`, ADD PRIMARY KEY (`range_id`), ADD UNIQUE KEY `space` (`space`, `source`);
TRUNCATE version;
INSERT INTO version VALUES ('whois-1.... |
/*
SQLyog Ultimate v12.3.1 (64 bit)
MySQL - 5.5.53 : Database - mybatis
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;
/*!40101 SET SQL_MODE=''*/;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECK... |
CREATE TABLE user_info(
user_id SERIAL PRIMARY KEY,
username VARCHAR(9999),
email VARCHAR(9999)
);
CREATE TABLE credentials(
user_id INT,
hash TEXT
);
CREATE TABLE account (
account_id SERIAL PRIMARY KEY ,
user_id INT REFERENCES user_info(user_id),
account_balance INT
);
CREATE TABLE transfer(
transfer_id SERIAL PR... |
-- ---------------------------------------------------------------------------
--
-- gEDA - GPL Electronic Design Automation
-- gparts - gEDA Parts Manager
-- Copyright (C) 2010 Edward C. Hennessy
-- Copyright (C) 2010 gEDA Contributors (see ChangeLog for details)
--
-- This program is free software; you can redistribu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.