text stringlengths 6 9.38M |
|---|
CREATE TABLE mgt_fin_org_del_statistic_daily
(
statistic_date date comment '统计时间',
org_id int comment '组织ID',
cnt int DEFAULT 0 comment '统计数',
price int DEFAULT 0 comment '单价, 单位为分',
expense int DEFAULT 0 comment '消耗额',
amount int DEFAULT 0 comment '收款额',
balance int DEFAULT 0 comment '余额',
sta... |
-- Get lock info
select s1.username || '@' || s1.machine
|| ' ( SID=' || s1.sid || ' ) is blocking '
|| s2.username || '@' || s2.machine || ' ( SID=' || s2.sid || ' ) ' AS blocking_status
from v$lock l1, v$session s1, v$lock l2, v$session s2
where s1.sid=l1.sid and s2.sid=l2.sid
and l1.BLOCK=1 and... |
-- phpMyAdmin SQL Dump
-- version 4.1.14
-- http://www.phpmyadmin.net
--
-- Client : 127.0.0.1
-- Généré le : Jeu 14 Novembre 2019 à 19:22
-- Version du serveur : 5.6.17
-- Version de PHP : 5.5.12
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER... |
insert into Groups (group_name) values ('Council');
insert into Groups (group_name) values ('Volunteer');
insert into Groups (group_name) values ('Staff');
insert into Groups (group_name) values ('Admin');
/*council priviledges*/
insert into Group_Members (user, group_id, access)
values (16114836, 1, 'edit');
insert i... |
SELECT name, bonus
FROM Employee
LEFT JOIN Bonus
ON Employee.empId = Bonus.empId
WHERE bonus < 1000
OR bonus is null
|
-- --用户信息表
DROP TABLE IF EXISTS USER_INFO;
CREATE TABLE USER_INFO (
ID bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
NAME varchar(255) NULL COMMENT '姓名',
SEX varchar(50) NULL COMMENT '性别',
AGE integer NULL COMMENT '年龄',
ACCOUNT varchar(255) null COMMENT '用户账号',
PASSWD varchar(255) NULL COMMENT '密码',
PHO... |
ALTER TABLE LOBBY_USER ADD COLUMN PARTNER_ID VARCHAR(255) DEFAULT 'PLAY_FOR_FUN' NOT NULL;
ALTER TABLE STG_LOBBY_USER ADD COLUMN PARTNER_ID VARCHAR(255);
|
CREATE TABLE "pti_monumenti"
(
"pk_uid" integer PRIMARY KEY autoincrement NOT NULL,
"data_rilievo" date,
"nome_monumento" text,
"link_foto" text,
"note" text
)
-- aggiungo colonna geometrica
SELECT AddGeometryColumn ('pti_monumenti','geom',3004,'POINT','XY');
|
CREATE VIEW [Reporting].[Token4Gram]
AS
SELECT
[TweetID]
,[Token]
FROM [TextMining].[Token4Gram] (NOLOCK)
WHERE TweetID IN
(
SELECT TweetID FROM Internal.DistinctTweet
) |
-- Example - 01: Updating a table with a trigger
CREATE TABLE widgetCustomer ( id SERIAL, name VARCHAR(255), last_order_id BIGINT );
CREATE TABLE widgetSale ( id SERIAL, item_id BIGINT, customer_id BIGINT, quan INT, price DECIMAL(9,2) );
INSERT INTO widgetCustomer (name) VALUES ('Bob');
INSERT INTO widgetCustomer (n... |
SELECT
COUNT (case when statut > 0 and pj_acte_principal isnull then 1 else null end) as annotated,
COUNT (case when statut = 0 and pj_acte_principal isnull then 1 else null end) as toAnnot
FROM test_annotations
|
usjraetest
Our FB notifications are now unblocked, and I'd like to try testing them again today while we have a 2.5K bonus for all players on. To keep this within the test parameters recommended by Facebook, we can send a max of 50,000 notifications per application in a week. For the targeting, can we please create th... |
SELECT * FROM ITEM_CHOICES
WHERE
CHOICE_NO = ?
;
|
CREATE TABLE `migration` (
`type` varchar(25) NOT NULL,
`name` varchar(50) NOT NULL,
`migration` varchar(100) NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `migration` (`type`, `name`, `migration`) VALUES
('package', 'auth', '001_auth_create_usertables'),
('package', 'auth', '002_auth_cre... |
with a as( select user_id, count(distinct contact_email) as c_cnt
from Contacts
group by 1),
b as( select user_id, count(distinct contact_email) as t_cnt
from Contacts
where contact_email in (select email from Customers group by 1)
group by 1),
c as( select invoice... |
-- Seed data: First Albums!
-- TODO: use postgres variables to avoid duplicate queries and text repeats
-- First Album
-------------------------------------------------------------------------------
WITH album_rows AS (
INSERT INTO album (title, total_discs, media)
VALUES ('The Art of Nikolai Golovanov Volume I', ... |
create table mem(
num int not null primary key auto_increment,
name varchar(20) not null,
age int not null,
addr varchar(50) not null,
tel varchar(20) not null,
email varchar(50) not null
);
select * from mem;
insert into mem(name,age,addr,tel,email)
values('홍길동',34,'광주','010-1111-1111','bit@emp... |
--
-- P_L1_TO_L2_DATA (Procedure)
--
CREATE OR REPLACE PROCEDURE DWH_USER.P_L1_TO_L2_DATA (P_PROCESS_DATE VARCHAR2) IS
VCOUNT NUMBER;
VDATE_KEY NUMBER;
VSTATUS NUMBER;
VDATE DATE := TO_DATE(TO_DATE(P_PROCESS_DATE,'YYYYMMDD'),'DD/MM/RRRR');--TO_CHAR(TO_DATE(P_PROCESS_DATE,'RRRRMMDD'), 'DD/MM/RRRR');
BE... |
DROP INDEX IF EXISTS idx_id_origem_d;
DROP INDEX IF EXISTS idx_id_origem_p;
DROP INDEX IF EXISTS idx_id_origem_e;
DROP INDEX IF EXISTS IdxExamesCovidDetectado;
DROP INDEX IF EXISTS IdxHospital;
CREATE INDEX idx_id_origem_d ON desfechos (id_paciente);
CREATE UNIQUE INDEX idx_id_origem_p ON pacientes (id_paciente);
CREA... |
/*
Navicat MySQL Data Transfer
Source Server : localhost
Source Server Version : 50611
Source Host : localhost:3306
Source Database : cupd_elect
Target Server Type : MYSQL
Target Server Version : 50611
File Encoding : 65001
Date: 2016-12-04 01:52:36
*/
SET FOREIGN_KEY_CHECKS=0;
-... |
FULL OUTER JOIN
Combinação de RIGHT JOIN com LEFT JOIN,
retornando registros que não possuam correspondência em
ambas as tabelas, RESUMINDO: retorna todos os dados
das duas tabelas relacionadas
SINTAXE:
SELECT colunas FROM tabela1
FULL (OUTER) JOIN tabela2
on tabela1.coluna = tabela2.coluna
este outer é opcional, v... |
-- Tie specific loot to specific bosses (sources)
INSERT INTO `item_item_sources` (`item_source_id`, `item_id`, `created_at`)
VALUES
-- Karazhan
-- Trash
(84, 30643, "2021-02-16 00:00:00"), -- belt-of-the-tracker
(84, 30641, "2021-02-16 00:00:00"), -- boots-of-elusion
(84, 30642, "2021-02-16 ... |
create database codegym_management;
use codegym_management;
create table student (
id int,
name varchar(50),
date_of_birth date
);
alter table student
modify id int primary key auto_increment;
insert into student (name, date_of_birth)
values
('Tien', '2000-07-13'),
('Toan', '2001-07-13');
select name
from... |
delete from HtmlLabelIndex where id=30388
/
delete from HtmlLabelInfo where indexid=30388
/
INSERT INTO HtmlLabelIndex values(30388,'请先保存当前页面数据,再添加其它接口动作!')
/
INSERT INTO HtmlLabelInfo VALUES(30388,'请先保存当前页面数据,再添加其它接口动作!',7)
/
INSERT INTO HtmlLabelInfo VALUES(30388,'Please save the current page data, adding other i... |
-- 1
"""
What are the top 5 brands by receipts scanned for most recent month?
"""
with temp as
(
select b.name as name,sum(x.itemtotal) as itemtotal
from brand b join (select barcode,sum(quantitypurchased) as itemtotal
from rewards rew join receipt rec on rew.receipt_Id=rec.receiptId
where extract(day f... |
create procedure sp_GetCountOfTeachers(@SchoolId int=NULL)
as
if @SchoolId IS NULL
select sc.Number,(select count(SchoolId) from Teacher as t where t.SchoolId=sc.SchoolId) from School as sc
else
select sc.Number,(select count(SchoolId) from Teacher as t where t.SchoolId=sc.SchoolId) from School as sc where sc.Schoo... |
select first_name || '(' || department_id || ')' "Name & Department Id" from employees;
select last_name || ' is a ' || job_id "Employee Details" from employees;
select distinct department_id from employees;
select distinct job_id from employees;
desc employees;
desc departments;
select employee_id "Emp #",
first_name ... |
-- --------------------------------------------------------
-- Host: localhost
-- Versión del servidor: 5.7.24 - MySQL Community Server (GPL)
-- SO del servidor: Win64
-- HeidiSQL Versión: 10.2.0.5599
-- --------------------------------------------------------
/... |
/*
Navicat MySQL Data Transfer
Source Server : 诚信科技
Source Server Version : 50641
Source Host : 47.107.60.226:3306
Source Database : bet
Target Server Type : MYSQL
Target Server Version : 50641
File Encoding : 65001
Date: 2019-02-15 15:08:01
*/
SET FOREIGN_KEY_CHECKS=0;
-- ------... |
--分子dmssts
INSERT INTO ${TABLENAME}(CODE,ORGAN_CODE,VALUE,DATATYPE,UPDATETIME,STATISTIME,DIMNAME,DIMVALUE,FLAG)
select
'dmssts' as code,
organ.organ_code as organ_code,
decode(dmssts.value, NULL, 0, dmssts.value) as value,
'个数' as datatype,
sysdate as updateTime,
'${dateStr}' as statistime,
'无' as dim... |
-- List the rows from the table: first_table
SELECT * FROM first_table;
|
-- phpMyAdmin SQL Dump
-- version 5.0.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Aug 09, 2021 at 07:36 AM
-- Server version: 10.4.17-MariaDB
-- PHP Version: 8.0.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIEN... |
INSERT INTO departments (dept_name)
VALUES
('Auto'),
('Grocery'),
('Beauty'),
('Outdoor'),
('General'),
('Testing Department');
INSERT INTO roles (title,salary,dept_id)
VALUES
('Director', 60000, 5),
('General Manager',55000, 5),
('Auto Manager',50000, 1),
('Grocery Manager',45000, 2),
('Fish Manager',45000, 3),
('O... |
--- bill
-- no user
SELECT SUM(o.num * p.price)
FROM ws.orders AS o
INNER JOIN ws.products AS p
USING(pid)
WHERE o.payed = 0;
-- user
SELECT u.name, u.address, SUM(o.num * p.price)
FROM ws.orders AS o
INNER JOIN ws.products AS p
USING(pid)
INNER JOIN ws.users AS u
USING(uid)
WHERE o.payed = 0 AND u.userna... |
CREATE TABLE antispam_samples (
post_id integer primary key,
timestamp integer,
hatena_id text not null,
source text not null,
keyword text not null,
body text not null,
follower_count int default 0,
spam boolean default 0 not null check (spam in (0,1))
);
CREATE TABLE antispam_unclassified (
post_id integer ... |
/**
* 1.Crear una tabla PROFESSOR en la base de datos EXAMPLE3 con sus atributos
*
* creation of the Professor table with its attributes
*/
USE example3;
CREATE TABLE professor
(
id INTEGER NOT NULL AUTO_INCREMENT,
first_name VARCHAR(50) NOT NULL,
last_name VARCHAR(50),
city VARCHAR(50) NOT NULL,
... |
alter table ACT_RU_VARIABLE add column SCOPE_ID_ nvarchar(255);
alter table ACT_RU_VARIABLE add column SUB_SCOPE_ID_ nvarchar(255);
alter table ACT_RU_VARIABLE add column SCOPE_TYPE_ nvarchar(255);
create index ACT_IDX_RU_VAR_SCOPE_ID_TYPE on ACT_RU_VARIABLE(SCOPE_ID_, SCOPE_TYPE_);
create index ACT_IDX_RU_VAR_SUB_ID_... |
DECLARE
v_Id NUMBER;
v_StateId NUMBER;
v_WorkbasketId NUMBER;
v_errorcode NUMBER;
v_errormessage NVARCHAR2(255);
BEGIN
v_Id := :Id;
v_StateId := :TaskState_Id;
v_WorkbasketId := :WorkBasket_Id;
:affectedRows := 0;
v_errorcode := 0;
v_errormessage := '';
... |
INSERT INTO burgers_db.burgers (burger_name, devoured)
VALUES ("In n out Burger", false);
("Shake Shak ShackBurger", false);
("Hinoki and the Bird", false);
("Petit Trois", false);
("Monty Good Burger", false);
("Burgers Never Say Die", false); |
insert into user values(1001,sysdate(),'AB');
insert into user values(1002,sysdate(),'Jack');
insert into user values(1003,sysdate(),'Jhill');
insert into post values(10001,'First pos',1001);
insert into post values(10002,'second post ',1001);
insert into post values(10003,'first post ',1002); |
delete from HtmlLabelIndex where id=23996
/
delete from HtmlLabelInfo where indexid=23996
/
INSERT INTO HtmlLabelIndex values(23996,'开启手机功能')
/
INSERT INTO HtmlLabelInfo VALUES(23996,'开启手机功能',7)
/
INSERT INTO HtmlLabelInfo VALUES(23996,'Mgms Enabled',8)
/
INSERT INTO HtmlLabelInfo VALUES(23996,'開啓手機功能',9)
/ |
/*td:667 by 王金永 for 表单明细字段新建页面的页头是【字段管理:添加】修改为【 新建:明细字段 】*/
delete HtmlLabelInfo where indexid = 17463
/
delete HtmlLabelIndex where id = 17463
/
delete HtmlLabelInfo where indexid = 6074
/
delete HtmlLabelIndex where id = 6074
/
INSERT INTO HtmlLabelIndex values(6074,'主')
/
INSERT INTO HtmlLabelInfo VALUE... |
CREATE TABLE IF NOT EXISTS comments
(
id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
text TEXT NOT NULL,
date DATE NOT NULL,
image VARCHAR(100) NOT NULL DEFAULT 'no-user.jpg',
user_id INT(11) NOT NULL,
status TINYINT(1) NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET utf8; |
CREATE TABLE users
(
email character varying(255) NOT NULL,
enabled boolean,
last_name character varying(255),
name character varying(255),
password character varying(255),
user_role integer,
CONSTRAINT users_pkey PRIMARY KEY (email)
);
CREATE TABLE contact
(
id integer NOT NULL GENERAT... |
SELECT
TZ_SCORE_ITEM_ID, a.TZ_ZDCSGZ_ID, TZ_ZDCSGZ
FROM
PS_TZ_MODAL_DT_TBL a
LEFT JOIN
PS_TZ_ZDCS_DFGZ_T c ON (a.TZ_ZDCSGZ_ID = c.TZ_ZDCSGZ_ID)
WHERE
TZ_SCORE_ITEM_TYPE = 'B'
AND TZ_IF_ZDCS = 'Y'
AND EXISTS( SELECT
'X'
FROM
PS_TZ_RS_MODAL_TBL b
... |
create table roles(
id serial primary key not null,
name varchar unique not null ,
status varchar(255) not null default 'ACTIVE',
created date default CURRENT_DATE not null,
updated date default CURRENT_DATE not null
) |
# --- !Ups
CREATE TABLE animals (
id UUID NOT NULL,
animal_name VARCHAR(255),
species_id UUID,
pen_id UUID,
CONSTRAINT pk_animals PRIMARY KEY (id)
);
CREATE TABLE keepers (
id UUID NOT NULL,
keeper_name VARCHAR(255),
pen_type VARCHAR(255),
CONSTRAINT pk_keepers PRIMARY KEY... |
-- phpMyAdmin SQL Dump
-- version 4.0.10deb1
-- http://www.phpmyadmin.net
--
-- Servidor: localhost
-- Tempo de Geração: 30/08/2016 às 04:23
-- Versão do servidor: 5.5.50-0ubuntu0.14.04.1
-- Versão do PHP: 5.5.9-1ubuntu4.19
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER... |
-- LABORATORY WORK 1
-- BY Kanievskyi_Vladyslav
/*---------------------------------------------------------------------------
1.Створити схему даних з назвою – прізвище студента, у якій користувач може:
видаляти таблиці та робити запити з таблиць
4 бали
----------------------------------------------------------------... |
ALTER TABLE projects DROP COLUMN basic_auth_username;
ALTER TABLE projects DROP COLUMN encrypted_basic_auth_password;
|
--liquibase formatted sql
--changeset jhogan:sprint1-1
--comment: Adding person table because I want to keep track of people that I know
create table person (
id int not null primary key auto_increment,
firstname varchar(50),
lastname varchar(50),
state varchar(2)
);
-- rollback DROP TABLE person;
|
-- phpMyAdmin SQL Dump
-- version 4.7.7
-- https://www.phpmyadmin.net/
--
-- Host: localhost:8889
-- Generation Time: Sep 13, 2019 at 05:52 AM
-- Server version: 5.6.38
-- PHP Version: 7.2.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIEN... |
/*------------------------------------------------------------------------------------------------*/
/* */
/* eTraxis - Records tracking web-based system. */
/* Copyright (C)... |
USE employees;
INSERT INTO department (name)
VALUES ("sales"),
("finance"),
("engineering"),
("legal");
INSERT INTO role (title,salary,department_id);
VALUES ("sale lead",80000.00,1),
("manager",200000.00,1),
("sale associate",50000.00,1),
("accountant",60000.00,2),
("senior... |
--
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements. See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership. The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you ma... |
delete from albumsubcompany a where rowid>(select min(rowid) from albumsubcompany b where a.subcompanyid=b.subcompanyid )
/ |
-- phpMyAdmin SQL Dump
-- version 4.4.15.7
-- http://www.phpmyadmin.net
--
-- Client : ustonesezv13.mysql.db
-- Généré le : Lun 05 Décembre 2016 à 11:05
-- Version du serveur : 5.5.50-0+deb7u2-log
-- Version de PHP : 5.4.45-0+deb7u5
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @... |
select * from profitshop.products where length(descr) > 20; |
DELETE FROM cmdarg WHERE cmdarg_cmd_id NOT IN (SELECT cmd_id FROM cmd);
ALTER TABLE cmdarg ADD FOREIGN KEY (cmdarg_cmd_id) REFERENCES cmd(cmd_id) ON DELETE CASCADE;
|
use adlister_test;
CREATE TABLE users (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
username varchar(100) NOT NULL ,
password varchar(255) NOT NUll,
email varchar(150) NOT NULL
);
CREATE TABLE ads (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
title varchar(200) NOT NULL,
descriptio... |
PRAGMA foreign_keys = on;
-- INSERT USERS
-- username: bernas password: bernas123
INSERT INTO user VALUES (1, 'bernas', '$2y$10$jg3dahQYJUeS3e5zLBp.7.75AZaweaGpOEnThMHiMBg1KE45AFRrK');
-- INSERT CONFERENCE
INSERT INTO conference VALUES (1, 'bernas', 'Programming 2020', 2020, '2019-12-10', '2019-12-20', 'Faculdade d... |
--create the database
CREATE DATABASE StudentExercises
-- create all of the necessary tables for the database
CREATE TABLE Student (
Id INTEGER NOT NULL PRIMARY KEY IDENTITY,
FirstName VARCHAR(55) NOT NULL,
LastName VARCHAR(55) NOT NULL,
SlackHandle VARCHAR(55) NOT NULL,
CohortId INTEGER NOT NULL,... |
//GROUP BY 查询
select name,count(signin) from employeer group by name;
//WITH ROLLUP 可以实现在分组统计数据基础上再进行相同的统计(SUM,AVG,COUNT…)
select name,sum(signin) as sum_count from employeer group by name with ROLLUP;
//
|
select
f.field_id,
f.field_name,
f.field_order,
f.field_type,
f.is_required,
f.add_separator,
f.description,
f.regex_check,
f.regex_search,
f.regex_replace,
f.param1,
f.param2,
fv.value_id,
e.event_time
from
tbl_groups g,
tbl_membership ms,
... |
USE codeup_test_db;
SELECT 'Albums released after 1991' AS'';
delete FROM albums WHERE release_date > 1991;
SELECT 'Albums with the genre ''disco''' AS'';
delete FROM albums WHERE genre="disco";
SELECT 'Albums by Whitney Houston' AS'';
delete FROM albums WHERE artist="Whitney Houston/Various Artist"; |
SELECT
count(subscription_id) as total
FROM (
SELECT
distinct on (dss.subscription_id)
dss.subscription_id
, dss.status
FROM common.daily_status_snapshot dss
INNER JOIN common.subscription_d sd ON sd.subscription_id = dss.subscription_id
INNER JOIN common.user_dim ud O... |
USE codeup_test_db;
SELECT 'All albums in your table' AS'';
SELECT * FROM albums;
UPDATE albums
SET sales = sales * 10;
SELECT * FROM albums;
-- Only works if you use int for date but I used year so subtraction does not work unless it is in the range.
-- SELECT 'All albums released before 1980' AS'';
-- SELECT * ... |
create table PointofInterest(
pointID number,
describe varchar2(30),
opentime varchar(10),
closetime varchar2(10),
townID number,
constraint PK primary key (pointID)
);
create table Town(
townID number,
townname varchar(30),
state varchar(30),
longitude varchar(30),
latitude... |
-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1:3306
-- Tiempo de generación: 09-09-2020 a las 20:43:47
-- Versión del servidor: 8.0.21
-- Versión de PHP: 7.2.24-0ubuntu0.18.04.6
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!4... |
drop table if exists model_training_set;
create table model_training_set
(
customer_id int(11) default null,
address_id int(11) default null,
branch_id int(11) default null,
commute_distance_miles int(11) default null,
label int(11) default null,
censor int(11) default null,
version int(11) default null
)... |
-- phpMyAdmin SQL Dump
-- version 4.8.3
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: Jul 15, 2019 at 11:23 PM
-- Server version: 5.7.23
-- PHP Version: 7.2.10
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CH... |
drop database pos;
create database pos;
connect pos;
create table if not exists category (
id int not null primary key auto_increment,
name varchar(128),
parent_category_id int not null default 0
);
create table if not exists manufacturer (
id int not null primary key auto_increment,
name varchar(128)
);
creat... |
USE fds;
DROP TABLE IF EXISTS file_detail;
DROP TABLE IF EXISTS file_detail_history;
DROP TABLE IF EXISTS download_metrics;
DROP DATABASE fds; |
/*
Navicat MySQL Data Transfer
Source Server : 阿里云
Source Server Version : 80017
Source Host : 47.98.182.28:3306
Source Database : cigt
Target Server Type : MYSQL
Target Server Version : 80017
File Encoding : 65001
Date: 2019-11-17 14:19:19
*/
SET FOREIGN_KEY_CHECKS=0;
-- -------... |
CREATE TABLE [ASData_PL].[Comt_ApprenticeshipPriorLearning]
( [ApprenticeshipId] [bigint] PRIMARY KEY NOT NULL,
[DurationReducedBy] [int] NULL,
[PriceReducedBy] [int] NULL,
[IsAccelerated] bit DEFAULT (0),
[DurationReducedByHours] [int] NULL,
[WeightageReducedBy] [int] NULL,
[ReasonForRplReduction] [nvarchar](10... |
INSERT INTO "user" (name, password) VALUES
('user-station-manager', 'user-station-manager'),
('user-red', 'user-red'),
('john', 'john'),
('jane', 'jane');
INSERT INTO route (name) VALUES
('route-red'),
('route-blue');
INSERT INTO role (name) VALUES
('station-manager'),
('a-role');
INSERT... |
# https://leetcode.com/problems/combine-two-tables/
SELECT FirstName, LastName, City, State
FROM Person LEFT JOIN Address USING(`PersonId`); |
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE Students (
first_name VARCHAR(30),
last_name VARCHAR(30),
github VARCHAR(30)
);
INSERT INTO "Students" VALUES('Jane','Hacker','jhacks');
INSERT INTO "Students" VALUES('Sarah','Developer','sdevelops');
CREATE TABLE Projects (
id INTEGER PRIMARY KEY AUTOINCREME... |
-- point 13
-- delete rows with score <= 5
DELETE FROM second_table WHERE score <= 5;
|
delete from HtmlLabelIndex where id=20997
/
delete from HtmlLabelInfo where indexid=20997
/
INSERT INTO HtmlLabelIndex values(20997,'文档日志查看')
/
INSERT INTO HtmlLabelInfo VALUES(20997,'文档日志查看',7)
/
INSERT INTO HtmlLabelInfo VALUES(20997,'Document Log View',8)
/
delete from HtmlLabelIndex where id=20999
/
delete ... |
DROP PROCEDURE IF EXISTS user_login;
DELIMITER $$
CREATE PROCEDURE `user_login`(IN i_username VARCHAR(50), IN i_password VARCHAR(50))
BEGIN
DROP TABLE IF EXISTS UserLogin;
CREATE TABLE UserLogin
SELECT User.username, User.status, C.isCustomer, A.isAdmin, M.isManager
FROM User, (SELECT COUNT(*) AS isCustom... |
CREATE TABLE Reservations (
NumCL numeric(10) REFERENCES CLIENTS,
NumHo numeric(10) REFERENCES Hotels,
NumTy numeric(10) REFERENCES TypesChambre,
DateA TIMESTAMP(0),
NbJours INTERVAL DAY TO SECOND(0) default INTERVAL '1' DAY NOT NULL,
NbChambres numeric(10) default 1 NOT NULL,
PRIMARY KEY (NumCl, NumHo, N... |
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
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 ... |
select round_id as rd,
school_name as name,
p::numeric(4,3) as p
from ncaa_sr.rounds
where TRUE --round_id=2
and p<1.0
order by round_id asc,p desc;
|
select America,Asia,Europe
from
(
select row_number() over(order by name) as id, name as america
from student where continent = 'America'
) am
FULL OUTER JOIN
(
select row_number() over(order by name) as id, name as Asia
from student where continent = 'Asia'
) a
ON am.id = a.id
FULL OUTER JOIN
(
s... |
CREATE PROCEDURE SqlPermissions_RemoveGroup(@prmName varchar(255))
as
BEGIN
delete from SqlPermissions_Groups
where Name = @prmName;
END |
select * from t_employees;
select * from t_salaries;
select count(*)
from t_employees;
select * from t_dept_emp;
#########################################################
# Create a visualization that provides a breakdown between the male and female employees working in the company each year, starting from 1990.
... |
-- Find the total price paid on orders by every customer from RUSSIA in 1996. Print the customer name and the total price.
SELECT c_name, sum(o_totalprice)
FROM customer, orders, nation
WHERE c_custkey = o_custkey
AND c_nationkey = n_nationkey
AND o_orderdate LIKE '1996-%'
AND n_name = 'RUSSIA'
GROUP BY c... |
create database if not exists bank;
set global local_infile = 1;
use bank;
#Accounts Table
create table if not exists accounts(
account_id int,
district_id int,
frequency varchar(255),
dt date,
PRIMARY KEY(account_id)
);
... |
--create a new table
CREATE TABLE departments(
dept_no VARCHAR (30) NOT NULL,
dept_name VARCHAR (30) NOT NULL,
PRIMARY KEY (dept_no),
UNIQUE (dept_name)
);
--view table columns
select * from departments
select * from dept_employee
select * from dept_manager
select * from employees
select * from salaries
select * f... |
DELETE FROM usuarios WHERE nome = "Sofia Wylie"; |
-- 1. Observe the result of running a simple SQL command.
SELECT name, continent, population
FROM world
-- 2. Show the name for the countries that have a population of at least 200 million. 200 million is 200000000, there are eight zeros.
SELECT name
FROM world
WHERE population>200000000
-- 3. Give... |
--
-- Table structure for table `company_beneficial`
--
DROP TABLE IF EXISTS `company_beneficial`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `company_beneficial` (
`id` int NOT NULL AUTO_INCREMENT,
`first_name` varchar(100) NOT NULL,... |
-- Show permissions for users
-- All users exist on LocalHost
SHOW GRANTS FOR 'user_0d_1'@'localhost';
SHOW GRANTS FOR 'user_0d_2'@'localhost'; |
ALTER TABLE public."UserLicense"
ADD COLUMN "Rate_Id" bigint;
ALTER TABLE public."UserLicense"
ADD CONSTRAINT "UserLicence_Rate_Id_fkey" FOREIGN KEY ("Rate_Id")
REFERENCES public."Rates" ("Id") MATCH SIMPLE; |
--a) 5 Consultas simples de una sola tabla
--b) 2 Actualizaciones y 2 Borrados en cualquier tabla
--c) 3 Consultas con más de 1 tabla
--d) 3 Consultas usando funciones
--e) 2 Consultas usando group by
--f) 2 Consultas utilizando subconsultas
--g) 2 Consultas usando group by con having
--h) 3 actualizaciones usando subc... |
alter table workflow_createdoc add extfile2doc integer null
/
update workflow_createdoc set extfile2doc=1
/
|
# This is a fix for InnoDB in MySQL >= 4.1.x
# It "suspends judgement" for fkey relationships until are tables are set.
SET FOREIGN_KEY_CHECKS = 0;
-- ---------------------------------------------------------------------
-- abonoproveedor
-- ---------------------------------------------------------------------
DROP ... |
USE comboioslusitanos;
SELECT *
FROM bilhete;
SELECT *
FROM cliente;
SELECT *
FROM comboio;
SELECT *
FROM endereco;
SELECT *
FROM lugar;
SELECT *
FROM reserva;
SELECT *
FROM viagem;
SELECT Email, nome, DataNascimento
FROM cliente
WHERE sexo = 'F';
SELECT Email, nome, DataNascimento
FROM c... |
-- Checklist 13
ALTER TYPE tp_sala DROP attribute (tamanho); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.